LibreOffice Module sw (master)  1
fltini.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 <hintids.hxx>
21 #include <i18nlangtag/lang.h>
23 #include <o3tl/any.hxx>
24 #include <tools/svlibrary.h>
25 #include <sot/storage.hxx>
26 #include <shellio.hxx>
27 #include <fltini.hxx>
28 #include <init.hxx>
29 #include <fmtfsize.hxx>
30 #include <swtable.hxx>
31 #include <fmtcntnt.hxx>
32 #include <editeng/boxitem.hxx>
33 #include <ndtxt.hxx>
34 #include <swfltopt.hxx>
35 #include <swdll.hxx>
36 #include <iodetect.hxx>
37 #include <osl/module.hxx>
38 #include <rtl/bootstrap.hxx>
39 #include <sal/log.hxx>
40 #include <osl/diagnose.h>
41 
42 using namespace utl;
43 using namespace com::sun::star::uno;
44 using namespace com::sun::star;
45 
46 Reader *ReadAscii = nullptr, *ReadHTML = nullptr, *ReadXML = nullptr;
47 
48 static Reader* GetRTFReader();
49 static Reader* GetWW8Reader();
50 static Reader* GetDOCXReader();
51 
52 // Note: if editing, please don't forget to modify also the enum
53 // ReaderWriterEnum and aFilterDetect in iodetect.hxx & iodetect.cxx
55 {
57  SwReaderWriterEntry( nullptr, &::GetASCWriter, false ),
58  SwReaderWriterEntry( &::GetWW8Reader, nullptr, true ),
61  SwReaderWriterEntry( nullptr, &::GetHTMLWriter, true ),
62  SwReaderWriterEntry( &::GetWW8Reader, nullptr, true ),
63  SwReaderWriterEntry( nullptr, &::GetXMLWriter, true ),
64  SwReaderWriterEntry( nullptr, &::GetASCWriter, false ),
65  SwReaderWriterEntry( nullptr, &::GetASCWriter, true ),
66  SwReaderWriterEntry( &::GetDOCXReader, nullptr, true )
67 };
68 
70 {
71  if ( pReader )
72  return pReader;
73  else if ( fnGetReader )
74  {
75  pReader = (*fnGetReader)();
76  return pReader;
77  }
78  return nullptr;
79 }
80 
81 void SwReaderWriterEntry::GetWriter( const OUString& rNm, const OUString& rBaseURL, WriterRef& xWrt ) const
82 {
83  if ( fnGetWriter )
84  (*fnGetWriter)( rNm, rBaseURL, xWrt );
85  else
86  xWrt = WriterRef(nullptr);
87 }
88 
89 Reader* SwGetReaderXML() // SW_DLLPUBLIC
90 {
91  return ReadXML;
92 }
93 
94 static void SetFltPtr( sal_uInt16 rPos, Reader* pReader )
95 {
96  aReaderWriter[ rPos ].pReader = pReader;
97 }
98 
99 namespace sw {
100 
101 Filters::Filters()
102 {
103  ReadAscii = new AsciiReader;
104  ReadHTML = new HTMLReader;
105  ReadXML = new XMLReader;
106  SetFltPtr( READER_WRITER_BAS, ReadAscii );
109  SetFltPtr( READER_WRITER_TEXT_DLG, ReadAscii );
110  SetFltPtr( READER_WRITER_TEXT, ReadAscii );
111 }
112 
113 Filters::~Filters()
114 {
115  // kill Readers
116  for(SwReaderWriterEntry & rEntry : aReaderWriter)
117  {
118  if( rEntry.bDelReader && rEntry.pReader )
119  {
120  delete rEntry.pReader;
121  rEntry.pReader = nullptr;
122  }
123  }
124  msword_.release();
125 }
126 
127 #ifndef DISABLE_DYNLOADING
128 
129 oslGenericFunction Filters::GetMswordLibSymbol( const char *pSymbol )
130 {
131  if (!msword_.is())
132  {
133  OUString url("$LO_LIB_DIR/" SVLIBRARY("msword"));
134  rtl::Bootstrap::expandMacros(url);
135  bool ok = msword_.load( url, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY );
136  SAL_WARN_IF(!ok, "sw", "failed to load msword library");
137  }
138  if (msword_.is())
139  return msword_.getFunctionSymbol( OUString::createFromAscii( pSymbol ) );
140  return nullptr;
141 }
142 
143 #endif
144 
145 }
146 
147 namespace SwReaderWriter {
148 
150 {
151  return aReaderWriter[READER_WRITER_RTF].GetReader();
152 }
153 
155 {
156  return aReaderWriter[READER_WRITER_DOCX].GetReader();
157 }
158 
159 void GetWriter( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet )
160 {
161  for( int n = 0; n < MAXFILTER; ++n )
162  if ( aFilterDetect[n].IsFilter( rFltName ) )
163  {
164  aReaderWriter[n].GetWriter( rFltName, rBaseURL, xRet );
165  break;
166  }
167 }
168 
169 Reader* GetReader( const OUString& rFltName )
170 {
171  Reader* pRead = nullptr;
172  for( int n = 0; n < MAXFILTER; ++n )
173  {
174  if ( aFilterDetect[n].IsFilter( rFltName ) )
175  {
176  pRead = aReaderWriter[n].GetReader();
177  // add special treatment for some readers
178  if ( pRead )
179  pRead->SetFltName( rFltName );
180  break;
181  }
182  }
183  return pRead;
184 }
185 
186 } // namespace SwReaderWriter
187 
188 bool Writer::IsStgWriter() const { return false; }
189 
190 bool StgWriter::IsStgWriter() const { return true; }
191 
192 // Read Filter Flags; used by WW8 / W4W / EXCEL / LOTUS
193 
194 /*
195 <FilterFlags>
196  <Excel_Lotus>
197  <MinRow cfg:type="long">0</MinRow>
198  <MaxRow cfg:type="long">0</MaxRow>
199  <MinCol cfg:type="long">0</MinCol>
200  <MaxCol cfg:type="long">0</MaxCol>
201  </Excel_Lotus>
202  <W4W>
203  <W4WHD cfg:type="long">0</W4WHD>
204  <W4WFT cfg:type="long">0</W4WFT>
205  <W4W000 cfg:type="long">0</W4W000>
206  </W4W>
207  <WinWord>
208  <WW1F cfg:type="long">0</WW1F>
209  <WW cfg:type="long">0</WW>
210  <WW8 cfg:type="long">0</WW8>
211  <WWF cfg:type="long">0</WWF>
212  <WWFA0 cfg:type="long">0</WWFA0>
213  <WWFA1 cfg:type="long">0</WWFA1>
214  <WWFA2 cfg:type="long">0</WWFA2>
215  <WWFB0 cfg:type="long">0</WWFB0>
216  <WWFB1 cfg:type="long">0</WWFB1>
217  <WWFB2 cfg:type="long">0</WWFB2>
218  <WWFLX cfg:type="long">0</WWFLX>
219  <WWFLY cfg:type="long">0</WWFLY>
220  <WWFT cfg:type="long">0</WWFT>
221  <WWWR cfg:type="long">0</WWWR>
222  </WinWord>
223  <Writer>
224  <SW3Imp cfg:type="long">0</SW3Imp>
225  </Writer>
226 </FilterFlags>
227 */
228 
229 SwFilterOptions::SwFilterOptions( sal_uInt16 nCnt, const char** ppNames,
230  sal_uInt64* pValues )
231  : ConfigItem( "Office.Writer/FilterFlags" )
232 {
233  GetValues( nCnt, ppNames, pValues );
234 }
235 
236 void SwFilterOptions::GetValues( sal_uInt16 nCnt, const char** ppNames,
237  sal_uInt64* pValues )
238 {
239  Sequence<OUString> aNames( nCnt );
240  OUString* pNames = aNames.getArray();
241  sal_uInt16 n;
242 
243  for( n = 0; n < nCnt; ++n )
244  pNames[ n ] = OUString::createFromAscii( ppNames[ n ] );
245  Sequence<Any> aValues = GetProperties( aNames );
246 
247  if( nCnt == aValues.getLength() )
248  {
249  const Any* pAnyValues = aValues.getConstArray();
250  for( n = 0; n < nCnt; ++n )
251  pValues[ n ] = pAnyValues[ n ].hasValue()
252  ? *o3tl::doAccess<sal_uInt64>(pAnyValues[ n ])
253  : 0;
254  }
255  else
256  {
257  for( n = 0; n < nCnt; ++n )
258  pValues[ n ] = 0;
259  }
260 }
261 
263 void SwFilterOptions::Notify( const css::uno::Sequence< OUString >& ) {}
264 
265 void StgReader::SetFltName( const OUString& rFltNm )
266 {
268  m_aFltName = rFltNm;
269 }
270 
271 void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor,
272  SwTwips nPageWidth)
273 {
274  const SfxPoolItem* pItem = nullptr;
275  if( SfxItemState::SET != rFlySet.GetItemState( RES_FRM_SIZE, true, &pItem ) ||
276  MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetWidth() )
277  {
278  std::unique_ptr<SwFormatFrameSize> aSz(rFlySet.Get(RES_FRM_SIZE).Clone());
279  if (pItem)
280  aSz.reset(static_cast<SwFormatFrameSize*>(pItem->Clone()));
281 
282  SwTwips nWidth;
283  // determine the width; if there is a table use the width of the table;
284  // otherwise use the width of the page
285  const SwTableNode* pTableNd = rAnchor.GetNode().FindTableNode();
286  if( pTableNd )
287  nWidth = pTableNd->GetTable().GetFrameFormat()->GetFrameSize().GetWidth();
288  else
289  nWidth = nPageWidth;
290 
291  const SwNodeIndex* pSttNd = rFlySet.Get( RES_CNTNT ).GetContentIdx();
292  if( pSttNd )
293  {
294  bool bOnlyOneNode = true;
295  sal_uLong nMinFrame = 0;
296  sal_uLong nMaxFrame = 0;
297  SwTextNode* pFirstTextNd = nullptr;
298  SwNodeIndex aIdx( *pSttNd, 1 );
299  SwNodeIndex aEnd( *pSttNd->GetNode().EndOfSectionNode() );
300  while( aIdx < aEnd )
301  {
302  SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
303  if( pTextNd )
304  {
305  if( !pFirstTextNd )
306  pFirstTextNd = pTextNd;
307  else if( pFirstTextNd != pTextNd )
308  {
309  // forget it
310  bOnlyOneNode = false;
311  break;
312  }
313 
314  sal_uLong nAbsMinCnts;
315  pTextNd->GetMinMaxSize( aIdx.GetIndex(), nMinFrame, nMaxFrame, nAbsMinCnts );
316  }
317  ++aIdx;
318  }
319 
320  if( bOnlyOneNode )
321  {
322  if( nMinFrame < MINLAY && pFirstTextNd )
323  {
324  // if the first node don't contained any content, then
325  // insert one char in it calc again and delete once again
326  SwIndex aNdIdx( pFirstTextNd );
327  pFirstTextNd->InsertText("MM", aNdIdx);
328  sal_uLong nAbsMinCnts;
329  pFirstTextNd->GetMinMaxSize( pFirstTextNd->GetIndex(),
330  nMinFrame, nMaxFrame, nAbsMinCnts );
331  aNdIdx -= 2;
332  pFirstTextNd->EraseText( aNdIdx, 2 );
333  }
334 
335  // consider border and distance to content
336  const SvxBoxItem& rBoxItem = rFlySet.Get( RES_BOX );
337  SvxBoxItemLine nLine = SvxBoxItemLine::LEFT;
338  for( int i = 0; i < 2; ++i )
339  {
340  const editeng::SvxBorderLine* pLn = rBoxItem.GetLine( nLine );
341  if( pLn )
342  {
343  sal_uInt16 nWidthTmp = pLn->GetOutWidth() + pLn->GetInWidth();
344  nWidthTmp = nWidthTmp + rBoxItem.GetDistance( nLine );
345  nMinFrame += nWidthTmp;
346  nMaxFrame += nWidthTmp;
347  }
348  nLine = SvxBoxItemLine::RIGHT;
349  }
350 
351  // enforce minimum width for contents
352  if( nMinFrame < MINLAY )
353  nMinFrame = MINLAY;
354  if( nMaxFrame < MINLAY )
355  nMaxFrame = MINLAY;
356 
357  if( nWidth > static_cast<sal_uInt16>(nMaxFrame) )
358  nWidth = nMaxFrame;
359  else if( nWidth > static_cast<sal_uInt16>(nMinFrame) )
360  nWidth = nMinFrame;
361  }
362  }
363 
364  if( MINFLY > nWidth )
365  nWidth = MINFLY;
366 
367  aSz->SetWidth( nWidth );
368  if( MINFLY > aSz->GetHeight() )
369  aSz->SetHeight( MINFLY );
370  rFlySet.Put( *aSz );
371  }
372  else if( MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetHeight() )
373  {
374  std::unique_ptr<SwFormatFrameSize> aSz(static_cast<SwFormatFrameSize*>(pItem->Clone()));
375  aSz->SetHeight( MINFLY );
376  rFlySet.Put( std::move(aSz) );
377  }
378 }
379 
380 namespace
381 {
382 
383 struct CharSetNameMap
384 {
385  rtl_TextEncoding eCode;
386  const char* pName;
387 };
388 
389 const CharSetNameMap *GetCharSetNameMap()
390 {
391  static const CharSetNameMap aMapArr[] =
392  {
393 # define IMPLENTRY(X) { RTL_TEXTENCODING_##X, #X }
394  IMPLENTRY(DONTKNOW),
395  IMPLENTRY(MS_1252),
396  IMPLENTRY(APPLE_ROMAN),
397  IMPLENTRY(IBM_437),
398  IMPLENTRY(IBM_850),
399  IMPLENTRY(IBM_860),
400  IMPLENTRY(IBM_861),
401  IMPLENTRY(IBM_863),
402  IMPLENTRY(IBM_865),
403  IMPLENTRY(SYMBOL),
404  IMPLENTRY(ASCII_US),
405  IMPLENTRY(ISO_8859_1),
406  IMPLENTRY(ISO_8859_2),
407  IMPLENTRY(ISO_8859_3),
408  IMPLENTRY(ISO_8859_4),
409  IMPLENTRY(ISO_8859_5),
410  IMPLENTRY(ISO_8859_6),
411  IMPLENTRY(ISO_8859_7),
412  IMPLENTRY(ISO_8859_8),
413  IMPLENTRY(ISO_8859_9),
414  IMPLENTRY(ISO_8859_14),
415  IMPLENTRY(ISO_8859_15),
416  IMPLENTRY(IBM_737),
417  IMPLENTRY(IBM_775),
418  IMPLENTRY(IBM_852),
419  IMPLENTRY(IBM_855),
420  IMPLENTRY(IBM_857),
421  IMPLENTRY(IBM_862),
422  IMPLENTRY(IBM_864),
423  IMPLENTRY(IBM_866),
424  IMPLENTRY(IBM_869),
425  IMPLENTRY(MS_874),
426  IMPLENTRY(MS_1250),
427  IMPLENTRY(MS_1251),
428  IMPLENTRY(MS_1253),
429  IMPLENTRY(MS_1254),
430  IMPLENTRY(MS_1255),
431  IMPLENTRY(MS_1256),
432  IMPLENTRY(MS_1257),
433  IMPLENTRY(MS_1258),
434  IMPLENTRY(APPLE_ARABIC),
435  IMPLENTRY(APPLE_CENTEURO),
436  IMPLENTRY(APPLE_CROATIAN),
437  IMPLENTRY(APPLE_CYRILLIC),
438  IMPLENTRY(APPLE_DEVANAGARI),
439  IMPLENTRY(APPLE_FARSI),
440  IMPLENTRY(APPLE_GREEK),
441  IMPLENTRY(APPLE_GUJARATI),
442  IMPLENTRY(APPLE_GURMUKHI),
443  IMPLENTRY(APPLE_HEBREW),
444  IMPLENTRY(APPLE_ICELAND),
445  IMPLENTRY(APPLE_ROMANIAN),
446  IMPLENTRY(APPLE_THAI),
447  IMPLENTRY(APPLE_TURKISH),
448  IMPLENTRY(APPLE_UKRAINIAN),
449  IMPLENTRY(APPLE_CHINSIMP),
450  IMPLENTRY(APPLE_CHINTRAD),
451  IMPLENTRY(APPLE_JAPANESE),
452  IMPLENTRY(APPLE_KOREAN),
453  IMPLENTRY(MS_932),
454  IMPLENTRY(MS_936),
455  IMPLENTRY(MS_949),
456  IMPLENTRY(MS_950),
457  IMPLENTRY(SHIFT_JIS),
458  IMPLENTRY(GB_2312),
459  IMPLENTRY(GBT_12345),
460  IMPLENTRY(GBK),
461  IMPLENTRY(BIG5),
462  IMPLENTRY(EUC_JP),
463  IMPLENTRY(EUC_CN),
464  IMPLENTRY(EUC_TW),
465  IMPLENTRY(ISO_2022_JP),
466  IMPLENTRY(ISO_2022_CN),
467  IMPLENTRY(KOI8_R),
468  IMPLENTRY(KOI8_U),
469  IMPLENTRY(UTF7),
470  IMPLENTRY(UTF8),
471  IMPLENTRY(ISO_8859_10),
472  IMPLENTRY(ISO_8859_13),
473  IMPLENTRY(EUC_KR),
474  IMPLENTRY(ISO_2022_KR),
475  IMPLENTRY(JIS_X_0201),
476  IMPLENTRY(JIS_X_0208),
477  IMPLENTRY(JIS_X_0212),
478  IMPLENTRY(MS_1361),
479  IMPLENTRY(GB_18030),
480  IMPLENTRY(BIG5_HKSCS),
481  IMPLENTRY(TIS_620),
482  IMPLENTRY(PT154),
483  IMPLENTRY(UCS4),
484  IMPLENTRY(UCS2),
485  IMPLENTRY(UNICODE),
486  {0,nullptr} //Last
487  };
488  return &aMapArr[0];
489 }
490 
491 /*
492  Get a rtl_TextEncoding from its name
493  */
494 rtl_TextEncoding CharSetFromName(const OUString& rChrSetStr)
495 {
496  const CharSetNameMap *pStart = GetCharSetNameMap();
497  rtl_TextEncoding nRet = pStart->eCode;
498 
499  for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
500  {
501  if(rChrSetStr.equalsIgnoreAsciiCaseAscii(pMap->pName))
502  {
503  nRet = pMap->eCode;
504  break;
505  }
506  }
507 
508  OSL_ENSURE(nRet != pStart->eCode, "TXT: That was an unknown language!");
509 
510  return nRet;
511 }
512 
513 /*
514  Get the String name of an rtl_TextEncoding
515  */
516 OUString NameFromCharSet(rtl_TextEncoding nChrSet)
517 {
518  const CharSetNameMap *pStart = GetCharSetNameMap();
519  const char *pRet = pStart->pName;
520 
521  for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
522  {
523  if (nChrSet == pMap->eCode)
524  {
525  pRet = pMap->pName;
526  break;
527  }
528  }
529 
530  OSL_ENSURE(pRet != pStart->pName, "TXT: That was an unknown language!");
531 
532  return OUString::createFromAscii(pRet);
533 }
534 
535 }
536 
537 // for the automatic conversion (mail/news/...)
538 // The user data contains the options for the ascii import/export filter.
539 // The format is:
540 // 1. CharSet - as ascii chars
541 // 2. LineEnd - as CR/LF/CRLF
542 // 3. Fontname
543 // 4. Language
544 // 5. Whether to include byte-order-mark - as true/false
545 // the delimiter character is ","
546 
547 void SwAsciiOptions::ReadUserData( const OUString& rStr )
548 {
549  sal_Int32 nToken = 0;
550  OUString sToken = rStr.getToken(0, ',', nToken); // 1. Charset name
551  if (!sToken.isEmpty())
552  m_eCharSet = CharSetFromName(sToken);
553  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 2. Line ending type
554  {
555  if (sToken.equalsIgnoreAsciiCase("CRLF"))
557  else if (sToken.equalsIgnoreAsciiCase("LF"))
559  else
561  }
562  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 3. Font name
563  m_sFont = sToken;
564  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 4. Language tag
566  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 5. Include BOM?
567  m_bIncludeBOM = !(sToken.equalsIgnoreAsciiCase("FALSE"));
568 }
569 
570 void SwAsciiOptions::WriteUserData(OUString& rStr)
571 {
572  // 1. charset
573  rStr = NameFromCharSet(m_eCharSet) + ",";
574 
575  // 2. LineEnd
576  switch(m_eCRLF_Flag)
577  {
578  case LINEEND_CRLF:
579  rStr += "CRLF";
580  break;
581  case LINEEND_CR:
582  rStr += "CR";
583  break;
584  case LINEEND_LF:
585  rStr += "LF";
586  break;
587  }
588  rStr += ",";
589 
590  // 3. Fontname
591  rStr += m_sFont + ",";
592 
593  // 4. Language
594  if (m_nLanguage)
595  {
597  }
598  rStr += ",";
599 
600  // 5. Whether to include byte-order-mark
601  if( m_bIncludeBOM )
602  {
603  rStr += "true";
604  }
605  else
606  {
607  rStr += "false";
608  }
609  rStr += ",";
610 }
611 
612 #ifdef DISABLE_DYNLOADING
613 
614 extern "C" {
615  Reader *ImportRTF();
616  void ExportRTF( const OUString&, const OUString& rBaseURL, WriterRef& );
617  Reader *ImportDOC();
618  void ExportDOC( const OUString&, const OUString& rBaseURL, WriterRef& );
619  Reader *ImportDOCX();
620  sal_uInt32 SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
622 }
623 
624 #endif
625 
627 {
628 #ifndef DISABLE_DYNLOADING
629 
630  FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportRTF" ) );
631 
632  if ( pFunction )
633  return (*pFunction)();
634 
635  return nullptr;
636 #else
637  return ImportRTF();
638 #endif
639 
640 }
641 
642 void GetRTFWriter( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet )
643 {
644 #ifndef DISABLE_DYNLOADING
645  FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportRTF" ) );
646 
647  if ( pFunction )
648  (*pFunction)( rFltName, rBaseURL, xRet );
649  else
650  xRet = WriterRef(nullptr);
651 #else
652  ExportRTF( rFltName, rBaseURL, xRet );
653 #endif
654 }
655 
657 {
658 #ifndef DISABLE_DYNLOADING
659  FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOC" ) );
660 
661  if ( pFunction )
662  return (*pFunction)();
663 
664  return nullptr;
665 #else
666  return ImportDOC();
667 #endif
668 }
669 
670 void GetWW8Writer( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet )
671 {
672 #ifndef DISABLE_DYNLOADING
673  FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportDOC" ) );
674 
675  if ( pFunction )
676  (*pFunction)( rFltName, rBaseURL, xRet );
677  else
678  xRet = WriterRef(nullptr);
679 #else
680  ExportDOC( rFltName, rBaseURL, xRet );
681 #endif
682 }
683 
685 {
686 #ifndef DISABLE_DYNLOADING
687  FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOCX" ) );
688 
689  if ( pFunction )
690  return (*pFunction)();
691 
692  return nullptr;
693 #else
694  return ImportDOCX();
695 #endif
696 }
697 
698 typedef sal_uInt32 ( *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
699 typedef sal_uInt32 ( *GetSaveWarning )( SfxObjectShell& );
700 
701 ErrCode SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSaveInto, const OUString& rStorageName )
702 {
703 #ifndef DISABLE_DYNLOADING
704  SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( SwGlobals::getFilters().GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) );
705  if( pFunction )
706  return ErrCode(pFunction( rDoc, rStor, bSaveInto, rStorageName ));
707  return ERRCODE_NONE;
708 #else
709  return ErrCode(SaveOrDelMSVBAStorage_ww8( rDoc, rStor, bSaveInto, rStorageName ));
710 #endif
711 }
712 
713 ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS )
714 {
715 #ifndef DISABLE_DYNLOADING
716  GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( SwGlobals::getFilters().GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) );
717  if( pFunction )
718  return ErrCode(pFunction( rDocS ));
719  return ERRCODE_NONE;
720 #else
721  return ErrCode(GetSaveWarningOfMSVBAStorage_ww8( rDocS ));
722 #endif
723 }
724 
725 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:686
tools::Long GetWidth() const
sal_uLong GetIndex() const
Definition: node.hxx:291
bool m_bIncludeBOM
Definition: shellio.hxx:64
rtl_TextEncoding m_eCharSet
Definition: shellio.hxx:61
oslGenericFunction GetMswordLibSymbol(const char *pSymbol)
Definition: fltini.cxx:129
ErrCode SaveOrDelMSVBAStorage(SfxObjectShell &rDoc, SotStorage &rStor, bool bSaveInto, const OUString &rStorageName)
Definition: fltini.cxx:701
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
SAL_DLLPUBLIC_EXPORT sal_uInt32 SaveOrDelMSVBAStorage_ww8(SfxObjectShell &rDoc, SotStorage &rStor, sal_Bool bSaveInto, const OUString &rStorageName)
Definition: wrtww8.cxx:3941
static OUString convertToBcp47(LanguageType nLangID)
#define MINFLY
Definition: swtypes.hxx:65
sal_uIntPtr sal_uLong
#define MINLAY
Definition: swtypes.hxx:66
void(* FnGetWriter)(const OUString &, const OUString &rBaseURL, WriterRef &)
Definition: shellio.hxx:525
sal_Int64 n
#define IMPLENTRY(X)
tools::SvRef< Writer > WriterRef
Definition: shellio.hxx:470
virtual SwReaderType GetReaderType() override
Definition: shellio.cxx:683
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
OUString m_aFltName
Definition: shellio.hxx:293
SwNode & GetNode() const
Definition: ndindex.hxx:119
SwFilterOptions(sal_uInt16 nCnt, const char **ppNames, sal_uInt64 *pValues)
Definition: fltini.cxx:229
Dialog to specify the properties of date form field.
SAL_DLLPUBLIC_EXPORT Reader * ImportRTF()
Definition: swparrtf.cxx:177
LINEEND_CR
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: fltini.cxx:263
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:203
OUString m_sFont
Definition: shellio.hxx:60
static Reader * GetWW8Reader()
Definition: fltini.cxx:656
Reader * ReadXML
Definition: fltini.cxx:46
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
sw::Filters & getFilters()
Definition: swdll.cxx:73
sal_uInt16 GetOutWidth() const
Reader * GetReader(const OUString &rFltName)
Return reader based on the name.
Definition: fltini.cxx:169
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
SAL_DLLPUBLIC_EXPORT void ExportDOC(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtww8.cxx:3947
Reader * ReadHTML
Definition: fltini.cxx:46
static void SetFltPtr(sal_uInt16 rPos, Reader *pReader)
Definition: fltini.cxx:94
const SwTable & GetTable() const
Definition: node.hxx:501
const editeng::SvxBorderLine * GetLine(SvxBoxItemLine nLine) const
SAL_DLLPUBLIC_EXPORT void ExportRTF(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: rtfexport.cxx:1474
void GetWriter(const OUString &rNm, const OUString &rBaseURL, WriterRef &xWrt) const
Get access to the writer.
Definition: fltini.cxx:81
ErrCode GetSaveWarningOfMSVBAStorage(SfxObjectShell &rDocS)
Definition: fltini.cxx:713
sal_uInt16 char * pName
Reader *(* FnGetReader)()
Definition: shellio.hxx:524
static SwReaderWriterEntry aReaderWriter[]
Definition: fltini.cxx:54
LINEEND_LF
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
static Reader * GetDOCXReader()
Definition: fltini.cxx:684
void ReadUserData(const OUString &)
Definition: fltini.cxx:547
static Reader * GetRTFReader()
Definition: fltini.cxx:626
void GetWW8Writer(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: fltini.cxx:670
Marks a character position inside a document model node.
Definition: index.hxx:33
unsigned char sal_Bool
void GetValues(sal_uInt16 nCnt, const char **ppNames, sal_uInt64 *pValues)
Definition: fltini.cxx:236
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
virtual bool IsStgWriter() const override
Definition: fltini.cxx:190
Reader * GetReader()
Get access to the reader.
Definition: fltini.cxx:69
SwIoDetect aFilterDetect[]
Definition: iodetect.cxx:40
Marks a node in the document model.
Definition: ndindex.hxx:31
void GetHTMLWriter(const OUString &rFilterOptions, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrthtml.cxx:1568
SAL_DLLPUBLIC_EXPORT sal_uInt32 GetSaveWarningOfMSVBAStorage_ww8(SfxObjectShell &rDocS)
Definition: wrtww8.cxx:3952
Reader * SwGetReaderXML()
Definition: fltini.cxx:89
virtual void SetFltName(const OUString &r) override
Definition: fltini.cxx:265
tools::Long SwTwips
Definition: swtypes.hxx:49
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
Reader * ReadAscii
Definition: fltini.cxx:46
void WriteUserData(OUString &)
Definition: fltini.cxx:570
void GetASCWriter(const OUString &rFltNm, [[maybe_unused]] const OUString &, WriterRef &xRet)
Definition: wrtasc.cxx:205
LineEnd m_eCRLF_Flag
Definition: shellio.hxx:63
void EraseText(const SwIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
Definition: ndtxt.cxx:2667
OUString InsertText(const OUString &rStr, const SwIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2282
void GetRTFWriter(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: fltini.cxx:642
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void CalculateFlySize(SfxItemSet &rFlySet, const SwNodeIndex &rAnchor, SwTwips nPageWidth)
Definition: fltini.cxx:271
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
DefTokenId nToken
virtual void SetFltName(const OUString &rFltNm)
Definition: shellio.cxx:609
void GetMinMaxSize(sal_uLong nIndex, sal_uLong &rMin, sal_uLong &rMax, sal_uLong &rAbs) const
Is in itratr.
Definition: itratr.cxx:995
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define SAL_WARN_IF(condition, area, stream)
#define ERRCODE_NONE
virtual void ImplCommit() override
Definition: fltini.cxx:262
SvxBoxItemLine
SAL_DLLPUBLIC_EXPORT Reader * ImportDOC()
Definition: ww8par.cxx:6250
void GetXMLWriter([[maybe_unused]] const OUString &, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtxml.cxx:566
SvxBoxItem & rBoxItem
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
LINEEND_CRLF
sal_uInt32(* SaveOrDel)(SfxObjectShell &, SotStorage &, sal_Bool, const OUString &)
Definition: fltini.cxx:698
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
Reader * GetRtfReader()
Definition: fltini.cxx:149
#define SVLIBRARY(Base)
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:357
LanguageType m_nLanguage
Definition: shellio.hxx:62
void GetWriter(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Return writer based on the name.
Definition: fltini.cxx:159
SAL_DLLPUBLIC_EXPORT Reader * ImportDOCX()
sal_uInt32(* GetSaveWarning)(SfxObjectShell &)
Definition: fltini.cxx:699
sal_uInt16 GetInWidth() const
virtual bool IsStgWriter() const
Definition: fltini.cxx:188
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:846