Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_xmloff / txtimp.hxx
blobd8b5b4b1a8d86a681946a1f79ef9adb02cd4def8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txtimp.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _XMLOFF_TEXTIMP_HXX_
31 #define _XMLOFF_TEXTIMP_HXX_
33 #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
34 #include <com/sun/star/uno/Reference.h>
35 #endif
37 #ifndef __SGI_STL_MAP
38 #include <map>
39 #endif
41 #ifndef __SGI_STL_VECTOR
42 #include <vector>
43 #endif
45 #ifndef _LIST_HXX
46 #include <tools/list.hxx>
47 #endif
49 #ifndef _XMLOFF_XMLICTXT_HXX
50 #include <bf_xmloff/xmlictxt.hxx>
51 #endif
52 #ifndef _XMLOFF_XMLIMPPR_HXX
53 #include <bf_xmloff/xmlimppr.hxx>
54 #endif
55 #ifndef _XMLOFF_XMLTKMAP_HXX
56 #include <bf_xmloff/xmltkmap.hxx>
57 #endif
59 // functional.hxx is obsolete and should be replaced by its comphelper
60 // counterpart
61 #ifndef _COMPHELPER_STLTYPES_HXX_
62 #include <comphelper/stl_types.hxx>
63 #endif
65 #ifndef _UNIVERSALL_REFERENCE_HXX
66 #include <bf_xmloff/uniref.hxx>
67 #endif
68 namespace com { namespace sun { namespace star {
69 namespace text { class XText; class XTextCursor; class XTextRange; class XTextContent; }
70 namespace frame { class XModel; }
71 namespace container { class XNameContainer; class XIndexReplace; class XNameAccess; }
72 namespace beans { class XPropertySet; }
73 namespace xml { namespace sax { class XAttributeList; } }
74 namespace util { struct DateTime; }
75 namespace lang { class XMultiServiceFactory; }
76 namespace ucb { class XAnyCompare; }
77 } } }
78 namespace binfilter {
79 class SvStringsDtor;
81 class SvXMLImport;
82 class SvXMLStylesContext;
83 class XMLTextListBlockContext;
84 class XMLTextListItemContext;
85 class SvxXMLListStyleContext;
86 class XMLPropStyleContext;
87 class SvI18NMap;
88 class XMLSectionImportContext;
89 class XMLFontStylesContext;
90 template<class A> class XMLPropertyBackpatcher;
91 class XMLEventsImportContext;
94 enum SwXMLTextElemTokens
96 XML_TOK_TEXT_P,
97 XML_TOK_TEXT_H,
98 XML_TOK_TEXT_ORDERED_LIST,
99 XML_TOK_TEXT_UNORDERED_LIST,
100 XML_TOK_TEXT_TEXTBOX_PAGE,
101 XML_TOK_TEXT_IMAGE_PAGE,
102 XML_TOK_TEXT_OBJECT_PAGE,
103 XML_TOK_TEXT_OBJECT_OLE_PAGE,
104 XML_TOK_TABLE_TABLE,
105 XML_TOK_TEXT_VARFIELD_DECLS,
106 XML_TOK_TEXT_USERFIELD_DECLS,
107 XML_TOK_TEXT_SEQUENCE_DECLS,
108 XML_TOK_TEXT_DDE_DECLS,
109 XML_TOK_DRAW_A_PAGE,
110 XML_TOK_TEXT_SECTION,
111 XML_TOK_TEXT_TOC,
112 XML_TOK_TEXT_OBJECT_INDEX,
113 XML_TOK_TEXT_TABLE_INDEX,
114 XML_TOK_TEXT_ILLUSTRATION_INDEX,
115 XML_TOK_TEXT_USER_INDEX,
116 XML_TOK_TEXT_ALPHABETICAL_INDEX,
117 XML_TOK_TEXT_BIBLIOGRAPHY_INDEX,
118 XML_TOK_TEXT_INDEX_TITLE,
119 XML_TOK_TEXT_TRACKED_CHANGES,
120 XML_TOK_TEXT_CHANGE_START,
121 XML_TOK_TEXT_CHANGE_END,
122 XML_TOK_TEXT_CHANGE,
123 XML_TOK_TEXT_FORMS,
124 XML_TOK_TEXT_CALCULATION_SETTINGS,
125 XML_TOK_TEXT_AUTOMARK,
126 XML_TOK_TEXT_APPLET_PAGE,
127 XML_TOK_TEXT_PLUGIN_PAGE,
128 XML_TOK_TEXT_FLOATING_FRAME_PAGE,
129 XML_TOK_TEXT_ELEM_END=XML_TOK_UNKNOWN
132 enum XMLTextPElemTokens
134 XML_TOK_TEXT_SPAN,
135 XML_TOK_TEXT_TAB_STOP,
136 XML_TOK_TEXT_LINE_BREAK,
137 XML_TOK_TEXT_S,
138 XML_TOK_TEXT_TEXTBOX,
139 XML_TOK_TEXT_IMAGE,
140 XML_TOK_TEXT_OBJECT,
141 XML_TOK_TEXT_OBJECT_OLE,
142 XML_TOK_TEXT_FLOATING_FRAME,
143 XML_TOK_TEXT_APPLET,
144 XML_TOK_TEXT_PLUGIN,
145 XML_TOK_TEXT_HYPERLINK,
146 XML_TOK_TEXT_RUBY,
148 XML_TOK_TEXT_FOOTNOTE,
149 XML_TOK_TEXT_ENDNOTE,
150 XML_TOK_TEXT_BOOKMARK,
151 XML_TOK_TEXT_BOOKMARK_START,
152 XML_TOK_TEXT_BOOKMARK_END,
153 XML_TOK_TEXT_REFERENCE,
154 XML_TOK_TEXT_REFERENCE_START,
155 XML_TOK_TEXT_REFERENCE_END,
157 XML_TOK_TEXT_TOC_MARK, // index marks
158 XML_TOK_TEXT_TOC_MARK_START,
159 XML_TOK_TEXT_TOC_MARK_END,
160 XML_TOK_TEXT_USER_INDEX_MARK,
161 XML_TOK_TEXT_USER_INDEX_MARK_START,
162 XML_TOK_TEXT_USER_INDEX_MARK_END,
163 XML_TOK_TEXT_ALPHA_INDEX_MARK,
164 XML_TOK_TEXT_ALPHA_INDEX_MARK_START,
165 XML_TOK_TEXT_ALPHA_INDEX_MARK_END,
167 XML_TOK_TEXT_SENDER_FIRSTNAME, // sender fields
168 XML_TOK_TEXT_SENDER_LASTNAME,
169 XML_TOK_TEXT_SENDER_INITIALS,
170 XML_TOK_TEXT_SENDER_TITLE,
171 XML_TOK_TEXT_SENDER_POSITION,
172 XML_TOK_TEXT_SENDER_EMAIL,
173 XML_TOK_TEXT_SENDER_PHONE_PRIVATE,
174 XML_TOK_TEXT_SENDER_FAX,
175 XML_TOK_TEXT_SENDER_COMPANY,
176 XML_TOK_TEXT_SENDER_PHONE_WORK,
177 XML_TOK_TEXT_SENDER_STREET,
178 XML_TOK_TEXT_SENDER_CITY,
179 XML_TOK_TEXT_SENDER_POSTAL_CODE,
180 XML_TOK_TEXT_SENDER_COUNTRY,
181 XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE,
183 XML_TOK_TEXT_AUTHOR_NAME, // author fields
184 XML_TOK_TEXT_AUTHOR_INITIALS,
186 XML_TOK_TEXT_DATE, // date & time fields
187 XML_TOK_TEXT_TIME,
189 XML_TOK_TEXT_PAGE_NUMBER, // page number fields
190 XML_TOK_TEXT_PAGE_CONTINUATION_STRING,
192 XML_TOK_TEXT_VARIABLE_SET, // variable fields
193 XML_TOK_TEXT_VARIABLE_GET,
194 XML_TOK_TEXT_VARIABLE_INPUT,
195 XML_TOK_TEXT_USER_FIELD_GET,
196 XML_TOK_TEXT_USER_FIELD_INPUT,
197 XML_TOK_TEXT_SEQUENCE,
198 XML_TOK_TEXT_EXPRESSION,
199 XML_TOK_TEXT_TEXT_INPUT,
201 XML_TOK_TEXT_DATABASE_DISPLAY, // database fields
202 XML_TOK_TEXT_DATABASE_NEXT,
203 XML_TOK_TEXT_DATABASE_SELECT,
204 XML_TOK_TEXT_DATABASE_ROW_NUMBER,
205 XML_TOK_TEXT_DATABASE_NAME,
207 XML_TOK_TEXT_DOCUMENT_CREATION_AUTHOR, //document info fields
208 XML_TOK_TEXT_DOCUMENT_CREATION_DATE,
209 XML_TOK_TEXT_DOCUMENT_CREATION_TIME,
210 XML_TOK_TEXT_DOCUMENT_DESCRIPTION,
211 XML_TOK_TEXT_DOCUMENT_INFORMATION_0,
212 XML_TOK_TEXT_DOCUMENT_INFORMATION_1,
213 XML_TOK_TEXT_DOCUMENT_INFORMATION_2,
214 XML_TOK_TEXT_DOCUMENT_INFORMATION_3,
215 XML_TOK_TEXT_DOCUMENT_PRINT_AUTHOR,
216 XML_TOK_TEXT_DOCUMENT_PRINT_DATE,
217 XML_TOK_TEXT_DOCUMENT_PRINT_TIME,
218 XML_TOK_TEXT_DOCUMENT_TITLE,
219 XML_TOK_TEXT_DOCUMENT_SUBJECT,
220 XML_TOK_TEXT_DOCUMENT_KEYWORDS,
221 XML_TOK_TEXT_DOCUMENT_REVISION,
222 XML_TOK_TEXT_DOCUMENT_EDIT_DURATION,
223 XML_TOK_TEXT_DOCUMENT_SAVE_AUTHOR,
224 XML_TOK_TEXT_DOCUMENT_SAVE_DATE,
225 XML_TOK_TEXT_DOCUMENT_SAVE_TIME,
226 XML_TOK_TEXT_DOCUMENT_USER_DEFINED,
228 XML_TOK_TEXT_PLACEHOLDER, // misc. fields
229 XML_TOK_TEXT_CONDITIONAL_TEXT,
230 XML_TOK_TEXT_HIDDEN_TEXT,
231 XML_TOK_TEXT_HIDDEN_PARAGRAPH,
232 XML_TOK_TEXT_FILENAME,
233 XML_TOK_TEXT_CHAPTER,
234 XML_TOK_TEXT_TEMPLATENAME,
235 XML_TOK_TEXT_WORD_COUNT, // statistics/count fields
236 XML_TOK_TEXT_PARAGRAPH_COUNT,
237 XML_TOK_TEXT_TABLE_COUNT,
238 XML_TOK_TEXT_CHARACTER_COUNT,
239 XML_TOK_TEXT_IMAGE_COUNT,
240 XML_TOK_TEXT_OBJECT_COUNT,
241 XML_TOK_TEXT_PAGE_COUNT,
242 XML_TOK_TEXT_GET_PAGE_VAR,
243 XML_TOK_TEXT_SET_PAGE_VAR,
244 XML_TOK_TEXT_MACRO,
245 XML_TOK_TEXT_DDE,
246 XML_TOK_TEXT_REFERENCE_REF,
247 XML_TOK_TEXT_BOOKMARK_REF,
248 XML_TOK_TEXT_SEQUENCE_REF,
249 XML_TOK_TEXT_FOOTNOTE_REF,
250 XML_TOK_TEXT_ENDNOTE_REF,
251 XML_TOK_TEXT_SHEET_NAME,
252 XML_TOK_TEXT_BIBLIOGRAPHY_MARK,
253 XML_TOK_TEXT_ANNOTATION,
254 XML_TOK_TEXT_SCRIPT,
255 XML_TOK_TEXT_TABLE_FORMULA,
256 XML_TOK_TEXT_DROPDOWN,
258 // misc
259 XML_TOK_TEXTP_CHANGE_START, // avoid ambigiouty with SwXMLTextElemTokens
260 XML_TOK_TEXTP_CHANGE_END, // avoid ambigiouty with SwXMLTextElemTokens
261 XML_TOK_TEXTP_CHANGE, // avoid ambigiouty with SwXMLTextElemTokens
262 XML_TOK_DRAW_A,
263 XML_TOK_TEXT_MEASURE,
265 XML_TOK_TEXT_P_ELEM_END=XML_TOK_UNKNOWN
268 enum XMLTextPAttrTokens
270 XML_TOK_TEXT_P_STYLE_NAME,
271 XML_TOK_TEXT_P_COND_STYLE_NAME,
272 XML_TOK_TEXT_P_LEVEL,
273 XML_TOK_TEXT_P_END=XML_TOK_UNKNOWN
276 enum XMLTextListBlockAttrTokens
278 XML_TOK_TEXT_LIST_BLOCK_STYLE_NAME,
279 XML_TOK_TEXT_LIST_BLOCK_CONTINUE_NUMBERING,
280 XML_TOK_TEXT_LIST_BLOCK_END=XML_TOK_UNKNOWN
283 enum XMLTextListBlockElemTokens
285 XML_TOK_TEXT_LIST_HEADER,
286 XML_TOK_TEXT_LIST_ITEM,
287 XML_TOK_TEXT_LIST_BLOCK_ELEM_END=XML_TOK_UNKNOWN
290 enum XMLTextFrameAttrTokens
292 XML_TOK_TEXT_FRAME_STYLE_NAME,
293 XML_TOK_TEXT_FRAME_NAME,
294 XML_TOK_TEXT_FRAME_ANCHOR_TYPE,
295 XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER,
296 XML_TOK_TEXT_FRAME_X,
297 XML_TOK_TEXT_FRAME_Y,
298 XML_TOK_TEXT_FRAME_WIDTH,
299 XML_TOK_TEXT_FRAME_REL_WIDTH,
300 XML_TOK_TEXT_FRAME_HEIGHT,
301 XML_TOK_TEXT_FRAME_MIN_HEIGHT,
302 XML_TOK_TEXT_FRAME_REL_HEIGHT,
303 XML_TOK_TEXT_FRAME_NEXT_CHAIN_NAME,
304 XML_TOK_TEXT_FRAME_HREF,
305 XML_TOK_TEXT_FRAME_FILTER_NAME,
306 XML_TOK_TEXT_FRAME_Z_INDEX,
307 XML_TOK_TEXT_FRAME_TRANSFORM,
308 XML_TOK_TEXT_FRAME_CLASS_ID,
309 XML_TOK_TEXT_FRAME_CODE,
310 XML_TOK_TEXT_FRAME_OBJECT,
311 XML_TOK_TEXT_FRAME_ARCHIVE,
312 XML_TOK_TEXT_FRAME_MAY_SCRIPT,
313 XML_TOK_TEXT_FRAME_MIME_TYPE,
314 XML_TOK_TEXT_FRAME_APPLET_NAME,
315 XML_TOK_TEXT_FRAME_FRAME_NAME,
316 XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE,
317 XML_TOK_TEXT_FRAME_END=XML_TOK_UNKNOWN
320 enum XMLTextHyperlinkAttrTokens
322 XML_TOK_TEXT_HYPERLINK_HREF,
323 XML_TOK_TEXT_HYPERLINK_NAME,
324 XML_TOK_TEXT_HYPERLINK_TARGET_FRAME,
325 XML_TOK_TEXT_HYPERLINK_SHOW,
326 XML_TOK_TEXT_HYPERLINK_STYLE_NAME,
327 XML_TOK_TEXT_HYPERLINK_VIS_STYLE_NAME,
328 XML_TOK_TEXT_HYPERLINK_SERVER_MAP,
329 XML_TOK_TEXT_HYPERLINK_END=XML_TOK_UNKNOWN
332 enum XMLTextPageMasterElemTokens
334 XML_TOK_TEXT_MP_HEADER,
335 XML_TOK_TEXT_MP_FOOTER,
336 XML_TOK_TEXT_MP_HEADER_LEFT,
337 XML_TOK_TEXT_MP_FOOTER_LEFT,
338 XML_TOK_TEXT_MP_END=XML_TOK_UNKNOWN
341 enum XMLTextContourAttrTokens
343 XML_TOK_TEXT_CONTOUR_WIDTH,
344 XML_TOK_TEXT_CONTOUR_HEIGHT,
345 XML_TOK_TEXT_CONTOUR_VIEWBOX,
346 XML_TOK_TEXT_CONTOUR_POINTS,
347 XML_TOK_TEXT_CONTOUR_D,
348 XML_TOK_TEXT_CONTOUR_AUTO,
349 XML_TOK_TEXT_CONTOUR_END=XML_TOK_UNKNOWN
351 enum XMLTextType
353 XML_TEXT_TYPE_BODY,
354 XML_TEXT_TYPE_CELL,
355 XML_TEXT_TYPE_SHAPE,
356 XML_TEXT_TYPE_TEXTBOX,
357 XML_TEXT_TYPE_HEADER_FOOTER,
358 XML_TEXT_TYPE_SECTION,
359 XML_TEXT_TYPE_FOOTNOTE,
360 XML_TEXT_TYPE_CHANGED_REGION
363 #define XML_TEXT_RENAME_TYPE_FRAME 10
364 #define XML_TEXT_RENAME_TYPE_TABLE 20
366 // create type for section list, XMLSectionList_Impl
367 DECLARE_LIST( XMLSectionList_Impl, XMLSectionImportContext* )
369 class XMLTextImportHelper : public UniRefBase
371 SvXMLTokenMap *pTextElemTokenMap;
372 SvXMLTokenMap *pTextPElemTokenMap;
373 SvXMLTokenMap *pTextPAttrTokenMap;
374 SvXMLTokenMap *pTextFieldAttrTokenMap;
375 SvXMLTokenMap *pTextListBlockAttrTokenMap;
376 SvXMLTokenMap *pTextListBlockElemTokenMap;
377 SvXMLTokenMap *pTextFrameAttrTokenMap;
378 SvXMLTokenMap *pTextContourAttrTokenMap;
379 SvXMLTokenMap *pTextHyperlinkAttrTokenMap;
380 SvXMLTokenMap *pTextMasterPageElemTokenMap;
381 SvStringsDtor *pPrevFrmNames;
382 SvStringsDtor *pNextFrmNames;
384 SvXMLImportContextRef xAutoStyles;
385 SvXMLImportContextRef xFontDecls;
386 SvXMLImportContextRef xListBlock;
387 SvXMLImportContextRef xListItem;
389 XMLSectionList_Impl aSectionList;
391 UniReference < SvXMLImportPropertyMapper > xParaImpPrMap;
392 UniReference < SvXMLImportPropertyMapper > xTextImpPrMap;
393 UniReference < SvXMLImportPropertyMapper > xFrameImpPrMap;
394 UniReference < SvXMLImportPropertyMapper > xSectionImpPrMap;
395 UniReference < SvXMLImportPropertyMapper > xRubyImpPrMap;
397 SvI18NMap *pRenameMap;
398 ::rtl::OUString *pOutlineStyles;
400 /// start ranges for open bookmarks
401 ::std::map< ::rtl::OUString,
402 ::com::sun::star::uno::Reference<
403 ::com::sun::star::text::XTextRange>,
404 ::comphelper::UStringLess> aBookmarkStartRanges;
406 /// backpatcher for references to footnotes and endnotes
407 XMLPropertyBackpatcher<sal_Int16> * pFootnoteBackpatcher;
409 /// backpatchers for references to sequences
410 XMLPropertyBackpatcher<sal_Int16> * pSequenceIdBackpatcher;
412 XMLPropertyBackpatcher< ::rtl::OUString> * pSequenceNameBackpatcher;
414 /// name of the last 'open' redline that started between paragraphs
415 ::rtl::OUString sOpenRedlineIdentifier;
417 ::com::sun::star::uno::Reference <
418 ::com::sun::star::text::XText > xText;
419 ::com::sun::star::uno::Reference <
420 ::com::sun::star::text::XTextCursor > xCursor;
421 ::com::sun::star::uno::Reference <
422 ::com::sun::star::text::XTextRange > xCursorAsRange;
423 ::com::sun::star::uno::Reference <
424 ::com::sun::star::container::XNameContainer > xParaStyles;
425 ::com::sun::star::uno::Reference <
426 ::com::sun::star::container::XNameContainer > xTextStyles;
427 ::com::sun::star::uno::Reference <
428 ::com::sun::star::container::XNameContainer > xNumStyles;
429 ::com::sun::star::uno::Reference <
430 ::com::sun::star::container::XNameContainer > xFrameStyles;
431 ::com::sun::star::uno::Reference <
432 ::com::sun::star::container::XNameContainer > xPageStyles;
433 ::com::sun::star::uno::Reference<
434 ::com::sun::star::container::XIndexReplace > xChapterNumbering;
435 ::com::sun::star::uno::Reference<
436 ::com::sun::star::container::XNameAccess > xTextFrames;
437 ::com::sun::star::uno::Reference<
438 ::com::sun::star::container::XNameAccess > xGraphics;
439 ::com::sun::star::uno::Reference<
440 ::com::sun::star::container::XNameAccess > xObjects;
441 ::com::sun::star::uno::Reference<
442 ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory;
443 ::com::sun::star::uno::Reference<
444 ::com::sun::star::ucb::XAnyCompare > xNumRuleCompare;
446 sal_Bool bInsertMode : 1;
447 sal_Bool bStylesOnlyMode : 1;
448 sal_Bool bBlockMode : 1;
449 sal_Bool bProgress : 1;
450 sal_Bool bOrganizerMode : 1;
451 sal_Bool bBodyContentStarted : 1;
453 // #107848#
454 // One more flag to remember if we are inside a deleted redline section
455 sal_Bool bInsideDeleteContext : 1;
457 SvXMLTokenMap *_GetTextElemTokenMap();
458 SvXMLTokenMap *_GetTextPElemTokenMap();
459 SvXMLTokenMap *_GetTextPAttrTokenMap();
460 SvXMLTokenMap *_GetTextFrameAttrTokenMap();
461 SvXMLTokenMap *_GetTextContourAttrTokenMap();
462 SvXMLTokenMap *_GetTextHyperlinkAttrTokenMap();
463 SvXMLTokenMap *_GetTextMasterPageElemTokenMap();
465 // clean up backpatchers; to be called only by destructor
466 // Code is implemented in XMLPropertyBackpatcher.cxx
467 void _FinitBackpatcher();
469 protected:
470 virtual SvXMLImportContext *CreateTableChildContext(
471 SvXMLImport& rImport,
472 sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
473 const ::com::sun::star::uno::Reference<
474 ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
476 // access, lazy initialization and destruction of backpatchers
477 // Code is implemented in XMLPropertyBackpatcher.cxx
478 #if !(defined(MACOSX) && (__GNUC__ < 3))
479 inline XMLPropertyBackpatcher<sal_Int16>& GetFootnoteBP();
480 inline XMLPropertyBackpatcher<sal_Int16>& GetSequenceIdBP();
481 inline XMLPropertyBackpatcher< ::rtl::OUString> & GetSequenceNameBP();
482 #else
483 XMLPropertyBackpatcher<sal_Int16>& GetFootnoteBP();
484 XMLPropertyBackpatcher<sal_Int16>& GetSequenceIdBP();
485 XMLPropertyBackpatcher< ::rtl::OUString> & GetSequenceNameBP();
486 #endif
488 public:
490 const ::rtl::OUString sParaStyleName;
491 const ::rtl::OUString sCharStyleName;
492 const ::rtl::OUString sHeadingStyleName;
493 const ::rtl::OUString sNumberingLevel;
494 const ::rtl::OUString sNumberingStartValue;
495 const ::rtl::OUString sNumberingRules;
496 const ::rtl::OUString sParaIsNumberingRestart;
497 const ::rtl::OUString sNumberingIsNumber;
498 const ::rtl::OUString sCurrentPresentation;
499 const ::rtl::OUString sSequenceNumber;
500 const ::rtl::OUString sSourceName;
501 const ::rtl::OUString sChainNextName;
502 const ::rtl::OUString sChainPrevName;
503 const ::rtl::OUString sHyperLinkURL;
504 const ::rtl::OUString sHyperLinkName;
505 const ::rtl::OUString sHyperLinkTarget;
506 const ::rtl::OUString sUnvisitedCharStyleName;
507 const ::rtl::OUString sVisitedCharStyleName;
508 const ::rtl::OUString sTextFrame;
509 const ::rtl::OUString sPageDescName;
510 const ::rtl::OUString sServerMap;
511 const ::rtl::OUString sHyperLinkEvents;
512 const ::rtl::OUString sContent;
513 const ::rtl::OUString sServiceCombinedCharacters;
515 XMLTextImportHelper(
516 const ::com::sun::star::uno::Reference <
517 ::com::sun::star::frame::XModel>& rModel,
518 SvXMLImport& rImport,
519 sal_Bool bInsertM = sal_False, sal_Bool bStylesOnlyM = sal_False,
520 sal_Bool bProgress = sal_False,
521 sal_Bool bBlockMode = sal_False,
522 sal_Bool bOrganizerMode = sal_False );
524 ~XMLTextImportHelper();
526 void SetCursor(
527 const ::com::sun::star::uno::Reference <
528 ::com::sun::star::text::XTextCursor >& rCursor );
529 void ResetCursor();
531 void SetAutoStyles( SvXMLStylesContext *pStyles );
533 void SetFontDecls( XMLFontStylesContext *pFontDecls );
534 const XMLFontStylesContext *GetFontDecls() const;
536 SvXMLImportContext *CreateTextChildContext(
537 SvXMLImport& rImport,
538 sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
539 const ::com::sun::star::uno::Reference<
540 ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
541 XMLTextType eType = XML_TEXT_TYPE_SHAPE );
543 inline const SvXMLTokenMap& GetTextElemTokenMap();
544 inline const SvXMLTokenMap& GetTextPElemTokenMap();
545 inline const SvXMLTokenMap& GetTextPAttrTokenMap();
546 inline const SvXMLTokenMap& GetTextFrameAttrTokenMap();
547 inline const SvXMLTokenMap& GetTextContourAttrTokenMap();
548 inline const SvXMLTokenMap& GetTextHyperlinkAttrTokenMap();
549 inline const SvXMLTokenMap& GetTextMasterPageElemTokenMap();
551 const SvXMLTokenMap& GetTextListBlockAttrTokenMap();
552 const SvXMLTokenMap& GetTextListBlockElemTokenMap();
553 const SvXMLTokenMap& GetTextFieldAttrTokenMap(); // impl: txtfldi.cxx
555 ::com::sun::star::uno::Reference <
556 ::com::sun::star::text::XText > & GetText() { return xText; }
557 ::com::sun::star::uno::Reference <
558 ::com::sun::star::text::XTextCursor > & GetCursor() { return xCursor; }
559 ::com::sun::star::uno::Reference <
560 ::com::sun::star::text::XTextRange > & GetCursorAsRange()
562 return xCursorAsRange;
565 sal_Bool IsInsertMode() { return bInsertMode; }
566 sal_Bool IsStylesOnlyMode() { return bStylesOnlyMode; }
567 sal_Bool IsBlockMode() { return bBlockMode; }
568 sal_Bool IsOrganizerMode() { return bOrganizerMode; }
569 sal_Bool IsProgress() { return bProgress; }
571 XMLTextListBlockContext *GetListBlock();
572 SvXMLImportContext *_GetListBlock() { return &xListBlock; }
573 sal_Bool IsInList() const { return xListBlock.Is(); }
574 void SetListBlock( XMLTextListBlockContext *pListBlock );
575 void _SetListBlock( SvXMLImportContext *pListBlock );
577 XMLTextListItemContext *GetListItem();
578 SvXMLImportContext *_GetListItem() { return &xListItem; }
579 sal_Bool HasListItem() const { return xListItem.Is(); }
580 void SetListItem( XMLTextListItemContext *pListItem );
581 void _SetListItem( SvXMLImportContext *pListItem );
583 XMLSectionList_Impl& GetSectionList() { return aSectionList; }
585 #ifdef CONV_STAR_FONTS
586 ::rtl::OUString ConvertStarFonts( const ::rtl::OUString& rChars,
587 const ::rtl::OUString& rStyleName,
588 sal_uInt8& rFlags,
589 sal_Bool bPara,
590 SvXMLImport& rImport ) const;
591 #endif
592 // insert a string without special whitespace processing enabled
593 void InsertString( const ::rtl::OUString& rChars );
594 // insert a string with special whitespace processing enabled
595 void InsertString( const ::rtl::OUString& rChars,
596 sal_Bool& rIgnoreLeadingSpace );
597 // Delete current paragraph
598 void DeleteParagraph();
600 void InsertControlCharacter( sal_Int16 nControl );
601 void InsertTextContent( ::com::sun::star::uno::Reference <
602 ::com::sun::star::text::XTextContent > & xContent);
604 ::rtl::OUString SetStyleAndAttrs(
605 const ::com::sun::star::uno::Reference <
606 ::com::sun::star::text::XTextCursor >& rCursor,
607 const ::rtl::OUString& rStyleName,
608 sal_Bool bPara );
610 /** Find a suitable name for the given outline level.
611 * If rStyleName is empty, change it to a previously used or default style
612 * name for that level. Otherwise, leave rStyleName unmodified.
614 void FindOutlineStyleName( ::rtl::OUString& rStyleName, sal_Int8 nLevel );
616 void SetOutlineStyle( sal_Int8 nLevel, const ::rtl::OUString& rStyleName );
617 void SetOutlineStyles();
618 void SetHyperlink(
619 const ::com::sun::star::uno::Reference <
620 ::com::sun::star::text::XTextCursor >& rCursor,
621 const ::rtl::OUString& rHRef,
622 const ::rtl::OUString& rName,
623 const ::rtl::OUString& rTargetFrameName,
624 const ::rtl::OUString& rStyleName,
625 const ::rtl::OUString& rVisitedStyleName,
626 XMLEventsImportContext* pEvents = NULL);
627 void SetRuby(
628 const ::com::sun::star::uno::Reference <
629 ::com::sun::star::text::XTextCursor >& rCursor,
630 const ::rtl::OUString& rStyleName,
631 const ::rtl::OUString& rTextStyleName,
632 const ::rtl::OUString& rText );
634 /// return key appropriate for use with NumberFormat property
635 /// return -1 if style is not found
636 /// (may return whether data style uses the system language)
637 sal_Int32 GetDataStyleKey( const ::rtl::OUString& sStyleName,
638 sal_Bool* pIsSystemLanguage = NULL );
640 const SvxXMLListStyleContext *FindAutoListStyle(
641 const ::rtl::OUString& rName ) const;
642 XMLPropStyleContext *FindAutoFrameStyle(
643 const ::rtl::OUString& rName ) const;
644 XMLPropStyleContext* FindSectionStyle(
645 const ::rtl::OUString& rName ) const;
646 XMLPropStyleContext* FindPageMaster(
647 const ::rtl::OUString& rName ) const;
649 const ::com::sun::star::uno::Reference <
650 ::com::sun::star::container::XNameContainer>& GetParaStyles() const
652 return xParaStyles;
655 const ::com::sun::star::uno::Reference <
656 ::com::sun::star::container::XNameContainer>& GetTextStyles() const
658 return xTextStyles;
661 const ::com::sun::star::uno::Reference <
662 ::com::sun::star::container::XNameContainer>& GetNumberingStyles() const
664 return xNumStyles;
667 const ::com::sun::star::uno::Reference <
668 ::com::sun::star::container::XNameContainer>& GetFrameStyles() const
670 return xFrameStyles;
673 const ::com::sun::star::uno::Reference <
674 ::com::sun::star::container::XNameContainer>& GetPageStyles() const
676 return xPageStyles;
679 const ::com::sun::star::uno::Reference<
680 ::com::sun::star::container::XIndexReplace >& GetChapterNumbering() const
682 return xChapterNumbering;
685 sal_Bool HasFrameByName( const ::rtl::OUString& rName ) const;
686 void ConnectFrameChains( const ::rtl::OUString& rFrmName,
687 const ::rtl::OUString& rNextFrmName,
688 const ::com::sun::star::uno::Reference <
689 ::com::sun::star::beans::XPropertySet >& rFrmPropSet );
691 const UniReference < SvXMLImportPropertyMapper >&
692 GetParaImportPropertySetMapper() const { return xParaImpPrMap; }
693 const UniReference < SvXMLImportPropertyMapper >&
694 GetTextImportPropertySetMapper() const { return xTextImpPrMap; }
695 const UniReference < SvXMLImportPropertyMapper >&
696 GetFrameImportPropertySetMapper() const { return xFrameImpPrMap; }
697 const UniReference < SvXMLImportPropertyMapper >&
698 GetSectionImportPropertySetMapper() const { return xSectionImpPrMap; }
699 const UniReference < SvXMLImportPropertyMapper >&
700 GetRubyImportPropertySetMapper() const { return xRubyImpPrMap; }
701 static SvXMLImportPropertyMapper *CreateShapeExtPropMapper(SvXMLImport&);
702 static SvXMLImportPropertyMapper *CreateCharExtPropMapper(SvXMLImport&, XMLFontStylesContext *pFontDecls = NULL);
703 static SvXMLImportPropertyMapper *CreateParaExtPropMapper(SvXMLImport&, XMLFontStylesContext *pFontDecls = NULL);
704 static sal_Bool HasDrawNameAttribute(
705 const ::com::sun::star::uno::Reference<
706 ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
707 SvXMLNamespaceMap& rNamespaceMap );
709 SvI18NMap& GetRenameMap();
711 /// save the start of a range reference
712 void InsertBookmarkStartRange(
713 const ::rtl::OUString sName,
714 const ::com::sun::star::uno::Reference<
715 ::com::sun::star::text::XTextRange> & rRange);
717 /// process the start of a range reference
718 sal_Bool FindAndRemoveBookmarkStartRange(
719 ::com::sun::star::uno::Reference<
720 ::com::sun::star::text::XTextRange> & rRange,
721 const ::rtl::OUString sName);
723 /// insert new footnote ID.
724 /// Also fixup open references from the backpatch list to this ID.
725 // Code is implemented in XMLPropertyBackpatcher.cxx
726 void InsertFootnoteID(const ::rtl::OUString& sXMLId, sal_Int16 nAPIId);
728 /// set the proper footnote reference ID,
729 /// or put into backpatch list if ID is unknown
730 // Code is implemented in XMLPropertyBackpatcher.cxx
731 void ProcessFootnoteReference(
732 const ::rtl::OUString& sXMLId,
733 const ::com::sun::star::uno::Reference<
734 ::com::sun::star::beans::XPropertySet> & xPropSet);
736 /// insert new sequence ID
737 /// Also fixup open references from backpatch list to this ID.
738 // Code is implemented in XMLPropertyBackpatcher.cxx
739 void InsertSequenceID(const ::rtl::OUString& sXMLId,
740 const ::rtl::OUString& sName,
741 sal_Int16 nAPIId);
743 /// set sequence ID or insert into backpatch list
744 // Code is implemented in XMLPropertyBackpatcher.cxx
745 void ProcessSequenceReference(
746 const ::rtl::OUString& sXMLId,
747 const ::com::sun::star::uno::Reference<
748 ::com::sun::star::beans::XPropertySet> & xPropSet);
750 sal_Bool IsInFrame() const;
751 virtual sal_Bool IsInHeaderFooter() const;
753 virtual ::com::sun::star::uno::Reference<
754 ::com::sun::star::beans::XPropertySet>
755 createAndInsertOLEObject( SvXMLImport& rImport,
756 const ::rtl::OUString& rHRef,
757 const ::rtl::OUString &rStyleName,
758 const ::rtl::OUString &rTblName,
759 sal_Int32 nWidth, sal_Int32 nHeight );
761 virtual ::com::sun::star::uno::Reference<
762 ::com::sun::star::beans::XPropertySet>
763 createAndInsertApplet(
764 const ::rtl::OUString &rName,
765 const ::rtl::OUString &rCode,
766 sal_Bool bMayScript,
767 const ::rtl::OUString& rHRef,
768 sal_Int32 nWidth, sal_Int32 nHeight );
770 virtual ::com::sun::star::uno::Reference<
771 ::com::sun::star::beans::XPropertySet>
772 createAndInsertPlugin(
773 const ::rtl::OUString &rMimeType,
774 const ::rtl::OUString& rHRef,
775 sal_Int32 nWidth, sal_Int32 nHeight );
777 virtual ::com::sun::star::uno::Reference<
778 ::com::sun::star::beans::XPropertySet>
779 createAndInsertFloatingFrame(
780 const ::rtl::OUString &rName,
781 const ::rtl::OUString &rHRef,
782 const ::rtl::OUString &rStyleName,
783 sal_Int32 nWidth, sal_Int32 nHeight );
785 virtual void endAppletOrPlugin(
786 ::com::sun::star::uno::Reference<
787 ::com::sun::star::beans::XPropertySet> &rPropSet,
788 ::std::map < const ::rtl::OUString, ::rtl::OUString, ::comphelper::UStringLess > &rParamMap );
790 // applet helper methods
791 // implemented in sw/filter/xml/txtparai.hxx
793 // redlining helper methods
794 // (to be implemented in sw/filter/xml/txtparai.hxx)
796 virtual void RedlineAdd(
797 const ::rtl::OUString& rType, /// redline type (insert, del,... )
798 const ::rtl::OUString& rId, /// use to identify this redline
799 const ::rtl::OUString& rAuthor, /// name of the author
800 const ::rtl::OUString& rComment, /// redline comment
801 const ::com::sun::star::util::DateTime& rDateTime, /// date+time
802 sal_Bool bMergeLastParagraph); /// merge last paras
803 virtual ::com::sun::star::uno::Reference<
804 ::com::sun::star::text::XTextCursor> RedlineCreateText(
805 ::com::sun::star::uno::Reference< /// needed to get the document
806 ::com::sun::star::text::XTextCursor> & rOldCursor,
807 const ::rtl::OUString& rId); /// ID used to RedlineAdd() call
808 virtual void RedlineSetCursor(
809 const ::rtl::OUString& rId, /// ID used to RedlineAdd() call
810 sal_Bool bStart, /// start or end Cursor
811 sal_Bool bIsOutsideOfParagraph); /// range is not within <text:p>
812 virtual void RedlineAdjustStartNodeCursor(
813 sal_Bool bStart);
814 virtual void SetShowChanges( sal_Bool bShowChanges );
815 virtual void SetRecordChanges( sal_Bool bRecordChanges );
816 virtual void SetChangesProtectionKey(
817 const ::com::sun::star::uno::Sequence<sal_Int8> & rProtectionKey );
819 // access to the last open redline ID:
820 ::rtl::OUString GetOpenRedlineId();
821 void SetOpenRedlineId( ::rtl::OUString& rId);
822 void ResetOpenRedlineId();
824 // #107848#
825 // Access methods to the inside_deleted_section flag (redlining)
826 void SetInsideDeleteContext(sal_Bool bNew) { bInsideDeleteContext = bNew; }
827 sal_Bool IsInsideDeleteContext() const { return bInsideDeleteContext; }
830 inline const SvXMLTokenMap& XMLTextImportHelper::GetTextElemTokenMap()
832 if( !pTextElemTokenMap )
833 pTextElemTokenMap = _GetTextElemTokenMap();
835 return *pTextElemTokenMap;
838 inline const SvXMLTokenMap& XMLTextImportHelper::GetTextPElemTokenMap()
840 if( !pTextPElemTokenMap )
841 pTextPElemTokenMap = _GetTextPElemTokenMap();
843 return *pTextPElemTokenMap;
846 inline const SvXMLTokenMap& XMLTextImportHelper::GetTextPAttrTokenMap()
848 if( !pTextPAttrTokenMap )
849 pTextPAttrTokenMap = _GetTextPAttrTokenMap();
851 return *pTextPAttrTokenMap;
854 inline const SvXMLTokenMap& XMLTextImportHelper::GetTextFrameAttrTokenMap()
856 if( !pTextFrameAttrTokenMap )
857 pTextFrameAttrTokenMap = _GetTextFrameAttrTokenMap();
859 return *pTextFrameAttrTokenMap;
862 inline const SvXMLTokenMap& XMLTextImportHelper::GetTextContourAttrTokenMap()
864 if( !pTextContourAttrTokenMap )
865 pTextContourAttrTokenMap = _GetTextContourAttrTokenMap();
867 return *pTextContourAttrTokenMap;
870 inline const SvXMLTokenMap& XMLTextImportHelper::GetTextHyperlinkAttrTokenMap()
872 if( !pTextHyperlinkAttrTokenMap )
873 pTextHyperlinkAttrTokenMap = _GetTextHyperlinkAttrTokenMap();
875 return *pTextHyperlinkAttrTokenMap;
878 inline const SvXMLTokenMap& XMLTextImportHelper::GetTextMasterPageElemTokenMap()
880 if( !pTextMasterPageElemTokenMap )
881 pTextMasterPageElemTokenMap = _GetTextMasterPageElemTokenMap();
883 return *pTextMasterPageElemTokenMap;
886 }//end of namespace binfilter
887 #endif