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( isUnoTunnelId<SwXMLImport>(rId) )
475  {
476  return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
477  }
478  return SvXMLImport::getSomething( rId );
479 }
480 
481 static OTextCursorHelper *lcl_xml_GetSwXTextCursor( const Reference < XTextCursor >& rTextCursor )
482 {
483  Reference<XUnoTunnel> xCursorTunnel( rTextCursor, UNO_QUERY );
484  OSL_ENSURE( xCursorTunnel.is(), "missing XUnoTunnel for Cursor" );
485  if( !xCursorTunnel.is() )
486  return nullptr;
487  OTextCursorHelper *pTextCursor = reinterpret_cast< OTextCursorHelper *>(
488  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
489  OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
490  return pTextCursor;
491 }
492 
494 {
495  // delegate to parent
497 
498  OSL_ENSURE( GetModel().is(), "model is missing" );
499  if( !GetModel().is() )
500  return;
501 
502  // this method will modify the document directly -> lock SolarMutex
503  SolarMutexGuard aGuard;
504 
505  Reference< XPropertySet > xImportInfo( getImportInfo() );
506  Reference< XPropertySetInfo > xPropertySetInfo;
507  if( xImportInfo.is() )
508  xPropertySetInfo = xImportInfo->getPropertySetInfo();
509  if( xPropertySetInfo.is() )
510  {
511  Any aAny;
512  // insert style mode?
513  OUString sStyleInsertModeFamilies("StyleInsertModeFamilies");
514  if( xPropertySetInfo->hasPropertyByName(sStyleInsertModeFamilies) )
515  {
516  aAny = xImportInfo->getPropertyValue(sStyleInsertModeFamilies);
517  Sequence< OUString> aFamiliesSeq;
518  if( aAny >>= aFamiliesSeq )
519  {
520  SfxStyleFamily nFamilyMask = SfxStyleFamily::None;
521  for( const OUString& rFamily : std::as_const(aFamiliesSeq) )
522  {
523  if( rFamily=="FrameStyles" )
524  nFamilyMask |= SfxStyleFamily::Frame;
525  else if( rFamily=="PageStyles" )
526  nFamilyMask |= SfxStyleFamily::Page;
527  else if( rFamily=="CharacterStyles" )
528  nFamilyMask |= SfxStyleFamily::Char;
529  else if( rFamily=="ParagraphStyles" )
530  nFamilyMask |= SfxStyleFamily::Para;
531  else if( rFamily=="NumberingStyles" )
532  nFamilyMask |= SfxStyleFamily::Pseudo;
533  }
534 
535  bool bOverwrite = false;
536  const OUString sStyleInsertModeOverwrite("StyleInsertModeOverwrite");
537  if( xPropertySetInfo->hasPropertyByName(sStyleInsertModeOverwrite) )
538  {
539  aAny = xImportInfo->getPropertyValue(sStyleInsertModeOverwrite);
540  if( auto b = o3tl::tryAccess<bool>(aAny) )
541  {
542  if( *b )
543  bOverwrite = true;
544  }
545  }
546 
547  setStyleInsertMode( nFamilyMask, bOverwrite );
548  }
549  }
550 
551  // text insert mode?
552  const OUString sTextInsertModeRange("TextInsertModeRange");
553  if( xPropertySetInfo->hasPropertyByName(sTextInsertModeRange) )
554  {
555  aAny = xImportInfo->getPropertyValue(sTextInsertModeRange);
556  Reference<XTextRange> xInsertTextRange;
557  if( aAny >>= xInsertTextRange )
558  setTextInsertMode( xInsertTextRange );
559  }
560 
561  // auto text mode
562  const OUString sAutoTextMode("AutoTextMode");
563  if( xPropertySetInfo->hasPropertyByName(sAutoTextMode) )
564  {
565  aAny = xImportInfo->getPropertyValue(sAutoTextMode);
566  if( auto b = o3tl::tryAccess<bool>(aAny) )
567  {
568  if( *b )
569  m_bBlock = true;
570  }
571  }
572 
573  // organizer mode
574  const OUString sOrganizerMode("OrganizerMode");
575  if( xPropertySetInfo->hasPropertyByName(sOrganizerMode) )
576  {
577  aAny = xImportInfo->getPropertyValue(sOrganizerMode);
578  if( auto b = o3tl::tryAccess<bool>(aAny) )
579  {
580  if( *b )
581  m_bOrganizerMode = true;
582  }
583  }
584 
585  // default document properties
586  const OUString sDefSettings("DefaultDocumentSettings");
587  if (xPropertySetInfo->hasPropertyByName(sDefSettings))
588  {
589  aAny = xImportInfo->getPropertyValue(sDefSettings);
591  if (aAny >>= aProps)
592  {
594  Reference<XPropertySet> xProps(
595  xFac->createInstance("com.sun.star.document.Settings"), UNO_QUERY);
596  Reference<XPropertySetInfo> xInfo(xProps->getPropertySetInfo());
597 
598  if (xProps.is() && xInfo.is())
599  {
600  for (const auto& rProp : std::as_const(aProps))
601  {
602  if (xInfo->hasPropertyByName(rProp.Name))
603  {
604  xProps->setPropertyValue(rProp.Name, rProp.Value);
605  }
606  }
607  }
608  }
609  }
610  }
611 
612  // There only is a text cursor by now if we are in insert mode. In any
613  // other case we have to create one at the start of the document.
614  // We also might change into the insert mode later, so we have to make
615  // sure to first set the insert mode and then create the text import
616  // helper. Otherwise it won't have the insert flag set!
617  OTextCursorHelper *pTextCursor = nullptr;
618  Reference < XTextCursor > xTextCursor;
619  if( HasTextImport() )
620  xTextCursor = GetTextImport()->GetCursor();
621  if( !xTextCursor.is() )
622  {
623  Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
624  Reference < XText > xText = xTextDoc->getText();
625  xTextCursor = xText->createTextCursor();
626  SwCursorShell *pCursorSh = nullptr;
627  SwDoc *pDoc = nullptr;
628  if( SvXMLImportFlags::ALL == getImportFlags() )
629  {
630  pTextCursor = lcl_xml_GetSwXTextCursor( xTextCursor );
631  OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
632  if( !pTextCursor )
633  return;
634 
635  pDoc = pTextCursor->GetDoc();
636  OSL_ENSURE( pDoc, "SwDoc missing" );
637  if( !pDoc )
638  return;
639 
640  // Is there an edit shell. If yes, then we are currently inserting
641  // a document. We then have to insert at the current edit shell's
642  // cursor position. That not quite clean code, but there is no other
643  // way currently.
644  pCursorSh = pDoc->GetEditShell();
645  }
646  if( pCursorSh )
647  {
648  const uno::Reference<text::XTextRange> xInsertTextRange(
650  *pDoc, *pCursorSh->GetCursor()->GetPoint(), nullptr ) );
651  setTextInsertMode( xInsertTextRange );
652  xTextCursor = GetTextImport()->GetCursor();
653  pTextCursor = nullptr;
654  }
655  else
656  GetTextImport()->SetCursor( xTextCursor );
657  }
658 
659  if( !(getImportFlags() & (SvXMLImportFlags::CONTENT|SvXMLImportFlags::MASTERSTYLES)) )
660  return;
661 
662  if( !pTextCursor )
663  pTextCursor = lcl_xml_GetSwXTextCursor( xTextCursor );
664  OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
665  if( !pTextCursor )
666  return;
667 
668  SwDoc *pDoc = pTextCursor->GetDoc();
669  OSL_ENSURE( pDoc, "SwDoc missing" );
670  if( !pDoc )
671  return;
672 
673  if (SvXMLImportFlags::ALL == getImportFlags())
674  {
675  // for flat ODF - this is done in SwReader::Read() for package ODF
676  pDoc->SetInReading(true);
677  pDoc->SetInXMLImport(true);
678  }
679 
680  if( (getImportFlags() & SvXMLImportFlags::CONTENT) && !IsStylesOnlyMode() )
681  {
682  m_pSttNdIdx.reset(new SwNodeIndex( pDoc->GetNodes() ));
683  if( IsInsertMode() )
684  {
685  SwPaM *pPaM = pTextCursor->GetPaM();
686  const SwPosition* pPos = pPaM->GetPoint();
687 
688  // Split once and remember the node that has been split.
689  pDoc->getIDocumentContentOperations().SplitNode( *pPos, false );
690  *m_pSttNdIdx = pPos->nNode.GetIndex()-1;
691 
692  // Split again.
693  pDoc->getIDocumentContentOperations().SplitNode( *pPos, false );
694 
695  // Insert all content into the new node
696  pPaM->Move( fnMoveBackward );
697  pDoc->SetTextFormatColl
699  }
700  }
701 
702  // We need a draw model to be able to set the z order
703  pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); // #i52858# - method name changed
704 
705  // SJ: #i49801# locking the model to disable repaints
706  SwDrawModel* pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel();
707  if ( pDrawModel )
708  pDrawModel->setLock(true);
709 
710  if (!GetGraphicStorageHandler().is())
711  {
712  m_xGraphicStorageHandler = SvXMLGraphicHelper::Create(SvXMLGraphicHelperMode::Read);
714  }
715 
716  if( !GetEmbeddedResolver().is() )
717  {
718  SfxObjectShell *pPersist = pDoc->GetPersist();
719  if( pPersist )
720  {
722  *pPersist,
723  SvXMLEmbeddedObjectHelperMode::Read );
724  Reference< document::XEmbeddedObjectResolver > xEmbeddedResolver( m_xEmbeddedResolver.get() );
725  SetEmbeddedResolver( xEmbeddedResolver );
726  }
727  }
728 }
729 
731 {
732  OSL_ENSURE( GetModel().is(), "model missing; maybe startDocument wasn't called?" );
733  if( !GetModel().is() )
734  return;
735 
736  // this method will modify the document directly -> lock SolarMutex
737  SolarMutexGuard aGuard;
738 
740  m_xGraphicStorageHandler->dispose();
741  m_xGraphicStorageHandler.clear();
742 
743  if( m_xEmbeddedResolver )
744  m_xEmbeddedResolver->dispose();
745  m_xEmbeddedResolver.clear();
746  // Clear the shape import to sort the shapes (and not in the
747  // destructor that might be called after the import has finished
748  // for Java filters.
749  if( HasShapeImport() )
751 
752  SwDoc *pDoc = nullptr;
753  if( (getImportFlags() & SvXMLImportFlags::CONTENT) && !IsStylesOnlyMode() )
754  {
755  Reference<XUnoTunnel> xCursorTunnel( GetTextImport()->GetCursor(),
756  UNO_QUERY);
757  assert(xCursorTunnel.is() && "missing XUnoTunnel for Cursor");
758  OTextCursorHelper *pTextCursor = reinterpret_cast< OTextCursorHelper *>(
759  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
760  assert(pTextCursor && "SwXTextCursor missing");
761  SwPaM *pPaM = pTextCursor->GetPaM();
762  if( IsInsertMode() && m_pSttNdIdx->GetIndex() )
763  {
764  // If we are in insert mode, join the split node that is in front
765  // of the new content with the first new node. Or in other words:
766  // Revert the first split node.
767  SwTextNode* pTextNode = m_pSttNdIdx->GetNode().GetTextNode();
768  SwNodeIndex aNxtIdx( *m_pSttNdIdx );
769  if( pTextNode && pTextNode->CanJoinNext( &aNxtIdx ) &&
770  m_pSttNdIdx->GetIndex() + 1 == aNxtIdx.GetIndex() )
771  {
772  // If the PaM points to the first new node, move the PaM to the
773  // end of the previous node.
774  if( pPaM->GetPoint()->nNode == aNxtIdx )
775  {
776  pPaM->GetPoint()->nNode = *m_pSttNdIdx;
777  pPaM->GetPoint()->nContent.Assign( pTextNode,
778  pTextNode->GetText().getLength());
779  }
780 
781 #if OSL_DEBUG_LEVEL > 0
782  // !!! This should be impossible !!!!
783  OSL_ENSURE( m_pSttNdIdx->GetIndex()+1 !=
784  pPaM->GetBound().nNode.GetIndex(),
785  "PaM.Bound1 point to new node " );
786  OSL_ENSURE( m_pSttNdIdx->GetIndex()+1 !=
787  pPaM->GetBound( false ).nNode.GetIndex(),
788  "PaM.Bound2 points to new node" );
789 
790  if( m_pSttNdIdx->GetIndex()+1 ==
791  pPaM->GetBound().nNode.GetIndex() )
792  {
793  const sal_Int32 nCntPos =
794  pPaM->GetBound().nContent.GetIndex();
795  pPaM->GetBound().nContent.Assign( pTextNode,
796  pTextNode->GetText().getLength() + nCntPos );
797  }
798  if( m_pSttNdIdx->GetIndex()+1 ==
799  pPaM->GetBound( false ).nNode.GetIndex() )
800  {
801  const sal_Int32 nCntPos =
802  pPaM->GetBound( false ).nContent.GetIndex();
803  pPaM->GetBound( false ).nContent.Assign( pTextNode,
804  pTextNode->GetText().getLength() + nCntPos );
805  }
806 #endif
807  // If the first new node isn't empty, convert the node's text
808  // attributes into hints. Otherwise, set the new node's
809  // paragraph style at the previous (empty) node.
810  SwTextNode* pDelNd = aNxtIdx.GetNode().GetTextNode();
811  if (!pTextNode->GetText().isEmpty())
812  pDelNd->FormatToTextAttr( pTextNode );
813  else
814  pTextNode->ChgFormatColl( pDelNd->GetTextColl() );
815  pTextNode->JoinNext();
816  }
817  }
818 
819  SwPosition* pPos = pPaM->GetPoint();
820  OSL_ENSURE( !pPos->nContent.GetIndex(), "last paragraph isn't empty" );
821  if( !pPos->nContent.GetIndex() )
822  {
823  SwTextNode* pCurrNd;
824  sal_uLong nNodeIdx = pPos->nNode.GetIndex();
825  pDoc = pPaM->GetDoc();
826 
827  OSL_ENSURE( pPos->nNode.GetNode().IsContentNode(),
828  "insert position is not a content node" );
829  if( !IsInsertMode() )
830  {
831  // If we're not in insert mode, the last node is deleted.
832  const SwNode *pPrev = pDoc->GetNodes()[nNodeIdx -1];
833  if( pPrev->IsContentNode() ||
834  ( pPrev->IsEndNode() &&
835  pPrev->StartOfSectionNode()->IsSectionNode() ) )
836  {
837  SwContentNode* pCNd = pPaM->GetContentNode();
838  if( pCNd && pCNd->StartOfSectionIndex()+2 <
839  pCNd->EndOfSectionIndex() )
840  {
841  pPaM->GetBound().nContent.Assign( nullptr, 0 );
842  pPaM->GetBound(false).nContent.Assign( nullptr, 0 );
843  pDoc->GetNodes().Delete( pPaM->GetPoint()->nNode );
844  }
845  }
846  }
847  else if( nullptr != (pCurrNd = pDoc->GetNodes()[nNodeIdx]->GetTextNode()) )
848  {
849  // Id we're in insert mode, the empty node is joined with
850  // the next and the previous one.
851  if( pCurrNd->CanJoinNext( &pPos->nNode ))
852  {
853  SwTextNode* pNextNd = pPos->nNode.GetNode().GetTextNode();
854  pPos->nContent.Assign( pNextNd, 0 );
855  pPaM->SetMark(); pPaM->DeleteMark();
856  pNextNd->JoinPrev();
857 
858  // Remove line break that has been inserted by the import,
859  // but only if one has been inserted!
860  if( pNextNd->CanJoinPrev(/* &pPos->nNode*/ ) &&
861  *m_pSttNdIdx != pPos->nNode )
862  {
863  pNextNd->JoinPrev();
864  }
865  }
866  else if (pCurrNd->GetText().isEmpty())
867  {
868  pPos->nContent.Assign( nullptr, 0 );
869  pPaM->SetMark(); pPaM->DeleteMark();
870  pDoc->GetNodes().Delete( pPos->nNode );
871  pPaM->Move( fnMoveBackward );
872  }
873  }
874 
875  // tdf#113877
876  // when we insert one document with list inside into another one with list at the insert position,
877  // the resulting numbering in these lists is not consequent.
878  //
879  // Main document:
880  // 1. One
881  // 2. Two
882  // 3. Three
883  // 4. <-- insert position
884  //
885  // Inserted document:
886  // 1. One
887  // 2. Two
888  // 3. Three
889  // 4.
890  //
891  // Expected result
892  // 1. One
893  // 2. Two
894  // 3. Three
895  // 4. One
896  // 5. Two
897  // 6. Three
898  // 7.
899  //
901  }
902  }
903 
904  /* Was called too early. Moved from SwXMLBodyContext_Impl::EndElement */
905 
906  GetTextImport()->RedlineAdjustStartNodeCursor( false );
907 
908  if( (getImportFlags() & SvXMLImportFlags::CONTENT) ||
909  ((getImportFlags() & SvXMLImportFlags::MASTERSTYLES) && IsStylesOnlyMode()) )
910  {
911  // pDoc might be 0. In this case UpdateTextCollCondition is looking
912  // for it itself.
913  UpdateTextCollConditions( pDoc );
914  }
915 
916  GetTextImport()->ResetCursor();
917 
918  m_pSttNdIdx.reset();
919 
920  // SJ: #i49801# -> now permitting repaints
921  if ( pDoc )
922  {
923  if( getImportFlags() == SvXMLImportFlags::ALL )
924  {
925  // Notify math objects. If we are in the package filter this will
926  // be done by the filter object itself
927  if( IsInsertMode() )
928  pDoc->PrtOLENotify( false );
929  else if ( pDoc->IsOLEPrtNotifyPending() )
930  pDoc->PrtOLENotify( true );
931 
932  assert(pDoc->IsInReading());
933  assert(pDoc->IsInXMLImport());
934  pDoc->SetInReading(false);
935  pDoc->SetInXMLImport(false);
936  }
937 
938  SwDrawModel* pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel();
939  if ( pDrawModel )
940  pDrawModel->setLock(false);
941  }
942 
943  // #i90243#
944  if ( m_bInititedXForms )
945  {
946  Reference< xforms::XFormsSupplier > xFormsSupp( GetModel(), UNO_QUERY );
947  Reference< XNameAccess > xXForms;
948  if ( xFormsSupp.is() )
949  xXForms = xFormsSupp->getXForms().get();
950 
951  if ( xXForms.is() )
952  {
953  try
954  {
955  Sequence< beans::PropertyValue > aXFormsSettings;
956 
957  const OUString& sXFormsSettingsName( GetXMLToken( XML_XFORM_MODEL_SETTINGS ) );
958  if ( m_xLateInitSettings.is() && m_xLateInitSettings->hasByName( sXFormsSettingsName ) )
959  {
960  OSL_VERIFY( m_xLateInitSettings->getByName( sXFormsSettingsName ) >>= aXFormsSettings );
961  applyXFormsSettings( xXForms, aXFormsSettings );
962  }
963  }
964  catch( const Exception& )
965  {
966  }
967  }
968  }
969 
970  // delegate to parent: takes care of error handling
972  ClearTextImport();
973 }
974 
975 // tdf#113877
976 // when we insert one document with list inside into another one with list at the insert position,
977 // the resulting numbering in these lists is not consequent.
978 //
979 // CASE-1: Main document:
980 // 1. One
981 // 2. Two
982 // 3. Three
983 // 4. <-- insert position
984 //
985 // Inserted document:
986 // 1. One
987 // 2. Two
988 // 3. Three
989 // 4.
990 //
991 // Expected result
992 // 1. One
993 // 2. Two
994 // 3. Three
995 // 4. One
996 // 5. Two
997 // 6. Three
998 // 7.
999 //
1000 // CASE-2: Main document:
1001 // 1. One
1002 // 2. Two
1003 // 3. Three
1004 // 4. <-- insert position
1005 //
1006 // Inserted document:
1007 // A) One
1008 // B) Two
1009 // C) Three
1010 // D)
1011 //
1012 // Expected result
1013 // 1. One
1014 // 2. Two
1015 // 3. Three
1016 // 4. One
1017 // A) Two
1018 // B) Three
1019 // 5.
1020 //
1022 {
1023  // 1. check environment
1024  if (! pDoc)
1025  return;
1026 
1027  if (! IsInsertMode() || ! m_pSttNdIdx->GetIndex())
1028  return;
1029 
1030  sal_uLong index = 1;
1031 
1032  // the last node of the main document where we have inserted a document
1033  const SwNodePtr node1 = pDoc->GetNodes()[m_pSttNdIdx->GetIndex() + 0];
1034 
1035  // the first node of the inserted document
1036  SwNodePtr node2 = pDoc->GetNodes()[m_pSttNdIdx->GetIndex() + index];
1037 
1038  if (! (node1 && node2
1039  && (node1->GetNodeType() == node2->GetNodeType())
1040  && (node1->IsTextNode() == node2->IsTextNode())
1041  ))
1042  {
1043  // not a text node at insert position
1044  return;
1045  }
1046 
1047  // 2. get the first node of the inserted document,
1048  // which will be used to detect if inside inserted document a new list was started after the first list
1049  const SfxPoolItem* pListId2Initial = nullptr;
1050  {
1051  SwContentNode* contentNode1 = static_cast<SwContentNode *>(node1);
1052  SwContentNode* contentNode2 = static_cast<SwContentNode *>(node2);
1053 
1054  // check if both lists have the same list properties
1055  const SfxPoolItem* pListId1 = contentNode1->GetNoCondAttr( RES_PARATR_LIST_ID, false );
1056  const SfxPoolItem* pListId2 = contentNode2->GetNoCondAttr( RES_PARATR_LIST_ID, false );
1057 
1058  if (! pListId1)
1059  return;
1060  if (! pListId2)
1061  return;
1062 
1063  auto pStringListId1 = dynamic_cast<const SfxStringItem*>(pListId1);
1064  assert(pStringListId1);
1065  const OUString& sListId1 = pStringListId1->GetValue();
1066  auto pStringListId2 = dynamic_cast<const SfxStringItem*>(pListId2);
1067  assert(pStringListId2);
1068  const OUString& sListId2 = pStringListId2->GetValue();
1069 
1070  const SwList* pList1 = pDoc->getIDocumentListsAccess().getListByName( sListId1 );
1071  const SwList* pList2 = pDoc->getIDocumentListsAccess().getListByName( sListId2 );
1072 
1073  if (! pList1)
1074  return;
1075  if (! pList2)
1076  return;
1077 
1078  const OUString& sDefaultListStyleName1 = pList1->GetDefaultListStyleName();
1079  const OUString& sDefaultListStyleName2 = pList2->GetDefaultListStyleName();
1080 
1081  if (sDefaultListStyleName1 != sDefaultListStyleName2)
1082  {
1083  const SwNumRule* pNumRule1 = pDoc->FindNumRulePtr( sDefaultListStyleName1 );
1084  const SwNumRule* pNumRule2 = pDoc->FindNumRulePtr( sDefaultListStyleName2 );
1085 
1086  if (pNumRule1 && pNumRule2)
1087  {
1088  // check style of the each list level
1089  for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
1090  {
1091  if( pNumRule1->Get( n ) != pNumRule2->Get( n ) )
1092  {
1093  return;
1094  }
1095  }
1096 
1097  // our list should be merged
1098  pListId2Initial = pListId2;
1099  }
1100  }
1101  else
1102  {
1103  // our list should be merged
1104  pListId2Initial = pListId2;
1105  }
1106  }
1107 
1108  if (! pListId2Initial)
1109  {
1110  // two lists have different styles => they should not be merged
1111  return;
1112  }
1113 
1114  // 3. merge two lists
1115  while (
1116  node1 && node2
1117  && (node1->GetNodeType() == node2->GetNodeType())
1118  && (node1->IsTextNode() == node2->IsTextNode())
1119  )
1120  {
1121  SwContentNode* contentNode1 = static_cast<SwContentNode *>( node1 );
1122  SwContentNode* contentNode2 = static_cast<SwContentNode *>( node2 );
1123 
1124  const SfxPoolItem* pListId1 = contentNode1->GetNoCondAttr( RES_PARATR_LIST_ID, false );
1125  const SfxPoolItem* pListId2 = contentNode2->GetNoCondAttr( RES_PARATR_LIST_ID, false );
1126 
1127  if (! pListId1)
1128  return;
1129  if (! pListId2)
1130  return;
1131 
1132  if (*pListId2Initial != *pListId2)
1133  {
1134  // no more list items of the first list inside inserted document
1135  return;
1136  }
1137 
1138  // set list style to this list element
1139  contentNode2->SetAttr(*pListId1);
1140 
1141  // get next item
1142  index++;
1143  if (index >= pDoc->GetNodes().Count())
1144  {
1145  // no more items
1146  return;
1147  }
1148 
1149  node2 = pDoc->GetNodes()[m_pSttNdIdx->GetIndex() + index];
1150  }
1151 }
1152 
1153 // Locally derive XMLTextShapeImportHelper, so we can take care of the
1154 // form import This is Writer, but not text specific, so it should go
1155 // here!
1157 {
1158  // hold own reference form import helper, because the SvxImport
1159  // stored in the superclass, from whom we originally got the
1160  // reference, is already destroyed when we want to use it in the
1161  // destructor
1163 
1164  // hold reference to the one page (if it exists) for calling startPage()
1165  // and endPage. If !xPage.is(), then this document doesn't have a
1166  // XDrawPage.
1168 
1169 public:
1170  explicit SvTextShapeImportHelper(SvXMLImport& rImp);
1171  virtual ~SvTextShapeImportHelper() override;
1172 };
1173 
1176 {
1177  Reference<drawing::XDrawPageSupplier> xSupplier(rImp.GetModel(),UNO_QUERY);
1178  if (xSupplier.is())
1179  {
1180  if (rImp.GetFormImport().is())
1181  {
1182  rImp.GetFormImport()->startPage(xSupplier->getDrawPage());
1183  rFormImport = rImp.GetFormImport();
1184  }
1185 
1186  xPage = xSupplier->getDrawPage();
1188  }
1189 }
1190 
1192 {
1193  rFormImport->endPage();
1194 
1195  if (xPage.is())
1196  {
1198  }
1199 }
1200 
1202 {
1203  return new SwXMLTextImportHelper( GetModel(), *this, getImportInfo(),
1204  IsInsertMode(),
1205  IsStylesOnlyMode(),
1207 }
1208 
1210 {
1211  return new SvTextShapeImportHelper( *this );
1212 }
1213 
1215  const OUString& rLocalName,
1216  const Reference< xml::sax::XAttributeList > & xAttrList )
1217 {
1218  XMLFontStylesContext *pFSContext =
1219  new XMLFontStylesContext( *this, XML_NAMESPACE_OFFICE,
1220  rLocalName, xAttrList,
1221  osl_getThreadTextEncoding() );
1222  SetFontDecls( pFSContext );
1223  return pFSContext;
1224 }
1225 
1227 {
1228  if (IsInsertMode() || IsStylesOnlyMode() || IsBlockMode() || m_bOrganizerMode || !GetModel().is() )
1229  return;
1230 
1231  // this method will modify the document directly -> lock SolarMutex
1232  SolarMutexGuard aGuard;
1233 
1234  SwDoc *pDoc = getDoc();
1235  tools::Rectangle aRect;
1236  if( pDoc->GetDocShell() )
1237  aRect = pDoc->GetDocShell()->GetVisArea( ASPECT_CONTENT );
1238  //TODO/LATER: why that cast?!
1239  //aRect = ((SfxInPlaceObject *)pDoc->GetDocShell())->GetVisArea();
1240 
1241  sal_Int64 nTmp = 0;
1242  bool bShowRedlineChanges = false, bBrowseMode = false;
1243  bool bChangeShowRedline = false, bChangeBrowseMode = false;
1244 
1245  //TODO/LATER: why that cast?!
1246  bool bTwip = pDoc->GetDocShell()->GetMapUnit ( ) == MapUnit::MapTwip;
1247  //sal_Bool bTwip = pDoc->GetDocShell()->SfxInPlaceObject::GetMapUnit ( ) == MapUnit::MapTwip;
1248 
1249  for (const PropertyValue& rValue : aViewProps)
1250  {
1251  if ( rValue.Name == "ViewAreaTop" )
1252  {
1253  rValue.Value >>= nTmp;
1254  aRect.setY( static_cast< long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
1255  }
1256  else if ( rValue.Name == "ViewAreaLeft" )
1257  {
1258  rValue.Value >>= nTmp;
1259  aRect.setX( static_cast< long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
1260  }
1261  else if ( rValue.Name == "ViewAreaWidth" )
1262  {
1263  rValue.Value >>= nTmp;
1264  Size aSize( aRect.GetSize() );
1265  aSize.setWidth( static_cast< long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
1266  aRect.SetSize( aSize );
1267  }
1268  else if ( rValue.Name == "ViewAreaHeight" )
1269  {
1270  rValue.Value >>= nTmp;
1271  Size aSize( aRect.GetSize() );
1272  aSize.setHeight( static_cast< long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
1273  aRect.SetSize( aSize );
1274  }
1275  else if ( rValue.Name == "ShowRedlineChanges" )
1276  {
1277  bShowRedlineChanges = *o3tl::doAccess<bool>(rValue.Value);
1278  bChangeShowRedline = true;
1279  }
1280 // Headers and footers are not displayed in BrowseView anymore
1281  else if ( rValue.Name == "InBrowseMode" )
1282  {
1283  bBrowseMode = *o3tl::doAccess<bool>(rValue.Value);
1284  bChangeBrowseMode = true;
1285  }
1286  }
1287  if( pDoc->GetDocShell() )
1288  pDoc->GetDocShell()->SetVisArea ( aRect );
1289 
1290  if (bChangeBrowseMode)
1292 
1293  if (bChangeShowRedline)
1294  GetTextImport()->SetShowChanges( bShowRedlineChanges );
1295 }
1296 
1297 // Note: this will be called only if there are OOo elements in settings.xml.
1298 // So if a setting is missing there we can assume that it was written
1299 // by an OOo/LO version that is older than the introduction of the setting!
1301 {
1302  // this method will modify the document directly -> lock SolarMutex
1303  SolarMutexGuard aGuard;
1304 
1306  if( !xFac.is() )
1307  return;
1308 
1309  Reference< XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), UNO_QUERY );
1310  if( !xProps.is() )
1311  return;
1312 
1313  Reference< XPropertySetInfo > xInfo( xProps->getPropertySetInfo() );
1314  if( !xInfo.is() )
1315  return;
1316 
1317  std::unordered_set< OUString > aExcludeAlways;
1318  aExcludeAlways.insert("LinkUpdateMode");
1319  // this should contain things that are actually user-settable, via Tools->Options
1320  std::unordered_set< OUString > aExcludeWhenNotLoadingUserSettings;
1321  aExcludeWhenNotLoadingUserSettings.insert("ForbiddenCharacters");
1322  aExcludeWhenNotLoadingUserSettings.insert("IsKernAsianPunctuation");
1323  aExcludeWhenNotLoadingUserSettings.insert("CharacterCompressionType");
1324  aExcludeWhenNotLoadingUserSettings.insert("FieldAutoUpdate");
1325  aExcludeWhenNotLoadingUserSettings.insert("ChartAutoUpdate");
1326  aExcludeWhenNotLoadingUserSettings.insert("AddParaTableSpacing");
1327  aExcludeWhenNotLoadingUserSettings.insert("AddParaTableSpacingAtStart");
1328  aExcludeWhenNotLoadingUserSettings.insert("PrintAnnotationMode");
1329  aExcludeWhenNotLoadingUserSettings.insert("PrintBlackFonts");
1330  aExcludeWhenNotLoadingUserSettings.insert("PrintControls");
1331  aExcludeWhenNotLoadingUserSettings.insert("PrintDrawings");
1332  aExcludeWhenNotLoadingUserSettings.insert("PrintGraphics");
1333  aExcludeWhenNotLoadingUserSettings.insert("PrintLeftPages");
1334  aExcludeWhenNotLoadingUserSettings.insert("PrintPageBackground");
1335  aExcludeWhenNotLoadingUserSettings.insert("PrintProspect");
1336  aExcludeWhenNotLoadingUserSettings.insert("PrintReversed");
1337  aExcludeWhenNotLoadingUserSettings.insert("PrintRightPages");
1338  aExcludeWhenNotLoadingUserSettings.insert("PrintFaxName");
1339  aExcludeWhenNotLoadingUserSettings.insert("PrintPaperFromSetup");
1340  aExcludeWhenNotLoadingUserSettings.insert("PrintTables");
1341  aExcludeWhenNotLoadingUserSettings.insert("PrintSingleJobs");
1342  aExcludeWhenNotLoadingUserSettings.insert("UpdateFromTemplate");
1343  aExcludeWhenNotLoadingUserSettings.insert("PrinterIndependentLayout");
1344  aExcludeWhenNotLoadingUserSettings.insert("PrintEmptyPages");
1345  aExcludeWhenNotLoadingUserSettings.insert("ConsiderTextWrapOnObjPos");
1346  aExcludeWhenNotLoadingUserSettings.insert("DoNotJustifyLinesWithManualBreak");
1347  aExcludeWhenNotLoadingUserSettings.insert("ProtectForm");
1348  aExcludeWhenNotLoadingUserSettings.insert("MsWordCompTrailingBlanks");
1349  aExcludeWhenNotLoadingUserSettings.insert("SubtractFlysAnchoredAtFlys");
1350  aExcludeWhenNotLoadingUserSettings.insert("EmptyDbFieldHidesPara");
1351 
1352  SvtSaveOptions aSaveOpt;
1353  bool bIsUserSetting = aSaveOpt.IsLoadUserSettings();
1354 
1355  // for some properties we don't want to use the application
1356  // default if they're missing. So we watch for them in the loop
1357  // below, and set them if not found
1358  bool bPrinterIndependentLayout = false;
1359  bool bUseOldNumbering = false;
1360  bool bAddExternalLeading = false;
1361  bool bAddParaSpacingToTableCells = false;
1362  bool bUseFormerLineSpacing = false;
1363  bool bUseFormerObjectPositioning = false;
1364  bool bUseFormerTextWrapping = false;
1365  bool bConsiderWrapOnObjPos = false;
1366  bool bIgnoreFirstLineIndentInNumbering = false;
1367  bool bDoNotJustifyLinesWithManualBreak = false;
1368  bool bDoNotResetParaAttrsForNumFont = false;
1369  bool bLoadReadonly = false;
1370  bool bDoNotCaptureDrawObjsOnPage( false );
1371  bool bClipAsCharacterAnchoredWriterFlyFrames( false );
1372  bool bUnixForceZeroExtLeading = false;
1373  bool bSmallCapsPercentage66 = false;
1374  bool bTabOverflow = false;
1375  bool bUnbreakableNumberings = false;
1376  bool bClippedPictures = false;
1377  bool bBackgroundParaOverDrawings = false;
1378  bool bTabOverMargin = false;
1379  bool bTabOverMarginValue = false;
1380  bool bPropLineSpacingShrinksFirstLine = false;
1381  bool bSubtractFlysAnchoredAtFlys = false;
1382  bool bCollapseEmptyCellPara = false;
1383 
1384  const PropertyValue* currentDatabaseDataSource = nullptr;
1385  const PropertyValue* currentDatabaseCommand = nullptr;
1386  const PropertyValue* currentDatabaseCommandType = nullptr;
1387  const PropertyValue* embeddedDatabaseName = nullptr;
1388 
1389  for( const PropertyValue& rValue : aConfigProps )
1390  {
1391  bool bSet = aExcludeAlways.find(rValue.Name) == aExcludeAlways.end();
1392  if( bSet && !bIsUserSetting
1393  && (aExcludeWhenNotLoadingUserSettings.find(rValue.Name)
1394  != aExcludeWhenNotLoadingUserSettings.end()) )
1395  {
1396  bSet = false;
1397  }
1398 
1399  if( bSet )
1400  {
1401  try
1402  {
1403  if( xInfo->hasPropertyByName( rValue.Name ) )
1404  {
1405  if( rValue.Name == "RedlineProtectionKey" )
1406  {
1407  Sequence<sal_Int8> aKey;
1408  rValue.Value >>= aKey;
1409  GetTextImport()->SetChangesProtectionKey( aKey );
1410  }
1411  else
1412  {
1413  // HACK: Setting these out of order does not work.
1414  if( rValue.Name == "CurrentDatabaseDataSource" )
1415  currentDatabaseDataSource = &rValue;
1416  else if( rValue.Name == "CurrentDatabaseCommand" )
1417  currentDatabaseCommand = &rValue;
1418  else if( rValue.Name == "CurrentDatabaseCommandType" )
1419  currentDatabaseCommandType = &rValue;
1420  else if (rValue.Name == "EmbeddedDatabaseName")
1421  embeddedDatabaseName = &rValue;
1422  else
1423  xProps->setPropertyValue( rValue.Name, rValue.Value );
1424  }
1425  }
1426 
1427  // did we find any of the non-default cases?
1428  if ( rValue.Name == "PrinterIndependentLayout" )
1429  bPrinterIndependentLayout = true;
1430  else if ( rValue.Name == "AddExternalLeading" )
1431  bAddExternalLeading = true;
1432  else if ( rValue.Name == "AddParaSpacingToTableCells" )
1433  bAddParaSpacingToTableCells = true;
1434  else if ( rValue.Name == "UseFormerLineSpacing" )
1435  bUseFormerLineSpacing = true;
1436  else if ( rValue.Name == "UseFormerObjectPositioning" )
1437  bUseFormerObjectPositioning = true;
1438  else if ( rValue.Name == "UseFormerTextWrapping" )
1439  bUseFormerTextWrapping = true;
1440  else if ( rValue.Name == "UseOldNumbering" )
1441  bUseOldNumbering = true;
1442  else if ( rValue.Name == "ConsiderTextWrapOnObjPos" )
1443  bConsiderWrapOnObjPos = true;
1444  else if ( rValue.Name == "IgnoreFirstLineIndentInNumbering" )
1445  bIgnoreFirstLineIndentInNumbering = true;
1446  else if ( rValue.Name == "DoNotJustifyLinesWithManualBreak" )
1447  bDoNotJustifyLinesWithManualBreak = true;
1448  else if ( rValue.Name == "DoNotResetParaAttrsForNumFont" )
1449  bDoNotResetParaAttrsForNumFont = true;
1450  else if ( rValue.Name == "LoadReadonly" )
1451  bLoadReadonly = true;
1452  else if ( rValue.Name == "DoNotCaptureDrawObjsOnPage" )
1453  bDoNotCaptureDrawObjsOnPage = true;
1454  else if ( rValue.Name == "ClipAsCharacterAnchoredWriterFlyFrames" )
1455  bClipAsCharacterAnchoredWriterFlyFrames = true;
1456  else if ( rValue.Name == "UnxForceZeroExtLeading" )
1457  bUnixForceZeroExtLeading = true;
1458  else if ( rValue.Name == "SmallCapsPercentage66" )
1459  bSmallCapsPercentage66 = true;
1460  else if ( rValue.Name == "TabOverflow" )
1461  bTabOverflow = true;
1462  else if ( rValue.Name == "UnbreakableNumberings" )
1463  bUnbreakableNumberings = true;
1464  else if ( rValue.Name == "ClippedPictures" )
1465  bClippedPictures = true;
1466  else if ( rValue.Name == "BackgroundParaOverDrawings" )
1467  bBackgroundParaOverDrawings = true;
1468  else if ( rValue.Name == "TabOverMargin" )
1469  {
1470  bTabOverMargin = true;
1471  rValue.Value >>= bTabOverMarginValue;
1472  }
1473  else if ( rValue.Name == "PropLineSpacingShrinksFirstLine" )
1474  bPropLineSpacingShrinksFirstLine = true;
1475  else if (rValue.Name == "SubtractFlysAnchoredAtFlys")
1476  bSubtractFlysAnchoredAtFlys = true;
1477  else if (rValue.Name == "CollapseEmptyCellPara")
1478  bCollapseEmptyCellPara = true;
1479  }
1480  catch( Exception& )
1481  {
1482  OSL_FAIL( "SwXMLImport::SetConfigurationSettings: Exception!" );
1483  }
1484  }
1485  }
1486 
1487  try
1488  {
1489  if( currentDatabaseDataSource != nullptr )
1490  xProps->setPropertyValue( currentDatabaseDataSource->Name, currentDatabaseDataSource->Value );
1491  if( currentDatabaseCommand != nullptr )
1492  xProps->setPropertyValue( currentDatabaseCommand->Name, currentDatabaseCommand->Value );
1493  if( currentDatabaseCommandType != nullptr )
1494  xProps->setPropertyValue( currentDatabaseCommandType->Name, currentDatabaseCommandType->Value );
1495  if (embeddedDatabaseName)
1496  xProps->setPropertyValue(embeddedDatabaseName->Name, embeddedDatabaseName->Value);
1497  } catch( Exception& )
1498  {
1499  OSL_FAIL( "SwXMLImport::SetConfigurationSettings: Exception!" );
1500  }
1501 
1502  // finally, treat the non-default cases
1503  // introduce boolean, that indicates a document, written by version prior SO8.
1504  const bool bDocumentPriorSO8 = !bConsiderWrapOnObjPos;
1505 
1506  if( ! bPrinterIndependentLayout )
1507  {
1508  xProps->setPropertyValue( "PrinterIndependentLayout", Any(sal_Int16(document::PrinterIndependentLayout::DISABLED)) );
1509  }
1510 
1511  if( ! bAddExternalLeading )
1512  {
1513  xProps->setPropertyValue( "AddExternalLeading", makeAny( false ) );
1514  }
1515 
1516  if( ! bUseFormerLineSpacing )
1517  {
1518  xProps->setPropertyValue( "UseFormerLineSpacing", makeAny( true ) );
1519  }
1520 
1521  if( !bUseFormerObjectPositioning )
1522  {
1523  xProps->setPropertyValue( "UseFormerObjectPositioning", makeAny( true ) );
1524  }
1525 
1526  if( !bUseOldNumbering )
1527  {
1528  xProps->setPropertyValue( "UseOldNumbering", makeAny(true) );
1529  }
1530 
1531  if( !bAddParaSpacingToTableCells )
1532  {
1533  xProps->setPropertyValue( "AddParaSpacingToTableCells",
1534  makeAny( false ) );
1535  }
1536 
1537  if( !bUseFormerTextWrapping )
1538  {
1539  xProps->setPropertyValue( "UseFormerTextWrapping", makeAny( true ) );
1540  }
1541 
1542  if( !bConsiderWrapOnObjPos )
1543  {
1544  xProps->setPropertyValue( "ConsiderTextWrapOnObjPos", makeAny( false ) );
1545  }
1546 
1547  // #i47448#
1548  // For SO7pp4, part of the 'new numbering' stuff has been backported from
1549  // SO8. Unfortunately, only part of it and by using the same compatibility option
1550  // like in SO8. Therefore documents generated with SO7pp4, containing
1551  // numbered paragraphs with first line indent differ between SO7pp4 and
1552  // SO8. In order to fix this for SO8pp1, I introduce a new compatibility
1553  // flag 'bIgnoreFirstLineIndentInNumbering'. This flag has to be set for all
1554  // documents < SO8, but not for SO8. So if the property is not present, the
1555  // flag will be set to 'true'. SO8 documents surely have the
1556  // 'ConsiderWrapOnObjPos' property set (no matter if 'true' or 'false'),
1557  // therefore the correct condition to set this flag is this:
1558  if( !bIgnoreFirstLineIndentInNumbering && bDocumentPriorSO8 )
1559  {
1560  xProps->setPropertyValue( "IgnoreFirstLineIndentInNumbering",
1561  makeAny( true ) );
1562  }
1563 
1564  // This flag has to be set for all documents < SO8
1565  if ( !bDoNotJustifyLinesWithManualBreak && bDocumentPriorSO8 )
1566  {
1567  xProps->setPropertyValue( "DoNotJustifyLinesWithManualBreak",
1568  makeAny( true ) );
1569  }
1570 
1571  // This flag has to be set for all documents < SO8
1572  if ( !bDoNotResetParaAttrsForNumFont && bDocumentPriorSO8 )
1573  {
1574  xProps->setPropertyValue( "DoNotResetParaAttrsForNumFont",
1575  makeAny( true ) );
1576  }
1577 
1578  if ( !bLoadReadonly )
1579  {
1580  xProps->setPropertyValue( "LoadReadonly", makeAny( false ) );
1581  }
1582 
1583  // This flag has to be set for all documents < SO8
1584  if ( !bDoNotCaptureDrawObjsOnPage && bDocumentPriorSO8 )
1585  {
1586  xProps->setPropertyValue( "DoNotCaptureDrawObjsOnPage",
1587  makeAny( true ) );
1588  }
1589 
1590  // This flag has to be set for all documents < SO8
1591  if ( !bClipAsCharacterAnchoredWriterFlyFrames && bDocumentPriorSO8 )
1592  {
1593  xProps->setPropertyValue( "ClipAsCharacterAnchoredWriterFlyFrames",
1594  makeAny( true ) );
1595  }
1596 
1597  if ( !bUnixForceZeroExtLeading )
1598  {
1599  xProps->setPropertyValue( "UnxForceZeroExtLeading", makeAny( true ) );
1600  }
1601 
1602  // Old LO versions had 66 as the value for small caps percentage, later changed to 80.
1603  // In order to keep backwards compatibility, SmallCapsPercentage66 option is written to .odt
1604  // files, and the default for new documents is 'false'. Files without this option
1605  // are considered to be old files, so set the compatibility option too.
1606  if ( !bSmallCapsPercentage66 )
1607  {
1608  xProps->setPropertyValue( "SmallCapsPercentage66", makeAny( true ) );
1609  }
1610 
1611  if ( !bTabOverflow )
1612  {
1613  xProps->setPropertyValue( "TabOverflow", makeAny( false ) );
1614  }
1615 
1616  if ( !bUnbreakableNumberings )
1617  {
1618  xProps->setPropertyValue( "UnbreakableNumberings", makeAny( false ) );
1619  }
1620 
1621  if ( !bClippedPictures )
1622  {
1623  xProps->setPropertyValue( "ClippedPictures", makeAny( false ) );
1624  }
1625 
1626  if ( !bBackgroundParaOverDrawings )
1627  xProps->setPropertyValue("BackgroundParaOverDrawings", makeAny( false ) );
1628 
1629  if ( !bTabOverMargin )
1630  xProps->setPropertyValue("TabOverMargin", makeAny( false ) );
1631 
1632  if (bTabOverMarginValue)
1633  // Let TabOverMargin imply the new default for
1634  // PrinterIndependentLayout, knowing the first is set by Word import
1635  // filters and Word defaults to our new default as well.
1636  xProps->setPropertyValue(
1637  "PrinterIndependentLayout",
1638  uno::Any(static_cast<sal_Int16>(document::PrinterIndependentLayout::HIGH_RESOLUTION)));
1639 
1640  if (!bPropLineSpacingShrinksFirstLine)
1641  xProps->setPropertyValue("PropLineSpacingShrinksFirstLine", makeAny(false));
1642 
1643  if (!bSubtractFlysAnchoredAtFlys)
1644  xProps->setPropertyValue("SubtractFlysAnchoredAtFlys", makeAny(true));
1645 
1646  if (!bCollapseEmptyCellPara)
1647  xProps->setPropertyValue("CollapseEmptyCellPara", makeAny(false));
1648 
1649  SwDoc *pDoc = getDoc();
1650  SfxPrinter *pPrinter = pDoc->getIDocumentDeviceAccess().getPrinter( false );
1651  if( pPrinter )
1652  {
1653  // If the printer is known, then the OLE objects will
1654  // already have correct sizes, and we don't have to call
1655  // PrtOLENotify again. Otherwise we have to call it.
1656  // The flag might be set from setting the printer, so it
1657  // it is required to clear it.
1658  pDoc->SetOLEPrtNotifyPending( !pPrinter->IsKnown() );
1659  }
1660 }
1661 
1663  const OUString& _rSettingsGroupName,
1664  const Sequence< PropertyValue>& _rSettings )
1665 {
1666  // the only doc-specific settings group we know so far are the XForms settings
1667  if ( !IsXMLToken( _rSettingsGroupName, XML_XFORM_MODEL_SETTINGS ) )
1668  return;
1669 
1670  // preserve the settings for a later iteration - we are currently reading the settings.xml,
1671  // the content.xml will be read later, by another instance of SwXMLImport
1672  OSL_ENSURE( m_xLateInitSettings.is(), "SwXMLImport::SetDocumentSpecificSettings: no storage for those settings!" );
1673  if ( !m_xLateInitSettings.is() )
1674  return;
1675 
1676  try
1677  {
1678  if ( m_xLateInitSettings->hasByName( _rSettingsGroupName ) )
1679  {
1680  m_xLateInitSettings->replaceByName( _rSettingsGroupName, makeAny( _rSettings ) );
1681  OSL_FAIL( "SwXMLImport::SetDocumentSpecificSettings: already have settings for this model!" );
1682  }
1683  else
1684  m_xLateInitSettings->insertByName( _rSettingsGroupName, makeAny( _rSettings ) );
1685  }
1686  catch( const Exception& )
1687  {
1688  }
1689 }
1690 
1692  const Sequence<Any>& aArguments )
1693 {
1694  // delegate to super class
1695  SvXMLImport::initialize(aArguments);
1696 
1697  // we are only looking for a NamedValue "LateInitSettings"
1698  for(const auto& rArgument : aArguments)
1699  {
1700  beans::NamedValue aNamedValue;
1701  if ( rArgument >>= aNamedValue )
1702  {
1703  if (aNamedValue.Name == "LateInitSettings")
1704  {
1705  OSL_VERIFY( aNamedValue.Value >>= m_xLateInitSettings );
1706  }
1707  }
1708  }
1709 }
1710 
1712 {
1713  uno::Reference<lang::XUnoTunnel> xModelTunnel( rImport.GetModel(), uno::UNO_QUERY );
1714  SwXTextDocument *pTextDoc = reinterpret_cast< SwXTextDocument *>(
1715  sal::static_int_cast< sal_IntPtr >( xModelTunnel->getSomething(SwXTextDocument::getUnoTunnelId() )));
1716  assert( pTextDoc );
1717  assert( pTextDoc->GetDocShell() );
1718  SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
1719  OSL_ENSURE( pDoc, "Where is my document?" );
1720  return pDoc;
1721 }
1722 
1724 {
1725  // obtain SwDoc
1726  Reference<XUnoTunnel> xDocTunnel( GetModel(), UNO_QUERY );
1727  if( ! xDocTunnel.is() )
1728  return;
1729  SwXTextDocument* pXTextDocument = reinterpret_cast<SwXTextDocument*>(
1730  xDocTunnel->getSomething( SwXTextDocument::getUnoTunnelId() ) );
1731  if( pXTextDocument == nullptr )
1732  return;
1733 
1734  SwDoc *pDoc = pXTextDocument->GetDocShell()->GetDoc();
1735 
1736  // init XForms (if not already done)
1737  // (no default model, since we'll load the models)
1738  if( ! pDoc->isXForms() )
1739  pDoc->initXForms( false );
1740 
1741  m_bInititedXForms = true;
1742 }
1743 
1745 {
1746  if( m_pDoc != nullptr )
1747  return m_pDoc;
1748  Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
1749  Reference < XText > xText = xTextDoc->getText();
1750  Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
1751  assert( xTextTunnel.is());
1752  SwXText *pText = reinterpret_cast< SwXText *>(
1753  sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
1754  assert( pText != nullptr );
1755  m_pDoc = pText->GetDoc();
1756  assert( m_pDoc != nullptr );
1757  return m_pDoc;
1758 }
1759 
1761 {
1762  return const_cast< SwXMLImport* >( this )->getDoc();
1763 }
1764 
1765 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1767  css::uno::Sequence<css::uno::Any> const &)
1768 {
1769  return cppu::acquire(new SwXMLImport(context, "com.sun.star.comp.Writer.XMLOasisImporter",
1770  SvXMLImportFlags::ALL));
1771 }
1772 
1773 
1774 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1776  css::uno::Sequence<css::uno::Any> const &)
1777 {
1778  return cppu::acquire(new SwXMLImport(context, "com.sun.star.comp.Writer.XMLOasisStylesImporter",
1779  SvXMLImportFlags::STYLES | SvXMLImportFlags::MASTERSTYLES | SvXMLImportFlags::AUTOSTYLES |
1780  SvXMLImportFlags::FONTDECLS));
1781 }
1782 
1783 
1784 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1786  css::uno::Sequence<css::uno::Any> const &)
1787 {
1788  return cppu::acquire(new SwXMLImport(context, "com.sun.star.comp.Writer.XMLOasisContentImporter",
1789  SvXMLImportFlags::CONTENT | SvXMLImportFlags::SCRIPTS | SvXMLImportFlags::AUTOSTYLES |
1790  SvXMLImportFlags::FONTDECLS));
1791 }
1792 
1793 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1795  css::uno::Sequence<css::uno::Any> const &)
1796 {
1797  return cppu::acquire(new SwXMLImport(context, "com.sun.star.comp.Writer.XMLOasisMetaImporter",
1798  SvXMLImportFlags::META));
1799 }
1800 
1801 
1802 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1804  css::uno::Sequence<css::uno::Any> const &)
1805 {
1806  return cppu::acquire(new SwXMLImport(context, "com.sun.star.comp.Writer.XMLOasisSettingsImporter",
1807  SvXMLImportFlags::SETTINGS));
1808 }
1809 
1810 extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportFODT(SvStream &rStream)
1811 {
1813 
1814  SfxObjectShellLock xDocSh(new SwDocShell(SfxObjectCreateMode::INTERNAL));
1815  xDocSh->DoInitNew();
1816  uno::Reference<frame::XModel> xModel(xDocSh->GetModel());
1817 
1818  uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
1819  uno::Reference<io::XInputStream> xStream(new utl::OSeekableInputStreamWrapper(rStream));
1820  uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.XmlFilterAdaptor"), uno::UNO_SET_THROW);
1821 
1822  css::uno::Sequence<OUString> aUserData(7);
1823  aUserData[0] = "com.sun.star.comp.filter.OdfFlatXml";
1824  aUserData[2] = "com.sun.star.comp.Writer.XMLOasisImporter";
1825  aUserData[3] = "com.sun.star.comp.Writer.XMLOasisExporter";
1826  aUserData[6] = "true";
1827  uno::Sequence<beans::PropertyValue> aAdaptorArgs(comphelper::InitPropertySequence(
1828  {
1829  { "UserData", uno::Any(aUserData) },
1830  }));
1831  css::uno::Sequence<uno::Any> aOuterArgs(1);
1832  aOuterArgs[0] <<= aAdaptorArgs;
1833 
1834  uno::Reference<lang::XInitialization> xInit(xInterface, uno::UNO_QUERY_THROW);
1835  xInit->initialize(aOuterArgs);
1836 
1837  uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW);
1838  uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
1839  {
1840  { "InputStream", uno::Any(xStream) },
1841  { "URL", uno::Any(OUString("private:stream")) },
1842  }));
1843  xImporter->setTargetDocument(xModel);
1844 
1845  uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW);
1846  //SetLoading hack because the document properties will be re-initted
1847  //by the xml filter and during the init, while it's considered uninitialized,
1848  //setting a property will inform the document it's modified, which attempts
1849  //to update the properties, which throws cause the properties are uninitialized
1850  xDocSh->SetLoading(SfxLoadedFlags::NONE);
1851  bool ret = xFilter->filter(aArgs);
1852  xDocSh->SetLoading(SfxLoadedFlags::ALL);
1853 
1854  xDocSh->DoClose();
1855 
1856  return ret;
1857 }
1858 
1859 extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDOCX(SvStream &rStream)
1860 {
1862 
1863  SfxObjectShellLock xDocSh(new SwDocShell(SfxObjectCreateMode::INTERNAL));
1864  xDocSh->DoInitNew();
1865  uno::Reference<frame::XModel> xModel(xDocSh->GetModel());
1866 
1867  uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
1868  uno::Reference<io::XInputStream> xStream(new utl::OSeekableInputStreamWrapper(rStream));
1869 
1870  uno::Reference<document::XFilter> xFilter(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.WriterFilter"), uno::UNO_QUERY_THROW);
1871 
1872  uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW);
1873  uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
1874  {
1875  { "InputStream", uno::makeAny(xStream) },
1876  { "InputMode", uno::makeAny(true) },
1877  }));
1878  xImporter->setTargetDocument(xModel);
1879 
1880  //SetLoading hack because the document properties will be re-initted
1881  //by the xml filter and during the init, while it's considered uninitialized,
1882  //setting a property will inform the document it's modified, which attempts
1883  //to update the properties, which throws cause the properties are uninitialized
1884  xDocSh->SetLoading(SfxLoadedFlags::NONE);
1885  bool ret = false;
1886  try
1887  {
1888  ret = xFilter->filter(aArgs);
1889  }
1890  catch (...)
1891  {
1892  }
1893  xDocSh->SetLoading(SfxLoadedFlags::ALL);
1894 
1895  xDocSh->DoClose();
1896 
1897  return ret;
1898 }
1899 
1900 /* 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:1794
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
rtl::Reference< SvXMLEmbeddedObjectHelper > m_xEmbeddedResolver
Definition: xmlimp.hxx:72
static OTextCursorHelper * lcl_xml_GetSwXTextCursor(const Reference< XTextCursor > &rTextCursor)
Definition: xmlimp.cxx:481
SAL_DLLPUBLIC_EXPORT bool TestImportDOCX(SvStream &rStream)
Definition: xmlimp.cxx:1859
std::unique_ptr< SwNodeIndex > m_pSttNdIdx
Definition: xmlimp.hxx:62
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:1760
virtual void SetConfigurationSettings(const css::uno::Sequence< css::beans::PropertyValue > &aConfigProps) override
Definition: xmlimp.cxx:1300
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()
SW_DLLPUBLIC const OUString & GetDefaultListStyleName() const
Definition: list.cxx:233
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:184
sal_uLong StartOfSectionIndex() const
Definition: node.hxx:673
XML_DOCUMENT_META
std::unique_ptr< SvXMLTokenMap > m_pTableCellAttrTokenMap
Definition: xmlimp.hxx:68
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:1766
const OUString & GetText() const
Definition: ndtxt.hxx:211
XML_DOCUMENT_STYLES
SwDocShell * GetDocShell()
Definition: doc.hxx:1341
rtl::Reference< SvXMLGraphicHelper > m_xGraphicStorageHandler
Definition: xmlimp.hxx:70
bool m_bLoadDoc
Definition: xmlimp.hxx:82
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:270
SwNodeIndex nNode
Definition: pam.hxx:37
sal_uIntPtr sal_uLong
SvXMLImport & GetImport()
Definition: list.hxx:35
bool IsBlockMode() const
Definition: xmlimp.hxx:156
Definition: doc.hxx:185
virtual XMLShapeImportHelper * CreateShapeImport() override
Definition: xmlimp.cxx:1209
SvXMLImportContext * CreateBodyContentContext(const OUString &rLocalName)
Definition: xmltext.cxx:69
css::uno::Reference< css::container::XNameContainer > m_xLateInitSettings
Definition: xmlimp.hxx:79
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:1785
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:67
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:1789
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:1174
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:83
bool m_bInititedXForms
Definition: xmlimp.hxx:89
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:1803
SvXMLImportContext * CreateMasterStylesContext(const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
Definition: xmlfmt.cxx:955
const SvXMLTokenMap & GetDocElemTokenMap()
Definition: xmlimp.cxx:360
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: xmlimp.cxx:1691
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
Definition: nodes.cxx:1063
rtl::Reference< ::xmloff::OFormLayerXMLImport > rFormImport
Definition: xmlimp.cxx:1162
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
bool IsStylesOnlyMode() const
Definition: xmlimp.hxx:155
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:493
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:1775
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:963
XML_AUTOMATIC_STYLES
XML_DOCUMENT_SETTINGS
SfxStyleFamily
bool m_bOrganizerMode
Definition: xmlimp.hxx:88
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:87
void SetGraphicStorageHandler(css::uno::Reference< css::document::XGraphicStorageHandler > const &rxGraphicStorageHandler)
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unotxdoc.cxx:294
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:203
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:481
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:929
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:555
const SfxPoolItem * GetNoCondAttr(sal_uInt16 nWhich, bool bInParents) const
Obtains attribute that is not delivered via conditional style!
Definition: node.cxx:1749
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:1813
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)
void UpdateTextCollConditions(SwDoc *pDoc)
Definition: xmlfmt.cxx:980
XML_SCRIPTS
#define PROGRESS_BAR_STEP
Definition: xmlimp.hxx:48
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:3928
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:66
void SetInReading(bool bNew)
Definition: doc.hxx:950
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:1191
bool IsInReading() const
Definition: doc.hxx:949
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:153
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:1167
Reference< XMultiServiceFactory > getProcessServiceFactory()
XML_DOCUMENT
SfxStyleFamily m_nStyleFamilyMask
Definition: xmlimp.hxx:81
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:1485
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:1021
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:939
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:402
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:1662
const SvXMLUnitConverter & GetMM100UnitConverter() const
SAL_DLLPUBLIC_EXPORT bool TestImportFODT(SvStream &rStream)
Definition: xmlimp.cxx:1810
const css::uno::Reference< css::frame::XModel > & GetModel() const
virtual void SAL_CALL endDocument() override
Definition: xmlimp.cxx:730
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:905
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:91
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:1226
#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:455
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:1112
void JoinPrev()
Definition: ndtxt.cxx:1047
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2479
SwDoc * GetDocFromXMLImport(SvXMLImport const &)
Definition: xmlimp.cxx:1711
virtual XMLTextImportHelper * CreateTextImport() override
Definition: xmlimp.cxx:1201
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:1214
sal_Int64 sanitiseMm100ToTwip(sal_Int64 n)
#define XML_STYLE_FAMILY_TEXT_TEXT
virtual void initXForms() override
Definition: xmlimp.cxx:1723
bool IsInXMLImport() const
Definition: doc.hxx:962
virtual void SAL_CALL endDocument() override
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:843
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:837
bool IsInsertMode() const
Definition: xmlimp.hxx:154
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)