1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 #ifndef INCLUDED_XMLOFF_TXTIMP_HXX 20 #define INCLUDED_XMLOFF_TXTIMP_HXX 21 22 #include <sal/config.h> 23 #include <xmloff/dllapi.h> 24 #include <sal/types.h> 25 #include <rtl/ustring.hxx> 26 #include <com/sun/star/uno/Reference.h> 27 #include <com/sun/star/uno/Sequence.hxx> 28 29 #include <map> 30 #include <memory> 31 32 #include <salhelper/simplereferenceobject.hxx> 33 34 class XMLTextListsHelper; 35 class SvXMLImportContext; 36 class SvXMLTokenMap; 37 class SvXMLImportPropertyMapper; 38 class SvXMLImport; 39 class SvXMLStylesContext; 40 class SvxXMLListStyleContext; 41 class XMLPropStyleContext; 42 class SvI18NMap; 43 template<class A> class XMLPropertyBackpatcher; 44 class XMLEventsImportContext; 45 46 namespace xmloff { 47 struct ParsedRDFaAttributes; 48 } 49 50 namespace com { namespace sun { namespace star { 51 namespace text { 52 class XText; 53 class XTextCursor; 54 class XTextRange; 55 class XTextContent; 56 class XFormField; 57 } 58 namespace frame { class XModel; } 59 namespace container { class XNameContainer; class XIndexReplace; } 60 namespace beans { class XPropertySet; } 61 namespace xml { namespace sax { class XAttributeList; } } 62 namespace util { struct DateTime; } 63 } } } 64 65 namespace rtl { template <class reference_type> class Reference; } 66 67 enum SwXMLTextElemTokens 68 { 69 XML_TOK_TEXT_P, 70 XML_TOK_TEXT_H, 71 XML_TOK_TEXT_LIST, 72 XML_TOK_TEXT_FRAME_PAGE, 73 XML_TOK_TABLE_TABLE, 74 XML_TOK_TEXT_VARFIELD_DECLS, 75 XML_TOK_TEXT_USERFIELD_DECLS, 76 XML_TOK_TEXT_SEQUENCE_DECLS, 77 XML_TOK_TEXT_DDE_DECLS, 78 XML_TOK_DRAW_A_PAGE, 79 XML_TOK_TEXT_SECTION, 80 XML_TOK_TEXT_TOC, 81 XML_TOK_TEXT_OBJECT_INDEX, 82 XML_TOK_TEXT_TABLE_INDEX, 83 XML_TOK_TEXT_ILLUSTRATION_INDEX, 84 XML_TOK_TEXT_USER_INDEX, 85 XML_TOK_TEXT_ALPHABETICAL_INDEX, 86 XML_TOK_TEXT_BIBLIOGRAPHY_INDEX, 87 XML_TOK_TEXT_INDEX_TITLE, 88 XML_TOK_TEXT_TRACKED_CHANGES, 89 XML_TOK_TEXT_CHANGE_START, 90 XML_TOK_TEXT_CHANGE_END, 91 XML_TOK_TEXT_CHANGE, 92 XML_TOK_TEXT_FORMS, 93 XML_TOK_TEXT_CALCULATION_SETTINGS, 94 XML_TOK_TEXT_AUTOMARK, 95 XML_TOK_TEXT_NUMBERED_PARAGRAPH 96 }; 97 98 enum XMLTextPElemTokens 99 { 100 XML_TOK_TEXT_SPAN, 101 XML_TOK_TEXT_TAB_STOP, 102 XML_TOK_TEXT_LINE_BREAK, 103 XML_TOK_TEXT_SOFT_PAGE_BREAK, 104 XML_TOK_TEXT_S, 105 XML_TOK_TEXT_FRAME, 106 XML_TOK_TEXT_HYPERLINK, 107 XML_TOK_TEXT_RUBY, 108 109 XML_TOK_TEXT_NOTE, 110 XML_TOK_TEXT_BOOKMARK, 111 XML_TOK_TEXT_BOOKMARK_START, 112 XML_TOK_TEXT_BOOKMARK_END, 113 XML_TOK_TEXT_REFERENCE, 114 XML_TOK_TEXT_REFERENCE_START, 115 XML_TOK_TEXT_REFERENCE_END, 116 117 XML_TOK_TEXT_TOC_MARK, // index marks 118 XML_TOK_TEXT_TOC_MARK_START, 119 XML_TOK_TEXT_TOC_MARK_END, 120 XML_TOK_TEXT_USER_INDEX_MARK, 121 XML_TOK_TEXT_USER_INDEX_MARK_START, 122 XML_TOK_TEXT_USER_INDEX_MARK_END, 123 XML_TOK_TEXT_ALPHA_INDEX_MARK, 124 XML_TOK_TEXT_ALPHA_INDEX_MARK_START, 125 XML_TOK_TEXT_ALPHA_INDEX_MARK_END, 126 127 XML_TOK_TEXT_SENDER_FIRSTNAME, // sender fields 128 XML_TOK_TEXT_SENDER_LASTNAME, 129 XML_TOK_TEXT_SENDER_INITIALS, 130 XML_TOK_TEXT_SENDER_TITLE, 131 XML_TOK_TEXT_SENDER_POSITION, 132 XML_TOK_TEXT_SENDER_EMAIL, 133 XML_TOK_TEXT_SENDER_PHONE_PRIVATE, 134 XML_TOK_TEXT_SENDER_FAX, 135 XML_TOK_TEXT_SENDER_COMPANY, 136 XML_TOK_TEXT_SENDER_PHONE_WORK, 137 XML_TOK_TEXT_SENDER_STREET, 138 XML_TOK_TEXT_SENDER_CITY, 139 XML_TOK_TEXT_SENDER_POSTAL_CODE, 140 XML_TOK_TEXT_SENDER_COUNTRY, 141 XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE, 142 143 XML_TOK_TEXT_AUTHOR_NAME, // author fields 144 XML_TOK_TEXT_AUTHOR_INITIALS, 145 146 XML_TOK_TEXT_DATE, // date & time fields 147 XML_TOK_TEXT_TIME, 148 149 XML_TOK_TEXT_PAGE_NUMBER, // page number fields 150 XML_TOK_TEXT_PAGE_CONTINUATION_STRING, 151 152 XML_TOK_TEXT_VARIABLE_SET, // variable fields 153 XML_TOK_TEXT_VARIABLE_GET, 154 XML_TOK_TEXT_VARIABLE_INPUT, 155 XML_TOK_TEXT_USER_FIELD_GET, 156 XML_TOK_TEXT_USER_FIELD_INPUT, 157 XML_TOK_TEXT_SEQUENCE, 158 XML_TOK_TEXT_EXPRESSION, 159 XML_TOK_TEXT_TEXT_INPUT, 160 161 XML_TOK_TEXT_DATABASE_DISPLAY, // database fields 162 XML_TOK_TEXT_DATABASE_NEXT, 163 XML_TOK_TEXT_DATABASE_SELECT, 164 XML_TOK_TEXT_DATABASE_ROW_NUMBER, 165 XML_TOK_TEXT_DATABASE_NAME, 166 167 XML_TOK_TEXT_DOCUMENT_CREATION_AUTHOR, //document info fields 168 XML_TOK_TEXT_DOCUMENT_CREATION_DATE, 169 XML_TOK_TEXT_DOCUMENT_CREATION_TIME, 170 XML_TOK_TEXT_DOCUMENT_DESCRIPTION, 171 XML_TOK_TEXT_DOCUMENT_PRINT_AUTHOR, 172 XML_TOK_TEXT_DOCUMENT_PRINT_DATE, 173 XML_TOK_TEXT_DOCUMENT_PRINT_TIME, 174 XML_TOK_TEXT_DOCUMENT_TITLE, 175 XML_TOK_TEXT_DOCUMENT_SUBJECT, 176 XML_TOK_TEXT_DOCUMENT_KEYWORDS, 177 XML_TOK_TEXT_DOCUMENT_REVISION, 178 XML_TOK_TEXT_DOCUMENT_EDIT_DURATION, 179 XML_TOK_TEXT_DOCUMENT_SAVE_AUTHOR, 180 XML_TOK_TEXT_DOCUMENT_SAVE_DATE, 181 XML_TOK_TEXT_DOCUMENT_SAVE_TIME, 182 XML_TOK_TEXT_DOCUMENT_USER_DEFINED, 183 184 XML_TOK_TEXT_PLACEHOLDER, // misc. fields 185 XML_TOK_TEXT_CONDITIONAL_TEXT, 186 XML_TOK_TEXT_HIDDEN_TEXT, 187 XML_TOK_TEXT_HIDDEN_PARAGRAPH, 188 XML_TOK_TEXT_FILENAME, 189 XML_TOK_TEXT_CHAPTER, 190 XML_TOK_TEXT_TEMPLATENAME, 191 XML_TOK_TEXT_WORD_COUNT, // statistics/count fields 192 XML_TOK_TEXT_PARAGRAPH_COUNT, 193 XML_TOK_TEXT_TABLE_COUNT, 194 XML_TOK_TEXT_CHARACTER_COUNT, 195 XML_TOK_TEXT_IMAGE_COUNT, 196 XML_TOK_TEXT_OBJECT_COUNT, 197 XML_TOK_TEXT_PAGE_COUNT, 198 XML_TOK_TEXT_GET_PAGE_VAR, 199 XML_TOK_TEXT_SET_PAGE_VAR, 200 XML_TOK_TEXT_MACRO, 201 XML_TOK_TEXT_DDE, 202 XML_TOK_TEXT_REFERENCE_REF, 203 XML_TOK_TEXT_BOOKMARK_REF, 204 XML_TOK_TEXT_SEQUENCE_REF, 205 XML_TOK_TEXT_NOTE_REF, 206 XML_TOK_TEXT_SHEET_NAME, 207 XML_TOK_TEXT_PAGE_NAME, 208 XML_TOK_TEXT_BIBLIOGRAPHY_MARK, 209 XML_TOK_TEXT_ANNOTATION, 210 XML_TOK_TEXT_ANNOTATION_END, 211 XML_TOK_TEXT_NAME, 212 XML_TOK_TEXT_RESOLVED, 213 XML_TOK_TEXT_SCRIPT, 214 XML_TOK_TEXT_TABLE_FORMULA, 215 XML_TOK_TEXT_DROP_DOWN, 216 217 // RDF metadata 218 XML_TOK_TEXT_META, 219 XML_TOK_TEXT_META_FIELD, 220 221 // misc 222 XML_TOK_TEXTP_CHANGE_START, // TEXTP avoids clash with SwXMLTextElemTokens 223 XML_TOK_TEXTP_CHANGE_END, 224 XML_TOK_TEXTP_CHANGE, 225 XML_TOK_DRAW_A, 226 XML_TOK_TEXT_MEASURE, 227 228 XML_TOK_DRAW_HEADER, 229 XML_TOK_DRAW_FOOTER, 230 XML_TOK_DRAW_DATE_TIME, 231 XML_TOK_TEXT_PAGE_CONTINUATION, 232 233 XML_TOK_TEXT_FIELDMARK, 234 XML_TOK_TEXT_FIELDMARK_START, 235 XML_TOK_TEXT_FIELDMARK_END 236 }; 237 238 enum XMLTextPAttrTokens 239 { 240 XML_TOK_TEXT_P_XMLID, 241 XML_TOK_TEXT_P_ABOUT, 242 XML_TOK_TEXT_P_PROPERTY, 243 XML_TOK_TEXT_P_CONTENT, 244 XML_TOK_TEXT_P_DATATYPE, 245 XML_TOK_TEXT_P_TEXTID, 246 XML_TOK_TEXT_P_STYLE_NAME, 247 XML_TOK_TEXT_P_COND_STYLE_NAME, 248 XML_TOK_TEXT_P_LEVEL, 249 XML_TOK_TEXT_P_IS_LIST_HEADER, 250 XML_TOK_TEXT_P_RESTART_NUMBERING, 251 XML_TOK_TEXT_P_START_VALUE 252 }; 253 254 enum XMLTextNumberedParagraphAttrTokens 255 { 256 XML_TOK_TEXT_NUMBERED_PARAGRAPH_XMLID, 257 XML_TOK_TEXT_NUMBERED_PARAGRAPH_LIST_ID, 258 XML_TOK_TEXT_NUMBERED_PARAGRAPH_LEVEL, 259 XML_TOK_TEXT_NUMBERED_PARAGRAPH_STYLE_NAME, 260 XML_TOK_TEXT_NUMBERED_PARAGRAPH_CONTINUE_NUMBERING, 261 XML_TOK_TEXT_NUMBERED_PARAGRAPH_START_VALUE 262 }; 263 264 enum XMLTextListBlockAttrTokens 265 { 266 XML_TOK_TEXT_LIST_BLOCK_XMLID, 267 XML_TOK_TEXT_LIST_BLOCK_STYLE_NAME, 268 XML_TOK_TEXT_LIST_BLOCK_CONTINUE_NUMBERING, 269 XML_TOK_TEXT_LIST_BLOCK_CONTINUE_LIST 270 }; 271 272 enum XMLTextListBlockElemTokens 273 { 274 XML_TOK_TEXT_LIST_HEADER, 275 XML_TOK_TEXT_LIST_ITEM 276 }; 277 278 enum XMLTextFrameAttrTokens 279 { 280 XML_TOK_TEXT_FRAME_STYLE_NAME, 281 XML_TOK_TEXT_FRAME_NAME, 282 XML_TOK_TEXT_FRAME_ANCHOR_TYPE, 283 XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER, 284 XML_TOK_TEXT_FRAME_X, 285 XML_TOK_TEXT_FRAME_Y, 286 XML_TOK_TEXT_FRAME_WIDTH, 287 XML_TOK_TEXT_FRAME_REL_WIDTH, 288 XML_TOK_TEXT_FRAME_HEIGHT, 289 XML_TOK_TEXT_FRAME_MIN_HEIGHT, 290 XML_TOK_TEXT_FRAME_REL_HEIGHT, 291 XML_TOK_TEXT_FRAME_NEXT_CHAIN_NAME, 292 XML_TOK_TEXT_FRAME_HREF, 293 XML_TOK_TEXT_FRAME_FILTER_NAME, 294 XML_TOK_TEXT_FRAME_Z_INDEX, 295 XML_TOK_TEXT_FRAME_TRANSFORM, 296 XML_TOK_TEXT_FRAME_CLASS_ID, 297 XML_TOK_TEXT_FRAME_CODE, 298 XML_TOK_TEXT_FRAME_OBJECT, 299 XML_TOK_TEXT_FRAME_ARCHIVE, 300 XML_TOK_TEXT_FRAME_MAY_SCRIPT, 301 XML_TOK_TEXT_FRAME_MIME_TYPE, 302 XML_TOK_TEXT_FRAME_APPLET_NAME, 303 XML_TOK_TEXT_FRAME_FRAME_NAME, 304 XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE, 305 XML_TOK_TEXT_FRAME_MIN_WIDTH 306 }; 307 308 enum XMLTextHyperlinkAttrTokens 309 { 310 XML_TOK_TEXT_HYPERLINK_HREF, 311 XML_TOK_TEXT_HYPERLINK_NAME, 312 XML_TOK_TEXT_HYPERLINK_TARGET_FRAME, 313 XML_TOK_TEXT_HYPERLINK_SHOW, 314 XML_TOK_TEXT_HYPERLINK_STYLE_NAME, 315 XML_TOK_TEXT_HYPERLINK_VIS_STYLE_NAME, 316 XML_TOK_TEXT_HYPERLINK_SERVER_MAP 317 }; 318 319 enum XMLTextPageMasterElemTokens 320 { 321 XML_TOK_TEXT_MP_HEADER, 322 XML_TOK_TEXT_MP_FOOTER, 323 XML_TOK_TEXT_MP_HEADER_LEFT, 324 XML_TOK_TEXT_MP_FOOTER_LEFT, 325 XML_TOK_TEXT_MP_HEADER_FIRST, 326 XML_TOK_TEXT_MP_FOOTER_FIRST 327 }; 328 329 enum XMLTextContourAttrTokens 330 { 331 XML_TOK_TEXT_CONTOUR_WIDTH, 332 XML_TOK_TEXT_CONTOUR_HEIGHT, 333 XML_TOK_TEXT_CONTOUR_VIEWBOX, 334 XML_TOK_TEXT_CONTOUR_POINTS, 335 XML_TOK_TEXT_CONTOUR_D, 336 XML_TOK_TEXT_CONTOUR_AUTO 337 }; 338 enum XMLTextType 339 { 340 Body, 341 Cell, 342 Shape, 343 TextBox, 344 HeaderFooter, 345 Section, 346 Footnote, 347 ChangedRegion 348 }; 349 350 /// variable type (for XMLSetVarFieldImportContext) 351 enum VarType 352 { 353 VarTypeSimple, 354 VarTypeUserField, 355 VarTypeSequence 356 // see following NOTE! 357 }; 358 359 // NOTE: these values must be distinct from any in "enum VarType" because they 360 // are used as keys to SvI18NMap::Add() 361 #define XML_TEXT_RENAME_TYPE_FRAME 10 362 #define XML_TEXT_RENAME_TYPE_TABLE 20 363 364 class XMLOFF_DLLPUBLIC XMLTextImportHelper : public salhelper::SimpleReferenceObject 365 { 366 private: 367 XMLTextImportHelper(const XMLTextImportHelper&) = delete; 368 XMLTextImportHelper& operator=(const XMLTextImportHelper&) = delete; 369 370 struct Impl; 371 std::unique_ptr<Impl> m_xImpl; 372 /// ugly, but implementation of this is in XMLPropertyBackpatcher.cxx 373 struct BackpatcherImpl; 374 std::shared_ptr<BackpatcherImpl> m_xBackpatcherImpl; 375 static std::shared_ptr<BackpatcherImpl> MakeBackpatcherImpl(); 376 377 protected: 378 virtual SvXMLImportContext *CreateTableChildContext( 379 SvXMLImport& rImport, 380 sal_uInt16 nPrefix, const OUString& rLocalName, 381 const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ); 382 383 // access, lazy initialization and destruction of backpatchers 384 // Code is implemented in XMLPropertyBackpatcher.cxx 385 inline XMLPropertyBackpatcher<sal_Int16>& GetFootnoteBP(); 386 inline XMLPropertyBackpatcher<sal_Int16>& GetSequenceIdBP(); 387 inline XMLPropertyBackpatcher< OUString> & GetSequenceNameBP(); 388 389 public: 390 391 XMLTextImportHelper( 392 css::uno::Reference< css::frame::XModel > const& rModel, 393 SvXMLImport& rImport, 394 bool const bInsertMode = false, bool const bStylesOnlyMode = false, 395 bool const bProgress = false, bool const bBlockMode = false, 396 bool const bOrganizerMode = false); 397 398 virtual ~XMLTextImportHelper() override; 399 400 void SetCursor( 401 const css::uno::Reference< css::text::XTextCursor >& rCursor ); 402 void ResetCursor(); 403 404 void SetAutoStyles( SvXMLStylesContext *pStyles ); 405 406 SvXMLImportContext *CreateTextChildContext( 407 SvXMLImport& rImport, 408 sal_uInt16 nPrefix, const OUString& rLocalName, 409 const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList, 410 XMLTextType eType = XMLTextType::Shape ); 411 412 SvXMLTokenMap const& GetTextElemTokenMap(); 413 SvXMLTokenMap const& GetTextPElemTokenMap(); 414 SvXMLTokenMap const& GetTextPAttrTokenMap(); 415 SvXMLTokenMap const& GetTextFrameAttrTokenMap(); 416 SvXMLTokenMap const& GetTextContourAttrTokenMap(); 417 SvXMLTokenMap const& GetTextHyperlinkAttrTokenMap(); 418 SvXMLTokenMap const& GetTextMasterPageElemTokenMap(); 419 420 const SvXMLTokenMap& GetTextNumberedParagraphAttrTokenMap(); 421 const SvXMLTokenMap& GetTextListBlockAttrTokenMap(); 422 const SvXMLTokenMap& GetTextListBlockElemTokenMap(); 423 const SvXMLTokenMap& GetTextFieldAttrTokenMap(); // impl: txtfldi.cxx 424 425 css::uno::Reference< css::text::XText > & GetText(); 426 css::uno::Reference< css::text::XTextCursor > & GetCursor(); 427 css::uno::Reference< css::text::XTextRange > & GetCursorAsRange(); 428 429 bool IsInsertMode() const; 430 bool IsStylesOnlyMode() const; 431 bool IsBlockMode() const; 432 bool IsOrganizerMode() const; 433 bool IsProgress() const; 434 435 OUString ConvertStarFonts( const OUString& rChars, 436 const OUString& rStyleName, 437 sal_uInt8& rFlags, 438 bool bPara, 439 SvXMLImport& rImport ) const; 440 // insert a string without special whitespace processing enabled 441 void InsertString( const OUString& rChars ); 442 // insert a string with special whitespace processing enabled 443 void InsertString( const OUString& rChars, 444 bool& rIgnoreLeadingSpace ); 445 // Delete current paragraph 446 void DeleteParagraph(); 447 448 void InsertControlCharacter( sal_Int16 nControl ); 449 void InsertTextContent( css::uno::Reference< css::text::XTextContent > const & xContent); 450 451 // Add parameter <bOutlineLevelAttrFound> (#i73509#) 452 // Add parameter <bSetListAttrs> in order to suppress the handling of the list attributes (#i80724#) 453 OUString SetStyleAndAttrs( 454 SvXMLImport const & rImport, 455 const css::uno::Reference< css::text::XTextCursor >& rCursor, 456 const OUString& rStyleName, 457 bool bPara, 458 bool bOutlineLevelAttrFound = false, 459 sal_Int8 nOutlineLevel = -1, 460 bool bSetListAttrs = true ); 461 462 /** Find a suitable name for the given outline level. 463 * If rStyleName is empty, change it to a previously used or default style 464 * name for that level. Otherwise, leave rStyleName unmodified. 465 */ 466 // Adjust 2nd parameter (#i69629#) 467 void FindOutlineStyleName( OUString& rStyleName, 468 sal_Int8 nOutlineLevel ); 469 470 // Change method name to reflect change of data structure (#i69629#) 471 void AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel, 472 const OUString& rStyleName ); 473 474 void SetOutlineStyles( bool bSetEmpty ); 475 476 void SetHyperlink( 477 SvXMLImport const & rImport, 478 const css::uno::Reference< css::text::XTextCursor >& rCursor, 479 const OUString& rHRef, 480 const OUString& rName, 481 const OUString& rTargetFrameName, 482 const OUString& rStyleName, 483 const OUString& rVisitedStyleName, 484 XMLEventsImportContext* pEvents); 485 void SetRuby( 486 SvXMLImport const & rImport, 487 const css::uno::Reference< css::text::XTextCursor >& rCursor, 488 const OUString& rStyleName, 489 const OUString& rTextStyleName, 490 const OUString& rText ); 491 492 /// return key appropriate for use with NumberFormat property 493 /// return -1 if style is not found 494 /// (may return whether data style uses the system language) 495 sal_Int32 GetDataStyleKey( const OUString& sStyleName, 496 bool* pIsSystemLanguage = nullptr ); 497 498 const SvxXMLListStyleContext *FindAutoListStyle( 499 const OUString& rName ) const; 500 XMLPropStyleContext *FindAutoFrameStyle( 501 const OUString& rName ) const; 502 XMLPropStyleContext* FindSectionStyle( 503 const OUString& rName ) const; 504 XMLPropStyleContext* FindPageMaster( 505 const OUString& rName ) const; 506 XMLPropStyleContext* FindDrawingPage(OUString const& rName) const; 507 508 const css::uno::Reference< css::container::XNameContainer> & GetParaStyles() const; 509 510 const css::uno::Reference< css::container::XNameContainer> & GetTextStyles() const; 511 512 const css::uno::Reference< css::container::XNameContainer> & 513 GetNumberingStyles() const; 514 515 const css::uno::Reference< css::container::XNameContainer> & GetFrameStyles() const; 516 517 const css::uno::Reference< css::container::XNameContainer> & GetPageStyles() const; 518 519 const css::uno::Reference< css::container::XNameContainer> & GetCellStyles() const; 520 521 const css::uno::Reference< css::container::XIndexReplace > & 522 GetChapterNumbering() const; 523 524 bool HasFrameByName( const OUString& rName ) const; 525 526 bool IsDuplicateFrame(const OUString& sName, sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight) const; 527 void StoreLastImportedFrameName(const OUString& rName); 528 void ClearLastImportedTextFrameName(); 529 530 void ConnectFrameChains( const OUString& rFrmName, 531 const OUString& rNextFrmName, 532 const css::uno::Reference< css::beans::XPropertySet >& rFrmPropSet ); 533 534 rtl::Reference< SvXMLImportPropertyMapper > const& 535 GetParaImportPropertySetMapper() const; 536 rtl::Reference< SvXMLImportPropertyMapper > const& 537 GetTextImportPropertySetMapper() const; 538 rtl::Reference< SvXMLImportPropertyMapper > const& 539 GetSectionImportPropertySetMapper() const; 540 rtl::Reference< SvXMLImportPropertyMapper > const& 541 GetRubyImportPropertySetMapper() const; 542 543 static SvXMLImportPropertyMapper *CreateShapeExtPropMapper(SvXMLImport&); 544 static SvXMLImportPropertyMapper *CreateParaExtPropMapper(SvXMLImport&); 545 static SvXMLImportPropertyMapper* CreateParaDefaultExtPropMapper(SvXMLImport&); 546 static SvXMLImportPropertyMapper* CreateTableDefaultExtPropMapper(SvXMLImport&); 547 static SvXMLImportPropertyMapper* CreateTableRowDefaultExtPropMapper(SvXMLImport&); 548 static SvXMLImportPropertyMapper* CreateTableCellExtPropMapper(SvXMLImport&); 549 static SvXMLImportPropertyMapper* CreateDrawingPageExtPropMapper(SvXMLImport&); 550 551 SvI18NMap& GetRenameMap(); 552 553 /// save the start of a range reference 554 void InsertBookmarkStartRange( 555 const OUString & sName, 556 const css::uno::Reference< css::text::XTextRange> & rRange, 557 OUString const& i_rXmlId, 558 std::shared_ptr< ::xmloff::ParsedRDFaAttributes > & 559 i_rpRDFaAttributes); 560 561 /// process the start of a range reference 562 bool FindAndRemoveBookmarkStartRange( 563 const OUString & sName, 564 css::uno::Reference< css::text::XTextRange> & o_rRange, 565 OUString & o_rXmlId, 566 std::shared_ptr< ::xmloff::ParsedRDFaAttributes > & o_rpRDFaAttributes); 567 568 OUString FindActiveBookmarkName(); 569 570 void pushFieldCtx( const OUString& name, const OUString& type ); 571 css::uno::Reference<css::text::XFormField> popFieldCtx(); 572 void addFieldParam( const OUString& name, const OUString& value ); 573 void setCurrentFieldParamsTo(css::uno::Reference< css::text::XFormField> const &xFormField); 574 OUString getCurrentFieldType(); 575 bool hasCurrentFieldCtx() const; 576 577 578 /// insert new footnote ID. 579 /// Also fixup open references from the backpatch list to this ID. 580 // Code is implemented in XMLPropertyBackpatcher.cxx 581 void InsertFootnoteID(const OUString& sXMLId, sal_Int16 nAPIId); 582 583 /// set the proper footnote reference ID, 584 /// or put into backpatch list if ID is unknown 585 // Code is implemented in XMLPropertyBackpatcher.cxx 586 void ProcessFootnoteReference( 587 const OUString& sXMLId, 588 const css::uno::Reference< css::beans::XPropertySet> & xPropSet); 589 590 /// insert new sequence ID 591 /// Also fixup open references from backpatch list to this ID. 592 // Code is implemented in XMLPropertyBackpatcher.cxx 593 void InsertSequenceID(const OUString& sXMLId, 594 const OUString& sName, 595 sal_Int16 nAPIId); 596 597 /// set sequence ID or insert into backpatch list 598 // Code is implemented in XMLPropertyBackpatcher.cxx 599 void ProcessSequenceReference( 600 const OUString& sXMLId, 601 const css::uno::Reference< css::beans::XPropertySet> & xPropSet); 602 603 bool IsInFrame() const; 604 virtual bool IsInHeaderFooter() const; 605 606 virtual css::uno::Reference< css::beans::XPropertySet> 607 createAndInsertOLEObject( SvXMLImport& rImport, 608 const OUString& rHRef, 609 const OUString &rStyleName, 610 const OUString &rTblName, 611 sal_Int32 nWidth, sal_Int32 nHeight ); 612 613 virtual css::uno::Reference< css::beans::XPropertySet> 614 createAndInsertOOoLink( SvXMLImport& rImport, 615 const OUString& rHRef, 616 const OUString &rStyleName, 617 const OUString &rTblName, 618 sal_Int32 nWidth, sal_Int32 nHeight ); 619 620 virtual css::uno::Reference< css::beans::XPropertySet> 621 createAndInsertApplet( 622 const OUString &rName, 623 const OUString &rCode, 624 bool bMayScript, 625 const OUString& rHRef, 626 sal_Int32 nWidth, sal_Int32 nHeight ); 627 628 virtual css::uno::Reference< css::beans::XPropertySet> 629 createAndInsertPlugin( 630 const OUString &rMimeType, 631 const OUString& rHRef, 632 sal_Int32 nWidth, sal_Int32 nHeight ); 633 634 virtual css::uno::Reference< css::beans::XPropertySet> 635 createAndInsertFloatingFrame( 636 const OUString &rName, 637 const OUString &rHRef, 638 const OUString &rStyleName, 639 sal_Int32 nWidth, sal_Int32 nHeight ); 640 641 virtual void endAppletOrPlugin( 642 const css::uno::Reference< css::beans::XPropertySet> &rPropSet, 643 ::std::map < const OUString, OUString > &rParamMap ); 644 645 // applet helper methods 646 // implemented in sw/filter/xml/txtparai.hxx 647 648 // redlining helper methods 649 // (to be implemented in sw/filter/xml/txtparai.hxx) 650 651 virtual void RedlineAdd( 652 /// redline type (insert, del,... ) 653 const OUString& rType, 654 /// use to identify this redline 655 const OUString& rId, 656 /// name of the author 657 const OUString& rAuthor, 658 /// redline comment 659 const OUString& rComment, 660 /// date+time 661 const css::util::DateTime& rDateTime, 662 /// merge last paras 663 bool bMergeLastParagraph); 664 665 virtual css::uno::Reference< css::text::XTextCursor> RedlineCreateText( 666 /// needed to get the document 667 css::uno::Reference< css::text::XTextCursor > & rOldCursor, 668 /// ID used to RedlineAdd() call 669 const OUString& rId); 670 671 virtual void RedlineSetCursor( 672 /// ID used to RedlineAdd() call 673 const OUString& rId, 674 /// start or end Cursor 675 bool bStart, 676 /// range is not within <text:p> 677 bool bIsOutsideOfParagraph); 678 679 virtual void RedlineAdjustStartNodeCursor(); 680 virtual void SetShowChanges( bool bShowChanges ); 681 virtual void SetRecordChanges( bool bRecordChanges ); 682 virtual void SetChangesProtectionKey( 683 const css::uno::Sequence<sal_Int8> & rProtectionKey ); 684 685 /// get the last open redline ID 686 OUString const & GetOpenRedlineId() const; 687 /// modify the last open redline ID 688 void SetOpenRedlineId( OUString const & rId); 689 /// reset the last open redline ID 690 void ResetOpenRedlineId(); 691 692 /** redlining : Setter to remember the fact we are inside/outside 693 * a <text:deletion> element (deleted redline section) */ 694 void SetInsideDeleteContext(bool const bNew); 695 /** redlining : Getter to know if we are inside 696 * a <text:deletion> element (deleted redline section) */ 697 bool IsInsideDeleteContext() const; 698 699 SvXMLImport & GetXMLImport(); 700 701 XMLTextListsHelper & GetTextListHelper(); 702 703 // forwards to TextListHelper; these are used in many places 704 /// push a list context on the list context stack 705 void PushListContext(); 706 /// pop the list context stack 707 void PopListContext(); 708 709 void SetCellParaStyleDefault(OUString const& rNewValue); 710 OUString const& GetCellParaStyleDefault() const; 711 712 void AddCrossRefHeadingMapping(OUString const& rFrom, OUString const& rTo); 713 void MapCrossRefHeadingFieldsHorribly(); 714 715 void setBookmarkAttributes(OUString const& bookmark, bool hidden, OUString const& condition); 716 bool getBookmarkHidden(OUString const& bookmark) const; 717 const OUString& getBookmarkCondition(OUString const& bookmark) const; 718 719 }; 720 721 #endif 722 723 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 724