LCOV - code coverage report
Current view: top level - xmloff/source/text - txtimp.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1019 0.0 %
Date: 2014-04-14 Functions: 0 104 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      20             : 
      21             : #include <vector>
      22             : 
      23             : #include <boost/scoped_array.hpp>
      24             : 
      25             : #include <com/sun/star/container/XEnumerationAccess.hpp>
      26             : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      27             : #include <com/sun/star/text/XChapterNumberingSupplier.hpp>
      28             : #include <com/sun/star/text/XTextFramesSupplier.hpp>
      29             : #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
      30             : #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
      31             : #include <com/sun/star/text/XFormField.hpp>
      32             : #include <com/sun/star/ucb/XAnyCompareFactory.hpp>
      33             : #include <xmloff/xmlnmspe.hxx>
      34             : #include <xmloff/txtstyli.hxx>
      35             : #include <xmloff/xmlnumi.hxx>
      36             : 
      37             : #include "txtparai.hxx"
      38             : #include <xmloff/txtprmap.hxx>
      39             : #include <xmloff/txtimppr.hxx>
      40             : #include <xmloff/xmlimp.hxx>
      41             : #include "txtvfldi.hxx"
      42             : #include <xmloff/i18nmap.hxx>
      43             : #include "XMLTextListItemContext.hxx"
      44             : #include "XMLTextListBlockContext.hxx"
      45             : #include "XMLTextFrameContext.hxx"
      46             : #include "XMLTextFrameHyperlinkContext.hxx"
      47             : #include "XMLSectionImportContext.hxx"
      48             : #include "XMLIndexTOCContext.hxx"
      49             : #include <xmloff/XMLFontStylesContext.hxx>
      50             : #include <xmloff/XMLEventsImportContext.hxx>
      51             : #include "XMLTrackedChangesImportContext.hxx"
      52             : #include "XMLChangeImportContext.hxx"
      53             : #include "XMLAutoMarkFileContext.hxx"
      54             : 
      55             : #include "XMLCalculationSettingsContext.hxx"
      56             : #include "XMLNumberStylesImport.hxx"
      57             : // XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#)
      58             : #include <com/sun/star/beans/XPropertyState.hpp>
      59             : #include <txtlists.hxx>
      60             : #include <xmloff/odffields.hxx>
      61             : 
      62             : using ::com::sun::star::ucb::XAnyCompare;
      63             : 
      64             : using namespace ::std;
      65             : using namespace ::com::sun::star;
      66             : using namespace ::com::sun::star::uno;
      67             : using namespace ::com::sun::star::beans;
      68             : using namespace ::com::sun::star::text;
      69             : using namespace ::com::sun::star::frame;
      70             : using namespace ::com::sun::star::style;
      71             : using namespace ::com::sun::star::container;
      72             : using namespace ::com::sun::star::drawing;
      73             : using namespace ::com::sun::star::xml::sax;
      74             : using namespace ::com::sun::star::lang;
      75             : using namespace ::xmloff::token;
      76             : using namespace ::com::sun::star::ucb;
      77             : 
      78             : static const SvXMLTokenMapEntry aTextElemTokenMap[] =
      79             : {
      80             :     { XML_NAMESPACE_TEXT, XML_P,                XML_TOK_TEXT_P              },
      81             :     { XML_NAMESPACE_TEXT, XML_H,                XML_TOK_TEXT_H              },
      82             :     { XML_NAMESPACE_TEXT, XML_LIST,             XML_TOK_TEXT_LIST           },
      83             :     { XML_NAMESPACE_DRAW, XML_FRAME,            XML_TOK_TEXT_FRAME_PAGE     },
      84             :     { XML_NAMESPACE_DRAW, XML_A,                XML_TOK_DRAW_A_PAGE },
      85             :     { XML_NAMESPACE_TABLE,XML_TABLE,            XML_TOK_TABLE_TABLE         },
      86             :     { XML_NAMESPACE_TEXT, XML_VARIABLE_DECLS,   XML_TOK_TEXT_VARFIELD_DECLS },
      87             :     { XML_NAMESPACE_TEXT, XML_USER_FIELD_DECLS, XML_TOK_TEXT_USERFIELD_DECLS },
      88             :     { XML_NAMESPACE_TEXT, XML_SEQUENCE_DECLS,   XML_TOK_TEXT_SEQUENCE_DECLS },
      89             :     { XML_NAMESPACE_TEXT, XML_DDE_CONNECTION_DECLS, XML_TOK_TEXT_DDE_DECLS },
      90             :     { XML_NAMESPACE_TEXT, XML_SECTION,          XML_TOK_TEXT_SECTION },
      91             :     { XML_NAMESPACE_TEXT, XML_TABLE_OF_CONTENT, XML_TOK_TEXT_TOC },
      92             :     { XML_NAMESPACE_TEXT, XML_OBJECT_INDEX,     XML_TOK_TEXT_OBJECT_INDEX },
      93             :     { XML_NAMESPACE_TEXT, XML_TABLE_INDEX,      XML_TOK_TEXT_TABLE_INDEX },
      94             :     { XML_NAMESPACE_TEXT, XML_ILLUSTRATION_INDEX, XML_TOK_TEXT_ILLUSTRATION_INDEX },
      95             :     { XML_NAMESPACE_TEXT, XML_USER_INDEX,       XML_TOK_TEXT_USER_INDEX },
      96             :     { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX, XML_TOK_TEXT_ALPHABETICAL_INDEX },
      97             :     { XML_NAMESPACE_TEXT, XML_BIBLIOGRAPHY,     XML_TOK_TEXT_BIBLIOGRAPHY_INDEX },
      98             :     { XML_NAMESPACE_TEXT, XML_INDEX_TITLE,      XML_TOK_TEXT_INDEX_TITLE },
      99             :     { XML_NAMESPACE_TEXT, XML_TRACKED_CHANGES,  XML_TOK_TEXT_TRACKED_CHANGES },
     100             :     { XML_NAMESPACE_TEXT, XML_CHANGE_START,     XML_TOK_TEXT_CHANGE_START },
     101             :     { XML_NAMESPACE_TEXT, XML_CHANGE_END,       XML_TOK_TEXT_CHANGE_END },
     102             :     { XML_NAMESPACE_TEXT, XML_CHANGE,           XML_TOK_TEXT_CHANGE },
     103             :     { XML_NAMESPACE_OFFICE, XML_FORMS,          XML_TOK_TEXT_FORMS },
     104             :     { XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS,    XML_TOK_TEXT_CALCULATION_SETTINGS },
     105             :     { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE, XML_TOK_TEXT_AUTOMARK },
     106             :     // #i52127#
     107             :     { XML_NAMESPACE_TEXT, XML_NUMBERED_PARAGRAPH, XML_TOK_TEXT_NUMBERED_PARAGRAPH   },
     108             : 
     109             :     XML_TOKEN_MAP_END
     110             : };
     111             : 
     112             : static const SvXMLTokenMapEntry aTextPElemTokenMap[] =
     113             : {
     114             :     { XML_NAMESPACE_TEXT, XML_SPAN, XML_TOK_TEXT_SPAN },
     115             :     { XML_NAMESPACE_TEXT, XML_TAB, XML_TOK_TEXT_TAB_STOP },
     116             :     { XML_NAMESPACE_TEXT, XML_LINE_BREAK, XML_TOK_TEXT_LINE_BREAK },
     117             :     { XML_NAMESPACE_TEXT, XML_SOFT_PAGE_BREAK, XML_TOK_TEXT_SOFT_PAGE_BREAK },
     118             :     { XML_NAMESPACE_TEXT, XML_S, XML_TOK_TEXT_S },
     119             :     { XML_NAMESPACE_TEXT, XML_A, XML_TOK_TEXT_HYPERLINK },
     120             :     { XML_NAMESPACE_TEXT, XML_RUBY, XML_TOK_TEXT_RUBY },
     121             : 
     122             :     { XML_NAMESPACE_TEXT, XML_NOTE, XML_TOK_TEXT_NOTE },
     123             :     { XML_NAMESPACE_TEXT, XML_BOOKMARK, XML_TOK_TEXT_BOOKMARK },
     124             :     { XML_NAMESPACE_TEXT, XML_BOOKMARK_START, XML_TOK_TEXT_BOOKMARK_START },
     125             :     { XML_NAMESPACE_TEXT, XML_BOOKMARK_END, XML_TOK_TEXT_BOOKMARK_END },
     126             :     { XML_NAMESPACE_TEXT, XML_REFERENCE_MARK, XML_TOK_TEXT_REFERENCE },
     127             :     { XML_NAMESPACE_TEXT, XML_REFERENCE_MARK_START,
     128             :       XML_TOK_TEXT_REFERENCE_START },
     129             :     { XML_NAMESPACE_TEXT, XML_REFERENCE_MARK_END,
     130             :       XML_TOK_TEXT_REFERENCE_END },
     131             : 
     132             :     { XML_NAMESPACE_DRAW, XML_FRAME, XML_TOK_TEXT_FRAME },
     133             :     { XML_NAMESPACE_DRAW, XML_A,                XML_TOK_DRAW_A },
     134             : 
     135             :     // index marks
     136             :     { XML_NAMESPACE_TEXT, XML_TOC_MARK, XML_TOK_TEXT_TOC_MARK },
     137             :     { XML_NAMESPACE_TEXT, XML_TOC_MARK_START, XML_TOK_TEXT_TOC_MARK_START },
     138             :     { XML_NAMESPACE_TEXT, XML_TOC_MARK_END, XML_TOK_TEXT_TOC_MARK_END },
     139             :     { XML_NAMESPACE_TEXT, XML_USER_INDEX_MARK, XML_TOK_TEXT_USER_INDEX_MARK },
     140             :     { XML_NAMESPACE_TEXT, XML_USER_INDEX_MARK_START,
     141             :       XML_TOK_TEXT_USER_INDEX_MARK_START },
     142             :     { XML_NAMESPACE_TEXT, XML_USER_INDEX_MARK_END,
     143             :       XML_TOK_TEXT_USER_INDEX_MARK_END },
     144             :     { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX_MARK,
     145             :       XML_TOK_TEXT_ALPHA_INDEX_MARK },
     146             :     { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX_MARK_START,
     147             :       XML_TOK_TEXT_ALPHA_INDEX_MARK_START },
     148             :     { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX_MARK_END,
     149             :       XML_TOK_TEXT_ALPHA_INDEX_MARK_END },
     150             : 
     151             :     // sender fields
     152             :     { XML_NAMESPACE_TEXT, XML_SENDER_FIRSTNAME,XML_TOK_TEXT_SENDER_FIRSTNAME},
     153             :     { XML_NAMESPACE_TEXT, XML_SENDER_LASTNAME, XML_TOK_TEXT_SENDER_LASTNAME },
     154             :     { XML_NAMESPACE_LO_EXT, XML_SENDER_INITIALS, XML_TOK_TEXT_SENDER_INITIALS },
     155             :     { XML_NAMESPACE_TEXT,   XML_SENDER_INITIALS, XML_TOK_TEXT_SENDER_INITIALS },
     156             :     { XML_NAMESPACE_TEXT, XML_SENDER_TITLE, XML_TOK_TEXT_SENDER_TITLE },
     157             :     { XML_NAMESPACE_TEXT, XML_SENDER_POSITION, XML_TOK_TEXT_SENDER_POSITION },
     158             :     { XML_NAMESPACE_TEXT, XML_SENDER_EMAIL, XML_TOK_TEXT_SENDER_EMAIL },
     159             :     { XML_NAMESPACE_TEXT, XML_SENDER_PHONE_PRIVATE,
     160             :       XML_TOK_TEXT_SENDER_PHONE_PRIVATE },
     161             :     { XML_NAMESPACE_TEXT, XML_SENDER_FAX, XML_TOK_TEXT_SENDER_FAX },
     162             :     { XML_NAMESPACE_TEXT, XML_SENDER_COMPANY, XML_TOK_TEXT_SENDER_COMPANY },
     163             :     { XML_NAMESPACE_TEXT, XML_SENDER_PHONE_WORK,
     164             :       XML_TOK_TEXT_SENDER_PHONE_WORK },
     165             :     { XML_NAMESPACE_TEXT, XML_SENDER_STREET, XML_TOK_TEXT_SENDER_STREET },
     166             :     { XML_NAMESPACE_TEXT, XML_SENDER_CITY, XML_TOK_TEXT_SENDER_CITY },
     167             :     { XML_NAMESPACE_TEXT, XML_SENDER_POSTAL_CODE,
     168             :       XML_TOK_TEXT_SENDER_POSTAL_CODE },
     169             :     { XML_NAMESPACE_TEXT, XML_SENDER_COUNTRY, XML_TOK_TEXT_SENDER_COUNTRY },
     170             :     { XML_NAMESPACE_TEXT, XML_SENDER_STATE_OR_PROVINCE,
     171             :       XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE },
     172             : 
     173             :     // misc. document fields
     174             :     { XML_NAMESPACE_TEXT, XML_AUTHOR_NAME, XML_TOK_TEXT_AUTHOR_NAME },
     175             :     { XML_NAMESPACE_TEXT, XML_AUTHOR_INITIALS, XML_TOK_TEXT_AUTHOR_INITIALS },
     176             :     { XML_NAMESPACE_TEXT, XML_DATE, XML_TOK_TEXT_DATE },
     177             :     { XML_NAMESPACE_TEXT, XML_TIME, XML_TOK_TEXT_TIME },
     178             :     { XML_NAMESPACE_TEXT, XML_PAGE_NUMBER, XML_TOK_TEXT_PAGE_NUMBER },
     179             :     { XML_NAMESPACE_TEXT, XML_PAGE_CONTINUATION_STRING,
     180             :       XML_TOK_TEXT_PAGE_CONTINUATION_STRING },
     181             : 
     182             :     // variable fields
     183             :     { XML_NAMESPACE_TEXT, XML_VARIABLE_SET, XML_TOK_TEXT_VARIABLE_SET },
     184             :     { XML_NAMESPACE_TEXT, XML_VARIABLE_GET, XML_TOK_TEXT_VARIABLE_GET },
     185             :     { XML_NAMESPACE_TEXT, XML_VARIABLE_INPUT, XML_TOK_TEXT_VARIABLE_INPUT },
     186             :     { XML_NAMESPACE_TEXT, XML_USER_FIELD_GET, XML_TOK_TEXT_USER_FIELD_GET },
     187             :     { XML_NAMESPACE_TEXT, XML_USER_FIELD_INPUT,XML_TOK_TEXT_USER_FIELD_INPUT},
     188             :     { XML_NAMESPACE_TEXT, XML_SEQUENCE, XML_TOK_TEXT_SEQUENCE },
     189             :     { XML_NAMESPACE_TEXT, XML_EXPRESSION, XML_TOK_TEXT_EXPRESSION },
     190             :     { XML_NAMESPACE_TEXT, XML_TEXT_INPUT, XML_TOK_TEXT_TEXT_INPUT },
     191             : 
     192             :     // database fields
     193             :     { XML_NAMESPACE_TEXT, XML_DATABASE_DISPLAY,
     194             :       XML_TOK_TEXT_DATABASE_DISPLAY },
     195             :     { XML_NAMESPACE_TEXT, XML_DATABASE_NEXT,
     196             :       XML_TOK_TEXT_DATABASE_NEXT },
     197             :     { XML_NAMESPACE_TEXT, XML_DATABASE_ROW_SELECT,
     198             :       XML_TOK_TEXT_DATABASE_SELECT },
     199             :     { XML_NAMESPACE_TEXT, XML_DATABASE_ROW_NUMBER,
     200             :       XML_TOK_TEXT_DATABASE_ROW_NUMBER },
     201             :     { XML_NAMESPACE_TEXT, XML_DATABASE_NAME, XML_TOK_TEXT_DATABASE_NAME },
     202             : 
     203             :     // docinfo fields
     204             :     { XML_NAMESPACE_TEXT, XML_INITIAL_CREATOR,
     205             :       XML_TOK_TEXT_DOCUMENT_CREATION_AUTHOR },
     206             :     { XML_NAMESPACE_TEXT, XML_DESCRIPTION, XML_TOK_TEXT_DOCUMENT_DESCRIPTION},
     207             :     { XML_NAMESPACE_TEXT, XML_PRINTED_BY, XML_TOK_TEXT_DOCUMENT_PRINT_AUTHOR},
     208             :     { XML_NAMESPACE_TEXT, XML_TITLE, XML_TOK_TEXT_DOCUMENT_TITLE },
     209             :     { XML_NAMESPACE_TEXT, XML_SUBJECT, XML_TOK_TEXT_DOCUMENT_SUBJECT },
     210             :     { XML_NAMESPACE_TEXT, XML_KEYWORDS, XML_TOK_TEXT_DOCUMENT_KEYWORDS },
     211             :     { XML_NAMESPACE_TEXT, XML_CREATOR, XML_TOK_TEXT_DOCUMENT_SAVE_AUTHOR },
     212             :     { XML_NAMESPACE_TEXT, XML_EDITING_CYCLES,
     213             :       XML_TOK_TEXT_DOCUMENT_REVISION },
     214             :     { XML_NAMESPACE_TEXT, XML_CREATION_DATE,
     215             :       XML_TOK_TEXT_DOCUMENT_CREATION_DATE },
     216             :     { XML_NAMESPACE_TEXT, XML_CREATION_TIME,
     217             :       XML_TOK_TEXT_DOCUMENT_CREATION_TIME },
     218             :     { XML_NAMESPACE_TEXT, XML_PRINT_DATE, XML_TOK_TEXT_DOCUMENT_PRINT_DATE },
     219             :     { XML_NAMESPACE_TEXT, XML_PRINT_TIME, XML_TOK_TEXT_DOCUMENT_PRINT_TIME },
     220             :     { XML_NAMESPACE_TEXT, XML_MODIFICATION_DATE,
     221             :       XML_TOK_TEXT_DOCUMENT_SAVE_DATE },
     222             :     { XML_NAMESPACE_TEXT, XML_MODIFICATION_TIME,
     223             :       XML_TOK_TEXT_DOCUMENT_SAVE_TIME },
     224             :     { XML_NAMESPACE_TEXT, XML_EDITING_DURATION,
     225             :       XML_TOK_TEXT_DOCUMENT_EDIT_DURATION },
     226             :     { XML_NAMESPACE_TEXT, XML_USER_DEFINED,
     227             :       XML_TOK_TEXT_DOCUMENT_USER_DEFINED },
     228             : 
     229             :     // misc fields
     230             :     { XML_NAMESPACE_TEXT, XML_PLACEHOLDER, XML_TOK_TEXT_PLACEHOLDER },
     231             :     { XML_NAMESPACE_TEXT, XML_HIDDEN_TEXT, XML_TOK_TEXT_HIDDEN_TEXT },
     232             :     { XML_NAMESPACE_TEXT, XML_HIDDEN_PARAGRAPH,
     233             :       XML_TOK_TEXT_HIDDEN_PARAGRAPH },
     234             :     { XML_NAMESPACE_TEXT, XML_CONDITIONAL_TEXT,
     235             :       XML_TOK_TEXT_CONDITIONAL_TEXT },
     236             :     { XML_NAMESPACE_TEXT, XML_FILE_NAME, XML_TOK_TEXT_FILENAME },
     237             :     { XML_NAMESPACE_TEXT, XML_CHAPTER,  XML_TOK_TEXT_CHAPTER },
     238             :     { XML_NAMESPACE_TEXT, XML_TEMPLATE_NAME, XML_TOK_TEXT_TEMPLATENAME },
     239             :     { XML_NAMESPACE_TEXT, XML_PARAGRAPH_COUNT, XML_TOK_TEXT_PARAGRAPH_COUNT },
     240             :     { XML_NAMESPACE_TEXT, XML_WORD_COUNT, XML_TOK_TEXT_WORD_COUNT },
     241             :     { XML_NAMESPACE_TEXT, XML_TABLE_COUNT, XML_TOK_TEXT_TABLE_COUNT },
     242             :     { XML_NAMESPACE_TEXT, XML_CHARACTER_COUNT, XML_TOK_TEXT_CHARACTER_COUNT },
     243             :     { XML_NAMESPACE_TEXT, XML_IMAGE_COUNT, XML_TOK_TEXT_IMAGE_COUNT },
     244             :     { XML_NAMESPACE_TEXT, XML_OBJECT_COUNT, XML_TOK_TEXT_OBJECT_COUNT },
     245             :     { XML_NAMESPACE_TEXT, XML_PAGE_COUNT, XML_TOK_TEXT_PAGE_COUNT },
     246             :     { XML_NAMESPACE_TEXT, XML_PAGE_VARIABLE_GET, XML_TOK_TEXT_GET_PAGE_VAR },
     247             :     { XML_NAMESPACE_TEXT, XML_PAGE_VARIABLE_SET, XML_TOK_TEXT_SET_PAGE_VAR },
     248             :     { XML_NAMESPACE_TEXT, XML_EXECUTE_MACRO, XML_TOK_TEXT_MACRO },
     249             :     { XML_NAMESPACE_TEXT, XML_DDE_CONNECTION, XML_TOK_TEXT_DDE },
     250             :     { XML_NAMESPACE_TEXT, XML_REFERENCE_REF, XML_TOK_TEXT_REFERENCE_REF },
     251             :     { XML_NAMESPACE_TEXT, XML_BOOKMARK_REF, XML_TOK_TEXT_BOOKMARK_REF },
     252             :     { XML_NAMESPACE_TEXT, XML_SEQUENCE_REF, XML_TOK_TEXT_SEQUENCE_REF },
     253             :     { XML_NAMESPACE_TEXT, XML_NOTE_REF, XML_TOK_TEXT_NOTE_REF },
     254             :     { XML_NAMESPACE_TEXT, XML_BIBLIOGRAPHY_MARK,
     255             :       XML_TOK_TEXT_BIBLIOGRAPHY_MARK },
     256             :     { XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_TEXT_ANNOTATION },
     257             :     { XML_NAMESPACE_OFFICE, XML_ANNOTATION_END, XML_TOK_TEXT_ANNOTATION_END },
     258             :     { XML_NAMESPACE_TEXT, XML_SCRIPT, XML_TOK_TEXT_SCRIPT },
     259             :     { XML_NAMESPACE_TEXT, XML_TABLE_FORMULA, XML_TOK_TEXT_TABLE_FORMULA },
     260             :     { XML_NAMESPACE_TEXT, XML_DROPDOWN, XML_TOK_TEXT_DROPDOWN },
     261             : 
     262             :     // Calc fields
     263             :     { XML_NAMESPACE_TEXT, XML_SHEET_NAME, XML_TOK_TEXT_SHEET_NAME },
     264             : 
     265             :     // draw fields
     266             :     { XML_NAMESPACE_TEXT, XML_MEASURE,  XML_TOK_TEXT_MEASURE },
     267             : 
     268             :     // RDF metadata
     269             :     { XML_NAMESPACE_TEXT, XML_META,         XML_TOK_TEXT_META },
     270             :     { XML_NAMESPACE_TEXT, XML_META_FIELD,   XML_TOK_TEXT_META_FIELD },
     271             : 
     272             :     // redlining (aka change tracking)
     273             :     { XML_NAMESPACE_TEXT, XML_CHANGE_START, XML_TOK_TEXTP_CHANGE_START },
     274             :     { XML_NAMESPACE_TEXT, XML_CHANGE_END  , XML_TOK_TEXTP_CHANGE_END },
     275             :     { XML_NAMESPACE_TEXT, XML_CHANGE, XML_TOK_TEXTP_CHANGE },
     276             : 
     277             :     { XML_NAMESPACE_PRESENTATION, XML_HEADER, XML_TOK_DRAW_HEADER },
     278             :     { XML_NAMESPACE_PRESENTATION, XML_FOOTER, XML_TOK_DRAW_FOOTER },
     279             :     { XML_NAMESPACE_PRESENTATION, XML_DATE_TIME, XML_TOK_DRAW_DATE_TIME },
     280             :     { XML_NAMESPACE_TEXT, XML_PAGE_CONTINUATION, XML_TOK_TEXT_PAGE_CONTINUATION },
     281             : 
     282             :     { XML_NAMESPACE_FIELD, XML_FIELDMARK, XML_TOK_TEXT_FIELDMARK },
     283             :     { XML_NAMESPACE_FIELD, XML_FIELDMARK_START, XML_TOK_TEXT_FIELDMARK_START },
     284             :     { XML_NAMESPACE_FIELD, XML_FIELDMARK_END, XML_TOK_TEXT_FIELDMARK_END },
     285             : 
     286             : 
     287             :     XML_TOKEN_MAP_END
     288             : };
     289             : 
     290             : static const SvXMLTokenMapEntry aTextPAttrTokenMap[] =
     291             : {
     292             :     { XML_NAMESPACE_XML  , XML_ID,          XML_TOK_TEXT_P_XMLID },
     293             :     { XML_NAMESPACE_XHTML, XML_ABOUT,       XML_TOK_TEXT_P_ABOUT },
     294             :     { XML_NAMESPACE_XHTML, XML_PROPERTY,    XML_TOK_TEXT_P_PROPERTY },
     295             :     { XML_NAMESPACE_XHTML, XML_CONTENT,     XML_TOK_TEXT_P_CONTENT },
     296             :     { XML_NAMESPACE_XHTML, XML_DATATYPE,    XML_TOK_TEXT_P_DATATYPE },
     297             :     { XML_NAMESPACE_TEXT, XML_ID,           XML_TOK_TEXT_P_TEXTID },
     298             :     { XML_NAMESPACE_TEXT, XML_STYLE_NAME,   XML_TOK_TEXT_P_STYLE_NAME },
     299             :     { XML_NAMESPACE_TEXT, XML_COND_STYLE_NAME,
     300             :                                             XML_TOK_TEXT_P_COND_STYLE_NAME },
     301             :     { XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL,XML_TOK_TEXT_P_LEVEL },
     302             :     { XML_NAMESPACE_TEXT, XML_IS_LIST_HEADER,XML_TOK_TEXT_P_IS_LIST_HEADER },
     303             :     { XML_NAMESPACE_TEXT, XML_RESTART_NUMBERING,XML_TOK_TEXT_P_RESTART_NUMBERING },
     304             :     { XML_NAMESPACE_TEXT, XML_START_VALUE,XML_TOK_TEXT_P_START_VALUE },
     305             :     XML_TOKEN_MAP_END
     306             : };
     307             : 
     308             : static const SvXMLTokenMapEntry aTextNumberedParagraphAttrTokenMap[] =
     309             : {
     310             :     { XML_NAMESPACE_XML , XML_ID,    XML_TOK_TEXT_NUMBERED_PARAGRAPH_XMLID },
     311             :     { XML_NAMESPACE_TEXT, XML_LIST_ID,
     312             :         XML_TOK_TEXT_NUMBERED_PARAGRAPH_LIST_ID },
     313             :     { XML_NAMESPACE_TEXT, XML_LEVEL, XML_TOK_TEXT_NUMBERED_PARAGRAPH_LEVEL },
     314             :     { XML_NAMESPACE_TEXT, XML_STYLE_NAME,
     315             :         XML_TOK_TEXT_NUMBERED_PARAGRAPH_STYLE_NAME },
     316             :     { XML_NAMESPACE_TEXT, XML_CONTINUE_NUMBERING,
     317             :         XML_TOK_TEXT_NUMBERED_PARAGRAPH_CONTINUE_NUMBERING },
     318             :     { XML_NAMESPACE_TEXT, XML_START_VALUE,
     319             :         XML_TOK_TEXT_NUMBERED_PARAGRAPH_START_VALUE },
     320             :     XML_TOKEN_MAP_END
     321             : };
     322             : 
     323             : static const SvXMLTokenMapEntry aTextListBlockAttrTokenMap[] =
     324             : {
     325             :     { XML_NAMESPACE_XML , XML_ID,           XML_TOK_TEXT_LIST_BLOCK_XMLID },
     326             :     { XML_NAMESPACE_TEXT, XML_STYLE_NAME,
     327             :             XML_TOK_TEXT_LIST_BLOCK_STYLE_NAME },
     328             :     { XML_NAMESPACE_TEXT, XML_CONTINUE_NUMBERING,
     329             :             XML_TOK_TEXT_LIST_BLOCK_CONTINUE_NUMBERING },
     330             :     { XML_NAMESPACE_TEXT, XML_CONTINUE_LIST,
     331             :             XML_TOK_TEXT_LIST_BLOCK_CONTINUE_LIST },
     332             :     XML_TOKEN_MAP_END
     333             : };
     334             : 
     335             : static const SvXMLTokenMapEntry aTextListBlockElemTokenMap[] =
     336             : {
     337             :     { XML_NAMESPACE_TEXT, XML_LIST_HEADER, XML_TOK_TEXT_LIST_HEADER },
     338             :     { XML_NAMESPACE_TEXT, XML_LIST_ITEM,    XML_TOK_TEXT_LIST_ITEM   },
     339             :     XML_TOKEN_MAP_END
     340             : };
     341             : 
     342             : static const SvXMLTokenMapEntry aTextFrameAttrTokenMap[] =
     343             : {
     344             :     { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_TEXT_FRAME_STYLE_NAME },
     345             :     { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_TEXT_FRAME_NAME },
     346             :     { XML_NAMESPACE_TEXT, XML_ANCHOR_TYPE, XML_TOK_TEXT_FRAME_ANCHOR_TYPE },
     347             :     { XML_NAMESPACE_TEXT, XML_ANCHOR_PAGE_NUMBER, XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER },
     348             :     { XML_NAMESPACE_SVG, XML_X, XML_TOK_TEXT_FRAME_X },
     349             :     { XML_NAMESPACE_SVG, XML_Y, XML_TOK_TEXT_FRAME_Y },
     350             :     { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_TEXT_FRAME_WIDTH },
     351             :     { XML_NAMESPACE_FO, XML_MIN_WIDTH, XML_TOK_TEXT_FRAME_MIN_WIDTH },
     352             :     { XML_NAMESPACE_STYLE, XML_REL_WIDTH, XML_TOK_TEXT_FRAME_REL_WIDTH },
     353             :     { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_TEXT_FRAME_HEIGHT },
     354             :     { XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TOK_TEXT_FRAME_MIN_HEIGHT },
     355             :     { XML_NAMESPACE_STYLE, XML_REL_HEIGHT, XML_TOK_TEXT_FRAME_REL_HEIGHT },
     356             :     { XML_NAMESPACE_DRAW, XML_CHAIN_NEXT_NAME, XML_TOK_TEXT_FRAME_NEXT_CHAIN_NAME },
     357             :     { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TEXT_FRAME_HREF },
     358             :     { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_TEXT_FRAME_FILTER_NAME },
     359             :     { XML_NAMESPACE_DRAW, XML_ZINDEX, XML_TOK_TEXT_FRAME_Z_INDEX },
     360             :     { XML_NAMESPACE_SVG, XML_TRANSFORM, XML_TOK_TEXT_FRAME_TRANSFORM },
     361             :     { XML_NAMESPACE_DRAW, XML_CLASS_ID, XML_TOK_TEXT_FRAME_CLASS_ID },
     362             :     { XML_NAMESPACE_DRAW,   XML_CODE,           XML_TOK_TEXT_FRAME_CODE },
     363             :     { XML_NAMESPACE_DRAW,   XML_OBJECT,         XML_TOK_TEXT_FRAME_OBJECT },
     364             :     { XML_NAMESPACE_DRAW,   XML_ARCHIVE,        XML_TOK_TEXT_FRAME_ARCHIVE },
     365             :     { XML_NAMESPACE_DRAW,   XML_MAY_SCRIPT,     XML_TOK_TEXT_FRAME_MAY_SCRIPT },
     366             :     { XML_NAMESPACE_DRAW,   XML_MIME_TYPE,  XML_TOK_TEXT_FRAME_MIME_TYPE },
     367             :     { XML_NAMESPACE_DRAW, XML_APPLET_NAME, XML_TOK_TEXT_FRAME_APPLET_NAME },
     368             :     { XML_NAMESPACE_DRAW, XML_FRAME_NAME, XML_TOK_TEXT_FRAME_FRAME_NAME },
     369             :     { XML_NAMESPACE_DRAW, XML_NOTIFY_ON_UPDATE_OF_RANGES, XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE },
     370             :     { XML_NAMESPACE_DRAW, XML_NOTIFY_ON_UPDATE_OF_TABLE, XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE },
     371             :     XML_TOKEN_MAP_END
     372             : };
     373             : 
     374             : static const SvXMLTokenMapEntry aTextContourAttrTokenMap[] =
     375             : {
     376             :     { XML_NAMESPACE_SVG, XML_WIDTH,     XML_TOK_TEXT_CONTOUR_WIDTH      },
     377             :     { XML_NAMESPACE_SVG, XML_HEIGHT,    XML_TOK_TEXT_CONTOUR_HEIGHT     },
     378             :     { XML_NAMESPACE_SVG, XML_VIEWBOX,   XML_TOK_TEXT_CONTOUR_VIEWBOX    },
     379             :     { XML_NAMESPACE_SVG, XML_D,         XML_TOK_TEXT_CONTOUR_D          },
     380             :     { XML_NAMESPACE_DRAW,XML_POINTS,    XML_TOK_TEXT_CONTOUR_POINTS     },
     381             :     { XML_NAMESPACE_DRAW,XML_RECREATE_ON_EDIT,  XML_TOK_TEXT_CONTOUR_AUTO   },
     382             :     XML_TOKEN_MAP_END
     383             : };
     384             : 
     385             : static const SvXMLTokenMapEntry aTextHyperlinkAttrTokenMap[] =
     386             : {
     387             :     { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TEXT_HYPERLINK_HREF },
     388             :     { XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_TEXT_HYPERLINK_NAME },
     389             :     { XML_NAMESPACE_XLINK, XML_SHOW, XML_TOK_TEXT_HYPERLINK_SHOW },
     390             :     { XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, XML_TOK_TEXT_HYPERLINK_TARGET_FRAME },
     391             :     { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_HYPERLINK_STYLE_NAME },
     392             :     { XML_NAMESPACE_TEXT, XML_VISITED_STYLE_NAME, XML_TOK_TEXT_HYPERLINK_VIS_STYLE_NAME },
     393             :     { XML_NAMESPACE_OFFICE, XML_SERVER_MAP, XML_TOK_TEXT_HYPERLINK_SERVER_MAP },
     394             :     XML_TOKEN_MAP_END
     395             : };
     396             : 
     397             : static const SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] =
     398             : {
     399             :     { XML_NAMESPACE_STYLE, XML_HEADER, XML_TOK_TEXT_MP_HEADER },
     400             :     { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER },
     401             :     { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT },
     402             :     { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT },
     403             :     { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST },
     404             :     { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST },
     405             : 
     406             :     XML_TOKEN_MAP_END
     407             : };
     408             : 
     409             : static const SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
     410             : {
     411             :     { XML_NAMESPACE_TEXT, XML_FIXED, XML_TOK_TEXTFIELD_FIXED },
     412             :     { XML_NAMESPACE_TEXT, XML_DESCRIPTION,  XML_TOK_TEXTFIELD_DESCRIPTION },
     413             :     { XML_NAMESPACE_TEXT, XML_HELP, XML_TOK_TEXTFIELD_HELP },
     414             :     { XML_NAMESPACE_TEXT, XML_HINT, XML_TOK_TEXTFIELD_HINT },
     415             :     { XML_NAMESPACE_TEXT, XML_PLACEHOLDER_TYPE,
     416             :                 XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE },
     417             :     { XML_NAMESPACE_TEXT, XML_NAME, XML_TOK_TEXTFIELD_NAME },
     418             :     { XML_NAMESPACE_TEXT, XML_FORMULA, XML_TOK_TEXTFIELD_FORMULA },
     419             :     { XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_TOK_TEXTFIELD_NUM_FORMAT },
     420             :     { XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC,
     421             :                 XML_TOK_TEXTFIELD_NUM_LETTER_SYNC },
     422             :     { XML_NAMESPACE_TEXT, XML_DISPLAY_FORMULA,
     423             :                 XML_TOK_TEXTFIELD_DISPLAY_FORMULA },
     424             :     { XML_NAMESPACE_TEXT, XML_VALUE_TYPE, XML_TOK_TEXTFIELD_VALUE_TYPE }, // #i32362#: src680m48++ saves text:value-type
     425             :     { XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_TOK_TEXTFIELD_VALUE_TYPE },
     426             :     { XML_NAMESPACE_TEXT, XML_VALUE, XML_TOK_TEXTFIELD_VALUE },
     427             :     { XML_NAMESPACE_OFFICE, XML_VALUE, XML_TOK_TEXTFIELD_VALUE },
     428             :     { XML_NAMESPACE_TEXT, XML_STRING_VALUE, XML_TOK_TEXTFIELD_STRING_VALUE },
     429             :     { XML_NAMESPACE_OFFICE, XML_STRING_VALUE, XML_TOK_TEXTFIELD_STRING_VALUE },
     430             :     { XML_NAMESPACE_TEXT, XML_DATE_VALUE, XML_TOK_TEXTFIELD_DATE_VALUE },
     431             :     { XML_NAMESPACE_OFFICE, XML_DATE_VALUE, XML_TOK_TEXTFIELD_DATE_VALUE },
     432             :     { XML_NAMESPACE_TEXT, XML_TIME_VALUE, XML_TOK_TEXTFIELD_TIME_VALUE },
     433             :     { XML_NAMESPACE_OFFICE, XML_TIME_VALUE, XML_TOK_TEXTFIELD_TIME_VALUE },
     434             :     { XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, XML_TOK_TEXTFIELD_BOOL_VALUE},
     435             :     { XML_NAMESPACE_OFFICE, XML_CURRENCY, XML_TOK_TEXTFIELD_CURRENCY},
     436             :     { XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME,
     437             :                 XML_TOK_TEXTFIELD_DATA_STYLE_NAME },
     438             :     { XML_NAMESPACE_TEXT, XML_DISPLAY_OUTLINE_LEVEL,
     439             :                 XML_TOK_TEXTFIELD_NUMBERING_LEVEL },
     440             :     { XML_NAMESPACE_TEXT, XML_SEPARATION_CHARACTER,
     441             :                 XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR },
     442             :     { XML_NAMESPACE_TEXT, XML_DISPLAY, XML_TOK_TEXTFIELD_DISPLAY },
     443             :     { XML_NAMESPACE_TEXT, XML_TIME_ADJUST, XML_TOK_TEXTFIELD_TIME_ADJUST },
     444             :     { XML_NAMESPACE_TEXT, XML_DATE_ADJUST, XML_TOK_TEXTFIELD_DATE_ADJUST },
     445             :     { XML_NAMESPACE_TEXT, XML_PAGE_ADJUST, XML_TOK_TEXTFIELD_PAGE_ADJUST },
     446             :     { XML_NAMESPACE_TEXT, XML_SELECT_PAGE, XML_TOK_TEXTFIELD_SELECT_PAGE },
     447             :     { XML_NAMESPACE_TEXT, XML_DATABASE_NAME, XML_TOK_TEXTFIELD_DATABASE_NAME},
     448             :     { XML_NAMESPACE_TEXT, XML_TABLE_NAME, XML_TOK_TEXTFIELD_TABLE_NAME },
     449             :     { XML_NAMESPACE_TEXT, XML_COLUMN_NAME, XML_TOK_TEXTFIELD_COLUMN_NAME },
     450             :     { XML_NAMESPACE_TEXT, XML_ROW_NUMBER, XML_TOK_TEXTFIELD_ROW_NUMBER },
     451             :     { XML_NAMESPACE_TEXT, XML_CONDITION, XML_TOK_TEXTFIELD_CONDITION },
     452             :     { XML_NAMESPACE_TEXT, XML_STRING_VALUE_IF_TRUE,
     453             :                 XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE },
     454             :     { XML_NAMESPACE_TEXT, XML_STRING_VALUE_IF_FALSE,
     455             :                 XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE },
     456             :     { XML_NAMESPACE_TEXT, XML_EDITING_CYCLES, XML_TOK_TEXTFIELD_REVISION },
     457             :     { XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL, XML_TOK_TEXTFIELD_OUTLINE_LEVEL},
     458             :     { XML_NAMESPACE_TEXT, XML_ACTIVE, XML_TOK_TEXTFIELD_ACTIVE },
     459             :     { XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_TOK_TEXTFIELD_NOTE_CLASS },
     460             :     { XML_NAMESPACE_TEXT, XML_REFERENCE_FORMAT,
     461             :                 XML_TOK_TEXTFIELD_REFERENCE_FORMAT },
     462             :     { XML_NAMESPACE_TEXT, XML_REF_NAME, XML_TOK_TEXTFIELD_REF_NAME },
     463             :     { XML_NAMESPACE_TEXT, XML_CONNECTION_NAME,
     464             :       XML_TOK_TEXTFIELD_CONNECTION_NAME },
     465             :     { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TEXTFIELD_HREF },
     466             :     { XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME,
     467             :       XML_TOK_TEXTFIELD_TARGET_FRAME },
     468             :     { XML_NAMESPACE_TEXT, XML_ANNOTATION, XML_TOK_TEXTFIELD_ANNOTATION },
     469             :     { XML_NAMESPACE_SCRIPT, XML_LANGUAGE, XML_TOK_TEXTFIELD_LANGUAGE },
     470             :     { XML_NAMESPACE_TEXT, XML_KIND, XML_TOK_TEXTFIELD_MEASURE_KIND },
     471             :     { XML_NAMESPACE_TEXT, XML_IS_HIDDEN, XML_TOK_TEXTFIELD_IS_HIDDEN },
     472             :     { XML_NAMESPACE_TEXT, XML_CURRENT_VALUE,
     473             :                 XML_TOK_TEXTFIELD_CURRENT_VALUE },
     474             :     { XML_NAMESPACE_TEXT, XML_TABLE_TYPE, XML_TOK_TEXTFIELD_TABLE_TYPE },
     475             :     { XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_TEXT_NAME },
     476             : 
     477             :     XML_TOKEN_MAP_END
     478             : };
     479             : 
     480             : 
     481             : // maximum allowed length of combined characters field
     482             : #define MAX_COMBINED_CHARACTERS 6
     483             : 
     484           0 : struct XMLTextImportHelper::Impl
     485             :     : private ::boost::noncopyable
     486             : {
     487             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextElemTokenMap;
     488             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextPElemTokenMap;
     489             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextPAttrTokenMap;
     490             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextFieldAttrTokenMap;
     491             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextNumberedParagraphAttrTokenMap;
     492             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextListBlockAttrTokenMap;
     493             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextListBlockElemTokenMap;
     494             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextFrameAttrTokenMap;
     495             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextContourAttrTokenMap;
     496             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextHyperlinkAttrTokenMap;
     497             :     boost::scoped_ptr<SvXMLTokenMap> m_pTextMasterPageElemTokenMap;
     498             :     boost::scoped_ptr< std::vector<OUString> > m_pPrevFrmNames;
     499             :     boost::scoped_ptr< std::vector<OUString> > m_pNextFrmNames;
     500             :     boost::scoped_ptr<XMLTextListsHelper> m_pTextListsHelper;
     501             : 
     502             :     SvXMLImportContextRef m_xAutoStyles;
     503             :     SvXMLImportContextRef m_xFontDecls;
     504             : 
     505             :     UniReference< SvXMLImportPropertyMapper > m_xParaImpPrMap;
     506             :     UniReference< SvXMLImportPropertyMapper > m_xTextImpPrMap;
     507             :     UniReference< SvXMLImportPropertyMapper > m_xFrameImpPrMap;
     508             :     UniReference< SvXMLImportPropertyMapper > m_xSectionImpPrMap;
     509             :     UniReference< SvXMLImportPropertyMapper > m_xRubyImpPrMap;
     510             : 
     511             :     boost::scoped_ptr<SvI18NMap> m_pRenameMap;
     512             : 
     513             :     /* Change and extend data structure:
     514             :        - data structure contains candidates of paragraph styles, which
     515             :          will be assigned to the outline style
     516             :        - data structure contains more than one candidate for each list level
     517             :          of the outline style (#i69629#)
     518             :     */
     519             :     ::boost::scoped_array< ::std::vector< OUString > >
     520             :         m_pOutlineStylesCandidates;
     521             : 
     522             :     // start range, xml:id, RDFa stuff
     523             :     typedef ::boost::tuple<
     524             :         uno::Reference<text::XTextRange>, OUString,
     525             :         ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes > >
     526             :             BookmarkMapEntry_t;
     527             :     /// start ranges for open bookmarks
     528             :     ::std::map< OUString, BookmarkMapEntry_t > m_BookmarkStartRanges;
     529             : 
     530             :     typedef ::std::vector< OUString > BookmarkVector_t;
     531             :     BookmarkVector_t m_BookmarkVector;
     532             : 
     533             :     /// name of the last 'open' redline that started between paragraphs
     534             :     OUString m_sOpenRedlineIdentifier;
     535             : 
     536             :     uno::Reference<text::XText> m_xText;
     537             :     uno::Reference<text::XTextCursor> m_xCursor;
     538             :     uno::Reference<text::XTextRange> m_xCursorAsRange;
     539             :     uno::Reference<container::XNameContainer> m_xParaStyles;
     540             :     uno::Reference<container::XNameContainer> m_xTextStyles;
     541             :     uno::Reference<container::XNameContainer> m_xNumStyles;
     542             :     uno::Reference<container::XNameContainer> m_xFrameStyles;
     543             :     uno::Reference<container::XNameContainer> m_xPageStyles;
     544             :     uno::Reference<container::XIndexReplace> m_xChapterNumbering;
     545             :     uno::Reference<container::XNameAccess> m_xTextFrames;
     546             :     uno::Reference<container::XNameAccess> m_xGraphics;
     547             :     uno::Reference<container::XNameAccess> m_xObjects;
     548             :     uno::Reference<lang::XMultiServiceFactory> m_xServiceFactory;
     549             : 
     550             :     SvXMLImport & m_rSvXMLImport;
     551             : 
     552             :     bool m_bInsertMode : 1;
     553             :     bool m_bStylesOnlyMode : 1;
     554             :     bool m_bBlockMode : 1;
     555             :     bool m_bProgress : 1;
     556             :     bool m_bOrganizerMode : 1;
     557             :     bool m_bBodyContentStarted : 1;
     558             : 
     559             :     // #107848#
     560             :     /// Are we inside a <text:deletion> element (deleted redline section)
     561             :     bool m_bInsideDeleteContext : 1;
     562             : 
     563             :     typedef ::std::pair< OUString, OUString> field_name_type_t;
     564             :     typedef ::std::pair< OUString, OUString > field_param_t;
     565             :     typedef ::std::vector< field_param_t > field_params_t;
     566             :     typedef ::std::pair< field_name_type_t, field_params_t > field_stack_item_t;
     567             :     typedef ::std::stack< field_stack_item_t > field_stack_t;
     568             : 
     569             :     field_stack_t m_FieldStack;
     570             : 
     571             :     OUString m_sCellParaStyleDefault;
     572             : 
     573           0 :     Impl(       uno::Reference<frame::XModel> const& rModel,
     574             :                 SvXMLImport & rImport,
     575             :                 bool const bInsertMode, bool const bStylesOnlyMode,
     576             :                 bool const bProgress, bool const bBlockMode,
     577             :                 bool const bOrganizerMode)
     578             :         :   m_pTextElemTokenMap( 0 )
     579             :         ,   m_pTextPElemTokenMap( 0 )
     580             :         ,   m_pTextPAttrTokenMap( 0 )
     581             :         ,   m_pTextFieldAttrTokenMap( 0 )
     582             :         ,   m_pTextNumberedParagraphAttrTokenMap( 0 )
     583             :         ,   m_pTextListBlockAttrTokenMap( 0 )
     584             :         ,   m_pTextListBlockElemTokenMap( 0 )
     585             :         ,   m_pTextFrameAttrTokenMap( 0 )
     586             :         ,   m_pTextContourAttrTokenMap( 0 )
     587             :         ,   m_pTextHyperlinkAttrTokenMap( 0 )
     588             :         ,   m_pTextMasterPageElemTokenMap( 0 )
     589             :         ,   m_pPrevFrmNames( 0 )
     590             :         ,   m_pNextFrmNames( 0 )
     591           0 :         ,   m_pTextListsHelper( new XMLTextListsHelper() )
     592             :         ,   m_pRenameMap( 0 )
     593             :         // XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#)
     594             :         ,   m_pOutlineStylesCandidates( 0 )
     595             :         ,   m_xServiceFactory( rModel, UNO_QUERY )
     596             :         ,   m_rSvXMLImport( rImport )
     597             :         ,   m_bInsertMode( bInsertMode )
     598             :         ,   m_bStylesOnlyMode( bStylesOnlyMode )
     599             :         ,   m_bBlockMode( bBlockMode )
     600             :         ,   m_bProgress( bProgress )
     601             :         ,   m_bOrganizerMode( bOrganizerMode )
     602             :         ,   m_bBodyContentStarted( true )
     603           0 :         ,   m_bInsideDeleteContext( false )
     604             :     {
     605           0 :     }
     606             : 
     607           0 :     void InitOutlineStylesCandidates()
     608             :     {
     609           0 :         if (!m_pOutlineStylesCandidates)
     610             :         {
     611           0 :             size_t const size(m_xChapterNumbering->getCount());
     612             :             m_pOutlineStylesCandidates.reset(
     613           0 :                 new ::std::vector< OUString >[size] );
     614             :         }
     615           0 :     }
     616             : 
     617             : };
     618             : 
     619             : 
     620           0 : uno::Reference< text::XText > & XMLTextImportHelper::GetText()
     621             : {
     622           0 :     return m_pImpl->m_xText;
     623             : }
     624             : 
     625           0 : uno::Reference< text::XTextCursor > & XMLTextImportHelper::GetCursor()
     626             : {
     627           0 :     return m_pImpl->m_xCursor;
     628             : }
     629             : 
     630           0 : uno::Reference< text::XTextRange > & XMLTextImportHelper::GetCursorAsRange()
     631             : {
     632           0 :     return m_pImpl->m_xCursorAsRange;
     633             : }
     634             : 
     635           0 : bool XMLTextImportHelper::IsInsertMode() const
     636             : {
     637           0 :     return m_pImpl->m_bInsertMode;
     638             : }
     639             : 
     640           0 : bool XMLTextImportHelper::IsStylesOnlyMode() const
     641             : {
     642           0 :     return m_pImpl->m_bStylesOnlyMode;
     643             : }
     644             : 
     645           0 : bool XMLTextImportHelper::IsBlockMode() const
     646             : {
     647           0 :     return m_pImpl->m_bBlockMode;
     648             : }
     649             : 
     650           0 : bool XMLTextImportHelper::IsOrganizerMode() const
     651             : {
     652           0 :     return m_pImpl->m_bOrganizerMode;
     653             : }
     654             : 
     655           0 : bool XMLTextImportHelper::IsProgress() const
     656             : {
     657           0 :     return m_pImpl->m_bProgress;
     658             : }
     659             : 
     660             : uno::Reference<container::XNameContainer> const&
     661           0 : XMLTextImportHelper::GetParaStyles() const
     662             : {
     663           0 :     return m_pImpl->m_xParaStyles;
     664             : }
     665             : 
     666             : uno::Reference<container::XNameContainer> const&
     667           0 : XMLTextImportHelper::GetTextStyles() const
     668             : {
     669           0 :     return m_pImpl->m_xTextStyles;
     670             : }
     671             : 
     672             : uno::Reference<container::XNameContainer> const&
     673           0 : XMLTextImportHelper::GetNumberingStyles() const
     674             : {
     675           0 :     return m_pImpl->m_xNumStyles;
     676             : }
     677             : 
     678             : uno::Reference<container::XNameContainer> const&
     679           0 : XMLTextImportHelper::GetFrameStyles() const
     680             : {
     681           0 :     return m_pImpl->m_xFrameStyles;
     682             : }
     683             : 
     684             : uno::Reference<container::XNameContainer> const&
     685           0 : XMLTextImportHelper::GetPageStyles() const
     686             : {
     687           0 :     return m_pImpl->m_xPageStyles;
     688             : }
     689             : 
     690             : uno::Reference<container::XIndexReplace> const&
     691           0 : XMLTextImportHelper::GetChapterNumbering() const
     692             : {
     693           0 :     return m_pImpl->m_xChapterNumbering;
     694             : }
     695             : 
     696             : UniReference< SvXMLImportPropertyMapper > const&
     697           0 : XMLTextImportHelper::GetParaImportPropertySetMapper() const
     698             : {
     699           0 :     return m_pImpl->m_xParaImpPrMap;
     700             : }
     701             : 
     702             : UniReference< SvXMLImportPropertyMapper > const&
     703           0 : XMLTextImportHelper::GetTextImportPropertySetMapper() const
     704             : {
     705           0 :     return m_pImpl->m_xTextImpPrMap;
     706             : }
     707             : 
     708             : UniReference< SvXMLImportPropertyMapper > const&
     709           0 : XMLTextImportHelper::GetSectionImportPropertySetMapper() const
     710             : {
     711           0 :     return m_pImpl->m_xSectionImpPrMap;
     712             : }
     713             : 
     714             : UniReference< SvXMLImportPropertyMapper > const&
     715           0 : XMLTextImportHelper::GetRubyImportPropertySetMapper() const
     716             : {
     717           0 :     return m_pImpl->m_xRubyImpPrMap;
     718             : }
     719             : 
     720           0 : void XMLTextImportHelper::SetInsideDeleteContext(bool const bNew)
     721             : {
     722           0 :     m_pImpl->m_bInsideDeleteContext = bNew;
     723           0 : }
     724             : 
     725           0 : bool XMLTextImportHelper::IsInsideDeleteContext() const
     726             : {
     727           0 :     return m_pImpl->m_bInsideDeleteContext;
     728             : }
     729             : 
     730           0 : SvXMLImport & XMLTextImportHelper::GetXMLImport()
     731             : {
     732           0 :     return m_pImpl->m_rSvXMLImport;
     733             : }
     734             : 
     735           0 : XMLTextListsHelper & XMLTextImportHelper::GetTextListHelper()
     736             : {
     737           0 :     return *m_pImpl->m_pTextListsHelper;
     738             : }
     739             : 
     740           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextElemTokenMap()
     741             : {
     742           0 :     if (!m_pImpl->m_pTextElemTokenMap.get())
     743             :     {
     744           0 :         m_pImpl->m_pTextElemTokenMap.reset(
     745           0 :             new SvXMLTokenMap( aTextElemTokenMap ));
     746             :     }
     747           0 :     return *m_pImpl->m_pTextElemTokenMap;
     748             : }
     749             : 
     750           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextPElemTokenMap()
     751             : {
     752           0 :     if (!m_pImpl->m_pTextPElemTokenMap.get())
     753             :     {
     754           0 :         m_pImpl->m_pTextPElemTokenMap.reset(
     755           0 :             new SvXMLTokenMap( aTextPElemTokenMap ));
     756             :     }
     757           0 :     return *m_pImpl->m_pTextPElemTokenMap;
     758             : }
     759             : 
     760           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextPAttrTokenMap()
     761             : {
     762           0 :     if (!m_pImpl->m_pTextPAttrTokenMap.get())
     763             :     {
     764           0 :         m_pImpl->m_pTextPAttrTokenMap.reset(
     765           0 :             new SvXMLTokenMap( aTextPAttrTokenMap ));
     766             :     }
     767           0 :     return *m_pImpl->m_pTextPAttrTokenMap;
     768             : }
     769             : 
     770           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextFrameAttrTokenMap()
     771             : {
     772           0 :     if (!m_pImpl->m_pTextFrameAttrTokenMap.get())
     773             :     {
     774           0 :         m_pImpl->m_pTextFrameAttrTokenMap.reset(
     775           0 :             new SvXMLTokenMap( aTextFrameAttrTokenMap ));
     776             :     }
     777           0 :     return *m_pImpl->m_pTextFrameAttrTokenMap;
     778             : }
     779             : 
     780           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextContourAttrTokenMap()
     781             : {
     782           0 :     if (!m_pImpl->m_pTextContourAttrTokenMap.get())
     783             :     {
     784           0 :         m_pImpl->m_pTextContourAttrTokenMap.reset(
     785           0 :             new SvXMLTokenMap( aTextContourAttrTokenMap ));
     786             :     }
     787           0 :     return *m_pImpl->m_pTextContourAttrTokenMap;
     788             : }
     789             : 
     790           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextHyperlinkAttrTokenMap()
     791             : {
     792           0 :     if (!m_pImpl->m_pTextHyperlinkAttrTokenMap.get())
     793             :     {
     794           0 :         m_pImpl->m_pTextHyperlinkAttrTokenMap.reset(
     795           0 :             new SvXMLTokenMap( aTextHyperlinkAttrTokenMap ));
     796             :     }
     797           0 :     return *m_pImpl->m_pTextHyperlinkAttrTokenMap;
     798             : }
     799             : 
     800           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextMasterPageElemTokenMap()
     801             : {
     802           0 :     if (!m_pImpl->m_pTextMasterPageElemTokenMap.get())
     803             :     {
     804           0 :         m_pImpl->m_pTextMasterPageElemTokenMap.reset(
     805           0 :             new SvXMLTokenMap( aTextMasterPageElemTokenMap ));
     806             :     }
     807           0 :     return *m_pImpl->m_pTextMasterPageElemTokenMap;
     808             : }
     809             : 
     810           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextFieldAttrTokenMap()
     811             : {
     812           0 :     if (!m_pImpl->m_pTextFieldAttrTokenMap.get())
     813             :     {
     814           0 :         m_pImpl->m_pTextFieldAttrTokenMap.reset(
     815           0 :             new SvXMLTokenMap( aTextFieldAttrTokenMap ));
     816             :     }
     817           0 :     return *m_pImpl->m_pTextFieldAttrTokenMap;
     818             : }
     819             : 
     820             : 
     821             : namespace
     822             : {
     823           0 :     class FieldParamImporter
     824             :     {
     825             :         public:
     826             :             typedef pair<OUString,OUString> field_param_t;
     827             :             typedef vector<field_param_t> field_params_t;
     828           0 :             FieldParamImporter(const field_params_t* const pInParams, Reference<XNameContainer> xOutParams)
     829             :                 : m_pInParams(pInParams)
     830           0 :                 , m_xOutParams(xOutParams)
     831           0 :             { };
     832             :             void Import();
     833             : 
     834             :         private:
     835             :             const field_params_t* const m_pInParams;
     836             :             Reference<XNameContainer> m_xOutParams;
     837             :     };
     838             : 
     839           0 :     void FieldParamImporter::Import()
     840             :     {
     841           0 :         ::std::vector<OUString> vListEntries;
     842           0 :         ::std::map<OUString, Any> vOutParams;
     843           0 :         for(field_params_t::const_iterator pCurrent = m_pInParams->begin();
     844           0 :             pCurrent != m_pInParams->end();
     845             :             ++pCurrent)
     846             :         {
     847           0 :             if(pCurrent->first.equalsAscii(ODF_FORMDROPDOWN_RESULT))
     848             :             {
     849             :                 // sal_Int32
     850           0 :                 vOutParams[pCurrent->first] = makeAny(pCurrent->second.toInt32());
     851             :             }
     852           0 :             else if(pCurrent->first.equalsAscii(ODF_FORMCHECKBOX_RESULT))
     853             :             {
     854             :                 // bool
     855           0 :                 vOutParams[pCurrent->first] = makeAny(pCurrent->second.toBoolean());
     856             :             }
     857           0 :             else if(pCurrent->first.equalsAscii(ODF_FORMDROPDOWN_LISTENTRY))
     858             :             {
     859             :                 // sequence
     860           0 :                 vListEntries.push_back(pCurrent->second);
     861             :             }
     862             :             else
     863           0 :                 vOutParams[pCurrent->first] = makeAny(pCurrent->second);
     864             :         }
     865           0 :         if(!vListEntries.empty())
     866             :         {
     867           0 :             Sequence<OUString> vListEntriesSeq(vListEntries.size());
     868           0 :             copy(vListEntries.begin(), vListEntries.end(), vListEntriesSeq.begin());
     869           0 :             vOutParams[OUString(ODF_FORMDROPDOWN_LISTENTRY)] = makeAny(vListEntriesSeq);
     870             :         }
     871           0 :         for(::std::map<OUString, Any>::const_iterator pCurrent = vOutParams.begin();
     872           0 :             pCurrent != vOutParams.end();
     873             :             ++pCurrent)
     874             :         {
     875             :             try
     876             :             {
     877           0 :                 m_xOutParams->insertByName(pCurrent->first, pCurrent->second);
     878             :             }
     879           0 :             catch(const ElementExistException&)
     880             :             {
     881             :             }
     882           0 :         }
     883           0 :     }
     884             : }
     885             : 
     886           0 : XMLTextImportHelper::XMLTextImportHelper(
     887             :         uno::Reference<frame::XModel> const& rModel,
     888             :         SvXMLImport& rImport,
     889             :         bool const bInsertMode, bool const bStylesOnlyMode,
     890             :         bool const bProgress, bool const bBlockMode,
     891             :         bool const bOrganizerMode)
     892             :     : m_pImpl( new Impl(rModel, rImport, bInsertMode, bStylesOnlyMode,
     893           0 :                     bProgress, bBlockMode, bOrganizerMode) )
     894           0 :     , m_pBackpatcherImpl( MakeBackpatcherImpl() )
     895             : {
     896           0 :     static OUString s_PropNameDefaultListId( "DefaultListId");
     897             : 
     898           0 :     Reference< XChapterNumberingSupplier > xCNSupplier( rModel, UNO_QUERY );
     899             : 
     900           0 :     if( xCNSupplier.is() )
     901             :     {
     902           0 :         m_pImpl->m_xChapterNumbering = xCNSupplier->getChapterNumberingRules();
     903           0 :         if (m_pImpl->m_xChapterNumbering.is())
     904             :         {
     905             :             Reference< XPropertySet > const xNumRuleProps(
     906           0 :                 m_pImpl->m_xChapterNumbering, UNO_QUERY);
     907           0 :             if ( xNumRuleProps.is() )
     908             :             {
     909             :                 Reference< XPropertySetInfo > xNumRulePropSetInfo(
     910           0 :                                             xNumRuleProps->getPropertySetInfo());
     911           0 :                 if (xNumRulePropSetInfo.is() &&
     912           0 :                     xNumRulePropSetInfo->hasPropertyByName(
     913           0 :                          s_PropNameDefaultListId))
     914             :                 {
     915           0 :                     OUString sListId;
     916           0 :                     xNumRuleProps->getPropertyValue(s_PropNameDefaultListId)
     917           0 :                         >>= sListId;
     918             :                     DBG_ASSERT( !sListId.isEmpty(),
     919             :                                 "no default list id found at chapter numbering rules instance. Serious defect -> please inform OD." );
     920           0 :                     if ( !sListId.isEmpty() )
     921             :                     {
     922             :                         Reference< XNamed > const xChapterNumNamed(
     923           0 :                             m_pImpl->m_xChapterNumbering, UNO_QUERY);
     924           0 :                         if ( xChapterNumNamed.is() )
     925             :                         {
     926           0 :                             m_pImpl->m_pTextListsHelper->KeepListAsProcessed(
     927             :                                                     sListId,
     928           0 :                                                     xChapterNumNamed->getName(),
     929           0 :                                                     OUString() );
     930           0 :                         }
     931           0 :                     }
     932           0 :                 }
     933           0 :             }
     934             :         }
     935             :     }
     936             : 
     937           0 :     Reference< XStyleFamiliesSupplier > xFamiliesSupp( rModel, UNO_QUERY );
     938             : //  DBG_ASSERT( xFamiliesSupp.is(), "no chapter numbering supplier" ); for clipboard there may be documents without styles
     939             : 
     940           0 :     if( xFamiliesSupp.is() )
     941             :     {
     942           0 :         Reference< XNameAccess > xFamilies(xFamiliesSupp->getStyleFamilies());
     943             : 
     944           0 :         const OUString aParaStyles("ParagraphStyles");
     945           0 :         if( xFamilies->hasByName( aParaStyles ) )
     946             :         {
     947           0 :             m_pImpl->m_xParaStyles.set(xFamilies->getByName(aParaStyles),
     948           0 :                 UNO_QUERY);
     949             :         }
     950             : 
     951           0 :         const OUString aCharStyles("CharacterStyles");
     952           0 :         if( xFamilies->hasByName( aCharStyles ) )
     953             :         {
     954           0 :             m_pImpl->m_xTextStyles.set(xFamilies->getByName(aCharStyles),
     955           0 :                 UNO_QUERY);
     956             :         }
     957             : 
     958           0 :         const OUString aNumStyles("NumberingStyles");
     959           0 :         if( xFamilies->hasByName( aNumStyles ) )
     960             :         {
     961           0 :             m_pImpl->m_xNumStyles.set(xFamilies->getByName(aNumStyles),
     962           0 :                 UNO_QUERY);
     963             :         }
     964             : 
     965           0 :         const OUString aFrameStyles("FrameStyles");
     966           0 :         if( xFamilies->hasByName( aFrameStyles ) )
     967             :         {
     968           0 :             m_pImpl->m_xFrameStyles.set(xFamilies->getByName(aFrameStyles),
     969           0 :                 UNO_QUERY);
     970             :         }
     971             : 
     972           0 :         const OUString aPageStyles("PageStyles");
     973           0 :         if( xFamilies->hasByName( aPageStyles ) )
     974             :         {
     975           0 :             m_pImpl->m_xPageStyles.set(xFamilies->getByName(aPageStyles),
     976           0 :                 UNO_QUERY);
     977           0 :         }
     978             :     }
     979             : 
     980           0 :     Reference < XTextFramesSupplier > xTFS( rModel, UNO_QUERY );
     981           0 :     if( xTFS.is() )
     982             :     {
     983           0 :         m_pImpl->m_xTextFrames.set(xTFS->getTextFrames());
     984             :     }
     985             : 
     986           0 :     Reference < XTextGraphicObjectsSupplier > xTGOS( rModel, UNO_QUERY );
     987           0 :     if( xTGOS.is() )
     988             :     {
     989           0 :         m_pImpl->m_xGraphics.set(xTGOS->getGraphicObjects());
     990             :     }
     991             : 
     992           0 :     Reference < XTextEmbeddedObjectsSupplier > xTEOS( rModel, UNO_QUERY );
     993           0 :     if( xTEOS.is() )
     994             :     {
     995           0 :         m_pImpl->m_xObjects.set(xTEOS->getEmbeddedObjects());
     996             :     }
     997             : 
     998             :     XMLPropertySetMapper *pPropMapper =
     999           0 :             new XMLTextPropertySetMapper( TEXT_PROP_MAP_PARA, false );
    1000           0 :     m_pImpl->m_xParaImpPrMap =
    1001           0 :         new XMLTextImportPropertyMapper( pPropMapper, rImport );
    1002             : 
    1003           0 :     pPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT, false );
    1004           0 :     m_pImpl->m_xTextImpPrMap =
    1005           0 :         new XMLTextImportPropertyMapper( pPropMapper, rImport );
    1006             : 
    1007           0 :     pPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_FRAME, false );
    1008           0 :     m_pImpl->m_xFrameImpPrMap =
    1009           0 :         new XMLTextImportPropertyMapper( pPropMapper, rImport );
    1010             : 
    1011           0 :     pPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_SECTION, false );
    1012           0 :     m_pImpl->m_xSectionImpPrMap =
    1013           0 :         new XMLTextImportPropertyMapper( pPropMapper, rImport );
    1014             : 
    1015           0 :     pPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_RUBY, false );
    1016           0 :     m_pImpl->m_xRubyImpPrMap =
    1017           0 :         new SvXMLImportPropertyMapper( pPropMapper, rImport );
    1018           0 : }
    1019             : 
    1020           0 : XMLTextImportHelper::~XMLTextImportHelper()
    1021             : {
    1022           0 : }
    1023             : 
    1024           0 : SvXMLImportPropertyMapper *XMLTextImportHelper::CreateShapeExtPropMapper(SvXMLImport& rImport)
    1025             : {
    1026             :     XMLPropertySetMapper *pPropMapper =
    1027           0 :         new XMLTextPropertySetMapper( TEXT_PROP_MAP_FRAME, false );
    1028           0 :     return new XMLTextImportPropertyMapper( pPropMapper, rImport );
    1029             : }
    1030             : 
    1031           0 : SvXMLImportPropertyMapper *XMLTextImportHelper::CreateParaExtPropMapper(SvXMLImport& rImport)
    1032             : {
    1033             :     XMLPropertySetMapper *pPropMapper =
    1034           0 :         new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE_PARA, false );
    1035           0 :     return new XMLTextImportPropertyMapper( pPropMapper, rImport );
    1036             : }
    1037             : 
    1038           0 : SvXMLImportPropertyMapper *XMLTextImportHelper::CreateParaDefaultExtPropMapper(SvXMLImport& rImport)
    1039             : {
    1040             :     XMLPropertySetMapper* pPropMapper =
    1041           0 :         new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE_PARA, false );
    1042           0 :     SvXMLImportPropertyMapper* pImportMapper = new XMLTextImportPropertyMapper( pPropMapper, rImport );
    1043             : 
    1044             :     pPropMapper =
    1045           0 :         new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT_ADDITIONAL_DEFAULTS, false );
    1046           0 :     pImportMapper->ChainImportMapper( new XMLTextImportPropertyMapper( pPropMapper, rImport ) );
    1047             : 
    1048           0 :     return pImportMapper;
    1049             : }
    1050             : 
    1051             : SvXMLImportPropertyMapper*
    1052           0 :     XMLTextImportHelper::CreateTableDefaultExtPropMapper(
    1053             :         SvXMLImport& rImport )
    1054             : {
    1055             :     XMLPropertySetMapper *pPropMapper =
    1056           0 :         new XMLTextPropertySetMapper( TEXT_PROP_MAP_TABLE_DEFAULTS, false );
    1057           0 :     return new SvXMLImportPropertyMapper( pPropMapper, rImport );
    1058             : }
    1059             : 
    1060             : SvXMLImportPropertyMapper*
    1061           0 :     XMLTextImportHelper::CreateTableRowDefaultExtPropMapper(
    1062             :         SvXMLImport& rImport )
    1063             : {
    1064             :     XMLPropertySetMapper *pPropMapper =
    1065           0 :         new XMLTextPropertySetMapper( TEXT_PROP_MAP_TABLE_ROW_DEFAULTS, false );
    1066           0 :     return new SvXMLImportPropertyMapper( pPropMapper, rImport );
    1067             : }
    1068             : 
    1069           0 : void XMLTextImportHelper::SetCursor( const Reference < XTextCursor > & rCursor )
    1070             : {
    1071           0 :     m_pImpl->m_xCursor.set(rCursor);
    1072           0 :     m_pImpl->m_xText.set(rCursor->getText());
    1073           0 :     m_pImpl->m_xCursorAsRange.set( rCursor, UNO_QUERY );
    1074           0 : }
    1075             : 
    1076           0 : void XMLTextImportHelper::ResetCursor()
    1077             : {
    1078           0 :     m_pImpl->m_xCursor.set(0);
    1079           0 :     m_pImpl->m_xText.set(0);
    1080           0 :     m_pImpl->m_xCursorAsRange.set(0);
    1081           0 : }
    1082             : 
    1083             : 
    1084           0 : bool XMLTextImportHelper::HasFrameByName( const OUString& rName ) const
    1085             : {
    1086           0 :     return (m_pImpl->m_xTextFrames.is() &&
    1087           0 :             m_pImpl->m_xTextFrames->hasByName(rName))
    1088           0 :         || (m_pImpl->m_xGraphics.is() &&
    1089           0 :             m_pImpl->m_xGraphics->hasByName(rName))
    1090           0 :         || (m_pImpl->m_xObjects.is() &&
    1091           0 :             m_pImpl->m_xObjects->hasByName(rName));
    1092             : }
    1093             : 
    1094           0 : void XMLTextImportHelper::InsertString( const OUString& rChars )
    1095             : {
    1096             :     DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
    1097             :     DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
    1098           0 :     if (m_pImpl->m_xText.is())
    1099             :     {
    1100           0 :         m_pImpl->m_xText->insertString(m_pImpl->m_xCursorAsRange,
    1101           0 :             rChars, sal_False);
    1102             :     }
    1103           0 : }
    1104             : 
    1105           0 : void XMLTextImportHelper::InsertString( const OUString& rChars,
    1106             :                                         bool& rIgnoreLeadingSpace )
    1107             : {
    1108             :     DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
    1109             :     DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
    1110           0 :     if (m_pImpl->m_xText.is())
    1111             :     {
    1112           0 :         sal_Int32 nLen = rChars.getLength();
    1113           0 :         OUStringBuffer sChars( nLen );
    1114             : 
    1115           0 :         for( sal_Int32 i=0; i < nLen; i++ )
    1116             :         {
    1117           0 :             sal_Unicode c = rChars[i];
    1118           0 :             switch( c )
    1119             :             {
    1120             :                 case 0x20:
    1121             :                 case 0x09:
    1122             :                 case 0x0a:
    1123             :                 case 0x0d:
    1124           0 :                     if( !rIgnoreLeadingSpace )
    1125           0 :                         sChars.append( (sal_Unicode)0x20 );
    1126           0 :                     rIgnoreLeadingSpace = true;
    1127           0 :                     break;
    1128             :                 default:
    1129           0 :                     rIgnoreLeadingSpace = false;
    1130           0 :                     sChars.append( c );
    1131           0 :                     break;
    1132             :             }
    1133             :         }
    1134           0 :         m_pImpl->m_xText->insertString(m_pImpl->m_xCursorAsRange,
    1135           0 :                                        sChars.makeStringAndClear(), sal_False);
    1136             :     }
    1137           0 : }
    1138             : 
    1139           0 : void XMLTextImportHelper::InsertControlCharacter( sal_Int16 nControl )
    1140             : {
    1141             :     DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
    1142             :     DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
    1143           0 :     if (m_pImpl->m_xText.is())
    1144             :     {
    1145           0 :         m_pImpl->m_xText->insertControlCharacter(
    1146           0 :             m_pImpl->m_xCursorAsRange, nControl, sal_False);
    1147             :     }
    1148           0 : }
    1149             : 
    1150           0 : void XMLTextImportHelper::InsertTextContent(
    1151             :     Reference < XTextContent > & xContent )
    1152             : {
    1153             :     DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
    1154             :     DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
    1155           0 :     if (m_pImpl->m_xText.is())
    1156             :     {
    1157             :         try {
    1158           0 :             m_pImpl->m_xText->insertTextContent( m_pImpl->m_xCursorAsRange, xContent, sal_False);
    1159           0 :         } catch ( const lang::IllegalArgumentException & )
    1160             :         {
    1161             :             SAL_WARN( "xmloff", "Cannot import part of the text - probably an image in the text frame?" );
    1162             :         }
    1163             :     }
    1164           0 : }
    1165             : 
    1166           0 : void XMLTextImportHelper::DeleteParagraph()
    1167             : {
    1168             :     DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
    1169             :     DBG_ASSERT(m_pImpl->m_xCursor.is(), "no cursor");
    1170             :     DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
    1171             : 
    1172           0 :     bool bDelete = true;
    1173             :     Reference < XEnumerationAccess > const xEnumAccess(
    1174           0 :         m_pImpl->m_xCursor, UNO_QUERY);
    1175           0 :     if( xEnumAccess.is() )
    1176             :     {
    1177           0 :         Reference < XEnumeration > xEnum(xEnumAccess->createEnumeration());
    1178             :         DBG_ASSERT( xEnum->hasMoreElements(), "empty text enumeration" );
    1179           0 :         if( xEnum->hasMoreElements() )
    1180             :         {
    1181           0 :             Reference < XComponent > xComp( xEnum->nextElement(), UNO_QUERY );
    1182             :             DBG_ASSERT( xComp.is(), "got no component" );
    1183           0 :             if( xComp.is() )
    1184             :             {
    1185           0 :                 xComp->dispose();
    1186           0 :                 bDelete = false;
    1187           0 :             }
    1188           0 :         }
    1189             :     }
    1190           0 :     if( bDelete )
    1191             :     {
    1192           0 :         if (m_pImpl->m_xCursor->goLeft( 1, sal_True ))
    1193             :         {
    1194           0 :             OUString sEmpty;
    1195           0 :             m_pImpl->m_xText->insertString(m_pImpl->m_xCursorAsRange,
    1196           0 :                                            sEmpty, sal_True);
    1197             :         }
    1198           0 :     }
    1199           0 : }
    1200             : 
    1201           0 : OUString XMLTextImportHelper::ConvertStarFonts( const OUString& rChars,
    1202             :                                                 const OUString& rStyleName,
    1203             :                                                 sal_uInt8& rFlags,
    1204             :                                                 bool bPara,
    1205             :                                                 SvXMLImport& rImport ) const
    1206             : {
    1207           0 :     OUStringBuffer sChars( rChars );
    1208           0 :     bool bConverted = false;
    1209           0 :     for( sal_Int32 j=0; j<rChars.getLength(); j++ )
    1210             :     {
    1211           0 :         sal_Unicode c = rChars[j];
    1212           0 :         if( c >= 0xf000 && c <= 0xf0ff )
    1213             :         {
    1214           0 :             if( (rFlags & CONV_STAR_FONT_FLAGS_VALID) == 0 )
    1215             :             {
    1216           0 :                 XMLTextStyleContext *pStyle = 0;
    1217             :                 sal_uInt16 nFamily = bPara ? XML_STYLE_FAMILY_TEXT_PARAGRAPH
    1218           0 :                                            : XML_STYLE_FAMILY_TEXT_TEXT;
    1219           0 :                 if (!rStyleName.isEmpty() && m_pImpl->m_xAutoStyles.Is())
    1220             :                 {
    1221             :                     const SvXMLStyleContext* pTempStyle =
    1222           0 :                         ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
    1223             :                                 FindStyleChildContext( nFamily, rStyleName,
    1224           0 :                                                        true );
    1225           0 :                     pStyle = PTR_CAST( XMLTextStyleContext,pTempStyle);
    1226             :                 }
    1227             : 
    1228           0 :                 if( pStyle )
    1229             :                 {
    1230           0 :                     sal_Int32 nCount = pStyle->_GetProperties().size();
    1231           0 :                     if( nCount )
    1232             :                     {
    1233             :                         UniReference < SvXMLImportPropertyMapper > xImpPrMap =
    1234           0 :                             ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)
    1235           0 :                                 ->GetImportPropertyMapper(nFamily);
    1236           0 :                         if( xImpPrMap.is() )
    1237             :                         {
    1238             :                             UniReference<XMLPropertySetMapper> rPropMapper =
    1239           0 :                                 xImpPrMap->getPropertySetMapper();
    1240           0 :                             for( sal_Int32 i=0; i < nCount; i++ )
    1241             :                             {
    1242           0 :                                 const XMLPropertyState& rProp = pStyle->_GetProperties()[i];
    1243           0 :                                 sal_Int32 nIdx = rProp.mnIndex;
    1244           0 :                                 sal_uInt32 nContextId = rPropMapper->GetEntryContextId(nIdx);
    1245           0 :                                 if( CTF_FONTFAMILYNAME == nContextId )
    1246             :                                 {
    1247           0 :                                     rFlags &= ~(CONV_FROM_STAR_BATS|CONV_FROM_STAR_MATH);
    1248           0 :                                     OUString sFontName;
    1249           0 :                                     rProp.maValue >>= sFontName;
    1250           0 :                                     OUString sStarBats( "StarBats"  );
    1251           0 :                                     OUString sStarMath( "StarMath"  );
    1252           0 :                                     if( sFontName.equalsIgnoreAsciiCase( sStarBats  ) )
    1253           0 :                                         rFlags |= CONV_FROM_STAR_BATS;
    1254           0 :                                     else if( sFontName.equalsIgnoreAsciiCase( sStarMath ) )
    1255           0 :                                         rFlags |= CONV_FROM_STAR_MATH;
    1256           0 :                                     break;
    1257             :                                 }
    1258           0 :                             }
    1259           0 :                         }
    1260             :                     }
    1261             : 
    1262             :                 }
    1263             : 
    1264           0 :                 rFlags |= CONV_STAR_FONT_FLAGS_VALID;
    1265             :             }
    1266           0 :             if( (rFlags & CONV_FROM_STAR_BATS ) != 0 )
    1267             :             {
    1268           0 :                 sChars[j] = rImport.ConvStarBatsCharToStarSymbol( c );
    1269           0 :                 bConverted = true;
    1270             :             }
    1271           0 :             else if( (rFlags & CONV_FROM_STAR_MATH ) != 0 )
    1272             :             {
    1273           0 :                 sChars[j] = rImport.ConvStarMathCharToStarSymbol( c );
    1274           0 :                 bConverted = true;
    1275             :             }
    1276             :         }
    1277             :     }
    1278             : 
    1279           0 :     return bConverted ? sChars.makeStringAndClear() : rChars;
    1280             : }
    1281             : 
    1282             : /* Helper method to determine, if a paragraph style has a list style (inclusive
    1283             :    an empty one) inherits a list style (inclusive an empty one) from one of its parents (#i69629#)
    1284             : */
    1285             : /* Apply special case, that found list style equals the chapter numbering, also
    1286             :    to the found list styles of the parent styles. (#i73973#)
    1287             : */
    1288           0 : static bool lcl_HasListStyle( const OUString& sStyleName,
    1289             :                                   const Reference < XNameContainer >& xParaStyles,
    1290             :                                   SvXMLImport& rImport,
    1291             :                                   const OUString& sNumberingStyleName,
    1292             :                                   const OUString& sOutlineStyleName )
    1293             : {
    1294           0 :     bool bRet( false );
    1295             : 
    1296           0 :     if ( !xParaStyles->hasByName( sStyleName ) )
    1297             :     {
    1298             :         // error case
    1299           0 :         return true;
    1300             :     }
    1301             : 
    1302           0 :     Reference< XPropertyState > xPropState( xParaStyles->getByName( sStyleName ),
    1303           0 :                                             UNO_QUERY );
    1304           0 :     if ( !xPropState.is() )
    1305             :     {
    1306             :         // error case
    1307           0 :         return false;
    1308             :     }
    1309             : 
    1310           0 :     if ( xPropState->getPropertyState( sNumberingStyleName ) == PropertyState_DIRECT_VALUE )
    1311             :     {
    1312             :         // list style found
    1313           0 :         bRet = true;
    1314             :         // special case: the set list style equals the chapter numbering
    1315           0 :         Reference< XPropertySet > xPropSet( xPropState, UNO_QUERY );
    1316           0 :         if ( xPropSet.is() )
    1317             :         {
    1318           0 :             OUString sListStyle;
    1319           0 :             xPropSet->getPropertyValue( sNumberingStyleName ) >>= sListStyle;
    1320           0 :             if ( !sListStyle.isEmpty() &&
    1321           0 :                  sListStyle == sOutlineStyleName )
    1322             :             {
    1323           0 :                 bRet = false;
    1324           0 :             }
    1325           0 :         }
    1326             :     }
    1327             :     else
    1328             :     {
    1329             :         // Tools.Outline settings lost on Save (#i77708#)
    1330           0 :         sal_Int32 nUPD( 0 );
    1331           0 :         sal_Int32 nBuild( 0 );
    1332             :         // Don't use UPD for versioning: xmloff/source/text/txtstyli.cxx and txtimp.cxx (#i86058#)
    1333           0 :         const bool bBuildIdFound = rImport.getBuildIds( nUPD, nBuild );
    1334             :         // search list style at parent
    1335           0 :         Reference<XStyle> xStyle( xPropState, UNO_QUERY );
    1336           0 :         while ( xStyle.is() )
    1337             :         {
    1338           0 :             OUString aParentStyle( xStyle->getParentStyle() );
    1339           0 :             if ( !aParentStyle.isEmpty() )
    1340             :             {
    1341           0 :                 aParentStyle =
    1342             :                     rImport.GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_PARAGRAPH,
    1343           0 :                                                  aParentStyle );
    1344             :             }
    1345           0 :             if ( aParentStyle.isEmpty() || !xParaStyles->hasByName( aParentStyle ) )
    1346             :             {
    1347             :                 // no list style found
    1348           0 :                 break;
    1349             :             }
    1350             :             else
    1351             :             {
    1352           0 :                 xPropState = Reference< XPropertyState >(
    1353           0 :                                     xParaStyles->getByName( aParentStyle ),
    1354           0 :                                     UNO_QUERY );
    1355           0 :                 if ( !xPropState.is() )
    1356             :                 {
    1357             :                     // error case
    1358           0 :                     return true;
    1359             :                 }
    1360           0 :                 if ( xPropState->getPropertyState( sNumberingStyleName ) == PropertyState_DIRECT_VALUE )
    1361             :                 {
    1362             :                     // list style found
    1363           0 :                     bRet = true;
    1364             :                     // Special case: the found list style equals the chapter numbering (#i73973#)
    1365           0 :                     Reference< XPropertySet > xPropSet( xPropState, UNO_QUERY );
    1366           0 :                     if ( xPropSet.is() )
    1367             :                     {
    1368           0 :                         OUString sListStyle;
    1369           0 :                         xPropSet->getPropertyValue( sNumberingStyleName ) >>= sListStyle;
    1370           0 :                         if ( !sListStyle.isEmpty() &&
    1371           0 :                              sListStyle == sOutlineStyleName )
    1372             :                         {
    1373           0 :                             bRet = false;
    1374             :                         }
    1375             :                         // Special handling for text documents from OOo version prior OOo 2.4 (#i77708#)
    1376             :                         /* Check explicitly on certain versions and on import of
    1377             :                            text documents in OpenOffice.org file format (#i86058#)
    1378             :                         */
    1379           0 :                         else if ( sListStyle.isEmpty() &&
    1380           0 :                                   ( rImport.IsTextDocInOOoFileFormat() ||
    1381           0 :                                     ( bBuildIdFound &&
    1382           0 :                                       ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
    1383           0 :                                         ( nUPD == 680 && nBuild <= 9238 ) ) ) ) ) // OOo 2.0 - OOo 2.3.1
    1384             :                         {
    1385           0 :                             bRet = false;
    1386           0 :                         }
    1387             :                     }
    1388           0 :                     break;
    1389             :                 }
    1390             :                 else
    1391             :                 {
    1392             :                     // search list style at parent
    1393           0 :                     xStyle = Reference<XStyle>( xPropState, UNO_QUERY );
    1394             :                 }
    1395             :             }
    1396           0 :         }
    1397             :     }
    1398             : 
    1399           0 :     return bRet;
    1400             : }
    1401           0 : OUString XMLTextImportHelper::SetStyleAndAttrs(
    1402             :         SvXMLImport& rImport,
    1403             :         const Reference < XTextCursor >& rCursor,
    1404             :         const OUString& rStyleName,
    1405             :         bool bPara,
    1406             :         bool bOutlineLevelAttrFound,
    1407             :         sal_Int8 nOutlineLevel,
    1408             :         // Numberings/Bullets in table not visible after save/reload (#i80724#)
    1409             :         bool bSetListAttrs )
    1410             : {
    1411           0 :     static OUString s_ParaStyleName( "ParaStyleName");
    1412           0 :     static OUString s_CharStyleName( "CharStyleName");
    1413           0 :     static OUString s_NumberingRules( "NumberingRules");
    1414           0 :     static OUString s_NumberingIsNumber( "NumberingIsNumber");
    1415           0 :     static OUString s_NumberingLevel( "NumberingLevel");
    1416           0 :     static OUString s_ParaIsNumberingRestart( "ParaIsNumberingRestart");
    1417           0 :     static OUString s_NumberingStartValue( "NumberingStartValue");
    1418           0 :     static OUString s_PropNameListId( "ListId");
    1419           0 :     static OUString s_PageDescName( "PageDescName");
    1420           0 :     static OUString s_ServiceCombinedCharacters( "com.sun.star.text.TextField.CombinedCharacters");
    1421           0 :     static OUString s_Content("Content");
    1422           0 :     static OUString s_OutlineLevel( "OutlineLevel");
    1423           0 :     static OUString s_NumberingStyleName( "NumberingStyleName");
    1424             : 
    1425             :     const sal_uInt16 nFamily = bPara ? XML_STYLE_FAMILY_TEXT_PARAGRAPH
    1426           0 :                                      : XML_STYLE_FAMILY_TEXT_TEXT;
    1427           0 :     XMLTextStyleContext *pStyle = 0;
    1428           0 :     OUString sStyleName( rStyleName );
    1429           0 :     if (!sStyleName.isEmpty() && m_pImpl->m_xAutoStyles.Is())
    1430             :     {
    1431             :         const SvXMLStyleContext* pTempStyle =
    1432           0 :             ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
    1433           0 :                     FindStyleChildContext( nFamily, sStyleName, true );
    1434           0 :         pStyle = PTR_CAST( XMLTextStyleContext,pTempStyle);
    1435             :     }
    1436           0 :     if( pStyle )
    1437           0 :         sStyleName = pStyle->GetParentName();
    1438             : 
    1439           0 :     Reference < XPropertySet > xPropSet( rCursor, UNO_QUERY );
    1440             :     Reference< XPropertySetInfo > xPropSetInfo(
    1441           0 :         xPropSet->getPropertySetInfo());
    1442             : 
    1443             :     // style
    1444           0 :     if( !sStyleName.isEmpty() )
    1445             :     {
    1446           0 :         sStyleName = rImport.GetStyleDisplayName( nFamily, sStyleName );
    1447           0 :         const OUString& rPropName = (bPara) ? s_ParaStyleName : s_CharStyleName;
    1448             :         const Reference < XNameContainer > & rStyles = (bPara)
    1449           0 :             ? m_pImpl->m_xParaStyles
    1450           0 :             : m_pImpl->m_xTextStyles;
    1451           0 :         if( rStyles.is() &&
    1452           0 :             xPropSetInfo->hasPropertyByName( rPropName ) &&
    1453           0 :             rStyles->hasByName( sStyleName ) )
    1454             :         {
    1455           0 :             xPropSet->setPropertyValue( rPropName, makeAny(sStyleName) );
    1456             :         }
    1457             :         else
    1458           0 :             sStyleName = OUString();
    1459             :     }
    1460             : 
    1461             :     /* The outline level needs to be only applied as list level, if the heading
    1462             :        is not inside a list and if it by default applies the outline style. (#i70748#)
    1463             :     */
    1464           0 :     bool bApplyOutlineLevelAsListLevel( false );
    1465             :     // Numberings/Bullets in table not visible after save/reload (#i80724#)
    1466           0 :     if (bSetListAttrs && bPara
    1467           0 :         && xPropSetInfo->hasPropertyByName( s_NumberingRules))
    1468             :     {
    1469             :         // Set numbering rules
    1470             :         Reference< XIndexReplace > const xNumRules(
    1471           0 :                 xPropSet->getPropertyValue(s_NumberingRules), UNO_QUERY);
    1472             : 
    1473           0 :         XMLTextListBlockContext * pListBlock(0);
    1474           0 :         XMLTextListItemContext  * pListItem(0);
    1475           0 :         XMLNumberedParaContext  * pNumberedParagraph(0);
    1476           0 :         GetTextListHelper().ListContextTop(
    1477           0 :             pListBlock, pListItem, pNumberedParagraph);
    1478             : 
    1479             :         OSL_ENSURE(!(pListBlock && pNumberedParagraph), "XMLTextImportHelper::"
    1480             :             "SetStyleAndAttrs: both list and numbered-paragraph???");
    1481             : 
    1482           0 :         Reference < XIndexReplace > xNewNumRules;
    1483           0 :         sal_Int8 nLevel(-1);
    1484           0 :         OUString sListId;
    1485           0 :         sal_Int16 nStartValue(-1);
    1486           0 :         bool bNumberingIsNumber(true);
    1487             : 
    1488           0 :         if (pListBlock) {
    1489             : 
    1490           0 :             if (!pListItem) {
    1491           0 :                 bNumberingIsNumber = false; // list-header
    1492             :             }
    1493             :             // consider text:style-override property of <text:list-item>
    1494             :             xNewNumRules.set(
    1495           0 :                 (pListItem != 0 && pListItem->HasNumRulesOverride())
    1496           0 :                     ? pListItem->GetNumRulesOverride()
    1497           0 :                     : pListBlock->GetNumRules() );
    1498           0 :             nLevel = static_cast<sal_Int8>(pListBlock->GetLevel());
    1499             : 
    1500           0 :             if ( pListItem && pListItem->HasStartValue() ) {
    1501           0 :                nStartValue = pListItem->GetStartValue();
    1502             :             }
    1503             : 
    1504             :             // Inconsistent behavior regarding lists (#i92811#)
    1505           0 :             sListId = m_pImpl->m_pTextListsHelper->GetListIdForListBlock(
    1506           0 :                             *pListBlock);
    1507             :         }
    1508           0 :         else if (pNumberedParagraph)
    1509             :         {
    1510           0 :             xNewNumRules.set(pNumberedParagraph->GetNumRules());
    1511           0 :             nLevel = static_cast<sal_Int8>(pNumberedParagraph->GetLevel());
    1512           0 :             sListId = pNumberedParagraph->GetListId();
    1513           0 :             nStartValue = pNumberedParagraph->GetStartValue();
    1514             :         }
    1515             : 
    1516             : 
    1517           0 :         if (pListBlock || pNumberedParagraph)
    1518             :         {
    1519             :             // Assure that list style of automatic paragraph style is applied at paragraph. (#i101349#)
    1520           0 :             bool bApplyNumRules = pStyle && pStyle->IsListStyleSet();
    1521           0 :             if ( !bApplyNumRules )
    1522             :             {
    1523           0 :                 bool bSameNumRules = xNewNumRules == xNumRules;
    1524           0 :                 if( !bSameNumRules && xNewNumRules.is() && xNumRules.is() )
    1525             :                 {
    1526             :                     // If the interface pointers are different then this does
    1527             :                     // not mean that the num rules are different. Further tests
    1528             :                     // are required then. However, if only one num rule is
    1529             :                     // set, no tests are required of course.
    1530           0 :                     Reference< XNamed > xNewNamed( xNewNumRules, UNO_QUERY );
    1531           0 :                     Reference< XNamed > xNamed( xNumRules, UNO_QUERY );
    1532           0 :                     if( xNewNamed.is() && xNamed.is() )
    1533             :                     {
    1534           0 :                         bSameNumRules = xNewNamed->getName() == xNamed->getName();
    1535             :                     }
    1536             :                     else
    1537             :                     {
    1538           0 :                         Reference< XAnyCompare > xNumRuleCompare( xNumRules, UNO_QUERY );
    1539           0 :                         if( xNumRuleCompare.is() )
    1540             :                         {
    1541           0 :                             bSameNumRules = (xNumRuleCompare->compare( Any(xNumRules), Any(xNewNumRules) ) == 0);
    1542           0 :                         }
    1543           0 :                     }
    1544             :                 }
    1545           0 :                 bApplyNumRules = !bSameNumRules;
    1546             :             }
    1547             : 
    1548           0 :             if ( bApplyNumRules )
    1549             :             {
    1550             :                 // #102607# This may except when xNewNumRules contains
    1551             :                 // a Writer-NumRule-Implementation bug gets applied to
    1552             :                 // a shape. Since this may occur inside a document
    1553             :                 // (e.g. when edited), this must be handled
    1554             :                 // gracefully.
    1555             :                 try
    1556             :                 {
    1557           0 :                     xPropSet->setPropertyValue(
    1558           0 :                         s_NumberingRules, makeAny(xNewNumRules) );
    1559             :                 }
    1560           0 :                 catch(const Exception&)
    1561             :                 {
    1562             :                     ; // I would really like to use a warning here,
    1563             :                       // but I can't access the XMLErrorHandler from
    1564             :                       // here.
    1565             :                 }
    1566             :             }
    1567             : 
    1568           0 :             if (!bNumberingIsNumber &&
    1569           0 :                 xPropSetInfo->hasPropertyByName(s_NumberingIsNumber))
    1570             :             {
    1571           0 :                 xPropSet->setPropertyValue(s_NumberingIsNumber, Any(sal_False));
    1572             :             }
    1573             : 
    1574           0 :             xPropSet->setPropertyValue( s_NumberingLevel, Any(nLevel) );
    1575             : 
    1576           0 :             if( pListBlock && pListBlock->IsRestartNumbering() )
    1577             :             {
    1578             :                 // TODO: property missing
    1579           0 :                 if (xPropSetInfo->hasPropertyByName(s_ParaIsNumberingRestart))
    1580             :                 {
    1581           0 :                     sal_Bool bTmp = sal_True;
    1582           0 :                     xPropSet->setPropertyValue(s_ParaIsNumberingRestart,
    1583           0 :                                                makeAny(bTmp) );
    1584             :                 }
    1585           0 :                 pListBlock->ResetRestartNumbering();
    1586             :             }
    1587             : 
    1588           0 :             if ( 0 <= nStartValue &&
    1589           0 :                 xPropSetInfo->hasPropertyByName(s_NumberingStartValue))
    1590             :             {
    1591           0 :                 xPropSet->setPropertyValue(s_NumberingStartValue,
    1592           0 :                                            makeAny(nStartValue));
    1593             :             }
    1594             : 
    1595           0 :             if (xPropSetInfo->hasPropertyByName(s_PropNameListId))
    1596             :             {
    1597           0 :                 if (!sListId.isEmpty()) {
    1598           0 :                     xPropSet->setPropertyValue(s_PropNameListId,
    1599           0 :                         makeAny(sListId) );
    1600             :                 }
    1601             :             }
    1602             : 
    1603           0 :             GetTextListHelper().SetListItem( (XMLTextListItemContext *)0 );
    1604             :         }
    1605             :         else
    1606             :         {
    1607             :             /* If the paragraph is not in a list but its style, remove it from
    1608             :                the list. Do not remove it, if the list of the style is
    1609             :                the chapter numbering rule.
    1610             :             */
    1611           0 :             if( xNumRules.is() )
    1612             :             {
    1613           0 :                 bool bRemove( true );
    1614             :                 // Special handling for document from OOo 2.x (#i70748#)
    1615           0 :                 sal_Int32 nUPD( 0 );
    1616           0 :                 sal_Int32 nBuild( 0 );
    1617           0 :                 const bool bBuildIdFound = rImport.getBuildIds( nUPD, nBuild );
    1618             :                 DBG_ASSERT( ( bBuildIdFound && nUPD == 680 ) ||
    1619             :                             !pStyle ||
    1620             :                             !pStyle->IsListStyleSet() ||
    1621             :                             pStyle->GetListStyle().isEmpty(),
    1622             :                             "automatic paragraph style with list style name, but paragraph not in list???" );
    1623           0 :                 if ( ( bBuildIdFound && nUPD == 680 ) ||
    1624           0 :                      !pStyle || !pStyle->IsListStyleSet() )
    1625             :                 {
    1626           0 :                     if (m_pImpl->m_xChapterNumbering.is())
    1627             :                     {
    1628           0 :                         Reference< XNamed > xNumNamed( xNumRules, UNO_QUERY );
    1629             :                         Reference< XNamed > const xChapterNumNamed (
    1630           0 :                             m_pImpl->m_xChapterNumbering, UNO_QUERY);
    1631           0 :                         if ( xNumNamed.is() && xChapterNumNamed.is() &&
    1632           0 :                              xNumNamed->getName() == xChapterNumNamed->getName() )
    1633             :                         {
    1634           0 :                             bRemove = false;
    1635             :                             // RFE: inserting headings into text documents (#i70748#)
    1636           0 :                             bApplyOutlineLevelAsListLevel = true;
    1637           0 :                         }
    1638             :                     }
    1639             :                 }
    1640           0 :                 if ( bRemove )
    1641             :                 {
    1642           0 :                     xPropSet->setPropertyValue( s_NumberingRules, Any() );
    1643             :                 }
    1644             :             }
    1645           0 :         }
    1646             :     }
    1647             : 
    1648             :     // hard paragraph properties
    1649           0 :     if( pStyle )
    1650             :     {
    1651           0 :         pStyle->FillPropertySet( xPropSet );
    1652           0 :         if( bPara && pStyle->HasMasterPageName() &&
    1653           0 :             xPropSetInfo->hasPropertyByName(s_PageDescName))
    1654             :         {
    1655             :             OUString sDisplayName(
    1656             :                 rImport.GetStyleDisplayName(
    1657             :                                 XML_STYLE_FAMILY_MASTER_PAGE,
    1658           0 :                                 pStyle->GetMasterPageName()) );
    1659           0 :             if( sDisplayName.isEmpty() ||
    1660           0 :                 (m_pImpl->m_xPageStyles.is() &&
    1661           0 :                  m_pImpl->m_xPageStyles->hasByName( sDisplayName)))
    1662             :             {
    1663           0 :                 xPropSet->setPropertyValue(s_PageDescName,
    1664           0 :                         makeAny(sDisplayName));
    1665           0 :             }
    1666             :         }
    1667           0 :         if( bPara && !pStyle->GetDropCapStyleName().isEmpty() &&
    1668           0 :             m_pImpl->m_xTextStyles.is())
    1669             :         {
    1670             :             OUString sDisplayName(
    1671             :                 rImport.GetStyleDisplayName(
    1672             :                                 XML_STYLE_FAMILY_TEXT_TEXT,
    1673           0 :                                 pStyle->GetDropCapStyleName()) );
    1674           0 :             if (m_pImpl->m_xTextStyles->hasByName(sDisplayName) &&
    1675           0 :                 xPropSetInfo->hasPropertyByName( pStyle->sDropCapCharStyleName ) )
    1676             :             {
    1677           0 :                 xPropSet->setPropertyValue( pStyle->sDropCapCharStyleName, makeAny(sDisplayName) );
    1678           0 :             }
    1679             :         }
    1680             : 
    1681             :         // combined characters special treatment
    1682           0 :         if (!bPara && pStyle->HasCombinedCharactersLetter())
    1683             :         {
    1684             :             // insert combined characters text field
    1685           0 :             if (m_pImpl->m_xServiceFactory.is())
    1686             :             {
    1687             :                 uno::Reference<beans::XPropertySet> const xTmp(
    1688           0 :                     m_pImpl->m_xServiceFactory->createInstance(
    1689           0 :                         s_ServiceCombinedCharacters), UNO_QUERY);
    1690           0 :                 if( xTmp.is() )
    1691             :                 {
    1692             :                     // fix cursor if larger than possible for
    1693             :                     // combined characters field
    1694           0 :                     if (rCursor->getString().getLength() >
    1695             :                             MAX_COMBINED_CHARACTERS)
    1696             :                     {
    1697           0 :                         rCursor->gotoRange(rCursor->getStart(), sal_False);
    1698           0 :                         rCursor->goRight(MAX_COMBINED_CHARACTERS, sal_True);
    1699             :                     }
    1700             : 
    1701             :                     // set field value (the combined character string)
    1702           0 :                     xTmp->setPropertyValue(s_Content,
    1703           0 :                         makeAny(rCursor->getString()));
    1704             : 
    1705             :                     // insert the field over it's original text
    1706           0 :                     Reference<XTextContent> xTextContent(xTmp, UNO_QUERY);
    1707           0 :                     if (m_pImpl->m_xText.is() && rCursor.is())
    1708             :                     {
    1709             :                         // #i107225# the combined characters need to be inserted first
    1710             :                         // the selected text has to be removed afterwards
    1711           0 :                         m_pImpl->m_xText->insertTextContent( rCursor->getStart(), xTextContent, sal_True );
    1712             : 
    1713           0 :                         if( !rCursor->getString().isEmpty() )
    1714             :                         {
    1715             :                             try
    1716             :                             {
    1717           0 :                                 uno::Reference< text::XTextCursor > xCrsr = rCursor->getText()->createTextCursorByRange( rCursor->getStart() );
    1718           0 :                                 xCrsr->goLeft( 1, true );
    1719           0 :                                 uno::Reference< beans::XPropertySet> xCrsrProperties( xCrsr, uno::UNO_QUERY_THROW );
    1720             :                                 //the hard properties of the removed text need to be applied to the combined characters field
    1721           0 :                                 pStyle->FillPropertySet( xCrsrProperties );
    1722           0 :                                 xCrsr->collapseToEnd();
    1723           0 :                                 xCrsr->gotoRange( rCursor->getEnd(), true );
    1724           0 :                                 xCrsr->setString( OUString() );
    1725             :                             }
    1726           0 :                             catch(const uno::Exception&)
    1727             :                             {
    1728             :                             }
    1729             :                         }
    1730           0 :                     }
    1731           0 :                 }
    1732             :             }
    1733             :         }
    1734             :     }
    1735             : 
    1736             :     // outline level; set after list style has been set
    1737             :     // Complete re-worked and corrected: (#i53198#)
    1738             :     // - set outline level at paragraph
    1739             :     // - set numbering level at paragraph, if none is already set
    1740             :     // - assure that style is marked as an outline style for the corresponding
    1741             :     //   outline level.
    1742             :     // - DO NOT set type of numbering rule to outline.
    1743             :     // - DO NOT set numbering rule directly at the paragraph.
    1744             : 
    1745             :     // Some minor rework and adjust access to paragraph styles (#i70748#)
    1746           0 :     if ( bPara )
    1747             :     {
    1748             :         // Headings not numbered anymore in 3.1 (#i103817#)
    1749           0 :         sal_Int16 nCurrentOutlineLevelInheritedFromParagraphStyle = 0;
    1750             :         const bool bHasOutlineLevelProp(
    1751           0 :             xPropSetInfo->hasPropertyByName(s_OutlineLevel));
    1752           0 :         if ( bHasOutlineLevelProp )
    1753             :         {
    1754           0 :             xPropSet->getPropertyValue(s_OutlineLevel)
    1755           0 :                 >>= nCurrentOutlineLevelInheritedFromParagraphStyle;
    1756             :         }
    1757           0 :         if ( nOutlineLevel > 0 )
    1758             :         {
    1759           0 :             if ( bHasOutlineLevelProp )
    1760             :             {
    1761             :                 // In case that the value equals the value of its paragraph style
    1762             :                 // attribute outline level, the paragraph attribute value is left unset
    1763           0 :                 if ( nCurrentOutlineLevelInheritedFromParagraphStyle != nOutlineLevel )
    1764             :                 {
    1765           0 :                     xPropSet->setPropertyValue( s_OutlineLevel,
    1766           0 :                         makeAny( static_cast<sal_Int16>(nOutlineLevel) ) );
    1767             :                 }
    1768             :             }
    1769             : 
    1770             :             // RFE: inserting headings into text documents (#i70748#)
    1771           0 :             if ( bApplyOutlineLevelAsListLevel )
    1772             :             {
    1773           0 :                 sal_Int16 nNumLevel = -1;
    1774           0 :                 xPropSet->getPropertyValue( s_NumberingLevel ) >>= nNumLevel;
    1775           0 :                 if ( nNumLevel == -1 ||
    1776           0 :                      nNumLevel != (nOutlineLevel - 1) )
    1777             :                 {
    1778           0 :                     xPropSet->setPropertyValue( s_NumberingLevel,
    1779           0 :                             makeAny( static_cast<sal_Int8>(nOutlineLevel - 1) ) );
    1780             :                 }
    1781             :             }
    1782             :             /* Correction: (#i69629#)
    1783             :                - for text document from version OOo 2.0.4/SO 8 PU4 and earlier
    1784             :                  the paragraph style of a heading should be assigned to the
    1785             :                  corresponding list level of the outline style.
    1786             :                - for other text documents the paragraph style of a heading is only
    1787             :                  a candidate for an assignment to the list level of the outline
    1788             :                  style, if it has no direct list style property and (if exists) the
    1789             :                  automatic paragraph style has also no direct list style set.
    1790             :             */
    1791           0 :             if (m_pImpl->m_xParaStyles.is() && m_pImpl->m_xParaStyles->hasByName(sStyleName))
    1792             :             {
    1793           0 :                 bool bOutlineStyleCandidate( false );
    1794             : 
    1795           0 :                 sal_Int32 nUPD( 0 );
    1796           0 :                 sal_Int32 nBuild( 0 );
    1797           0 :                 const bool bBuildIdFound = rImport.getBuildIds( nUPD, nBuild );
    1798             :                 // Lost outline numbering in master document (#i73509#)
    1799             :                 // Check explicitly on certain versions (#i86058#)
    1800           0 :                 if ( rImport.IsTextDocInOOoFileFormat() ||
    1801           0 :                      ( bBuildIdFound &&
    1802           0 :                        ( nUPD == 645 || nUPD == 641 ) ) )
    1803             :                 {
    1804           0 :                     bOutlineStyleCandidate = true;
    1805             :                 }
    1806           0 :                 else if ( nUPD == 680 && nBuild <= 9073 ) /* BuildId of OOo 2.0.4/SO8 PU4 */
    1807             :                 {
    1808           0 :                     bOutlineStyleCandidate = bOutlineLevelAttrFound;
    1809             :                 }
    1810           0 :                 if ( bOutlineStyleCandidate )
    1811             :                 {
    1812           0 :                     AddOutlineStyleCandidate( nOutlineLevel, sStyleName );
    1813             :                 }
    1814             :                 // Assure that heading applies the outline style (#i103817#)
    1815           0 :                 if ( ( !pStyle || !pStyle->IsListStyleSet() ) &&
    1816           0 :                      !bOutlineStyleCandidate &&
    1817           0 :                      m_pImpl->m_xChapterNumbering.is())
    1818             :                 {
    1819           0 :                     OUString sEmptyStr;
    1820           0 :                     if ( !lcl_HasListStyle( sStyleName,
    1821           0 :                                     m_pImpl->m_xParaStyles, GetXMLImport(),
    1822             :                                     s_NumberingStyleName,
    1823           0 :                                     sEmptyStr ) )
    1824             :                     {
    1825             :                         // heading not in a list --> apply outline style
    1826           0 :                         xPropSet->setPropertyValue( s_NumberingRules,
    1827           0 :                             makeAny(m_pImpl->m_xChapterNumbering) );
    1828           0 :                         xPropSet->setPropertyValue( s_NumberingLevel,
    1829           0 :                             makeAny(static_cast<sal_Int8>(nOutlineLevel - 1)));
    1830           0 :                     }
    1831             :                 }
    1832             :             }
    1833             :         }
    1834             :         //handle for text:p,if the paragraphstyle outlinelevel is set to[1~10]
    1835           0 :         else if( bHasOutlineLevelProp )
    1836             :         {
    1837           0 :             if ( nCurrentOutlineLevelInheritedFromParagraphStyle != 0 )
    1838             :             {
    1839           0 :                 sal_Int16 nZero = 0;
    1840           0 :                 xPropSet->setPropertyValue(s_OutlineLevel,
    1841           0 :                     makeAny( static_cast<sal_Int16>(nZero) ));
    1842             :             }
    1843             :         }
    1844             :     }
    1845             : 
    1846           0 :     return sStyleName;
    1847             : }
    1848             : 
    1849           0 : void XMLTextImportHelper::FindOutlineStyleName( OUString& rStyleName,
    1850             :                                                 sal_Int8 nOutlineLevel )
    1851             : {
    1852           0 :     static OUString s_HeadingStyleName( "HeadingStyleName");
    1853             : 
    1854             :     // style name empty?
    1855           0 :     if( rStyleName.isEmpty() )
    1856             :     {
    1857             :         // Empty? Then we need o do stuff. Let's do error checking first.
    1858           0 :         if (m_pImpl->m_xChapterNumbering.is() &&
    1859           0 :             ( nOutlineLevel > 0 ) &&
    1860           0 :             (nOutlineLevel <= m_pImpl->m_xChapterNumbering->getCount()))
    1861             :         {
    1862           0 :             nOutlineLevel--;   // for the remainder, the level's are 0-based
    1863             : 
    1864             :             // empty style name: look-up previously used name
    1865             : 
    1866             :             // if we don't have a previously used name, we'll use the default
    1867           0 :             m_pImpl->InitOutlineStylesCandidates();
    1868           0 :             if (m_pImpl->m_pOutlineStylesCandidates[nOutlineLevel].empty())
    1869             :             {
    1870             :                 // no other name used previously? Then use default
    1871             : 
    1872             :                 // iterate over property value sequence to find the style name
    1873           0 :                 Sequence<PropertyValue> aProperties;
    1874           0 :                 m_pImpl->m_xChapterNumbering->getByIndex( nOutlineLevel )
    1875           0 :                     >>= aProperties;
    1876           0 :                 for( sal_Int32 i = 0; i < aProperties.getLength(); i++ )
    1877             :                 {
    1878           0 :                     if (aProperties[i].Name == s_HeadingStyleName)
    1879             :                     {
    1880           0 :                         OUString aOutlineStyle;
    1881           0 :                         aProperties[i].Value >>= aOutlineStyle;
    1882           0 :                         m_pImpl->m_pOutlineStylesCandidates[nOutlineLevel]
    1883           0 :                             .push_back( aOutlineStyle );
    1884           0 :                         break;  // early out, if we found it!.
    1885             :                     }
    1886           0 :                 }
    1887             :             }
    1888             : 
    1889             :             // finally, we'll use the previously used style name for this
    1890             :             // format (or the default we've just put into that style)
    1891             :             // take last added one (#i71249#)
    1892             :             rStyleName =
    1893           0 :                 m_pImpl->m_pOutlineStylesCandidates[nOutlineLevel].back();
    1894             :         }
    1895             :         // else: nothing we can do, so we'll leave it empty
    1896             :     }
    1897             :     // else: we already had a style name, so we let it pass.
    1898           0 : }
    1899             : 
    1900           0 : void XMLTextImportHelper::AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel,
    1901             :                                                     const OUString& rStyleName )
    1902             : {
    1903           0 :     if (!rStyleName.isEmpty()
    1904           0 :         && m_pImpl->m_xChapterNumbering.is()
    1905           0 :         && (nOutlineLevel > 0)
    1906           0 :         && (nOutlineLevel <= m_pImpl->m_xChapterNumbering->getCount()))
    1907             :     {
    1908           0 :         m_pImpl->InitOutlineStylesCandidates();
    1909           0 :         m_pImpl->m_pOutlineStylesCandidates[nOutlineLevel-1].push_back(
    1910           0 :             rStyleName);
    1911             :     }
    1912           0 : }
    1913             : 
    1914           0 : void XMLTextImportHelper::SetOutlineStyles( bool bSetEmptyLevels )
    1915             : {
    1916           0 :     static OUString s_NumberingStyleName( "NumberingStyleName");
    1917           0 :     static OUString s_HeadingStyleName( "HeadingStyleName");
    1918             : 
    1919           0 :     if ((m_pImpl->m_pOutlineStylesCandidates != 0 || bSetEmptyLevels) &&
    1920           0 :          m_pImpl->m_xChapterNumbering.is() &&
    1921           0 :          !IsInsertMode())
    1922             :     {
    1923           0 :         bool bChooseLastOne( false );
    1924             :         {
    1925           0 :             if ( GetXMLImport().IsTextDocInOOoFileFormat() )
    1926             :             {
    1927           0 :                 bChooseLastOne = true;
    1928             :             }
    1929             :             else
    1930             :             {
    1931           0 :                 sal_Int32 nUPD( 0 );
    1932           0 :                 sal_Int32 nBuild( 0 );
    1933           0 :                 if ( GetXMLImport().getBuildIds( nUPD, nBuild ) )
    1934             :                 {
    1935             :                     // check explicitly on certain versions
    1936           0 :                     bChooseLastOne = ( nUPD == 641 ) || ( nUPD == 645 ) ||  // prior OOo 2.0
    1937           0 :                                      ( nUPD == 680 && nBuild <= 9073 ); // OOo 2.0 - OOo 2.0.4
    1938             :                 }
    1939             :             }
    1940             :         }
    1941             : 
    1942           0 :         OUString sOutlineStyleName;
    1943             :         {
    1944             :             Reference<XPropertySet> xChapterNumRule(
    1945           0 :                 m_pImpl->m_xChapterNumbering, UNO_QUERY);
    1946           0 :             const OUString sName("Name");
    1947           0 :             xChapterNumRule->getPropertyValue(sName) >>= sOutlineStyleName;
    1948             :         }
    1949             : 
    1950           0 :         const sal_Int32 nCount = m_pImpl->m_xChapterNumbering->getCount();
    1951             :         /* First collect all paragraph styles choosen for assignment to each
    1952             :            list level of the outline style, then perform the intrinsic assignment.
    1953             :            Reason: The assignment of a certain paragraph style to a list level
    1954             :                    of the outline style causes side effects on the children
    1955             :                    paragraph styles in Writer. (#i106218#)
    1956             :         */
    1957           0 :         ::std::vector<OUString> sChosenStyles(nCount);
    1958           0 :         for( sal_Int32 i=0; i < nCount; ++i )
    1959             :         {
    1960           0 :             if ( bSetEmptyLevels ||
    1961           0 :                  (m_pImpl->m_pOutlineStylesCandidates &&
    1962           0 :                   !m_pImpl->m_pOutlineStylesCandidates[i].empty()))
    1963             :             {
    1964             :                 // determine, which candidate is one to be assigned to the list
    1965             :                 // level of the outline style
    1966           0 :                 if (m_pImpl->m_pOutlineStylesCandidates &&
    1967           0 :                     !m_pImpl->m_pOutlineStylesCandidates[i].empty())
    1968             :                 {
    1969           0 :                     if ( bChooseLastOne )
    1970             :                     {
    1971           0 :                         sChosenStyles[i] =
    1972           0 :                         m_pImpl->m_pOutlineStylesCandidates[i].back();
    1973             :                     }
    1974             :                     else
    1975             :                     {
    1976           0 :                         for (sal_uInt32 j = 0;
    1977           0 :                             j < m_pImpl->m_pOutlineStylesCandidates[i].size();
    1978             :                             ++j)
    1979             :                         {
    1980           0 :                             if (!lcl_HasListStyle(
    1981           0 :                                     m_pImpl->m_pOutlineStylesCandidates[i][j],
    1982           0 :                                     m_pImpl->m_xParaStyles,
    1983           0 :                                     GetXMLImport(),
    1984             :                                     s_NumberingStyleName,
    1985           0 :                                     sOutlineStyleName))
    1986             :                             {
    1987           0 :                                 sChosenStyles[i] =
    1988           0 :                                     m_pImpl->m_pOutlineStylesCandidates[i][j];
    1989           0 :                                 break;
    1990             :                             }
    1991             :                         }
    1992             :                     }
    1993             :                 }
    1994             :             }
    1995             :         }
    1996             :         // Trashed outline numbering in ODF 1.1 text document created by OOo 3.x (#i106218#)
    1997           0 :         Sequence < PropertyValue > aProps( 1 );
    1998           0 :         PropertyValue *pProps = aProps.getArray();
    1999           0 :         pProps->Name = s_HeadingStyleName;
    2000           0 :         for ( sal_Int32 i = 0; i < nCount; ++i )
    2001             :         {
    2002             :             // Paragraph style assignments in Outline of template lost from second level on (#i107610#)
    2003           0 :             if ( bSetEmptyLevels || !sChosenStyles[i].isEmpty() )
    2004             :             {
    2005           0 :                 pProps->Value <<= sChosenStyles[i];
    2006           0 :                 m_pImpl->m_xChapterNumbering->replaceByIndex(i,
    2007           0 :                         makeAny( aProps ));
    2008             :             }
    2009           0 :         }
    2010             :     }
    2011           0 : }
    2012             : 
    2013           0 : void XMLTextImportHelper::SetHyperlink(
    2014             :     SvXMLImport& rImport,
    2015             :     const Reference < XTextCursor >& rCursor,
    2016             :     const OUString& rHRef,
    2017             :     const OUString& rName,
    2018             :     const OUString& rTargetFrameName,
    2019             :     const OUString& rStyleName,
    2020             :     const OUString& rVisitedStyleName,
    2021             :     XMLEventsImportContext* pEvents)
    2022             : {
    2023           0 :     static OUString s_HyperLinkURL( "HyperLinkURL");
    2024           0 :     static OUString s_HyperLinkName( "HyperLinkName");
    2025           0 :     static OUString s_HyperLinkTarget( "HyperLinkTarget");
    2026           0 :     static OUString s_UnvisitedCharStyleName( "UnvisitedCharStyleName");
    2027           0 :     static OUString s_VisitedCharStyleName( "VisitedCharStyleName");
    2028           0 :     static OUString s_HyperLinkEvents( "HyperLinkEvents");
    2029             : 
    2030           0 :     Reference < XPropertySet > xPropSet( rCursor, UNO_QUERY );
    2031             :     Reference < XPropertySetInfo > xPropSetInfo(
    2032           0 :         xPropSet->getPropertySetInfo());
    2033           0 :     if (!xPropSetInfo.is() || !xPropSetInfo->hasPropertyByName(s_HyperLinkURL))
    2034           0 :         return;
    2035             : 
    2036           0 :     xPropSet->setPropertyValue(s_HyperLinkURL, makeAny(rHRef));
    2037             : 
    2038           0 :     if (xPropSetInfo->hasPropertyByName(s_HyperLinkName))
    2039             :     {
    2040           0 :         xPropSet->setPropertyValue(s_HyperLinkName, makeAny(rName));
    2041             :     }
    2042             : 
    2043           0 :     if (xPropSetInfo->hasPropertyByName(s_HyperLinkTarget))
    2044             :     {
    2045           0 :         xPropSet->setPropertyValue(s_HyperLinkTarget,
    2046           0 :             makeAny(rTargetFrameName));
    2047             :     }
    2048             : 
    2049           0 :     if ( (pEvents != NULL) &&
    2050           0 :         xPropSetInfo->hasPropertyByName(s_HyperLinkEvents))
    2051             :     {
    2052             :         // The API treats events at hyperlinks differently from most
    2053             :         // other properties: You have to set a name replace with the
    2054             :         // events in it. The easiest way to to this is to 1) get
    2055             :         // events, 2) set new ones, and 3) then put events back.
    2056             :         uno::Reference<XNameReplace> const xReplace(
    2057           0 :             xPropSet->getPropertyValue(s_HyperLinkEvents), UNO_QUERY);
    2058           0 :         if (xReplace.is())
    2059             :         {
    2060             :             // set events
    2061           0 :             pEvents->SetEvents(xReplace);
    2062             : 
    2063             :             // put events
    2064           0 :             xPropSet->setPropertyValue(s_HyperLinkEvents, makeAny(xReplace));
    2065           0 :         }
    2066             :     }
    2067             : 
    2068           0 :     if (m_pImpl->m_xTextStyles.is())
    2069             :     {
    2070             :         OUString sDisplayName(
    2071             :             rImport.GetStyleDisplayName(
    2072           0 :                             XML_STYLE_FAMILY_TEXT_TEXT, rStyleName ) );
    2073           0 :         if( !sDisplayName.isEmpty() &&
    2074           0 :             xPropSetInfo->hasPropertyByName(s_UnvisitedCharStyleName) &&
    2075           0 :             m_pImpl->m_xTextStyles->hasByName(sDisplayName))
    2076             :         {
    2077           0 :             xPropSet->setPropertyValue(s_UnvisitedCharStyleName,
    2078           0 :                 makeAny(sDisplayName));
    2079             :         }
    2080             : 
    2081           0 :         sDisplayName =
    2082             :             rImport.GetStyleDisplayName(
    2083           0 :                             XML_STYLE_FAMILY_TEXT_TEXT, rVisitedStyleName );
    2084           0 :         if( !sDisplayName.isEmpty() &&
    2085           0 :             xPropSetInfo->hasPropertyByName(s_VisitedCharStyleName) &&
    2086           0 :             m_pImpl->m_xTextStyles->hasByName(sDisplayName))
    2087             :         {
    2088           0 :             xPropSet->setPropertyValue(s_VisitedCharStyleName,
    2089           0 :                 makeAny(sDisplayName));
    2090           0 :         }
    2091           0 :     }
    2092             : }
    2093             : 
    2094           0 : void XMLTextImportHelper::SetRuby(
    2095             :     SvXMLImport& rImport,
    2096             :     const Reference < XTextCursor >& rCursor,
    2097             :     const OUString& rStyleName,
    2098             :     const OUString& rTextStyleName,
    2099             :     const OUString& rText )
    2100             : {
    2101           0 :     Reference<XPropertySet> xPropSet(rCursor, UNO_QUERY);
    2102             : 
    2103           0 :     OUString sRubyText("RubyText");
    2104           0 :     OUString sRubyCharStyleName("RubyCharStyleName");
    2105             : 
    2106             :     // if we have one Ruby property, we assume all of them are present
    2107           0 :     if (xPropSet.is() &&
    2108           0 :         xPropSet->getPropertySetInfo()->hasPropertyByName( sRubyText ))
    2109             :     {
    2110             :         // the ruby text
    2111           0 :         xPropSet->setPropertyValue(sRubyText, makeAny(rText));
    2112             : 
    2113             :         // the ruby style (ruby-adjust)
    2114           0 :         XMLPropStyleContext *pStyle = 0;
    2115           0 :         if (!rStyleName.isEmpty() && m_pImpl->m_xAutoStyles.Is())
    2116             :         {
    2117             :             const SvXMLStyleContext* pTempStyle =
    2118           0 :                 ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
    2119             :                 FindStyleChildContext( XML_STYLE_FAMILY_TEXT_RUBY,
    2120           0 :                                        rStyleName, true );
    2121           0 :             pStyle = PTR_CAST(XMLPropStyleContext,pTempStyle);
    2122             : 
    2123           0 :             if (NULL != pStyle)
    2124           0 :                 pStyle->FillPropertySet( xPropSet );
    2125             :         }
    2126             : 
    2127             :         // the ruby text character style
    2128           0 :         if (m_pImpl->m_xTextStyles.is())
    2129             :         {
    2130             :             OUString sDisplayName(
    2131             :                 rImport.GetStyleDisplayName(
    2132           0 :                             XML_STYLE_FAMILY_TEXT_TEXT, rTextStyleName ) );
    2133           0 :             if( (!sDisplayName.isEmpty()) &&
    2134           0 :                 m_pImpl->m_xTextStyles->hasByName( sDisplayName ))
    2135             :             {
    2136           0 :                 xPropSet->setPropertyValue(sRubyCharStyleName, makeAny(sDisplayName));
    2137           0 :             }
    2138             :         }
    2139           0 :     }
    2140           0 : }
    2141             : 
    2142           0 : void XMLTextImportHelper::SetAutoStyles( SvXMLStylesContext *pStyles )
    2143             : {
    2144           0 :     m_pImpl->m_xAutoStyles = pStyles;
    2145           0 : }
    2146             : 
    2147           0 : SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext(
    2148             :         SvXMLImport& rImport,
    2149             :         sal_uInt16 nPrefix, const OUString& rLocalName,
    2150             :         const Reference< XAttributeList > & xAttrList,
    2151             :         XMLTextType eType )
    2152             : {
    2153           0 :     SvXMLImportContext *pContext = 0;
    2154             : 
    2155           0 :     const SvXMLTokenMap& rTokenMap = GetTextElemTokenMap();
    2156           0 :     bool bHeading = false;
    2157           0 :     bool bContent = true;
    2158           0 :     sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
    2159           0 :     switch( nToken )
    2160             :     {
    2161             :     case XML_TOK_TEXT_H:
    2162           0 :         bHeading = true;
    2163             :     case XML_TOK_TEXT_P:
    2164             :         pContext = new XMLParaContext( rImport,
    2165             :                                        nPrefix, rLocalName,
    2166           0 :                                        xAttrList, bHeading );
    2167           0 :         if (m_pImpl->m_bProgress && XML_TEXT_TYPE_SHAPE != eType)
    2168             :         {
    2169           0 :             rImport.GetProgressBarHelper()->Increment();
    2170             :         }
    2171           0 :         break;
    2172             :     case XML_TOK_TEXT_NUMBERED_PARAGRAPH:
    2173             :         pContext = new XMLNumberedParaContext(
    2174           0 :                         rImport, nPrefix, rLocalName, xAttrList );
    2175           0 :         break;
    2176             :     case XML_TOK_TEXT_LIST:
    2177             :         pContext = new XMLTextListBlockContext( rImport, *this,
    2178             :                                                 nPrefix, rLocalName,
    2179           0 :                                                 xAttrList );
    2180           0 :         break;
    2181             :     case XML_TOK_TABLE_TABLE:
    2182           0 :         if( XML_TEXT_TYPE_BODY == eType ||
    2183           0 :             XML_TEXT_TYPE_TEXTBOX == eType ||
    2184           0 :              XML_TEXT_TYPE_SECTION == eType ||
    2185           0 :             XML_TEXT_TYPE_HEADER_FOOTER == eType ||
    2186           0 :             XML_TEXT_TYPE_CHANGED_REGION == eType ||
    2187             :             XML_TEXT_TYPE_CELL == eType )
    2188             :             pContext = CreateTableChildContext( rImport, nPrefix, rLocalName,
    2189           0 :                                                 xAttrList );
    2190           0 :         break;
    2191             :     case XML_TOK_TEXT_SEQUENCE_DECLS:
    2192           0 :         if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
    2193             :             XML_TEXT_TYPE_HEADER_FOOTER == eType )
    2194             :         {
    2195             :             pContext = new XMLVariableDeclsImportContext(
    2196           0 :                 rImport, *this, nPrefix, rLocalName, VarTypeSequence);
    2197           0 :             bContent = false;
    2198             :         }
    2199           0 :         break;
    2200             : 
    2201             :     case XML_TOK_TEXT_VARFIELD_DECLS:
    2202           0 :         if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
    2203             :             XML_TEXT_TYPE_HEADER_FOOTER == eType )
    2204             :         {
    2205             :             pContext = new XMLVariableDeclsImportContext(
    2206           0 :                 rImport, *this, nPrefix, rLocalName, VarTypeSimple);
    2207           0 :             bContent = false;
    2208             :         }
    2209           0 :         break;
    2210             : 
    2211             :     case XML_TOK_TEXT_USERFIELD_DECLS:
    2212           0 :         if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted)||
    2213             :             XML_TEXT_TYPE_HEADER_FOOTER == eType )
    2214             :         {
    2215             :             pContext = new XMLVariableDeclsImportContext(
    2216           0 :                 rImport, *this, nPrefix, rLocalName, VarTypeUserField);
    2217           0 :             bContent = false;
    2218             :         }
    2219           0 :         break;
    2220             : 
    2221             :     case XML_TOK_TEXT_DDE_DECLS:
    2222           0 :         if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
    2223             :             XML_TEXT_TYPE_HEADER_FOOTER == eType )
    2224             :         {
    2225             :             pContext = new XMLDdeFieldDeclsImportContext(
    2226           0 :                 rImport, nPrefix, rLocalName);
    2227           0 :             bContent = false;
    2228             :         }
    2229           0 :         break;
    2230             : 
    2231             :     case XML_TOK_TEXT_FRAME_PAGE:
    2232           0 :         if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
    2233           0 :             XML_TEXT_TYPE_TEXTBOX == eType ||
    2234             :             XML_TEXT_TYPE_CHANGED_REGION == eType )
    2235             :         {
    2236             :             TextContentAnchorType eAnchorType =
    2237             :                 XML_TEXT_TYPE_TEXTBOX == eType ? TextContentAnchorType_AT_FRAME
    2238           0 :                                                : TextContentAnchorType_AT_PAGE;
    2239             :             pContext = new XMLTextFrameContext( rImport, nPrefix,
    2240             :                                                 rLocalName, xAttrList,
    2241           0 :                                                 eAnchorType );
    2242           0 :             bContent = false;
    2243             :         }
    2244           0 :         break;
    2245             : 
    2246             :     case XML_TOK_DRAW_A_PAGE:
    2247           0 :         if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
    2248           0 :             XML_TEXT_TYPE_TEXTBOX == eType ||
    2249             :              XML_TEXT_TYPE_CHANGED_REGION == eType)
    2250             :         {
    2251             :             TextContentAnchorType eAnchorType =
    2252             :                 XML_TEXT_TYPE_TEXTBOX == eType ? TextContentAnchorType_AT_FRAME
    2253           0 :                                                : TextContentAnchorType_AT_PAGE;
    2254             :             pContext = new XMLTextFrameHyperlinkContext( rImport, nPrefix,
    2255             :                                                 rLocalName, xAttrList,
    2256           0 :                                                 eAnchorType );
    2257           0 :             bContent = false;
    2258             :         }
    2259           0 :         break;
    2260             : 
    2261             :     case XML_TOK_TEXT_INDEX_TITLE:
    2262             :     case XML_TOK_TEXT_SECTION:
    2263           0 :         pContext = new XMLSectionImportContext( rImport, nPrefix, rLocalName );
    2264           0 :         break;
    2265             : 
    2266             :     case XML_TOK_TEXT_TOC:
    2267             :     case XML_TOK_TEXT_OBJECT_INDEX:
    2268             :     case XML_TOK_TEXT_TABLE_INDEX:
    2269             :     case XML_TOK_TEXT_ILLUSTRATION_INDEX:
    2270             :     case XML_TOK_TEXT_USER_INDEX:
    2271             :     case XML_TOK_TEXT_ALPHABETICAL_INDEX:
    2272             :     case XML_TOK_TEXT_BIBLIOGRAPHY_INDEX:
    2273           0 :         if( XML_TEXT_TYPE_SHAPE != eType )
    2274           0 :             pContext = new XMLIndexTOCContext( rImport, nPrefix, rLocalName );
    2275           0 :         break;
    2276             : 
    2277             :     case XML_TOK_TEXT_TRACKED_CHANGES:
    2278             :         pContext = new XMLTrackedChangesImportContext( rImport, nPrefix,
    2279           0 :                                                        rLocalName);
    2280           0 :         bContent = false;
    2281           0 :         break;
    2282             : 
    2283             :     case XML_TOK_TEXT_CHANGE:
    2284             :     case XML_TOK_TEXT_CHANGE_START:
    2285             :     case XML_TOK_TEXT_CHANGE_END:
    2286             :         pContext = new XMLChangeImportContext(
    2287             :             rImport, nPrefix, rLocalName,
    2288             :             (XML_TOK_TEXT_CHANGE_END != nToken),
    2289             :             (XML_TOK_TEXT_CHANGE_START != nToken),
    2290           0 :             sal_True);
    2291           0 :         break;
    2292             : 
    2293             :     case XML_TOK_TEXT_FORMS:
    2294           0 :         pContext = rImport.GetFormImport()->createOfficeFormsContext(rImport, nPrefix, rLocalName);
    2295           0 :         bContent = false;
    2296           0 :         break;
    2297             : 
    2298             :     case XML_TOK_TEXT_AUTOMARK:
    2299           0 :         if( XML_TEXT_TYPE_BODY == eType )
    2300             :         {
    2301           0 :             pContext = new XMLAutoMarkFileContext(rImport, nPrefix,rLocalName);
    2302             :         }
    2303           0 :         bContent = false;
    2304           0 :         break;
    2305             : 
    2306             :     case XML_TOK_TEXT_CALCULATION_SETTINGS:
    2307           0 :         pContext = new XMLCalculationSettingsContext ( rImport, nPrefix, rLocalName, xAttrList);
    2308           0 :         bContent = false;
    2309           0 :     break;
    2310             : 
    2311             :     default:
    2312           0 :         if ((XML_TEXT_TYPE_BODY == eType && m_pImpl->m_bBodyContentStarted) ||
    2313           0 :             XML_TEXT_TYPE_TEXTBOX == eType ||
    2314             :              XML_TEXT_TYPE_CHANGED_REGION == eType )
    2315             :         {
    2316           0 :             Reference < XShapes > xShapes;
    2317             :             pContext = rImport.GetShapeImport()->CreateGroupChildContext(
    2318           0 :                     rImport, nPrefix, rLocalName, xAttrList, xShapes );
    2319           0 :             bContent = false;
    2320             :         }
    2321             :     }
    2322             : 
    2323             :     // handle open redlines
    2324             :     if ( (XML_TOK_TEXT_CHANGE != nToken) &&
    2325             :          (XML_TOK_TEXT_CHANGE_END != nToken) &&
    2326             :          (XML_TOK_TEXT_CHANGE_START != nToken) )
    2327             :     {
    2328             : //      ResetOpenRedlineId();
    2329             :     }
    2330             : 
    2331           0 :     if( XML_TEXT_TYPE_BODY == eType && bContent )
    2332             :     {
    2333           0 :         m_pImpl->m_bBodyContentStarted = false;
    2334             :     }
    2335             : 
    2336           0 :     return pContext;
    2337             : }
    2338             : 
    2339           0 : SvXMLImportContext *XMLTextImportHelper::CreateTableChildContext(
    2340             :         SvXMLImport&,
    2341             :         sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/,
    2342             :         const Reference< XAttributeList > & )
    2343             : {
    2344           0 :     return 0;
    2345             : }
    2346             : 
    2347             : /// get data style key for use with NumberFormat property
    2348           0 : sal_Int32 XMLTextImportHelper::GetDataStyleKey(const OUString& sStyleName,
    2349             :                                                bool* pIsSystemLanguage )
    2350             : {
    2351             :     const SvXMLStyleContext* pStyle =
    2352           0 :         ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
    2353             :                   FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE,
    2354           0 :                                               sStyleName, true );
    2355             : 
    2356             :     // get appropriate context
    2357             : 
    2358             : 
    2359             :     // first check if it's a impress and draw only number format
    2360             :     // this is needed since its also a SvXMLNumFormatContext,
    2361             :     // that was needed to support them for controls in impress/draw also
    2362           0 :     SdXMLNumberFormatImportContext* pSdNumStyle = PTR_CAST( SdXMLNumberFormatImportContext, pStyle );
    2363           0 :     if( pSdNumStyle )
    2364             :     {
    2365           0 :         return pSdNumStyle->GetDrawKey();
    2366             :     }
    2367             :     else
    2368             :     {
    2369           0 :         SvXMLNumFormatContext* pNumStyle = PTR_CAST( SvXMLNumFormatContext, pStyle );
    2370           0 :         if( pNumStyle )
    2371             :         {
    2372           0 :             if( pIsSystemLanguage != NULL )
    2373           0 :                 *pIsSystemLanguage = pNumStyle->IsSystemLanguage();
    2374             : 
    2375             :             // return key
    2376           0 :             return pNumStyle->GetKey();
    2377             :         }
    2378             :     }
    2379           0 :     return -1;
    2380             : }
    2381             : 
    2382           0 : const SvxXMLListStyleContext *XMLTextImportHelper::FindAutoListStyle( const OUString& rName ) const
    2383             : {
    2384           0 :     const SvxXMLListStyleContext *pStyle = 0;
    2385           0 :     if (m_pImpl->m_xAutoStyles.Is())
    2386             :     {
    2387             :         const SvXMLStyleContext* pTempStyle =
    2388           0 :             ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
    2389             :                     FindStyleChildContext( XML_STYLE_FAMILY_TEXT_LIST, rName,
    2390           0 :                                            true );
    2391           0 :         pStyle = PTR_CAST( SvxXMLListStyleContext ,pTempStyle);
    2392             :     }
    2393             : 
    2394           0 :     return pStyle;
    2395             : }
    2396             : 
    2397           0 : XMLPropStyleContext *XMLTextImportHelper::FindAutoFrameStyle( const OUString& rName ) const
    2398             : {
    2399           0 :     XMLPropStyleContext *pStyle = 0;
    2400           0 :     if (m_pImpl->m_xAutoStyles.Is())
    2401             :     {
    2402             :         const SvXMLStyleContext* pTempStyle =
    2403           0 :             ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
    2404             :                     FindStyleChildContext( XML_STYLE_FAMILY_SD_GRAPHICS_ID, rName,
    2405           0 :                                            true );
    2406           0 :         pStyle = PTR_CAST( XMLPropStyleContext ,pTempStyle);
    2407             :     }
    2408             : 
    2409           0 :     return pStyle;
    2410             : }
    2411             : 
    2412           0 : XMLPropStyleContext* XMLTextImportHelper::FindSectionStyle(
    2413             :     const OUString& rName ) const
    2414             : {
    2415           0 :     XMLPropStyleContext* pStyle = NULL;
    2416           0 :     if (m_pImpl->m_xAutoStyles.Is())
    2417             :     {
    2418             :         const SvXMLStyleContext* pTempStyle =
    2419           0 :             ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
    2420             :                            FindStyleChildContext(
    2421             :                                XML_STYLE_FAMILY_TEXT_SECTION,
    2422           0 :                                rName, true );
    2423           0 :         pStyle = PTR_CAST( XMLPropStyleContext,pTempStyle);
    2424             :     }
    2425             : 
    2426           0 :     return pStyle;
    2427             : }
    2428             : 
    2429           0 : XMLPropStyleContext* XMLTextImportHelper::FindPageMaster(
    2430             :     const OUString& rName ) const
    2431             : {
    2432           0 :     XMLPropStyleContext* pStyle = NULL;
    2433           0 :     if (m_pImpl->m_xAutoStyles.Is())
    2434             :     {
    2435             :         const SvXMLStyleContext* pTempStyle =
    2436           0 :             ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
    2437             :                            FindStyleChildContext(
    2438             :                                XML_STYLE_FAMILY_PAGE_MASTER,
    2439           0 :                                rName, true );
    2440           0 :         pStyle = PTR_CAST( XMLPropStyleContext,pTempStyle);
    2441             :     }
    2442             : 
    2443           0 :     return pStyle;
    2444             : }
    2445             : 
    2446             : 
    2447           0 : void XMLTextImportHelper::PushListContext(XMLTextListBlockContext *i_pListBlock)
    2448             : {
    2449           0 :     GetTextListHelper().PushListContext(i_pListBlock);
    2450           0 : }
    2451             : 
    2452           0 : void XMLTextImportHelper::PopListContext()
    2453             : {
    2454           0 :     GetTextListHelper().PopListContext();
    2455           0 : }
    2456             : 
    2457             : 
    2458           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextNumberedParagraphAttrTokenMap()
    2459             : {
    2460           0 :     if (!m_pImpl->m_pTextNumberedParagraphAttrTokenMap.get())
    2461             :     {
    2462           0 :         m_pImpl->m_pTextNumberedParagraphAttrTokenMap.reset(
    2463           0 :             new SvXMLTokenMap( aTextNumberedParagraphAttrTokenMap ) );
    2464             :     }
    2465           0 :     return *m_pImpl->m_pTextNumberedParagraphAttrTokenMap;
    2466             : }
    2467             : 
    2468           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextListBlockAttrTokenMap()
    2469             : {
    2470           0 :     if (!m_pImpl->m_pTextListBlockAttrTokenMap.get())
    2471             :     {
    2472           0 :         m_pImpl->m_pTextListBlockAttrTokenMap.reset(
    2473           0 :             new SvXMLTokenMap( aTextListBlockAttrTokenMap ) );
    2474             :     }
    2475           0 :     return *m_pImpl->m_pTextListBlockAttrTokenMap;
    2476             : }
    2477             : 
    2478           0 : const SvXMLTokenMap& XMLTextImportHelper::GetTextListBlockElemTokenMap()
    2479             : {
    2480           0 :     if (!m_pImpl->m_pTextListBlockElemTokenMap.get())
    2481             :     {
    2482           0 :         m_pImpl->m_pTextListBlockElemTokenMap.reset(
    2483           0 :             new SvXMLTokenMap( aTextListBlockElemTokenMap ) );
    2484             :     }
    2485           0 :     return *m_pImpl->m_pTextListBlockElemTokenMap;
    2486             : }
    2487             : 
    2488           0 : SvI18NMap& XMLTextImportHelper::GetRenameMap()
    2489             : {
    2490           0 :     if (!m_pImpl->m_pRenameMap.get())
    2491             :     {
    2492           0 :         m_pImpl->m_pRenameMap.reset( new SvI18NMap() );
    2493             :     }
    2494           0 :     return *m_pImpl->m_pRenameMap;
    2495             : }
    2496             : 
    2497           0 : void XMLTextImportHelper::InsertBookmarkStartRange(
    2498             :     const OUString & sName,
    2499             :     const Reference<XTextRange> & rRange,
    2500             :     OUString const& i_rXmlId,
    2501             :     ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes > & i_rpRDFaAttributes)
    2502             : {
    2503           0 :     m_pImpl->m_BookmarkStartRanges[sName] =
    2504           0 :         ::boost::make_tuple(rRange, i_rXmlId, i_rpRDFaAttributes);
    2505           0 :     m_pImpl->m_BookmarkVector.push_back(sName);
    2506           0 : }
    2507             : 
    2508           0 : bool XMLTextImportHelper::FindAndRemoveBookmarkStartRange(
    2509             :     const OUString & sName,
    2510             :     Reference<XTextRange> & o_rRange,
    2511             :     OUString & o_rXmlId,
    2512             :     ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes > & o_rpRDFaAttributes)
    2513             : {
    2514           0 :     if (m_pImpl->m_BookmarkStartRanges.count(sName))
    2515             :     {
    2516             :         Impl::BookmarkMapEntry_t & rEntry =
    2517           0 :             (*m_pImpl->m_BookmarkStartRanges.find(sName)).second;
    2518           0 :         o_rRange.set(rEntry.get<0>());
    2519           0 :         o_rXmlId = rEntry.get<1>();
    2520           0 :         o_rpRDFaAttributes = rEntry.get<2>();
    2521           0 :         m_pImpl->m_BookmarkStartRanges.erase(sName);
    2522           0 :         Impl::BookmarkVector_t::iterator it(m_pImpl->m_BookmarkVector.begin());
    2523           0 :         while (it != m_pImpl->m_BookmarkVector.end() && it->compareTo(sName)!=0)
    2524             :         {
    2525           0 :             ++it;
    2526             :         }
    2527           0 :         if (it!=m_pImpl->m_BookmarkVector.end())
    2528             :         {
    2529           0 :             m_pImpl->m_BookmarkVector.erase(it);
    2530             :         }
    2531           0 :         return true;
    2532             :     }
    2533             :     else
    2534             :     {
    2535           0 :         return false;
    2536             :     }
    2537             : }
    2538             : 
    2539           0 : OUString XMLTextImportHelper::FindActiveBookmarkName()
    2540             : {
    2541           0 :     if (!m_pImpl->m_BookmarkVector.empty())
    2542             :     {
    2543           0 :         return m_pImpl->m_BookmarkVector.back();
    2544             :     }
    2545             :     else
    2546             :     {
    2547           0 :         return OUString(); // return the empty string on error...
    2548             :     }
    2549             : }
    2550             : 
    2551           0 : void XMLTextImportHelper::pushFieldCtx( const OUString& name, const OUString& type )
    2552             : {
    2553           0 :     m_pImpl->m_FieldStack.push(Impl::field_stack_item_t(
    2554           0 :         Impl::field_name_type_t(name, type), Impl::field_params_t()));
    2555           0 : }
    2556             : 
    2557           0 : void XMLTextImportHelper::popFieldCtx()
    2558             : {
    2559           0 :     if ( !m_pImpl->m_FieldStack.empty() )
    2560           0 :         m_pImpl->m_FieldStack.pop();
    2561           0 : }
    2562             : 
    2563           0 : void XMLTextImportHelper::addFieldParam( const OUString& name, const OUString& value )
    2564             : {
    2565             :     DBG_ASSERT(!m_pImpl->m_FieldStack.empty(),
    2566             :         "stack is empty: not good! Do a pushFieldCtx before...");
    2567           0 :     if (!m_pImpl->m_FieldStack.empty()) {
    2568           0 :         Impl::field_stack_item_t & FieldStackItem(m_pImpl->m_FieldStack.top());
    2569           0 :         FieldStackItem.second.push_back(Impl::field_param_t( name, value ));
    2570             :     }
    2571           0 : }
    2572             : 
    2573           0 : OUString XMLTextImportHelper::getCurrentFieldType()
    2574             : {
    2575             :     DBG_ASSERT(!m_pImpl->m_FieldStack.empty(),
    2576             :         "stack is empty: not good! Do a pushFieldCtx before...");
    2577           0 :     if (!m_pImpl->m_FieldStack.empty())
    2578             :     {
    2579           0 :         return m_pImpl->m_FieldStack.top().first.second;
    2580             :     }
    2581             :     else
    2582             :     {
    2583           0 :         return OUString();
    2584             :     }
    2585             : }
    2586             : 
    2587           0 : bool XMLTextImportHelper::hasCurrentFieldCtx()
    2588             : {
    2589           0 :     return !m_pImpl->m_FieldStack.empty();
    2590             : }
    2591             : 
    2592           0 : void XMLTextImportHelper::setCurrentFieldParamsTo(::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField> &xFormField)
    2593             : {
    2594             :     DBG_ASSERT(!m_pImpl->m_FieldStack.empty(),
    2595             :         "stack is empty: not good! Do a pushFieldCtx before...");
    2596           0 :     if (!m_pImpl->m_FieldStack.empty() && xFormField.is())
    2597             :     {
    2598           0 :         FieldParamImporter(&m_pImpl->m_FieldStack.top().second,
    2599           0 :             xFormField->getParameters()).Import();
    2600             :     }
    2601           0 : }
    2602             : 
    2603             : 
    2604           0 : void XMLTextImportHelper::ConnectFrameChains(
    2605             :         const OUString& rFrmName,
    2606             :         const OUString& rNextFrmName,
    2607             :         const Reference < XPropertySet >& rFrmPropSet )
    2608             : {
    2609           0 :     static OUString s_ChainNextName( "ChainNextName");
    2610           0 :     static OUString s_ChainPrevName( "ChainPrevName");
    2611             : 
    2612           0 :     if( rFrmName.isEmpty() )
    2613           0 :         return;
    2614             : 
    2615           0 :     if( !rNextFrmName.isEmpty() )
    2616             :     {
    2617           0 :         OUString sNextFrmName(GetRenameMap().Get( XML_TEXT_RENAME_TYPE_FRAME,
    2618           0 :                                                     rNextFrmName ));
    2619           0 :         if (m_pImpl->m_xTextFrames.is()
    2620           0 :             && m_pImpl->m_xTextFrames->hasByName(sNextFrmName))
    2621             :         {
    2622           0 :             rFrmPropSet->setPropertyValue(s_ChainNextName,
    2623           0 :                 makeAny(sNextFrmName));
    2624             :         }
    2625             :         else
    2626             :         {
    2627           0 :             if (!m_pImpl->m_pPrevFrmNames.get())
    2628             :             {
    2629           0 :                 m_pImpl->m_pPrevFrmNames.reset( new std::vector<OUString> );
    2630           0 :                 m_pImpl->m_pNextFrmNames.reset( new std::vector<OUString> );
    2631             :             }
    2632           0 :             m_pImpl->m_pPrevFrmNames->push_back(rFrmName);
    2633           0 :             m_pImpl->m_pNextFrmNames->push_back(sNextFrmName);
    2634           0 :         }
    2635             :     }
    2636           0 :     if (m_pImpl->m_pPrevFrmNames.get() && !m_pImpl->m_pPrevFrmNames->empty())
    2637             :     {
    2638           0 :         for(std::vector<OUString>::iterator i = m_pImpl->m_pPrevFrmNames->begin(), j = m_pImpl->m_pNextFrmNames->begin(); i != m_pImpl->m_pPrevFrmNames->end() && j != m_pImpl->m_pNextFrmNames->end(); ++i, ++j)
    2639             :         {
    2640           0 :             if((*j).equals(rFrmName))
    2641             :             {
    2642             :                 // The previuous frame must exist, because it existing than
    2643             :                 // inserting the entry
    2644           0 :                 rFrmPropSet->setPropertyValue(s_ChainPrevName, makeAny(*i));
    2645             : 
    2646           0 :                 i = m_pImpl->m_pPrevFrmNames->erase(i);
    2647           0 :                 j = m_pImpl->m_pNextFrmNames->erase(j);
    2648             : 
    2649             :                 // There cannot be more than one previous frames
    2650           0 :                 break;
    2651             :             }
    2652             :         }
    2653             :     }
    2654             : }
    2655             : 
    2656           0 : bool XMLTextImportHelper::IsInFrame() const
    2657             : {
    2658           0 :     static OUString s_TextFrame( "TextFrame");
    2659             : 
    2660           0 :     bool bIsInFrame = false;
    2661             : 
    2662             :     // are we currently in a text frame? yes, if the cursor has a
    2663             :     // TextFrame property and it's non-NULL
    2664           0 :     Reference<XPropertySet> xPropSet(((XMLTextImportHelper *)this)->GetCursor(), UNO_QUERY);
    2665           0 :     if (xPropSet.is())
    2666             :     {
    2667           0 :         if (xPropSet->getPropertySetInfo()->hasPropertyByName(s_TextFrame))
    2668             :         {
    2669             :             uno::Reference<XTextFrame> const xFrame(
    2670           0 :                 xPropSet->getPropertyValue(s_TextFrame), UNO_QUERY);
    2671             : 
    2672           0 :             if (xFrame.is())
    2673             :             {
    2674           0 :                 bIsInFrame = true;
    2675           0 :             }
    2676             :         }
    2677             :     }
    2678             : 
    2679           0 :     return bIsInFrame;
    2680             : }
    2681             : 
    2682           0 : bool XMLTextImportHelper::IsInHeaderFooter() const
    2683             : {
    2684           0 :     return false;
    2685             : }
    2686             : 
    2687           0 : Reference< XPropertySet> XMLTextImportHelper::createAndInsertOLEObject(
    2688             :                                         SvXMLImport&,
    2689             :                                         const OUString& /*rHRef*/,
    2690             :                                         const OUString& /*rStyleName*/,
    2691             :                                         const OUString& /*rTblName*/,
    2692             :                                         sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/ )
    2693             : {
    2694           0 :     Reference< XPropertySet> xPropSet;
    2695           0 :     return xPropSet;
    2696             : }
    2697             : 
    2698           0 : Reference< XPropertySet> XMLTextImportHelper::createAndInsertOOoLink(
    2699             :                                         SvXMLImport&,
    2700             :                                         const OUString& /*rHRef*/,
    2701             :                                         const OUString& /*rStyleName*/,
    2702             :                                         const OUString& /*rTblName*/,
    2703             :                                         sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/ )
    2704             : {
    2705           0 :     Reference< XPropertySet> xPropSet;
    2706           0 :     return xPropSet;
    2707             : }
    2708             : 
    2709           0 : Reference< XPropertySet> XMLTextImportHelper::createAndInsertApplet(
    2710             :                                         const OUString& /*rCode*/,
    2711             :                                         const OUString& /*rName*/,
    2712             :                                         bool /*bMayScript*/,
    2713             :                                         const OUString& /*rHRef*/,
    2714             :                                         sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/ )
    2715             : {
    2716           0 :     Reference< XPropertySet> xPropSet;
    2717           0 :     return xPropSet;
    2718             : }
    2719           0 : Reference< XPropertySet> XMLTextImportHelper::createAndInsertPlugin(
    2720             :                                         const OUString& /*rMimeType*/,
    2721             :                                         const OUString& /*rHRef*/,
    2722             :                                         sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/ )
    2723             : {
    2724           0 :     Reference< XPropertySet> xPropSet;
    2725           0 :     return xPropSet;
    2726             : }
    2727           0 : Reference< XPropertySet> XMLTextImportHelper::createAndInsertFloatingFrame(
    2728             :                                         const OUString& /*rName*/,
    2729             :                                         const OUString& /*rHRef*/,
    2730             :                                         const OUString& /*rStyleName*/,
    2731             :                                         sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/ )
    2732             : {
    2733           0 :     Reference< XPropertySet> xPropSet;
    2734           0 :     return xPropSet;
    2735             : }
    2736             : 
    2737           0 : void XMLTextImportHelper::endAppletOrPlugin(
    2738             :         const Reference < XPropertySet> &,
    2739             :         std::map < const OUString, OUString > &)
    2740             : {
    2741           0 : }
    2742             : // redline helper: dummy implementation to be overridden in sw/filter/xml
    2743           0 : void XMLTextImportHelper::RedlineAdd( const OUString& /*rType*/,
    2744             :                                       const OUString& /*rId*/,
    2745             :                                       const OUString& /*rAuthor*/,
    2746             :                                       const OUString& /*rComment*/,
    2747             :                                       const util::DateTime& /*rDateTime*/,
    2748             :                                       bool /*bMergeLastPara*/)
    2749             : {
    2750             :     // dummy implementation: do nothing
    2751           0 : }
    2752             : 
    2753           0 : Reference<XTextCursor> XMLTextImportHelper::RedlineCreateText(
    2754             :     Reference<XTextCursor> & /*rOldCursor*/,
    2755             :     const OUString& /*rId*/)
    2756             : {
    2757             :     // dummy implementation: do nothing
    2758           0 :     Reference<XTextCursor> xRet;
    2759           0 :     return xRet;
    2760             : }
    2761             : 
    2762           0 : void XMLTextImportHelper::RedlineSetCursor(
    2763             :     const OUString& /*rId*/,
    2764             :     bool /*bStart*/,
    2765             :     bool /*bIsOutsideOfParagraph*/)
    2766             : {
    2767             :     // dummy implementation: do nothing
    2768           0 : }
    2769             : 
    2770           0 : void XMLTextImportHelper::RedlineAdjustStartNodeCursor(bool)
    2771             : {
    2772             :     // dummy implementation: do nothing
    2773           0 : }
    2774             : 
    2775           0 : void XMLTextImportHelper::SetShowChanges( bool )
    2776             : {
    2777             :     // dummy implementation: do nothing
    2778           0 : }
    2779             : 
    2780           0 : void XMLTextImportHelper::SetRecordChanges( bool )
    2781             : {
    2782             :     // dummy implementation: do nothing
    2783           0 : }
    2784           0 : void XMLTextImportHelper::SetChangesProtectionKey(const Sequence<sal_Int8> &)
    2785             : {
    2786             :     // dummy implementation: do nothing
    2787           0 : }
    2788             : 
    2789             : 
    2790           0 : OUString XMLTextImportHelper::GetOpenRedlineId()
    2791             : {
    2792           0 :     return m_pImpl->m_sOpenRedlineIdentifier;
    2793             : }
    2794             : 
    2795           0 : void XMLTextImportHelper::SetOpenRedlineId( OUString& rId)
    2796             : {
    2797           0 :     m_pImpl->m_sOpenRedlineIdentifier = rId;
    2798           0 : }
    2799             : 
    2800           0 : void XMLTextImportHelper::ResetOpenRedlineId()
    2801             : {
    2802           0 :     OUString sEmpty;
    2803           0 :     SetOpenRedlineId(sEmpty);
    2804           0 : }
    2805             : 
    2806             : void
    2807           0 : XMLTextImportHelper::SetCellParaStyleDefault(OUString const& rNewValue)
    2808             : {
    2809           0 :     m_pImpl->m_sCellParaStyleDefault = rNewValue;
    2810           0 : }
    2811             : 
    2812           0 : OUString const& XMLTextImportHelper::GetCellParaStyleDefault()
    2813             : {
    2814           0 :     return m_pImpl->m_sCellParaStyleDefault;
    2815             : }
    2816             : 
    2817             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10