LibreOffice Module sw (master)  1
xmlimp.cxx
Go to the documentation of this file.
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 #include <sal/config.h>
21 #include <sal/log.hxx>
22 
23 #include <cassert>
24 
25 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
26 #include <com/sun/star/drawing/XDrawPage.hpp>
27 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
28 #include <com/sun/star/frame/Desktop.hpp>
29 #include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
30 #include <com/sun/star/io/IOException.hpp>
31 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
32 #include <com/sun/star/text/XTextDocument.hpp>
33 #include <com/sun/star/text/XTextRange.hpp>
34 
35 #include <o3tl/any.hxx>
36 #include <o3tl/safeint.hxx>
37 #include <xmloff/xmlnmspe.hxx>
38 #include <xmloff/xmltkmap.hxx>
39 #include <xmloff/xmlictxt.hxx>
40 #include <xmloff/txtimp.hxx>
41 #include <xmloff/nmspmap.hxx>
45 #include <doc.hxx>
46 #include <drawdoc.hxx>
49 #include <IDocumentListsAccess.hxx>
52 #include <unofreg.hxx>
53 #include <TextCursorHelper.hxx>
54 #include <unotext.hxx>
55 #include <unotextrange.hxx>
56 #include <unocrsr.hxx>
57 #include <poolfmt.hxx>
58 #include <ndtxt.hxx>
59 #include <editsh.hxx>
60 #include <strings.hrc>
61 #include <svl/stritem.hxx>
62 #include "xmlimp.hxx"
63 #include "xmlimpit.hxx"
64 #include "xmltexti.hxx"
65 #include <list.hxx>
66 #include <swdll.hxx>
68 #include <docsh.hxx>
69 #include <editeng/unolingu.hxx>
70 #include <svx/svdmodel.hxx>
71 #include <svx/xmlgrhlp.hxx>
72 #include <svx/xmleohlp.hxx>
73 #include <sfx2/docfile.hxx>
74 #include <sfx2/docfilt.hxx>
75 #include <sfx2/frame.hxx>
76 #include <sfx2/printer.hxx>
77 #include <xmloff/xmluconv.hxx>
78 #include <unotools/saveopt.hxx>
79 #include <unotools/streamwrap.hxx>
80 #include <tools/helpers.hxx>
81 #include <tools/diagnose_ex.h>
82 
83 #include <vcl/svapp.hxx>
84 #include <unotxdoc.hxx>
85 #include <numrule.hxx>
86 
87 #include <xmloff/xmlmetai.hxx>
88 #include <xmloff/xformsimport.hxx>
92 
93 #include <unordered_set>
94 
95 using namespace ::com::sun::star;
96 using namespace ::com::sun::star::uno;
97 using namespace ::com::sun::star::text;
98 using namespace ::com::sun::star::lang;
99 using namespace ::com::sun::star::beans;
100 using namespace ::com::sun::star::container;
101 using namespace ::com::sun::star::i18n;
102 using namespace ::com::sun::star::drawing;
103 using namespace ::com::sun::star::xforms;
104 using namespace ::xmloff::token;
105 using namespace ::std;
106 
108 {
118 };
119 
121 {
122  { XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS, XML_TOK_DOC_FONTDECLS },
123  { XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_DOC_STYLES },
124  { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, XML_TOK_DOC_AUTOSTYLES },
125  { XML_NAMESPACE_OFFICE, XML_MASTER_STYLES, XML_TOK_DOC_MASTERSTYLES },
126  { XML_NAMESPACE_OFFICE, XML_META, XML_TOK_DOC_META },
127  { XML_NAMESPACE_OFFICE, XML_BODY, XML_TOK_DOC_BODY },
128  { XML_NAMESPACE_OFFICE, XML_SCRIPTS, XML_TOK_DOC_SCRIPT },
129  { XML_NAMESPACE_OFFICE, XML_SETTINGS, XML_TOK_DOC_SETTINGS },
130  { XML_NAMESPACE_XFORMS, XML_MODEL, XML_TOK_DOC_XFORMS },
132 };
133 
135 {
136  SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); }
137 
138 public:
139 
140  SwXMLBodyContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx,
141  const OUString& rLName );
142 
143  virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
144  const OUString& rLocalName,
145  const Reference< xml::sax::XAttributeList > & xAttrList ) override;
146 };
147 
149  sal_uInt16 nPrfx, const OUString& rLName) :
150  SvXMLImportContext( rImport, nPrfx, rLName )
151 {
152  // tdf#107211: if at this point we don't have a defined char style "Default"
153  // or "Default Style", add a mapping for it as it is not written
154  // into the file since it's not really a style but "no style"
155  // (hence referencing it actually makes no sense except for hyperlinks
156  // which default to something other than "Default")
157  OUString const sDefault(SwResId(STR_POOLCOLL_STANDARD));
158  uno::Reference<container::XNameContainer> const& xStyles(
159  rImport.GetTextImport()->GetTextStyles());
160  if (!xStyles->hasByName("Default"))
161  { // this old name was used before LO 4.0
162  rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, "Default", sDefault);
163  }
164  if (!xStyles->hasByName("Default_20_Style"))
165  { // this new name contains a space which is converted to _20_ on export
166  rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, "Default_20_Style", sDefault);
167  }
168  bool isEncoded(false);
169  OUString const defaultEncoded(
170  rImport.GetMM100UnitConverter().encodeStyleName(sDefault, &isEncoded));
171  if (isEncoded && defaultEncoded != "Default_20_Style"
172  && !xStyles->hasByName(defaultEncoded))
173  { // new name may contain a space which is converted to _20_ on export
174  rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, defaultEncoded, sDefault);
175  }
176 }
177 
179  sal_uInt16 /*nPrefix*/,
180  const OUString& rLocalName,
181  const Reference< xml::sax::XAttributeList > & /*xAttrList*/ )
182 {
183  return GetSwImport().CreateBodyContentContext( rLocalName );
184 }
185 
186 // #i69629#
187 // enhance class <SwXMLDocContext_Impl> in order to be able to create subclasses
188 // NB: virtually inherit so we can multiply inherit properly
189 // in SwXMLOfficeDocContext_Impl
191 {
192 
193 protected: // #i69629#
194  SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); }
195 
196 public:
197 
198  SwXMLDocContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx,
199  const OUString& rLName );
200 
201  SwXMLDocContext_Impl( SwXMLImport& rImport );
202 
203  virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
204  const OUString& rLocalName,
205  const Reference< xml::sax::XAttributeList > & xAttrList ) override;
206 
207  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
208  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
209 };
210 
212  sal_uInt16 nPrfx, const OUString& rLName ) :
213  SvXMLImportContext( rImport, nPrfx, rLName )
214 {
215 }
216 
218  SvXMLImportContext( rImport )
219 {
220 }
221 
222 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SwXMLDocContext_Impl::createFastChildContext(
223  sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
224 {
225  return new SvXMLImportContext( GetImport() );
226 }
227 
229  sal_uInt16 nPrefix,
230  const OUString& rLocalName,
231  const Reference< xml::sax::XAttributeList > & xAttrList )
232 {
233  SvXMLImportContext *pContext = nullptr;
234 
235  const SvXMLTokenMap& rTokenMap = GetSwImport().GetDocElemTokenMap();
236  switch( rTokenMap.Get( nPrefix, rLocalName ) )
237  {
239  pContext = GetSwImport().CreateFontDeclsContext( rLocalName,
240  xAttrList );
241  break;
242  case XML_TOK_DOC_STYLES:
244  pContext = GetSwImport().CreateStylesContext( rLocalName, xAttrList,
245  false );
246  break;
248  // don't use the autostyles from the styles-document for the progress
251  ( PROGRESS_BAR_STEP );
252  pContext = GetSwImport().CreateStylesContext( rLocalName, xAttrList,
253  true );
254  break;
255 
257  pContext = GetSwImport().CreateMasterStylesContext( rLocalName,
258  xAttrList );
259  break;
260  case XML_TOK_DOC_META:
261  OSL_FAIL("XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
262  break;
263  case XML_TOK_DOC_SCRIPT:
264  pContext = GetSwImport().CreateScriptContext( rLocalName );
265  break;
266  case XML_TOK_DOC_BODY:
268  pContext = new SwXMLBodyContext_Impl( GetSwImport(), nPrefix,
269  rLocalName );
270  break;
272  pContext = new XMLDocumentSettingsContext( GetImport(), nPrefix, rLocalName, xAttrList );
273  break;
274  case XML_TOK_DOC_XFORMS:
275  pContext = createXFormsModelContext(GetImport(), nPrefix, rLocalName);
276  break;
277  }
278 
279  if( !pContext )
280  pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
281 
282  return pContext;
283 }
284 
285 // #i69629# - new subclass <SwXMLOfficeDocContext_Impl> of class <SwXMLDocContext_Impl>
288 {
289 public:
290 
293 
294  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
295  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
296 };
297 
299  SwXMLImport& rImport,
301  SvXMLImportContext( rImport ),
302  SwXMLDocContext_Impl( rImport ),
303  SvXMLMetaDocumentContext( rImport, xDocProps )
304 {
305 }
306 
307 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SwXMLOfficeDocContext_Impl::createFastChildContext(
308  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
309 {
310  // assign paragraph styles to list levels of outline style after all styles
311  // are imported and finished. This is the case, when <office:body> starts
312  // in flat OpenDocument file format.
313  {
314  if( nElement == XML_ELEMENT( OFFICE, XML_BODY ) )
315  {
316  GetImport().GetTextImport()->SetOutlineStyles( true );
317  }
318  }
319 
320  // behave like meta base class iff we encounter office:meta
321  if ( nElement == XML_ELEMENT( OFFICE, XML_META ) ) {
323  nElement, xAttrList );
324  } else {
326  nElement, xAttrList );
327  }
328 }
329 
330 // #i69629# - new subclass <SwXMLDocStylesContext_Impl> of class <SwXMLDocContext_Impl>
332 {
333 public:
334 
336  sal_uInt16 nPrfx,
337  const OUString& rLName );
338 
339  virtual void EndElement() override;
340 };
341 
343  SwXMLImport& rImport,
344  sal_uInt16 nPrfx,
345  const OUString& rLName ) :
346  SvXMLImportContext( rImport, nPrfx, rLName ),
347  SwXMLDocContext_Impl( rImport, nPrfx, rLName )
348 {
349 }
350 
352 {
353  // assign paragraph styles to list levels of outline style after all styles
354  // are imported and finished.
355  SwXMLImport& rSwImport = dynamic_cast<SwXMLImport&>( GetImport());
356  GetImport().GetTextImport()->SetOutlineStyles(
357  bool(rSwImport.GetStyleFamilyMask() & SfxStyleFamily::Para));
358 }
359 
361 {
362  if( !m_pDocElemTokenMap )
363  m_pDocElemTokenMap.reset( new SvXMLTokenMap( aDocTokenMap ) );
364 
365  return *m_pDocElemTokenMap;
366 }
367 
369  sal_uInt16 nPrefix,
370  const OUString& rLocalName,
371  const Reference< xml::sax::XAttributeList > & xAttrList )
372 {
373  SvXMLImportContext *pContext = nullptr;
374 
375  // #i69629# - own subclasses for <office:document> and <office:document-styles>
376  if( XML_NAMESPACE_OFFICE==nPrefix &&
377  ( IsXMLToken( rLocalName, XML_DOCUMENT_SETTINGS ) ||
378  IsXMLToken( rLocalName, XML_DOCUMENT_CONTENT ) ))
379  pContext = new SwXMLDocContext_Impl( *this, nPrefix, rLocalName );
380  else if ( XML_NAMESPACE_OFFICE==nPrefix &&
381  IsXMLToken( rLocalName, XML_DOCUMENT_STYLES ) )
382  {
383  pContext = new SwXMLDocStylesContext_Impl( *this, nPrefix, rLocalName );
384  }
385  else
386  pContext = SvXMLImport::CreateDocumentContext(nPrefix, rLocalName, xAttrList);
387 
388  return pContext;
389 }
390 
392  const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
393 {
394  SvXMLImportContext *pContext = nullptr;
395 
396  switch (nElement)
397  {
399  pContext = CreateMetaContext(nElement);
400  break;
402  {
403  uno::Reference<document::XDocumentProperties> const xDocProps(
405  // flat OpenDocument file format
406  pContext = new SwXMLOfficeDocContext_Impl( *this, xDocProps );
407  }
408  break;
409  default:
410  pContext = new SvXMLImportContext( *this );
411  }
412  return pContext;
413 }
414 
416  const uno::Reference< uno::XComponentContext >& rContext,
417  OUString const & implementationName, SvXMLImportFlags nImportFlags)
418 : SvXMLImport( rContext, implementationName, nImportFlags ),
419  m_nStyleFamilyMask( SfxStyleFamily::All ),
420  m_bLoadDoc( true ),
421  m_bInsert( false ),
422  m_bBlock( false ),
423  m_bOrganizerMode( false ),
424  m_bInititedXForms( false ),
425  m_pDoc( nullptr )
426 {
427  InitItemImport();
428 }
429 
431 {
432  if (HasShapeImport())
433  {
434  SAL_WARN("sw", "endDocument skipped, dropping shapes now to avoid dangling SvTextShapeImportHelper pointing to this");
436  }
437  m_pDocElemTokenMap.reset();
438  m_pTableElemTokenMap.reset();
439  m_pTableCellAttrTokenMap.reset();
440  FinitItemImport();
441 }
442 
444  const Reference< XTextRange > & rInsertPos )
445 {
446  m_bInsert = true;
447 
448  Reference < XText > xText = rInsertPos->getText();
449  Reference < XTextCursor > xTextCursor =
450  xText->createTextCursorByRange( rInsertPos );
451  GetTextImport()->SetCursor( xTextCursor );
452 }
453 
455  bool bOverwrite )
456 {
457  m_bInsert = !bOverwrite;
458  m_nStyleFamilyMask = nFamilies;
459  m_bLoadDoc = false;
460 }
461 
462 namespace
463 {
464  class theSwXMLImportUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXMLImportUnoTunnelId > {};
465 }
466 
468 {
469  return theSwXMLImportUnoTunnelId::get().getSeq();
470 }
471 
472 sal_Int64 SAL_CALL SwXMLImport::getSomething( const Sequence< sal_Int8 >& rId )
473 {
474  if( rId.getLength() == 16
475  && 0 == memcmp( getUnoTunnelId().getConstArray(),
476  rId.getConstArray(), 16 ) )
477  {
478  return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
479  }
480  return SvXMLImport::getSomething( rId );
481 }
482 
483 static OTextCursorHelper *lcl_xml_GetSwXTextCursor( const Reference < XTextCursor >& rTextCursor )
484 {
485  Reference<XUnoTunnel> xCursorTunnel( rTextCursor, UNO_QUERY );
486  OSL_ENSURE( xCursorTunnel.is(), "missing XUnoTunnel for Cursor" );
487  if( !xCursorTunnel.is() )
488  return nullptr;
489  OTextCursorHelper *pTextCursor = reinterpret_cast< OTextCursorHelper *>(
490  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
491  OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
492  return pTextCursor;
493 }
494 
496 {
497  // delegate to parent
499 
500  OSL_ENSURE( GetModel().is(), "model is missing" );
501  if( !GetModel().is() )
502  return;
503 
504  // this method will modify the document directly -> lock SolarMutex
505  SolarMutexGuard aGuard;
506 
507  Reference< XPropertySet > xImportInfo( getImportInfo() );
508  Reference< XPropertySetInfo > xPropertySetInfo;
509  if( xImportInfo.is() )
510  xPropertySetInfo = xImportInfo->getPropertySetInfo();
511  if( xPropertySetInfo.is() )
512  {
513  Any aAny;
514  // insert style mode?
515  OUString sStyleInsertModeFamilies("StyleInsertModeFamilies");
516  if( xPropertySetInfo->hasPropertyByName(sStyleInsertModeFamilies) )
517  {
518  aAny = xImportInfo->getPropertyValue(sStyleInsertModeFamilies);
519  Sequence< OUString> aFamiliesSeq;
520  if( aAny >>= aFamiliesSeq )
521  {
522  SfxStyleFamily nFamilyMask = SfxStyleFamily::None;
523  sal_Int32 nCount = aFamiliesSeq.getLength();
524  const OUString *pSeq = aFamiliesSeq.getConstArray();
525  for( sal_Int32 i=0; i < nCount; i++ )
526  {
527  const OUString& rFamily = pSeq[i];
528  if( rFamily=="FrameStyles" )
529  nFamilyMask |= SfxStyleFamily::Frame;
530  else if( rFamily=="PageStyles" )
531  nFamilyMask |= SfxStyleFamily::Page;
532  else if( rFamily=="CharacterStyles" )
533  nFamilyMask |= SfxStyleFamily::Char;
534  else if( rFamily=="ParagraphStyles" )
535  nFamilyMask |= SfxStyleFamily::Para;
536  else if( rFamily=="NumberingStyles" )
537  nFamilyMask |= SfxStyleFamily::Pseudo;
538  }
539 
540  bool bOverwrite = false;
541  const OUString sStyleInsertModeOverwrite("StyleInsertModeOverwrite");
542  if( xPropertySetInfo->hasPropertyByName(sStyleInsertModeOverwrite) )
543  {
544  aAny = xImportInfo->getPropertyValue(sStyleInsertModeOverwrite);
545  if( auto b = o3tl::tryAccess<bool>(aAny) )
546  {
547  if( *b )
548  bOverwrite = true;
549  }
550  }
551 
552  setStyleInsertMode( nFamilyMask, bOverwrite );
553  }
554  }
555 
556  // text insert mode?
557  const OUString sTextInsertModeRange("TextInsertModeRange");
558  if( xPropertySetInfo->hasPropertyByName(sTextInsertModeRange) )
559  {
560  aAny = xImportInfo->getPropertyValue(sTextInsertModeRange);
561  Reference<XTextRange> xInsertTextRange;
562  if( aAny >>= xInsertTextRange )
563  setTextInsertMode( xInsertTextRange );
564  }
565 
566  // auto text mode
567  const OUString sAutoTextMode("AutoTextMode");
568  if( xPropertySetInfo->hasPropertyByName(sAutoTextMode) )
569  {
570  aAny = xImportInfo->getPropertyValue(sAutoTextMode);
571  if( auto b = o3tl::tryAccess<bool>(aAny) )
572  {
573  if( *b )
574  m_bBlock = true;
575  }
576  }
577 
578  // organizer mode
579  const OUString sOrganizerMode("OrganizerMode");
580  if( xPropertySetInfo->hasPropertyByName(sOrganizerMode) )
581  {
582  aAny = xImportInfo->getPropertyValue(sOrganizerMode);
583  if( auto b = o3tl::tryAccess<bool>(aAny) )
584  {
585  if( *b )
586  m_bOrganizerMode = true;
587  }
588  }
589 
590  // default document properties
591  const OUString sDefSettings("DefaultDocumentSettings");
592  if (xPropertySetInfo->hasPropertyByName(sDefSettings))
593  {
594  aAny = xImportInfo->getPropertyValue(sDefSettings);
596  if (aAny >>= aProps)
597  {
599  Reference<XPropertySet> xProps(
600  xFac->createInstance("com.sun.star.document.Settings"), UNO_QUERY);
601  Reference<XPropertySetInfo> xInfo(xProps->getPropertySetInfo());
602 
603  if (xProps.is() && xInfo.is())
604  {
605  for (const auto& rProp : aProps)
606  {
607  if (xInfo->hasPropertyByName(rProp.Name))
608  {
609  xProps->setPropertyValue(rProp.Name, rProp.Value);
610  }
611  }
612  }
613  }
614  }
615  }
616 
617  // There only is a text cursor by now if we are in insert mode. In any
618  // other case we have to create one at the start of the document.
619  // We also might change into the insert mode later, so we have to make
620  // sure to first set the insert mode and then create the text import
621  // helper. Otherwise it won't have the insert flag set!
622  OTextCursorHelper *pTextCursor = nullptr;
623  Reference < XTextCursor > xTextCursor;
624  if( HasTextImport() )
625  xTextCursor = GetTextImport()->GetCursor();
626  if( !xTextCursor.is() )
627  {
628  Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
629  Reference < XText > xText = xTextDoc->getText();
630  xTextCursor = xText->createTextCursor();
631  SwCursorShell *pCursorSh = nullptr;
632  SwDoc *pDoc = nullptr;
633  if( SvXMLImportFlags::ALL == getImportFlags() )
634  {
635  pTextCursor = lcl_xml_GetSwXTextCursor( xTextCursor );
636  OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
637  if( !pTextCursor )
638  return;
639 
640  pDoc = pTextCursor->GetDoc();
641  OSL_ENSURE( pDoc, "SwDoc missing" );
642  if( !pDoc )
643  return;
644 
645  // Is there a edit shell. If yes, then we are currently inserting
646  // a document. We then have to insert at the current edit shell's
647  // cursor position. That not quite clean code, but there is no other
648  // way currently.
649  pCursorSh = pDoc->GetEditShell();
650  }
651  if( pCursorSh )
652  {
653  const uno::Reference<text::XTextRange> xInsertTextRange(
655  *pDoc, *pCursorSh->GetCursor()->GetPoint(), nullptr ) );
656  setTextInsertMode( xInsertTextRange );
657  xTextCursor = GetTextImport()->GetCursor();
658  pTextCursor = nullptr;
659  }
660  else
661  GetTextImport()->SetCursor( xTextCursor );
662  }
663 
664  if( !(getImportFlags() & (SvXMLImportFlags::CONTENT|SvXMLImportFlags::MASTERSTYLES)) )
665  return;
666 
667  if( !pTextCursor )
668  pTextCursor = lcl_xml_GetSwXTextCursor( xTextCursor );
669  OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
670  if( !pTextCursor )
671  return;
672 
673  SwDoc *pDoc = pTextCursor->GetDoc();
674  OSL_ENSURE( pDoc, "SwDoc missing" );
675  if( !pDoc )
676  return;
677 
678  if (SvXMLImportFlags::ALL == getImportFlags())
679  {
680  // for flat ODF - this is done in SwReader::Read() for package ODF
681  pDoc->SetInReading(true);
682  pDoc->SetInXMLImport(true);
683  }
684 
685  if( (getImportFlags() & SvXMLImportFlags::CONTENT) && !IsStylesOnlyMode() )
686  {
687  m_pSttNdIdx.reset(new SwNodeIndex( pDoc->GetNodes() ));
688  if( IsInsertMode() )
689  {
690  SwPaM *pPaM = pTextCursor->GetPaM();
691  const SwPosition* pPos = pPaM->GetPoint();
692 
693  // Split once and remember the node that has been splitted.
694  pDoc->getIDocumentContentOperations().SplitNode( *pPos, false );
695  *m_pSttNdIdx = pPos->nNode.GetIndex()-1;
696 
697  // Split again.
698  pDoc->getIDocumentContentOperations().SplitNode( *pPos, false );
699 
700  // Insert all content into the new node
701  pPaM->Move( fnMoveBackward );
702  pDoc->SetTextFormatColl
704  }
705  }
706 
707  // We need a draw model to be able to set the z order
708  pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); // #i52858# - method name changed
709 
710  // SJ: #i49801# locking the model to disable repaints
711  SwDrawModel* pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel();
712  if ( pDrawModel )
713  pDrawModel->setLock(true);
714 
715  if (!GetGraphicStorageHandler().is())
716  {
717  m_xGraphicStorageHandler = SvXMLGraphicHelper::Create(SvXMLGraphicHelperMode::Read);
719  }
720 
721  if( !GetEmbeddedResolver().is() )
722  {
723  SfxObjectShell *pPersist = pDoc->GetPersist();
724  if( pPersist )
725  {
727  *pPersist,
728  SvXMLEmbeddedObjectHelperMode::Read );
729  Reference< document::XEmbeddedObjectResolver > xEmbeddedResolver( m_xEmbeddedResolver.get() );
730  SetEmbeddedResolver( xEmbeddedResolver );
731  }
732  }
733 }
734 
736 {
737  OSL_ENSURE( GetModel().is(), "model missing; maybe startDocument wasn't called?" );
738  if( !GetModel().is() )
739  return;
740 
741  // this method will modify the document directly -> lock SolarMutex
742  SolarMutexGuard aGuard;
743 
745  m_xGraphicStorageHandler->dispose();
746  m_xGraphicStorageHandler.clear();
747 
748  if( m_xEmbeddedResolver )
749  m_xEmbeddedResolver->dispose();
750  m_xEmbeddedResolver.clear();
751  // Clear the shape import to sort the shapes (and not in the
752  // destructor that might be called after the import has finished
753  // for Java filters.
754  if( HasShapeImport() )
756 
757  SwDoc *pDoc = nullptr;
758  if( (getImportFlags() & SvXMLImportFlags::CONTENT) && !IsStylesOnlyMode() )
759  {
760  Reference<XUnoTunnel> xCursorTunnel( GetTextImport()->GetCursor(),
761  UNO_QUERY);
762  assert(xCursorTunnel.is() && "missing XUnoTunnel for Cursor");
763  OTextCursorHelper *pTextCursor = reinterpret_cast< OTextCursorHelper *>(
764  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
765  assert(pTextCursor && "SwXTextCursor missing");
766  SwPaM *pPaM = pTextCursor->GetPaM();
767  if( IsInsertMode() && m_pSttNdIdx->GetIndex() )
768  {
769  // If we are in insert mode, join the splitted node that is in front
770  // of the new content with the first new node. Or in other words:
771  // Revert the first split node.
772  SwTextNode* pTextNode = m_pSttNdIdx->GetNode().GetTextNode();
773  SwNodeIndex aNxtIdx( *m_pSttNdIdx );
774  if( pTextNode && pTextNode->CanJoinNext( &aNxtIdx ) &&
775  m_pSttNdIdx->GetIndex() + 1 == aNxtIdx.GetIndex() )
776  {
777  // If the PaM points to the first new node, move the PaM to the
778  // end of the previous node.
779  if( pPaM->GetPoint()->nNode == aNxtIdx )
780  {
781  pPaM->GetPoint()->nNode = *m_pSttNdIdx;
782  pPaM->GetPoint()->nContent.Assign( pTextNode,
783  pTextNode->GetText().getLength());
784  }
785 
786 #if OSL_DEBUG_LEVEL > 0
787  // !!! This should be impossible !!!!
788  OSL_ENSURE( m_pSttNdIdx->GetIndex()+1 !=
789  pPaM->GetBound().nNode.GetIndex(),
790  "PaM.Bound1 point to new node " );
791  OSL_ENSURE( m_pSttNdIdx->GetIndex()+1 !=
792  pPaM->GetBound( false ).nNode.GetIndex(),
793  "PaM.Bound2 points to new node" );
794 
795  if( m_pSttNdIdx->GetIndex()+1 ==
796  pPaM->GetBound().nNode.GetIndex() )
797  {
798  const sal_Int32 nCntPos =
799  pPaM->GetBound().nContent.GetIndex();
800  pPaM->GetBound().nContent.Assign( pTextNode,
801  pTextNode->GetText().getLength() + nCntPos );
802  }
803  if( m_pSttNdIdx->GetIndex()+1 ==
804  pPaM->GetBound( false ).nNode.GetIndex() )
805  {
806  const sal_Int32 nCntPos =
807  pPaM->GetBound( false ).nContent.GetIndex();
808  pPaM->GetBound( false ).nContent.Assign( pTextNode,
809  pTextNode->GetText().getLength() + nCntPos );
810  }
811 #endif
812  // If the first new node isn't empty, convert the node's text
813  // attributes into hints. Otherwise, set the new node's
814  // paragraph style at the previous (empty) node.
815  SwTextNode* pDelNd = aNxtIdx.GetNode().GetTextNode();
816  if (!pTextNode->GetText().isEmpty())
817  pDelNd->FormatToTextAttr( pTextNode );
818  else
819  pTextNode->ChgFormatColl( pDelNd->GetTextColl() );
820  pTextNode->JoinNext();
821  }
822  }
823 
824  SwPosition* pPos = pPaM->GetPoint();
825  OSL_ENSURE( !pPos->nContent.GetIndex(), "last paragraph isn't empty" );
826  if( !pPos->nContent.GetIndex() )
827  {
828  SwTextNode* pCurrNd;
829  sal_uLong nNodeIdx = pPos->nNode.GetIndex();
830  pDoc = pPaM->GetDoc();
831 
832  OSL_ENSURE( pPos->nNode.GetNode().IsContentNode(),
833  "insert position is not a content node" );
834  if( !IsInsertMode() )
835  {
836  // If we're not in insert mode, the last node is deleted.
837  const SwNode *pPrev = pDoc->GetNodes()[nNodeIdx -1];
838  if( pPrev->IsContentNode() ||
839  ( pPrev->IsEndNode() &&
840  pPrev->StartOfSectionNode()->IsSectionNode() ) )
841  {
842  SwContentNode* pCNd = pPaM->GetContentNode();
843  if( pCNd && pCNd->StartOfSectionIndex()+2 <
844  pCNd->EndOfSectionIndex() )
845  {
846  pPaM->GetBound().nContent.Assign( nullptr, 0 );
847  pPaM->GetBound(false).nContent.Assign( nullptr, 0 );
848  pDoc->GetNodes().Delete( pPaM->GetPoint()->nNode );
849  }
850  }
851  }
852  else if( nullptr != (pCurrNd = pDoc->GetNodes()[nNodeIdx]->GetTextNode()) )
853  {
854  // Id we're in insert mode, the empty node is joined with
855  // the next and the previous one.
856  if( pCurrNd->CanJoinNext( &pPos->nNode ))
857  {
858  SwTextNode* pNextNd = pPos->nNode.GetNode().GetTextNode();
859  pPos->nContent.Assign( pNextNd, 0 );
860  pPaM->SetMark(); pPaM->DeleteMark();
861  pNextNd->JoinPrev();
862 
863  // Remove line break that has been inserted by the import,
864  // but only if one has been inserted!
865  if( pNextNd->CanJoinPrev(/* &pPos->nNode*/ ) &&
866  *m_pSttNdIdx != pPos->nNode )
867  {
868  pNextNd->JoinPrev();
869  }
870  }
871  else if (pCurrNd->GetText().isEmpty())
872  {
873  pPos->nContent.Assign( nullptr, 0 );
874  pPaM->SetMark(); pPaM->DeleteMark();
875  pDoc->GetNodes().Delete( pPos->nNode );
876  pPaM->Move( fnMoveBackward );
877  }
878  }
879 
880  // tdf#113877
881  // when we insert one document with list inside into another one with list at the insert position,
882  // the resulting numbering in these lists is not consequent.
883  //
884  // Main document:
885  // 1. One
886  // 2. Two
887  // 3. Three
888  // 4. <-- insert position
889  //
890  // Inserted document:
891  // 1. One
892  // 2. Two
893  // 3. Three
894  // 4.
895  //
896  // Expected result
897  // 1. One
898  // 2. Two
899  // 3. Three
900  // 4. One
901  // 5. Two
902  // 6. Three
903  // 7.
904  //
906  }
907  }
908 
909  /* Was called too early. Moved from SwXMLBodyContext_Impl::EndElement */
910 
911  GetTextImport()->RedlineAdjustStartNodeCursor( false );
912 
913  if( (getImportFlags() & SvXMLImportFlags::CONTENT) ||
914  ((getImportFlags() & SvXMLImportFlags::MASTERSTYLES) && IsStylesOnlyMode()) )
915  {
916  // pDoc might be 0. In this case UpdateTextCollCondition is looking
917  // for it itself.
918  UpdateTextCollConditions( pDoc );
919  }
920 
921  GetTextImport()->ResetCursor();
922 
923  m_pSttNdIdx.reset();
924 
925  // SJ: #i49801# -> now permitting repaints
926  if ( pDoc )
927  {
928  if( getImportFlags() == SvXMLImportFlags::ALL )
929  {
930  // Notify math objects. If we are in the package filter this will
931  // be done by the filter object itself
932  if( IsInsertMode() )
933  pDoc->PrtOLENotify( false );
934  else if ( pDoc->IsOLEPrtNotifyPending() )
935  pDoc->PrtOLENotify( true );
936 
937  assert(pDoc->IsInReading());
938  assert(pDoc->IsInXMLImport());
939  pDoc->SetInReading(false);
940  pDoc->SetInXMLImport(false);
941  }
942 
943  SwDrawModel* pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel();
944  if ( pDrawModel )
945  pDrawModel->setLock(false);
946  }
947 
948  // #i90243#
949  if ( m_bInititedXForms )
950  {
951  Reference< xforms::XFormsSupplier > xFormsSupp( GetModel(), UNO_QUERY );
952  Reference< XNameAccess > xXForms;
953  if ( xFormsSupp.is() )
954  xXForms = xFormsSupp->getXForms().get();
955 
956  if ( xXForms.is() )
957  {
958  try
959  {
960  Sequence< beans::PropertyValue > aXFormsSettings;
961 
962  const OUString& sXFormsSettingsName( GetXMLToken( XML_XFORM_MODEL_SETTINGS ) );
963  if ( m_xLateInitSettings.is() && m_xLateInitSettings->hasByName( sXFormsSettingsName ) )
964  {
965  OSL_VERIFY( m_xLateInitSettings->getByName( sXFormsSettingsName ) >>= aXFormsSettings );
966  applyXFormsSettings( xXForms, aXFormsSettings );
967  }
968  }
969  catch( const Exception& )
970  {
971  }
972  }
973  }
974 
975  // delegate to parent: takes care of error handling
977  ClearTextImport();
978 }
979 
980 // tdf#113877
981 // when we insert one document with list inside into another one with list at the insert position,
982 // the resulting numbering in these lists is not consequent.
983 //
984 // CASE-1: Main document:
985 // 1. One
986 // 2. Two
987 // 3. Three
988 // 4. <-- insert position
989 //
990 // Inserted document:
991 // 1. One
992 // 2. Two
993 // 3. Three
994 // 4.
995 //
996 // Expected result
997 // 1. One
998 // 2. Two
999 // 3. Three
1000 // 4. One
1001 // 5. Two
1002 // 6. Three
1003 // 7.
1004 //
1005 // CASE-2: Main document:
1006 // 1. One
1007 // 2. Two
1008 // 3. Three
1009 // 4. <-- insert position
1010 //
1011 // Inserted document:
1012 // A) One
1013 // B) Two
1014 // C) Three
1015 // D)
1016 //
1017 // Expected result
1018 // 1. One
1019 // 2. Two
1020 // 3. Three
1021 // 4. One
1022 // A) Two
1023 // B) Three
1024 // 5.
1025 //
1027 {
1028  // 1. check environment
1029  if (! pDoc)
1030  return;
1031 
1032  if (! IsInsertMode() || ! m_pSttNdIdx->GetIndex())
1033  return;
1034 
1035  sal_uLong index = 1;
1036 
1037  // the last node of the main document where we have inserted a document
1038  const SwNodePtr node1 = pDoc->GetNodes()[m_pSttNdIdx->GetIndex() + 0];
1039 
1040  // the first node of the inserted document
1041  SwNodePtr node2 = pDoc->GetNodes()[m_pSttNdIdx->GetIndex() + index];
1042 
1043  if (! (node1 && node2
1044  && (node1->GetNodeType() == node2->GetNodeType())
1045  && (node1->IsTextNode() == node2->IsTextNode())
1046  ))
1047  {
1048  // not a text node at insert position
1049  return;
1050  }
1051 
1052  // 2. get the first node of the inserted document,
1053  // which will be used to detect if inside inserted document a new list was started after the first list
1054  const SfxPoolItem* pListId2Initial = nullptr;
1055  {
1056  SwContentNode* contentNode1 = static_cast<SwContentNode *>(node1);
1057  SwContentNode* contentNode2 = static_cast<SwContentNode *>(node2);
1058 
1059  // check if both lists have the same list properties
1060  const SfxPoolItem* pListId1 = contentNode1->GetNoCondAttr( RES_PARATR_LIST_ID, false );
1061  const SfxPoolItem* pListId2 = contentNode2->GetNoCondAttr( RES_PARATR_LIST_ID, false );
1062 
1063  if (! pListId1)
1064  return;
1065  if (! pListId2)
1066  return;
1067 
1068  auto pStringListId1 = dynamic_cast<const SfxStringItem*>(pListId1);
1069  assert(pStringListId1);
1070  const OUString& sListId1 = pStringListId1->GetValue();
1071  auto pStringListId2 = dynamic_cast<const SfxStringItem*>(pListId2);
1072  assert(pStringListId2);
1073  const OUString& sListId2 = pStringListId2->GetValue();
1074 
1075  const SwList* pList1 = pDoc->getIDocumentListsAccess().getListByName( sListId1 );
1076  const SwList* pList2 = pDoc->getIDocumentListsAccess().getListByName( sListId2 );
1077 
1078  if (! pList1)
1079  return;
1080  if (! pList2)
1081  return;
1082 
1083  const OUString& sDefaultListStyleName1 = pList1->GetDefaultListStyleName();
1084  const OUString& sDefaultListStyleName2 = pList2->GetDefaultListStyleName();
1085 
1086  if (sDefaultListStyleName1 != sDefaultListStyleName2)
1087  {
1088  const SwNumRule* pNumRule1 = pDoc->FindNumRulePtr( sDefaultListStyleName1 );
1089  const SwNumRule* pNumRule2 = pDoc->FindNumRulePtr( sDefaultListStyleName2 );
1090 
1091  if (pNumRule1 && pNumRule2)
1092  {
1093  // check style of the each list level
1094  for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
1095  {
1096  if( pNumRule1->Get( n ) != pNumRule2->Get( n ) )
1097  {
1098  return;
1099  }
1100  }
1101 
1102  // our list should be merged
1103  pListId2Initial = pListId2;
1104  }
1105  }
1106  else
1107  {
1108  // our list should be merged
1109  pListId2Initial = pListId2;
1110  }
1111  }
1112 
1113  if (! pListId2Initial)
1114  {
1115  // two lists have different styles => they should not be merged
1116  return;
1117  }
1118 
1119  // 3. merge two lists
1120  while (
1121  node1 && node2
1122  && (node1->GetNodeType() == node2->GetNodeType())
1123  && (node1->IsTextNode() == node2->IsTextNode())
1124  )
1125  {
1126  SwContentNode* contentNode1 = static_cast<SwContentNode *>( node1 );
1127  SwContentNode* contentNode2 = static_cast<SwContentNode *>( node2 );
1128 
1129  const SfxPoolItem* pListId1 = contentNode1->GetNoCondAttr( RES_PARATR_LIST_ID, false );
1130  const SfxPoolItem* pListId2 = contentNode2->GetNoCondAttr( RES_PARATR_LIST_ID, false );
1131 
1132  if (! pListId1)
1133  return;
1134  if (! pListId2)
1135  return;
1136 
1137  if (*pListId2Initial != *pListId2)
1138  {
1139  // no more list items of the first list inside inserted document
1140  return;
1141  }
1142 
1143  // set list style to this list element
1144  contentNode2->SetAttr(*pListId1);
1145 
1146  // get next item
1147  index++;
1148  if (index >= pDoc->GetNodes().Count())
1149  {
1150  // no more items
1151  return;
1152  }
1153 
1154  node2 = pDoc->GetNodes()[m_pSttNdIdx->GetIndex() + index];
1155  }
1156 }
1157 
1158 // Locally derive XMLTextShapeImportHelper, so we can take care of the
1159 // form import This is Writer, but not text specific, so it should go
1160 // here!
1162 {
1163  // hold own reference form import helper, because the SvxImport
1164  // stored in the superclass, from whom we originally got the
1165  // reference, is already destroyed when we want to use it in the
1166  // destructor
1168 
1169  // hold reference to the one page (if it exists) for calling startPage()
1170  // and endPage. If !xPage.is(), then this document doesn't have a
1171  // XDrawPage.
1173 
1174 public:
1175  explicit SvTextShapeImportHelper(SvXMLImport& rImp);
1176  virtual ~SvTextShapeImportHelper() override;
1177 };
1178 
1181 {
1182  Reference<drawing::XDrawPageSupplier> xSupplier(rImp.GetModel(),UNO_QUERY);
1183  if (xSupplier.is())
1184  {
1185  if (rImp.GetFormImport().is())
1186  {
1187  rImp.GetFormImport()->startPage(xSupplier->getDrawPage());
1188  rFormImport = rImp.GetFormImport();
1189  }
1190 
1191  xPage = xSupplier->getDrawPage();
1192  Reference<XShapes> xShapes( xPage, UNO_QUERY );
1194  }
1195 }
1196 
1198 {
1199  rFormImport->endPage();
1200 
1201  if (xPage.is())
1202  {
1203  Reference<XShapes> xShapes( xPage, UNO_QUERY );
1205  }
1206 }
1207 
1209 {
1210  return new SwXMLTextImportHelper( GetModel(), *this, getImportInfo(),
1211  IsInsertMode(),
1212  IsStylesOnlyMode(),
1214 }
1215 
1217 {
1218  return new SvTextShapeImportHelper( *this );
1219 }
1220 
1222  const OUString& rLocalName,
1223  const Reference< xml::sax::XAttributeList > & xAttrList )
1224 {
1225  XMLFontStylesContext *pFSContext =
1226  new XMLFontStylesContext( *this, XML_NAMESPACE_OFFICE,
1227  rLocalName, xAttrList,
1228  osl_getThreadTextEncoding() );
1229  SetFontDecls( pFSContext );
1230  return pFSContext;
1231 }
1232 
1234 {
1235  if (IsInsertMode() || IsStylesOnlyMode() || IsBlockMode() || m_bOrganizerMode || !GetModel().is() )
1236  return;
1237 
1238  // this method will modify the document directly -> lock SolarMutex
1239  SolarMutexGuard aGuard;
1240 
1241  SwDoc *pDoc = getDoc();
1242  tools::Rectangle aRect;
1243  if( pDoc->GetDocShell() )
1244  aRect = pDoc->GetDocShell()->GetVisArea( ASPECT_CONTENT );
1245  //TODO/LATER: why that cast?!
1246  //aRect = ((SfxInPlaceObject *)pDoc->GetDocShell())->GetVisArea();
1247 
1248  sal_Int32 nCount = aViewProps.getLength();
1249  const PropertyValue *pValue = aViewProps.getConstArray();
1250 
1251  sal_Int64 nTmp = 0;
1252  bool bShowRedlineChanges = false, bBrowseMode = false;
1253  bool bChangeShowRedline = false, bChangeBrowseMode = false;
1254 
1255  //TODO/LATER: why that cast?!
1256  bool bTwip = pDoc->GetDocShell()->GetMapUnit ( ) == MapUnit::MapTwip;
1257  //sal_Bool bTwip = pDoc->GetDocShell()->SfxInPlaceObject::GetMapUnit ( ) == MapUnit::MapTwip;
1258 
1259  for (sal_Int32 i = 0; i < nCount ; i++)
1260  {
1261  if ( pValue->Name == "ViewAreaTop" )
1262  {
1263  pValue->Value >>= nTmp;
1264  aRect.setY( static_cast< long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
1265  }
1266  else if ( pValue->Name == "ViewAreaLeft" )
1267  {
1268  pValue->Value >>= nTmp;
1269  aRect.setX( static_cast< long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
1270  }
1271  else if ( pValue->Name == "ViewAreaWidth" )
1272  {
1273  pValue->Value >>= nTmp;
1274  Size aSize( aRect.GetSize() );
1275  aSize.setWidth( static_cast< long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
1276  aRect.SetSize( aSize );
1277  }
1278  else if ( pValue->Name == "ViewAreaHeight" )
1279  {
1280  pValue->Value >>= nTmp;
1281  Size aSize( aRect.GetSize() );
1282  aSize.setHeight( static_cast< long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
1283  aRect.SetSize( aSize );
1284  }
1285  else if ( pValue->Name == "ShowRedlineChanges" )
1286  {
1287  bShowRedlineChanges = *o3tl::doAccess<bool>(pValue->Value);
1288  bChangeShowRedline = true;
1289  }
1290 // Headers and footers are not displayed in BrowseView anymore
1291  else if ( pValue->Name == "InBrowseMode" )
1292  {
1293  bBrowseMode = *o3tl::doAccess<bool>(pValue->Value);
1294  bChangeBrowseMode = true;
1295  }
1296  pValue++;
1297  }
1298  if( pDoc->GetDocShell() )
1299  pDoc->GetDocShell()->SetVisArea ( aRect );
1300 
1301  if (bChangeBrowseMode)
1303 
1304  if (bChangeShowRedline)
1305  GetTextImport()->SetShowChanges( bShowRedlineChanges );
1306 }
1307 
1308 // Note: this will be called only if there are OOo elements in settings.xml.
1309 // So if a setting is missing there we can assume that it was written
1310 // by an OOo/LO version that is older than the introduction of the setting!
1312 {
1313  // this method will modify the document directly -> lock SolarMutex
1314  SolarMutexGuard aGuard;
1315 
1317  if( !xFac.is() )
1318  return;
1319 
1320  Reference< XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), UNO_QUERY );
1321  if( !xProps.is() )
1322  return;
1323 
1324  Reference< XPropertySetInfo > xInfo( xProps->getPropertySetInfo() );
1325  if( !xInfo.is() )
1326  return;
1327 
1328  std::unordered_set< OUString > aExcludeAlways;
1329  aExcludeAlways.insert("LinkUpdateMode");
1330  // this should contain things that are actually user-settable, via Tools->Options
1331  std::unordered_set< OUString > aExcludeWhenNotLoadingUserSettings;
1332  aExcludeWhenNotLoadingUserSettings.insert("ForbiddenCharacters");
1333  aExcludeWhenNotLoadingUserSettings.insert("IsKernAsianPunctuation");
1334  aExcludeWhenNotLoadingUserSettings.insert("CharacterCompressionType");
1335  aExcludeWhenNotLoadingUserSettings.insert("FieldAutoUpdate");
1336  aExcludeWhenNotLoadingUserSettings.insert("ChartAutoUpdate");
1337  aExcludeWhenNotLoadingUserSettings.insert("AddParaTableSpacing");
1338  aExcludeWhenNotLoadingUserSettings.insert("AddParaTableSpacingAtStart");
1339  aExcludeWhenNotLoadingUserSettings.insert("PrintAnnotationMode");
1340  aExcludeWhenNotLoadingUserSettings.insert("PrintBlackFonts");
1341  aExcludeWhenNotLoadingUserSettings.insert("PrintControls");
1342  aExcludeWhenNotLoadingUserSettings.insert("PrintDrawings");
1343  aExcludeWhenNotLoadingUserSettings.insert("PrintGraphics");
1344  aExcludeWhenNotLoadingUserSettings.insert("PrintLeftPages");
1345  aExcludeWhenNotLoadingUserSettings.insert("PrintPageBackground");
1346  aExcludeWhenNotLoadingUserSettings.insert("PrintProspect");
1347  aExcludeWhenNotLoadingUserSettings.insert("PrintReversed");
1348  aExcludeWhenNotLoadingUserSettings.insert("PrintRightPages");
1349  aExcludeWhenNotLoadingUserSettings.insert("PrintFaxName");
1350  aExcludeWhenNotLoadingUserSettings.insert("PrintPaperFromSetup");
1351  aExcludeWhenNotLoadingUserSettings.insert("PrintTables");
1352  aExcludeWhenNotLoadingUserSettings.insert("PrintSingleJobs");
1353  aExcludeWhenNotLoadingUserSettings.insert("UpdateFromTemplate");
1354  aExcludeWhenNotLoadingUserSettings.insert("PrinterIndependentLayout");
1355  aExcludeWhenNotLoadingUserSettings.insert("PrintEmptyPages");
1356  aExcludeWhenNotLoadingUserSettings.insert("ConsiderTextWrapOnObjPos");
1357  aExcludeWhenNotLoadingUserSettings.insert("DoNotJustifyLinesWithManualBreak");
1358  aExcludeWhenNotLoadingUserSettings.insert("ProtectForm");
1359  aExcludeWhenNotLoadingUserSettings.insert("MsWordCompTrailingBlanks");
1360  aExcludeWhenNotLoadingUserSettings.insert("SubtractFlysAnchoredAtFlys");
1361  aExcludeWhenNotLoadingUserSettings.insert("EmptyDbFieldHidesPara");
1362 
1363  sal_Int32 nCount = aConfigProps.getLength();
1364  const PropertyValue* pValues = aConfigProps.getConstArray();
1365 
1366  SvtSaveOptions aSaveOpt;
1367  bool bIsUserSetting = aSaveOpt.IsLoadUserSettings();
1368 
1369  // for some properties we don't want to use the application
1370  // default if they're missing. So we watch for them in the loop
1371  // below, and set them if not found
1372  bool bPrinterIndependentLayout = false;
1373  bool bUseOldNumbering = false;
1374  bool bAddExternalLeading = false;
1375  bool bAddParaSpacingToTableCells = false;
1376  bool bUseFormerLineSpacing = false;
1377  bool bUseFormerObjectPositioning = false;
1378  bool bUseFormerTextWrapping = false;
1379  bool bConsiderWrapOnObjPos = false;
1380  bool bIgnoreFirstLineIndentInNumbering = false;
1381  bool bDoNotJustifyLinesWithManualBreak = false;
1382  bool bDoNotResetParaAttrsForNumFont = false;
1383  bool bLoadReadonly = false;
1384  bool bDoNotCaptureDrawObjsOnPage( false );
1385  bool bClipAsCharacterAnchoredWriterFlyFrames( false );
1386  bool bUnixForceZeroExtLeading = false;
1387  bool bSmallCapsPercentage66 = false;
1388  bool bTabOverflow = false;
1389  bool bUnbreakableNumberings = false;
1390  bool bClippedPictures = false;
1391  bool bBackgroundParaOverDrawings = false;
1392  bool bTabOverMargin = false;
1393  bool bTabOverMarginValue = false;
1394  bool bPropLineSpacingShrinksFirstLine = false;
1395  bool bSubtractFlysAnchoredAtFlys = false;
1396  bool bCollapseEmptyCellPara = false;
1397 
1398  const PropertyValue* currentDatabaseDataSource = nullptr;
1399  const PropertyValue* currentDatabaseCommand = nullptr;
1400  const PropertyValue* currentDatabaseCommandType = nullptr;
1401  const PropertyValue* embeddedDatabaseName = nullptr;
1402 
1403  while( nCount-- )
1404  {
1405  bool bSet = aExcludeAlways.find(pValues->Name) == aExcludeAlways.end();
1406  if( bSet && !bIsUserSetting
1407  && (aExcludeWhenNotLoadingUserSettings.find(pValues->Name)
1408  != aExcludeWhenNotLoadingUserSettings.end()) )
1409  {
1410  bSet = false;
1411  }
1412 
1413  if( bSet )
1414  {
1415  try
1416  {
1417  if( xInfo->hasPropertyByName( pValues->Name ) )
1418  {
1419  if( pValues->Name == "RedlineProtectionKey" )
1420  {
1421  Sequence<sal_Int8> aKey;
1422  pValues->Value >>= aKey;
1423  GetTextImport()->SetChangesProtectionKey( aKey );
1424  }
1425  else
1426  {
1427  // HACK: Setting these out of order does not work.
1428  if( pValues->Name == "CurrentDatabaseDataSource" )
1429  currentDatabaseDataSource = pValues;
1430  else if( pValues->Name == "CurrentDatabaseCommand" )
1431  currentDatabaseCommand = pValues;
1432  else if( pValues->Name == "CurrentDatabaseCommandType" )
1433  currentDatabaseCommandType = pValues;
1434  else if (pValues->Name == "EmbeddedDatabaseName")
1435  embeddedDatabaseName = pValues;
1436  else
1437  xProps->setPropertyValue( pValues->Name,
1438  pValues->Value );
1439  }
1440  }
1441 
1442  // did we find any of the non-default cases?
1443  if ( pValues->Name == "PrinterIndependentLayout" )
1444  bPrinterIndependentLayout = true;
1445  else if ( pValues->Name == "AddExternalLeading" )
1446  bAddExternalLeading = true;
1447  else if ( pValues->Name == "AddParaSpacingToTableCells" )
1448  bAddParaSpacingToTableCells = true;
1449  else if ( pValues->Name == "UseFormerLineSpacing" )
1450  bUseFormerLineSpacing = true;
1451  else if ( pValues->Name == "UseFormerObjectPositioning" )
1452  bUseFormerObjectPositioning = true;
1453  else if ( pValues->Name == "UseFormerTextWrapping" )
1454  bUseFormerTextWrapping = true;
1455  else if ( pValues->Name == "UseOldNumbering" )
1456  bUseOldNumbering = true;
1457  else if ( pValues->Name == "ConsiderTextWrapOnObjPos" )
1458  bConsiderWrapOnObjPos = true;
1459  else if ( pValues->Name == "IgnoreFirstLineIndentInNumbering" )
1460  bIgnoreFirstLineIndentInNumbering = true;
1461  else if ( pValues->Name == "DoNotJustifyLinesWithManualBreak" )
1462  bDoNotJustifyLinesWithManualBreak = true;
1463  else if ( pValues->Name == "DoNotResetParaAttrsForNumFont" )
1464  bDoNotResetParaAttrsForNumFont = true;
1465  else if ( pValues->Name == "LoadReadonly" )
1466  bLoadReadonly = true;
1467  else if ( pValues->Name == "DoNotCaptureDrawObjsOnPage" )
1468  bDoNotCaptureDrawObjsOnPage = true;
1469  else if ( pValues->Name == "ClipAsCharacterAnchoredWriterFlyFrames" )
1470  bClipAsCharacterAnchoredWriterFlyFrames = true;
1471  else if ( pValues->Name == "UnxForceZeroExtLeading" )
1472  bUnixForceZeroExtLeading = true;
1473  else if ( pValues->Name == "SmallCapsPercentage66" )
1474  bSmallCapsPercentage66 = true;
1475  else if ( pValues->Name == "TabOverflow" )
1476  bTabOverflow = true;
1477  else if ( pValues->Name == "UnbreakableNumberings" )
1478  bUnbreakableNumberings = true;
1479  else if ( pValues->Name == "ClippedPictures" )
1480  bClippedPictures = true;
1481  else if ( pValues->Name == "BackgroundParaOverDrawings" )
1482  bBackgroundParaOverDrawings = true;
1483  else if ( pValues->Name == "TabOverMargin" )
1484  {
1485  bTabOverMargin = true;
1486  pValues->Value >>= bTabOverMarginValue;
1487  }
1488  else if ( pValues->Name == "PropLineSpacingShrinksFirstLine" )
1489  bPropLineSpacingShrinksFirstLine = true;
1490  else if (pValues->Name == "SubtractFlysAnchoredAtFlys")
1491  bSubtractFlysAnchoredAtFlys = true;
1492  else if (pValues->Name == "CollapseEmptyCellPara")
1493  bCollapseEmptyCellPara = true;
1494  }
1495  catch( Exception& )
1496  {
1497  OSL_FAIL( "SwXMLImport::SetConfigurationSettings: Exception!" );
1498  }
1499  }
1500  pValues++;
1501  }
1502 
1503  try
1504  {
1505  if( currentDatabaseDataSource != nullptr )
1506  xProps->setPropertyValue( currentDatabaseDataSource->Name, currentDatabaseDataSource->Value );
1507  if( currentDatabaseCommand != nullptr )
1508  xProps->setPropertyValue( currentDatabaseCommand->Name, currentDatabaseCommand->Value );
1509  if( currentDatabaseCommandType != nullptr )
1510  xProps->setPropertyValue( currentDatabaseCommandType->Name, currentDatabaseCommandType->Value );
1511  if (embeddedDatabaseName)
1512  xProps->setPropertyValue(embeddedDatabaseName->Name, embeddedDatabaseName->Value);
1513  } catch( Exception& )
1514  {
1515  OSL_FAIL( "SwXMLImport::SetConfigurationSettings: Exception!" );
1516  }
1517 
1518  // finally, treat the non-default cases
1519  // introduce boolean, that indicates a document, written by version prior SO8.
1520  const bool bDocumentPriorSO8 = !bConsiderWrapOnObjPos;
1521 
1522  if( ! bPrinterIndependentLayout )
1523  {
1524  xProps->setPropertyValue( "PrinterIndependentLayout", Any(sal_Int16(document::PrinterIndependentLayout::DISABLED)) );
1525  }
1526 
1527  if( ! bAddExternalLeading )
1528  {
1529  xProps->setPropertyValue( "AddExternalLeading", makeAny( false ) );
1530  }
1531 
1532  if( ! bUseFormerLineSpacing )
1533  {
1534  xProps->setPropertyValue( "UseFormerLineSpacing", makeAny( true ) );
1535  }
1536 
1537  if( !bUseFormerObjectPositioning )
1538  {
1539  xProps->setPropertyValue( "UseFormerObjectPositioning", makeAny( true ) );
1540  }
1541 
1542  if( !bUseOldNumbering )
1543  {
1544  xProps->setPropertyValue( "UseOldNumbering", makeAny(true) );
1545  }
1546 
1547  if( !bAddParaSpacingToTableCells )
1548  {
1549  xProps->setPropertyValue( "AddParaSpacingToTableCells",
1550  makeAny( false ) );
1551  }
1552 
1553  if( !bUseFormerTextWrapping )
1554  {
1555  xProps->setPropertyValue( "UseFormerTextWrapping", makeAny( true ) );
1556  }
1557 
1558  if( !bConsiderWrapOnObjPos )
1559  {
1560  xProps->setPropertyValue( "ConsiderTextWrapOnObjPos", makeAny( false ) );
1561  }
1562 
1563  // #i47448#
1564  // For SO7pp4, part of the 'new numbering' stuff has been backported from
1565  // SO8. Unfortunately, only part of it and by using the same compatibility option
1566  // like in SO8. Therefore documents generated with SO7pp4, containing
1567  // numbered paragraphs with first line indent differ between SO7pp4 and
1568  // SO8. In order to fix this for SO8pp1, I introduce a new compatibility
1569  // flag 'bIgnoreFirstLineIndentInNumbering'. This flag has to be set for all
1570  // documents < SO8, but not for SO8. So if the property is not present, the
1571  // flag will be set to 'true'. SO8 documents surely have the
1572  // 'ConsiderWrapOnObjPos' property set (no matter if 'true' or 'false'),
1573  // therefore the correct condition to set this flag is this:
1574  if( !bIgnoreFirstLineIndentInNumbering && bDocumentPriorSO8 )
1575  {
1576  xProps->setPropertyValue( "IgnoreFirstLineIndentInNumbering",
1577  makeAny( true ) );
1578  }
1579 
1580  // This flag has to be set for all documents < SO8
1581  if ( !bDoNotJustifyLinesWithManualBreak && bDocumentPriorSO8 )
1582  {
1583  xProps->setPropertyValue( "DoNotJustifyLinesWithManualBreak",
1584  makeAny( true ) );
1585  }
1586 
1587  // This flag has to be set for all documents < SO8
1588  if ( !bDoNotResetParaAttrsForNumFont && bDocumentPriorSO8 )
1589  {
1590  xProps->setPropertyValue( "DoNotResetParaAttrsForNumFont",
1591  makeAny( true ) );
1592  }
1593 
1594  if ( !bLoadReadonly )
1595  {
1596  xProps->setPropertyValue( "LoadReadonly", makeAny( false ) );
1597  }
1598 
1599  // This flag has to be set for all documents < SO8
1600  if ( !bDoNotCaptureDrawObjsOnPage && bDocumentPriorSO8 )
1601  {
1602  xProps->setPropertyValue( "DoNotCaptureDrawObjsOnPage",
1603  makeAny( true ) );
1604  }
1605 
1606  // This flag has to be set for all documents < SO8
1607  if ( !bClipAsCharacterAnchoredWriterFlyFrames && bDocumentPriorSO8 )
1608  {
1609  xProps->setPropertyValue( "ClipAsCharacterAnchoredWriterFlyFrames",
1610  makeAny( true ) );
1611  }
1612 
1613  if ( !bUnixForceZeroExtLeading )
1614  {
1615  xProps->setPropertyValue( "UnxForceZeroExtLeading", makeAny( true ) );
1616  }
1617 
1618  // Old LO versions had 66 as the value for small caps percentage, later changed to 80.
1619  // In order to keep backwards compatibility, SmallCapsPercentage66 option is written to .odt
1620  // files, and the default for new documents is 'false'. Files without this option
1621  // are considered to be old files, so set the compatibility option too.
1622  if ( !bSmallCapsPercentage66 )
1623  {
1624  xProps->setPropertyValue( "SmallCapsPercentage66", makeAny( true ) );
1625  }
1626 
1627  if ( !bTabOverflow )
1628  {
1629  xProps->setPropertyValue( "TabOverflow", makeAny( false ) );
1630  }
1631 
1632  if ( !bUnbreakableNumberings )
1633  {
1634  xProps->setPropertyValue( "UnbreakableNumberings", makeAny( false ) );
1635  }
1636 
1637  if ( !bClippedPictures )
1638  {
1639  xProps->setPropertyValue( "ClippedPictures", makeAny( false ) );
1640  }
1641 
1642  if ( !bBackgroundParaOverDrawings )
1643  xProps->setPropertyValue("BackgroundParaOverDrawings", makeAny( false ) );
1644 
1645  if ( !bTabOverMargin )
1646  xProps->setPropertyValue("TabOverMargin", makeAny( false ) );
1647 
1648  if (bTabOverMarginValue)
1649  // Let TabOverMargin imply the new default for
1650  // PrinterIndependentLayout, knowing the first is set by Word import
1651  // filters and Word defaults to our new default as well.
1652  xProps->setPropertyValue(
1653  "PrinterIndependentLayout",
1654  uno::Any(static_cast<sal_Int16>(document::PrinterIndependentLayout::HIGH_RESOLUTION)));
1655 
1656  if (!bPropLineSpacingShrinksFirstLine)
1657  xProps->setPropertyValue("PropLineSpacingShrinksFirstLine", makeAny(false));
1658 
1659  if (!bSubtractFlysAnchoredAtFlys)
1660  xProps->setPropertyValue("SubtractFlysAnchoredAtFlys", makeAny(true));
1661 
1662  if (!bCollapseEmptyCellPara)
1663  xProps->setPropertyValue("CollapseEmptyCellPara", makeAny(false));
1664 
1665  SwDoc *pDoc = getDoc();
1666  SfxPrinter *pPrinter = pDoc->getIDocumentDeviceAccess().getPrinter( false );
1667  if( pPrinter )
1668  {
1669  // If the printer is known, then the OLE objects will
1670  // already have correct sizes, and we don't have to call
1671  // PrtOLENotify again. Otherwise we have to call it.
1672  // The flag might be set from setting the printer, so it
1673  // it is required to clear it.
1674  pDoc->SetOLEPrtNotifyPending( !pPrinter->IsKnown() );
1675  }
1676 }
1677 
1679  const OUString& _rSettingsGroupName,
1680  const Sequence< PropertyValue>& _rSettings )
1681 {
1682  // the only doc-specific settings group we know so far are the XForms settings
1683  if ( !IsXMLToken( _rSettingsGroupName, XML_XFORM_MODEL_SETTINGS ) )
1684  return;
1685 
1686  // preserve the settings for a later iteration - we are currently reading the settings.xml,
1687  // the content.xml will be read later, by another instance of SwXMLImport
1688  OSL_ENSURE( m_xLateInitSettings.is(), "SwXMLImport::SetDocumentSpecificSettings: no storage for those settings!" );
1689  if ( !m_xLateInitSettings.is() )
1690  return;
1691 
1692  try
1693  {
1694  if ( m_xLateInitSettings->hasByName( _rSettingsGroupName ) )
1695  {
1696  m_xLateInitSettings->replaceByName( _rSettingsGroupName, makeAny( _rSettings ) );
1697  OSL_FAIL( "SwXMLImport::SetDocumentSpecificSettings: already have settings for this model!" );
1698  }
1699  else
1700  m_xLateInitSettings->insertByName( _rSettingsGroupName, makeAny( _rSettings ) );
1701  }
1702  catch( const Exception& )
1703  {
1704  }
1705 }
1706 
1708  const Sequence<Any>& aArguments )
1709 {
1710  // delegate to super class
1711  SvXMLImport::initialize(aArguments);
1712 
1713  // we are only looking for a NamedValue "LateInitSettings"
1714  sal_Int32 nLength = aArguments.getLength();
1715  for(sal_Int32 i = 0; i < nLength; i++)
1716  {
1717  beans::NamedValue aNamedValue;
1718  if ( aArguments[i] >>= aNamedValue )
1719  {
1720  if (aNamedValue.Name == "LateInitSettings")
1721  {
1722  OSL_VERIFY( aNamedValue.Value >>= m_xLateInitSettings );
1723  }
1724  }
1725  }
1726 }
1727 
1729 {
1730  uno::Reference<lang::XUnoTunnel> xModelTunnel( rImport.GetModel(), uno::UNO_QUERY );
1731  SwXTextDocument *pTextDoc = reinterpret_cast< SwXTextDocument *>(
1732  sal::static_int_cast< sal_IntPtr >( xModelTunnel->getSomething(SwXTextDocument::getUnoTunnelId() )));
1733  assert( pTextDoc );
1734  assert( pTextDoc->GetDocShell() );
1735  SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
1736  OSL_ENSURE( pDoc, "Where is my document?" );
1737  return pDoc;
1738 }
1739 
1741 {
1742  // obtain SwDoc
1743  Reference<XUnoTunnel> xDocTunnel( GetModel(), UNO_QUERY );
1744  if( ! xDocTunnel.is() )
1745  return;
1746  SwXTextDocument* pXTextDocument = reinterpret_cast<SwXTextDocument*>(
1747  xDocTunnel->getSomething( SwXTextDocument::getUnoTunnelId() ) );
1748  if( pXTextDocument == nullptr )
1749  return;
1750 
1751  SwDoc *pDoc = pXTextDocument->GetDocShell()->GetDoc();
1752 
1753  // init XForms (if not already done)
1754  // (no default model, since we'll load the models)
1755  if( ! pDoc->isXForms() )
1756  pDoc->initXForms( false );
1757 
1758  m_bInititedXForms = true;
1759 }
1760 
1762 {
1763  if( m_pDoc != nullptr )
1764  return m_pDoc;
1765  Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
1766  Reference < XText > xText = xTextDoc->getText();
1767  Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
1768  assert( xTextTunnel.is());
1769  SwXText *pText = reinterpret_cast< SwXText *>(
1770  sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
1771  assert( pText != nullptr );
1772  m_pDoc = pText->GetDoc();
1773  assert( m_pDoc != nullptr );
1774  return m_pDoc;
1775 }
1776 
1778 {
1779  return const_cast< SwXMLImport* >( this )->getDoc();
1780 }
1781 
1782 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1784  css::uno::Sequence<css::uno::Any> const &)
1785 {
1786  return cppu::acquire(new SwXMLImport(context, "com.sun.star.comp.Writer.XMLOasisImporter",
1787  SvXMLImportFlags::ALL));
1788 }
1789 
1790 
1791 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1793  css::uno::Sequence<css::uno::Any> const &)
1794 {
1795  return cppu::acquire(new SwXMLImport(context, "com.sun.star.comp.Writer.XMLOasisStylesImporter",
1796  SvXMLImportFlags::STYLES | SvXMLImportFlags::MASTERSTYLES | SvXMLImportFlags::AUTOSTYLES |
1797  SvXMLImportFlags::FONTDECLS));
1798 }
1799 
1800 
1801 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1803  css::uno::Sequence<css::uno::Any> const &)
1804 {
1805  return cppu::acquire(new SwXMLImport(context, "com.sun.star.comp.Writer.XMLOasisContentImporter",
1806  SvXMLImportFlags::CONTENT | SvXMLImportFlags::SCRIPTS | SvXMLImportFlags::AUTOSTYLES |
1807  SvXMLImportFlags::FONTDECLS));
1808 }
1809 
1810 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1812  css::uno::Sequence<css::uno::Any> const &)
1813 {
1814  return cppu::acquire(new SwXMLImport(context, "com.sun.star.comp.Writer.XMLOasisMetaImporter",
1815  SvXMLImportFlags::META));
1816 }
1817 
1818 
1819 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1821  css::uno::Sequence<css::uno::Any> const &)
1822 {
1823  return cppu::acquire(new SwXMLImport(context, "com.sun.star.comp.Writer.XMLOasisSettingsImporter",
1824  SvXMLImportFlags::SETTINGS));
1825 }
1826 
1827 extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportFODT(SvStream &rStream)
1828 {
1830 
1831  SfxObjectShellLock xDocSh(new SwDocShell(SfxObjectCreateMode::INTERNAL));
1832  xDocSh->DoInitNew();
1833  uno::Reference<frame::XModel> xModel(xDocSh->GetModel());
1834 
1835  uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
1836  uno::Reference<io::XInputStream> xStream(new utl::OSeekableInputStreamWrapper(rStream));
1837  uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.XmlFilterAdaptor"), uno::UNO_SET_THROW);
1838 
1839  css::uno::Sequence<OUString> aUserData(7);
1840  aUserData[0] = "com.sun.star.comp.filter.OdfFlatXml";
1841  aUserData[2] = "com.sun.star.comp.Writer.XMLOasisImporter";
1842  aUserData[3] = "com.sun.star.comp.Writer.XMLOasisExporter";
1843  aUserData[6] = "true";
1844  uno::Sequence<beans::PropertyValue> aAdaptorArgs(comphelper::InitPropertySequence(
1845  {
1846  { "UserData", uno::Any(aUserData) },
1847  }));
1848  css::uno::Sequence<uno::Any> aOuterArgs(1);
1849  aOuterArgs[0] <<= aAdaptorArgs;
1850 
1851  uno::Reference<lang::XInitialization> xInit(xInterface, uno::UNO_QUERY_THROW);
1852  xInit->initialize(aOuterArgs);
1853 
1854  uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW);
1855  uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
1856  {
1857  { "InputStream", uno::Any(xStream) },
1858  { "URL", uno::Any(OUString("private:stream")) },
1859  }));
1860  xImporter->setTargetDocument(xModel);
1861 
1862  uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW);
1863  //SetLoading hack because the document properties will be re-initted
1864  //by the xml filter and during the init, while its considered uninitialized,
1865  //setting a property will inform the document its modified, which attempts
1866  //to update the properties, which throws cause the properties are uninitialized
1867  xDocSh->SetLoading(SfxLoadedFlags::NONE);
1868  bool ret = xFilter->filter(aArgs);
1869  xDocSh->SetLoading(SfxLoadedFlags::ALL);
1870 
1871  xDocSh->DoClose();
1872 
1873  return ret;
1874 }
1875 
1876 extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDOCX(SvStream &rStream)
1877 {
1879 
1880  SfxObjectShellLock xDocSh(new SwDocShell(SfxObjectCreateMode::INTERNAL));
1881  xDocSh->DoInitNew();
1882  uno::Reference<frame::XModel> xModel(xDocSh->GetModel());
1883 
1884  uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
1885  uno::Reference<io::XInputStream> xStream(new utl::OSeekableInputStreamWrapper(rStream));
1886 
1887  uno::Reference<document::XFilter> xFilter(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.WriterFilter"), uno::UNO_QUERY_THROW);
1888 
1889  uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW);
1890  uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
1891  {
1892  { "InputStream", uno::makeAny(xStream) },
1893  { "InputMode", uno::makeAny(true) },
1894  }));
1895  xImporter->setTargetDocument(xModel);
1896 
1897  //SetLoading hack because the document properties will be re-initted
1898  //by the xml filter and during the init, while its considered uninitialized,
1899  //setting a property will inform the document its modified, which attempts
1900  //to update the properties, which throws cause the properties are uninitialized
1901  xDocSh->SetLoading(SfxLoadedFlags::NONE);
1902  bool ret = false;
1903  try
1904  {
1905  ret = xFilter->filter(aArgs);
1906  }
1907  catch (...)
1908  {
1909  }
1910  xDocSh->SetLoading(SfxLoadedFlags::ALL);
1911 
1912  xDocSh->DoClose();
1913 
1914  return ret;
1915 }
1916 
1917 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLOasisMetaImporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlimp.cxx:1811
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
rtl::Reference< SvXMLEmbeddedObjectHelper > m_xEmbeddedResolver
Definition: xmlimp.hxx:74
static OTextCursorHelper * lcl_xml_GetSwXTextCursor(const Reference< XTextCursor > &rTextCursor)
Definition: xmlimp.cxx:483
SAL_DLLPUBLIC_EXPORT bool TestImportDOCX(SvStream &rStream)
Definition: xmlimp.cxx:1876
std::unique_ptr< SwNodeIndex > m_pSttNdIdx
Definition: xmlimp.hxx:64
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
void DeleteMark()
Definition: pam.hxx:177
virtual const SwDoc * GetDoc() const =0
sal_uLong Count() const
Definition: ndarr.hxx:143
const css::uno::Reference< css::document::XEmbeddedObjectResolver > & GetEmbeddedResolver() const
Marks a position in the document model.
Definition: pam.hxx:35
const SwDoc * getDoc() const
Definition: xmlimp.cxx:1777
virtual void SetConfigurationSettings(const css::uno::Sequence< css::beans::PropertyValue > &aConfigProps) override
Definition: xmlimp.cxx:1311
void applyXFormsSettings(const Reference< XNameAccess > &_rXForms, const Sequence< PropertyValue > &_rSettings)
void ClearShapeImport()
bool IsSectionNode() const
Definition: node.hxx:644
XML_STYLES
rtl::Reference< ::xmloff::OFormLayerXMLImport > const & GetFormImport()
const OUString & GetDefaultListStyleName() const
Definition: list.cxx:233
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:185
sal_uLong StartOfSectionIndex() const
Definition: node.hxx:673
XML_DOCUMENT_META
std::unique_ptr< SvXMLTokenMap > m_pTableCellAttrTokenMap
Definition: xmlimp.hxx:70
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLOasisImporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlimp.cxx:1783
const OUString & GetText() const
Definition: ndtxt.hxx:211
XML_DOCUMENT_STYLES
SwDocShell * GetDocShell()
Definition: doc.hxx:1340
rtl::Reference< SvXMLGraphicHelper > m_xGraphicStorageHandler
Definition: xmlimp.hxx:72
bool m_bLoadDoc
Definition: xmlimp.hxx:84
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:270
SwNodeIndex nNode
Definition: pam.hxx:37
sal_uIntPtr sal_uLong
SvXMLImport & GetImport()
Definition: list.hxx:33
bool IsBlockMode() const
Definition: xmlimp.hxx:158
Definition: doc.hxx:185
virtual XMLShapeImportHelper * CreateShapeImport() override
Definition: xmlimp.cxx:1216
SvXMLImportContext * CreateBodyContentContext(const OUString &rLocalName)
Definition: xmltext.cxx:69
css::uno::Reference< css::container::XNameContainer > m_xLateInitSettings
Definition: xmlimp.hxx:81
static const SvXMLTokenMapEntry aDocTokenMap[]
Definition: xmlimp.cxx:120
void setStyleInsertMode(SfxStyleFamily nFamilies, bool bOverwrite)
Definition: xmlimp.cxx:454
XML_MODEL
#define RES_PARATR_LIST_ID
Definition: hintids.hxx:185
SwNode & GetNode() const
Definition: ndindex.hxx:118
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLOasisContentImporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlimp.cxx:1802
SwPosition & GetBound(bool bOne=true)
Definition: pam.hxx:245
SwXMLImport(const css::uno::Reference< css::uno::XComponentContext > &rContext, OUString const &implementationName, SvXMLImportFlags nImportFlags)
Definition: xmlimp.cxx:415
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const Reference< xml::sax::XAttributeList > &xAttrList) override
Definition: xmlimp.cxx:228
std::unique_ptr< SvXMLTokenMap > m_pTableElemTokenMap
Definition: xmlimp.hxx:69
css::uno::Reference< css::frame::XModel > GetModel() const
bool IsKnown() const
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
XML_BODY
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:347
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
Definition: node.cxx:1775
virtual SwContentNode * JoinNext() override
Definition: ndtxt.cxx:949
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unotext.cxx:1208
SvTextShapeImportHelper(SvXMLImport &rImp)
Definition: xmlimp.cxx:1179
bool IsLoadUserSettings() const
SwXMLImport & GetSwImport()
Definition: xmlimp.cxx:194
XML_MASTER_STYLES
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:187
#define XML_TOKEN_MAP_END
SwContentNode * GetContentNode(bool bPoint=true) const
Definition: pam.hxx:229
void SetFontDecls(XMLFontStylesContext *pFontDecls)
SvXMLImportContext * CreateScriptContext(const OUString &rLocalName)
Definition: xmlscript.cxx:29
bool m_bInsert
Definition: xmlimp.hxx:85
bool m_bInititedXForms
Definition: xmlimp.hxx:91
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLOasisSettingsImporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlimp.cxx:1820
SvXMLImportContext * CreateMasterStylesContext(const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
Definition: xmlfmt.cxx:956
const SvXMLTokenMap & GetDocElemTokenMap()
Definition: xmlimp.cxx:360
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: xmlimp.cxx:1707
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
Definition: nodes.cxx:1063
rtl::Reference< ::xmloff::OFormLayerXMLImport > rFormImport
Definition: xmlimp.cxx:1167
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
bool IsStylesOnlyMode() const
Definition: xmlimp.hxx:157
SwXMLDocTokens
Definition: xmlimp.cxx:107
Reference< XInputStream > xStream
SwNodeType GetNodeType() const
Definition: node.hxx:144
SwIndex nContent
Definition: pam.hxx:38
SvXMLImportFlags
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, const bool bReset=true, const bool bResetListAttrs=false, SwRootFrame const *pLayout=nullptr)
Add 4th optional parameter .
Definition: docfmt.cxx:1096
virtual void SAL_CALL startDocument() override
Definition: xmlimp.cxx:495
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLOasisStylesImporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlimp.cxx:1792
virtual SvXMLImportContext * CreateDocumentContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
void PrtOLENotify(bool bAll)
Definition: docdesc.cxx:693
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:458
const OUString & GetLocalName() const
virtual SvXMLImportContext * CreateDocumentContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlimp.cxx:368
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
SwXMLOfficeDocContext_Impl(SwXMLImport &rImport, const Reference< document::XDocumentProperties > &xDocProps)
Definition: xmlimp.cxx:298
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
void SetInXMLImport(bool bNew)
Definition: doc.hxx:962
XML_AUTOMATIC_STYLES
XML_DOCUMENT_SETTINGS
SfxStyleFamily
bool m_bOrganizerMode
Definition: xmlimp.hxx:90
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
bool m_bBlock
Definition: xmlimp.hxx:89
void SetGraphicStorageHandler(css::uno::Reference< css::document::XGraphicStorageHandler > const &rxGraphicStorageHandler)
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unotxdoc.cxx:293
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:202
bool IsContentNode() const
Definition: node.hxx:628
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool HasShapeImport() const
void Increment(sal_Int32 nInc=1)
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:483
virtual SvXMLImportContext * CreateFastContext(sal_Int32 nElement, const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlimp.cxx:391
virtual tools::Rectangle GetVisArea(sal_uInt16 nAspect) const override
Definition: docsh.cxx:930
void SetOLEPrtNotifyPending(bool bSet=true)
Definition: doc.hxx:1665
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2423
virtual SwList * getListByName(const OUString &rListId) const =0
bool IsOLEPrtNotifyPending() const
Definition: doc.hxx:556
const SfxPoolItem * GetNoCondAttr(sal_uInt16 nWhich, bool bInParents) const
Obtains attribute that is not delivered via conditional style!
Definition: node.cxx:1735
SwXMLImport & GetSwImport()
Definition: xmlimp.cxx:136
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
void setY(long y)
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void initXForms(bool bCreateDefaultModel)
Definition: docxforms.cxx:49
bool CanJoinPrev(SwNodeIndex *pIdx=nullptr) const
Can we join two Nodes? We can return the 2nd position in pIdx.
Definition: node.cxx:1799
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:323
bool HasTextImport() const
void FinitItemImport()
Definition: xmlitemi.cxx:333
void ensure()
Definition: swdll.cxx:69
static rtl::Reference< SvXMLEmbeddedObjectHelper > Create(const css::uno::Reference< css::embed::XStorage > &,::comphelper::IEmbeddedHelper &rDocPersist, SvXMLEmbeddedObjectHelperMode eCreateMode)
void SetLoading(SfxLoadedFlags nFlags)
XML_SETTINGS
void SetSize(const Size &rSize)
int i
void UpdateTextCollConditions(SwDoc *pDoc)
Definition: xmlfmt.cxx:981
XML_SCRIPTS
#define PROGRESS_BAR_STEP
Definition: xmlimp.hxx:50
SwDoc * GetDoc() const
Definition: pam.hxx:243
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
void AddStyleDisplayName(sal_uInt16 nFamily, const OUString &rName, const OUString &rDisplayName)
void startPage(css::uno::Reference< css::drawing::XShapes > const &rShapes)
virtual SwFormatColl * ChgFormatColl(SwFormatColl *) override
Definition: ndtxt.cxx:3929
SwDocShell * GetDocShell()
Definition: unotxdoc.hxx:464
friend friend class SvXMLImportContext
ProgressBarHelper * GetProgressBarHelper()
XML_XFORM_MODEL_SETTINGS
sal_uInt16 Get(sal_uInt16 nPrefix, const OUString &rLName) const
Marks a node in the document model.
Definition: ndindex.hxx:31
bool IsEndNode() const
Definition: node.hxx:632
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const Reference< xml::sax::XAttributeList > &xAttrList) override
Definition: xmlimp.cxx:178
std::unique_ptr< SvXMLTokenMap > m_pDocElemTokenMap
Definition: xmlimp.hxx:68
void SetInReading(bool bNew)
Definition: doc.hxx:949
tuple index
void endPage(css::uno::Reference< css::drawing::XShapes > const &rShapes)
void SetEmbeddedResolver(css::uno::Reference< css::document::XEmbeddedObjectResolver > const &_xEmbeddedResolver)
#define ASPECT_CONTENT
bool isXForms() const
Definition: docxforms.cxx:44
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
virtual ~SvTextShapeImportHelper() override
Definition: xmlimp.cxx:1197
bool IsInReading() const
Definition: doc.hxx:948
Size GetSize() const
SvXMLImportContext(SvXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName)
virtual void EndElement() override
Definition: xmlimp.cxx:351
virtual const SwPaM * GetPaM() const =0
virtual void SAL_CALL startDocument() override
SfxStyleFamily GetStyleFamilyMask() const
Definition: xmlimp.hxx:155
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:83
void setLock(bool bLock)
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:677
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
Reference< drawing::XDrawPage > xPage
Definition: xmlimp.cxx:1172
Reference< XMultiServiceFactory > getProcessServiceFactory()
XML_DOCUMENT
SfxStyleFamily m_nStyleFamilyMask
Definition: xmlimp.hxx:83
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: xmlimp.cxx:472
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlimp.cxx:307
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1471
void ClearTextImport()
XML_DOCUMENT_CONTENT
SvXMLImportFlags getImportFlags() const
css::uno::Reference< css::document::XDocumentProperties > GetDocumentProperties() const
Definition: xmlmeta.cxx:45
void MergeListsAtDocumentInsertPosition(SwDoc *pDoc)
Definition: xmlimp.cxx:1026
unsigned char sal_uInt8
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
void InitItemImport()
Definition: xmlitemi.cxx:320
MapUnit GetMapUnit() const
sal_Int32 GetIndex() const
Definition: index.hxx:95
SvXMLImportContext * CreateStylesContext(const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, bool bAuto)
Definition: xmlfmt.cxx:940
bool DoInitNew(SfxMedium *pMedium=nullptr)
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:208
virtual SwDrawModel * GetOrCreateDrawModel()=0
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
SwNodes & GetNodes()
Definition: doc.hxx:403
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
#define XML_ELEMENT(prefix, name)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlimp.cxx:222
SfxObjectShell * GetPersist() const
Definition: docnew.cxx:634
virtual void SetDocumentSpecificSettings(const OUString &_rSettingsGroupName, const css::uno::Sequence< css::beans::PropertyValue > &_rSettings) override
Definition: xmlimp.cxx:1678
const SvXMLUnitConverter & GetMM100UnitConverter() const
SAL_DLLPUBLIC_EXPORT bool TestImportFODT(SvStream &rStream)
Definition: xmlimp.cxx:1827
const css::uno::Reference< css::frame::XModel > & GetModel() const
virtual void SAL_CALL endDocument() override
Definition: xmlimp.cxx:735
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
XML_META
SvXMLImportContext * createXFormsModelContext(SvXMLImport &rImport, sal_uInt16 nPrefix, const OUString &rLocalName)
virtual void SetVisArea(const tools::Rectangle &rRect) override
OLE-stuff.
Definition: docsh.cxx:906
SwXMLDocStylesContext_Impl(SwXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName)
Definition: xmlimp.cxx:342
OUString encodeStyleName(const OUString &rName, bool *pEncoded=nullptr) const
virtual ~SwXMLImport() override
Definition: xmlimp.cxx:430
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
void setTextInsertMode(const css::uno::Reference< css::text::XTextRange > &rInsertPos)
Definition: xmlimp.cxx:443
SwDoc * m_pDoc
Definition: xmlimp.hxx:93
const css::uno::Reference< css::beans::XPropertySet > & getImportInfo() const
XML_FONT_FACE_DECLS
virtual void SetViewSettings(const css::uno::Sequence< css::beans::PropertyValue > &aViewProps) override
Definition: xmlimp.cxx:1233
#define SAL_WARN(area, stream)
Reference< XModel > xModel
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: xmlimp.cxx:467
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
static rtl::Reference< SvXMLGraphicHelper > Create(const css::uno::Reference< css::embed::XStorage > &rXMLStorage, SvXMLGraphicHelperMode eCreateMode)
void setX(long x)
SwXMLBodyContext_Impl(SwXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName)
Definition: xmlimp.cxx:148
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:457
SvXMLImportContext * CreateMetaContext(const sal_Int32 nElement)
Definition: xmlmeta.cxx:57
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1135
sal_Int32 const nLength
void JoinPrev()
Definition: ndtxt.cxx:1047
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2470
SwDoc * GetDocFromXMLImport(SvXMLImport const &)
Definition: xmlimp.cxx:1728
virtual XMLTextImportHelper * CreateTextImport() override
Definition: xmlimp.cxx:1208
SwXMLDocContext_Impl(SwXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName)
Definition: xmlimp.cxx:211
IDocumentListsAccess const & getIDocumentListsAccess() const
Definition: doc.cxx:325
bool IsTextNode() const
Definition: node.hxx:636
void setWidth(long nWidth)
SvXMLImportContext * CreateFontDeclsContext(const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
Definition: xmlimp.cxx:1221
sal_Int64 sanitiseMm100ToTwip(sal_Int64 n)
#define XML_STYLE_FAMILY_TEXT_TEXT
virtual void initXForms() override
Definition: xmlimp.cxx:1740
bool IsInXMLImport() const
Definition: doc.hxx:961
virtual void SAL_CALL endDocument() override
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
const css::uno::Reference< css::document::XGraphicStorageHandler > & GetGraphicStorageHandler() const
Base class of the Writer document model elements.
Definition: node.hxx:79
void setHeight(long nHeight)
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:836
bool IsInsertMode() const
Definition: xmlimp.hxx:156
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)