1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_WW8_DOCUMENT_IMPL_HXX
25 #define INCLUDED_WW8_DOCUMENT_IMPL_HXX
26 
27 #include <set>
28 #include <WW8PieceTable.hxx>
29 #include <WW8BinTable.hxx>
30 #include <resources.hxx>
31 #ifndef INCLUDED_WW8_RESOURCE_MODEL_HXX
32 #include <resourcemodel/WW8ResourceModel.hxx>
33 #endif
34 #include <PLCF.hxx>
35 #include <WW8Sttbf.hxx>
36 #include <XNoteHelper.hxx>
37 
38 namespace writerfilter {
39 namespace doctok
40 {
41 
42 class WW8DocumentImpl;
43 
44 /**
45    A bookmark.
46 */
47 class Bookmark : public writerfilter::Reference<Properties>
48 {
49     /// bookmark first descriptor
50     writerfilter::Reference<Properties>::Pointer_t mpBKF;
51 
52     /// name of bookmark
53     rtl::OUString mName;
54 
55 public:
56     Bookmark(writerfilter::Reference<Properties>::Pointer_t pBKF,
57              rtl::OUString & rName);
58 
59     /**
60        Resolve bookmark to handler.
61 
62        @param rHandler    handler to send events to
63      */
64     virtual void resolve(Properties & rHandler);
65 
66     virtual string getType() const;
67 };
68 
69 /**
70    A helper for bookmarks.
71  */
72 class BookmarkHelper
73 {
74     /// PLCF containing Cps and BKFs for the bookmarks
75     PLCF<WW8BKF>::Pointer_t mpStartCps;
76 
77     /// Cps of the ends of bookmarks
78     WW8StructBase::Pointer_t mpEndCps;
79 
80     /// STTBF containing the names of bookmarks
81     WW8Sttbf::Pointer_t mpNames;
82 
83     /// piece table for converting CPs to FCs
84     WW8PieceTable::Pointer_t mpPieceTable;
85 
86     /// document to insert CpAndFcs to
87     WW8DocumentImpl * mpDoc;
88 
89     /**
90        Return start CpAndFc for a bookmark.
91 
92        @param nPos       index of the bookmark
93     */
94     CpAndFc getStartCpAndFc(sal_uInt32 nPos);
95 
96     /**
97        Return end CpAndFc for a bookmark.
98 
99        @param nPos       index of the bookmark
100     */
101     CpAndFc getEndCpAndFc(sal_uInt32 nPos);
102 
103     /**
104        Return the name of a bookmark.
105 
106        @param nPos       index of the bookmark
107     */
108     rtl::OUString getName(sal_uInt32 nPos);
109 
110     /**
111        Return index of a bookmark.
112 
113        @param rCpAndFc    CpAndFc of the bookmark
114      */
115     sal_uInt32 getIndex(const CpAndFc & rCpAndFc);
116 
117 public:
118     typedef boost::shared_ptr<BookmarkHelper> Pointer_t;
119 
BookmarkHelper(PLCF<WW8BKF>::Pointer_t pStartCps,WW8StructBase::Pointer_t pEndCps,WW8Sttbf::Pointer_t pNames,WW8PieceTable::Pointer_t pPieceTable,WW8DocumentImpl * pDoc)120     BookmarkHelper(PLCF<WW8BKF>::Pointer_t pStartCps,
121                    WW8StructBase::Pointer_t pEndCps,
122                    WW8Sttbf::Pointer_t pNames,
123                    WW8PieceTable::Pointer_t pPieceTable,
124                    WW8DocumentImpl * pDoc)
125     : mpStartCps(pStartCps), mpEndCps(pEndCps), mpNames(pNames),
126       mpPieceTable(pPieceTable), mpDoc(pDoc)
127     {
128     }
129 
130     /**
131        Initialize.
132 
133        Inserts CpAndFcs for the bookmark starts and ends into the
134     document.
135     */
136     void init();
137 
138     /**
139        Return BKF of a bookmark.
140 
141        @param rCpAndFc       CpAndFc of the bookmark
142      */
143     writerfilter::Reference<Properties>::Pointer_t getBKF
144     (const CpAndFc & rCpAndFc);
145 
146     /**
147        Return the name of a bookmark.
148 
149        @param rCpAndFc       CpAndFc of the bookmark
150      */
151     rtl::OUString getName(const CpAndFc & rCp);
152 
153     /**
154        Return bookmark.
155        @param rCpAndFc       CpAndFc of the bookmark
156      */
157     writerfilter::Reference<Properties>::Pointer_t
158     getBookmark(const CpAndFc & rCpAndFc);
159 };
160 
161 /**
162    Helper for shapes.
163  */
164 class ShapeHelper
165 {
166 public:
167     typedef hash_map<CpAndFc, WW8FSPA::Pointer_t, CpAndFcHash> Map_t;
168 
169 private:
170     WW8DocumentImpl * mpDoc;
171     Map_t mMap;
172 
173 public:
174     typedef boost::shared_ptr<ShapeHelper> Pointer_t;
175     ShapeHelper(PLCF<WW8FSPA>::Pointer_t pPlcspaMom,
176                 PLCF<WW8FSPA>::Pointer_t pPlcspaHdr,
177                 WW8DocumentImpl * pDoc);
178 
179     void init();
180 
181     writerfilter::Reference<Properties>::Pointer_t
182     getShape(const CpAndFc & rCpAndFc);
183 
184 };
185 
186 /**
187    Helper for fields.
188  */
189 class FieldHelper
190 {
191 public:
192     typedef hash_map<CpAndFc, WW8FLD::Pointer_t,
193                      CpAndFcHash> Map_t;
194 
195 private:
196     WW8DocumentImpl * mpDoc;
197     Map_t mMap;
198 public:
199 
200     typedef boost::shared_ptr<FieldHelper> Pointer_t;
201     FieldHelper(PLCF<WW8FLD>::Pointer_t pPlcffldMom,
202                 WW8DocumentImpl * pDoc);
203 
204     void init();
205 
206     writerfilter::Reference<Properties>::Pointer_t
207     getField(const CpAndFc & rCpAndFc);
208 
209     WW8FLD::Pointer_t getWW8FLD(const CpAndFc & rCpAndFc);
210 };
211 
212 /**
213     Helper for Breaks.
214 */
215 class BreakHelper
216 {
217 public:
218     typedef hash_map<CpAndFc, WW8BKD::Pointer_t,
219                      CpAndFcHash> Map_t;
220 private:
221     WW8DocumentImpl * mpDoc;
222     Map_t mMap;
223 public:
224     typedef boost::shared_ptr<BreakHelper> Pointer_t;
225     BreakHelper(PLCF<WW8BKD>::Pointer_t pPlcfbkdMom,
226                 WW8DocumentImpl * pDoc);
227 
228     void init();
229 
230     writerfilter::Reference<Properties>::Pointer_t
231     getBreak(const CpAndFc & rCpAndFc);
232 };
233 
234 /**
235    Implementation class for document.
236  */
237 class WW8DocumentImpl : public WW8Document
238 {
239     /// true if the document is contained in another document
240     bool bSubDocument;
241 
242     /// picture location
243     sal_uInt32 mfcPicLoc;
244 
245     /// true if FFDATA structure is found at offset mfcPicLoc in data stream
246     bool mbPicIsData;
247 
248     /// current field descriptor
249     WW8FLD::Pointer_t mpFLD;
250 
251     /// CpAndFcs in the document where properties change
252     CpAndFcs mCpAndFcs;
253 
254     /// CpAndFc pointing to the start of the document
255     CpAndFc mCpAndFcStart;
256 
257     /// CpAndFc pointing to the end of the document
258     CpAndFc mCpAndFcEnd;
259 
260     /// pointer to the cache of FKPs containing character properties
261     WW8FKPCache::Pointer_t mpCHPFKPCache;
262 
263     /// pointer to the cache of FPKs containing paragraph properties
264     WW8FKPCache::Pointer_t mpPAPFKPCache;
265 
266     /// pointer to the stream containing the whole document
267     WW8Stream::Pointer_t mpStream;
268 
269     /// pointer to the substream of the document containing table like
270     /// structures
271     WW8Stream::Pointer_t mpTableStream;
272 
273     /// pointer to the substream of the document containing the
274     /// document contents and formatting information
275     WW8Stream::Pointer_t mpDocStream;
276 
277     /// pointer to the data stream of the document
278     WW8Stream::Pointer_t mpDataStream;
279 
280     /// pointer to the compound object stream of the document
281     WW8Stream::Pointer_t mpCompObjStream;
282 
283     /// pointer to the summayry information stream of the document
284     WW8Stream::Pointer_t mpSummaryInformationStream;
285 
286     /// pointer to the piece table
287     WW8PieceTable::Pointer_t mpPieceTable;
288 
289     /// pointer to the bin table for paragraph properties
290     WW8BinTable::Pointer_t mpBinTablePAPX;
291 
292     /// pointer to the bin table for character properties
293     WW8BinTable::Pointer_t mpBinTableCHPX;
294 
295     /// PLCF containing the section descriptions
296     PLCF<WW8SED>::Pointer_t mpSEDs;
297 
298     /// pointer to the file information block
299     WW8Fib::Pointer_t mpFib;
300 
301     /// pointer to the file information block for post 2000 documents
302     WW8FibRgFcLcb2000::Pointer_t mpFibRgFcLcb2000;
303 
304     /// pointer to the offsets of headers/footers
305     WW8StructBase::Pointer_t mpHeaderOffsets;
306 
307     /// pointer to the helper for footnotes
308     XNoteHelper<WW8FRD>::Pointer_t mpFootnoteHelper;
309 
310     /// pointer to the helper for endnotes
311     XNoteHelper<WW8FRD>::Pointer_t mpEndnoteHelper;
312 
313     /// pointer to the helper for annotations
314     XNoteHelper<WW8ATRD>::Pointer_t mpAnnotationHelper;
315 
316     /// pointer to the helper for bookmarks
317     BookmarkHelper::Pointer_t mpBookmarkHelper;
318 
319     /// pointer to the helper for fields
320     FieldHelper::Pointer_t mpFieldHelper;
321 
322     /// pointer to the helper for shapes
323     ShapeHelper::Pointer_t mpShapeHelper;
324 
325     /// pointer to the helper for breaks
326     BreakHelper::Pointer_t mpBreakHelper;
327 
328 
329     /// cache for the Cp where main text flow end
330     CpAndFc mDocumentEndCpAndFc;
331 
332     /// cache for the Cp where footnotes section ends
333     CpAndFc mFootnoteEndCpAndFc;
334 
335     /// cache for the Cp where header section ends
336     CpAndFc mHeaderEndCpAndFc;
337 
338     /// cache for the Cp where annotation section ends
339     CpAndFc mAnnotationEndCpAndFc;
340 
341     /// cache for the Cp where endnote section ends
342     CpAndFc mEndnoteEndCpAndFc;
343 
344     /// cache for the Cp where textbox section ends
345     CpAndFc mTextboxEndCpAndFc;
346 
347     /// cache for the Cp where textbox in header section ends
348     CpAndFc mTextboxHeaderEndCpAndFc;
349 
350     /// DffBlock of document
351     DffBlock::Pointer_t mpDffBlock;
352 
353     /// Textbox stories
354     PLCF<WW8FTXBXS>::Pointer_t mpTextBoxStories;
355 
356     bool mbInSection;
357     bool mbInParagraphGroup;
358     bool mbInCharacterGroup;
359 
360     bool isSpecial(sal_uInt32 nChar);
361 
362     WW8Stream::Pointer_t getSubStream(const ::rtl::OUString & sId) const;
363 
364     /**
365        Parse bin table and create CpAndFcs for all points in the
366        document where properties of the given type change.
367 
368        @param rTable   bin table to parse
369        @param eType_   type of CpAndFcs to create
370      */
371     void parseBinTableCpAndFcs(WW8BinTable & rTable, PropertyType eType_);
372 
373     void startCharacterGroup(Stream & rStream);
374     void endCharacterGroup(Stream & rStream);
375     void startParagraphGroup(Stream & rStream);
376     void endParagraphGroup(Stream & rStream);
377     void startSectionGroup(Stream & rStream);
378     void endSectionGroup(Stream & rStream);
379     void text(Stream & rStream, const sal_uInt8 * data, size_t len);
380     void utext(Stream & rStream, const sal_uInt8 * data, size_t len);
381 
382 public:
383     WW8DocumentImpl(WW8Stream::Pointer_t rpStream);
384     WW8DocumentImpl(const WW8DocumentImpl & rSrc,
385                     const CpAndFc & rStart, const CpAndFc & rEnd);
386     virtual ~WW8DocumentImpl();
387 
388     virtual WW8DocumentImpl & Assign(const WW8DocumentImpl & rSrc);
389 
390     virtual string getType() const;
391 
392     virtual WW8Document::Pointer_t getSubDocument(SubDocumentId nId);
393     virtual WW8DocumentIterator::Pointer_t getIterator
394     (const CpAndFc & rCpAndFc);
395     virtual WW8DocumentIterator::Pointer_t begin();
396     virtual WW8DocumentIterator::Pointer_t end();
397 
398     virtual WW8Stream::Sequence getText(const CpAndFc & rStart);
399 
400     /**
401        Returns the document stream.
402     */
403 
404     WW8Stream::Pointer_t getDocStream() const;
405 
406     /**
407        Returns the data stream.
408      */
409     WW8Stream::Pointer_t getDataStream() const;
410 
411     /**
412        Returns distance in bytes to next CpAndFc.
413 
414        @param rCpAndFc  CpAndFc to start at
415      */
416     sal_uInt32 getByteLength(const CpAndFc & rCpAndFc) const;
417 
418     /**
419        Returns first character position in document.
420      */
421     const CpAndFc & getFirstCp() const;
422 
423     /**
424        Returns last character position in document.
425     */
426     const CpAndFc & getLastCp() const;
427 
428     /**
429        Returns next character position with change in properties.
430 
431        @param rCpAndFc   position to start at
432      */
433     CpAndFc getNextCp(const CpAndFc & rCpAndFc) const;
434 
435     /**
436        Returns previous character position with change in properties.
437 
438        @param rCpAndFc   position to start at
439     */
440     CpAndFc getPrevCp(const CpAndFc & rCpAndFc) const;
441 
442     /**
443        Returns character position where main text flow ends.
444      */
445     CpAndFc getDocumentEndCp() const;
446 
447     /**
448        Returns character position where footnotes end.
449     */
450     CpAndFc getFootnodeEndCp() const;
451 
452     /**
453        Returns character position where headers end.
454     */
455     CpAndFc getHeaderEndCp() const;
456 
457     /**
458        Returns character position where annatations end.
459     */
460     CpAndFc getAnnotationEndCp() const;
461 
462     /**
463        Returns character position where endnotes end.
464     */
465     CpAndFc getEndnoteEndCp() const;
466 
467     /**
468        Returns character position where textboxes end.
469     */
470     CpAndFc getTextboxEndCp() const;
471 
472     /**
473        Returns character positoion where textboxes in headers end.
474     */
475     CpAndFc getTextboxHeaderEndCp() const;
476 
477     /**
478        Insert CpAndFc to set of CpAndFcs.
479 
480        @param rCpAndFc    CpAndFc to insert
481     */
482     void insertCpAndFc(const CpAndFc & rCpAndFc);
483 
484     /**
485        Return FKP for certain CpAndFc.
486 
487        @param rCpAndFc CpAndFc for which the FKP is looked for
488      */
489     WW8FKP::Pointer_t getFKP(const CpAndFc & rCpAndFc);
490 
491     /**
492        Return FKP containing character properties.
493 
494        @param nIndex      index of FKP to return
495        @param bComplex    true if FKP contains complex FCs
496      */
497     WW8FKP::Pointer_t getFKPCHPX(sal_uInt32 nIndex, bool bComplex);
498 
499     /**
500        Return FKP containing paragraph properties.
501 
502        @param nIndex      index of FKP to return
503        @param bComplex    true if FKP contains complex FCs
504      */
505     WW8FKP::Pointer_t getFKPPAPX(sal_uInt32 nIndex, bool bComplex);
506 
507     /**
508        Return property set valid at a certain CpAndFc.
509 
510        @param rCpAndFc    CpAndFc to look at
511      */
512     writerfilter::Reference<Properties>::Pointer_t
513     getProperties(const CpAndFc & rCpAndFc);
514 
515     /**
516        Return subdocument referenced at a certain point in document.
517 
518        @param rCpAndFc       CpAndFc where subdocument is referenced
519      */
520     writerfilter::Reference<Stream>::Pointer_t
521     getSubDocument(const CpAndFc & rCpAndFc);
522 
523     /**
524        Return section description at a certain CpAndFc.
525 
526        @param rCpAndFc   CpAndFc to look at
527      */
528     WW8SED * getSED(const CpAndFc & rCpAndFc) const;
529 
530     /**
531      Return reference to list plcs.
532     */
533     writerfilter::Reference<Table>::Pointer_t getListTplcs() const;
534 
535     /**
536        Return reference to list table.
537      */
538     writerfilter::Reference<Table>::Pointer_t getListTable() const;
539 
540     /**
541        Return reference to table of list level overrides.
542     */
543     writerfilter::Reference<Table>::Pointer_t getLFOTable() const;
544 
545     /**
546        Return reference to font table.
547      */
548     writerfilter::Reference<Table>::Pointer_t getFontTable() const;
549 
550     /**
551        Return reference to style sheet.
552     */
553     writerfilter::Reference<Table>::Pointer_t getStyleSheet() const;
554 
555     /**
556        Return reference to associated data.
557      */
558     writerfilter::Reference<Table>::Pointer_t getAssocTable() const;
559 
560     /**
561        Return count of headers/footers.
562     */
563     sal_uInt32 getHeaderCount() const;
564 
565     /**
566        Return CpAndFc for a header or footer.
567 
568        @param nPos   index in the list of headers and footers
569      */
570     CpAndFc getHeaderCpAndFc(sal_uInt32 nPos);
571 
572     /**
573        Return subdocument for header/footer.
574 
575        @param nPos   index in the list of headers and footers
576      */
577     writerfilter::Reference<Stream>::Pointer_t getHeader(sal_uInt32 nPos);
578 
579     /**
580        Return count of footnotes.
581     */
582     sal_uInt32 getFootnoteCount() const;
583 
584     /**
585        Return subdocument for footnote.
586 
587        @param nPos     index of the footnote
588     */
589     writerfilter::Reference<Stream>::Pointer_t getFootnote(sal_uInt32 nPos);
590 
591     /**
592        Return subdocument for footnote at a certain position in document.
593 
594        @param rCpAndFc      position in document
595      */
596     writerfilter::Reference<Stream>::Pointer_t getFootnote
597     (const CpAndFc & rCpAndFc);
598 
599     /**
600        Return count of endnotes.
601     */
602     sal_uInt32 getEndnoteCount() const;
603 
604     /**
605        Return subdocument for an endnote.
606 
607        @param nPos       index of the endnote
608      */
609     writerfilter::Reference<Stream>::Pointer_t getEndnote(sal_uInt32 nPos);
610 
611     /**
612        Return subdocument for an endnote.
613 
614        @param rCpAndFc    CpAndFc where endnote is referenced
615      */
616     writerfilter::Reference<Stream>::Pointer_t getEndnote
617     (const CpAndFc & rCpAndFc);
618 
619     /**
620        Return count of annotations.
621     */
622     sal_uInt32 getAnnotationCount() const;
623 
624     /**
625        Return subdocument for an annotation.
626 
627        @param nPos       index of the annotation
628      */
629     writerfilter::Reference<Stream>::Pointer_t getAnnotation(sal_uInt32 nPos);
630 
631     /**
632        Return subdocument for an annotation.
633 
634        @param rCpAndFc    CpAndFc where annotation is referenced
635      */
636     writerfilter::Reference<Stream>::Pointer_t getAnnotation
637     (const CpAndFc & rCpAndFc);
638 
639     /**
640        Return bookmark.
641 
642        @param rCpAndFc    CpAndFc where bookmark begins or ends
643      */
644     writerfilter::Reference<Properties>::Pointer_t
645     getBookmark(const CpAndFc & rCpAndFc) const;
646 
647     /**
648        Return shape.
649 
650        @param rCpAndFc    CpAndFc of the shape
651      */
652     writerfilter::Reference<Properties>::Pointer_t
653     getShape(const CpAndFc & rCpAndFc) const;
654 
655     writerfilter::Reference<Properties>::Pointer_t
656     getShape(sal_uInt32 nSpid);
657 
658     /**
659        Return blip.
660 
661        @param nBlib  number of the blip to return
662     */
663     writerfilter::Reference<Properties>::Pointer_t
664     getBlip(sal_uInt32 nBlib);
665 
666     /**
667        Return break descriptor.
668 
669        @param rCpAndFc    CpAndFc of the break
670     */
671     writerfilter::Reference<Properties>::Pointer_t
672     getBreak(const CpAndFc & rCpAndFc) const;
673 
674 
675     /**
676        Return field.
677 
678        @param rCpAndFc    CpAndFc of the field
679      */
680     writerfilter::Reference<Properties>::Pointer_t
681     getField(const CpAndFc & rCpAndFc) const;
682 
683     /**
684        Return document properties.
685 
686     */
687     writerfilter::Reference<Properties>::Pointer_t
688     getDocumentProperties() const;
689 
690     /**
691        Return current field descriptor.
692     */
693     WW8FLD::Pointer_t getCurrentFLD() const;
694 
695     /**
696        Return stream of text box.
697 
698        @param nShpId    shape id of text box
699      */
700     writerfilter::Reference<Stream>::Pointer_t
701     getTextboxText(sal_uInt32 nShpId) const;
702 
703     /**
704        Return file character position according to a character
705        position.
706 
707        @param cp   the character position
708      */
709     Fc cp2fc(const Cp & cp) const;
710 
711     /**
712        Return the character position according to file character
713        position.
714 
715        @param fc  the file character position
716      */
717     Cp fc2cp(const Fc & fc) const;
718 
719     /**
720        Return CpAndFc related to character position.
721 
722        @param cp    the character position
723      */
724     CpAndFc getCpAndFc(const Cp & cp, PropertyType type = PROP_DOC) const;
725 
726     /**
727        Return CpAndFc related to file character position.
728 
729        @param fc    the file character position
730     */
731     CpAndFc getCpAndFc(const Fc & fc, PropertyType type = PROP_DOC) const;
732 
733     sal_uInt32 getPicLocation() const;
734     void setPicLocation(sal_uInt32 fcPicLoc);
735 
736     bool isPicData();
737     void setPicIsData(bool bPicIsData);
738 
739     /**
740        Create events for the document.
741 
742        @param rHandler    handler to send the events to
743      */
744     void resolve(Stream & rHandler);
745 
746     /**
747        Resolve text.
748 
749        The text of the given iterator is split at special
750        characters. Each run of non-special characters is send as one
751        event. Each run of special characters is send as one event.
752 
753        @param pIt        iterator whose text is to be resolved
754        @param rStream    handler for the events
755      */
756     void resolveText(WW8DocumentIterator::Pointer_t pIt, Stream & rStream);
757 
758     /**
759        Resolve the picture at mfcPicLoc.
760 
761        @param rStream
762      */
763     void resolvePicture(Stream & rStream);
764 
765     /**
766        Resolve special char.
767 
768        @param nChar    the special char
769        @param rStream  the stream handler to resolve the special char to
770      */
771     void resolveSpecialChar(sal_uInt32 nChar, Stream & rStream);
772 };
773 
774 /**
775    Implentation class for an iterator in a document.
776  */
777 class WW8DocumentIteratorImpl : public WW8DocumentIterator
778 {
779     /// pointer to the document
780     WW8DocumentImpl * mpDocument;
781 
782     /// CpAndFc the iterator is pointing to
783     CpAndFc mCpAndFc;
784 
785 public:
WW8DocumentIteratorImpl(WW8DocumentImpl * pDocument,const CpAndFc & rCpAndFc)786     WW8DocumentIteratorImpl(WW8DocumentImpl * pDocument,
787                             const CpAndFc & rCpAndFc)
788     : mpDocument(pDocument), mCpAndFc(rCpAndFc)
789     {
790     }
791 
792     virtual ~WW8DocumentIteratorImpl();
793 
794     /**
795        Increase the iterator to the next character position.
796      */
797     WW8DocumentIterator & operator++();
798 
799     /**
800        Decrease the iterator to the previous character position.
801      */
802     WW8DocumentIterator & operator--();
803 
804     virtual writerfilter::Reference<Properties>::Pointer_t getProperties()
805         const;
806     //void setAttributes(const IAttributeSet & aAttributeSet);
807 
808     virtual writerfilter::Reference<Stream>::Pointer_t getSubDocument() const;
809 
810     /** Return if the text the iterator points to is complex.
811 
812         @attention The definition of a complex run of text in Word is
813         counter-intuitive: Complex runs use 8-bit encoding for characters,
814         non-complex ones use 16 bits.
815     */
816     bool isComplex() const;
817     virtual PropertyType getPropertyType() const;
818 
819     virtual WW8Stream::Sequence getText();
820     virtual bool equal(const WW8DocumentIterator & rIt) const;
821 
822     virtual string toString() const;
823     virtual void dump(ostream & o) const;
824 
825     /**
826        Return pointer to the shape at character position the iterator
827        is pointing to.
828      */
829     virtual writerfilter::Reference<Properties>::Pointer_t getShape() const;
830 
831     /**
832        Return pointer to section description at character position the
833        iterator points to.
834      */
835     WW8SED * getSED() const;
836 };
837 
838 /**
839    Return string for property type.
840  */
841 string propertyTypeToString(PropertyType nType);
842 
843 }}
844 #endif // INCLUDED_WW8_DOCUMENT_IMPL_HXX
845