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