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
42using namespace utl;
43using namespace com::sun::star::uno;
44using namespace com::sun::star;
45
46Reader *ReadAscii = nullptr, *ReadHTML = nullptr, *ReadXML = nullptr;
47
48static Reader* GetRTFReader();
49static Reader* GetWW8Reader();
50static 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
81void SwReaderWriterEntry::GetWriter( std::u16string_view rNm, const OUString& rBaseURL, WriterRef& xWrt ) const
82{
83 if ( fnGetWriter )
84 (*fnGetWriter)( rNm, rBaseURL, xWrt );
85 else
86 xWrt = WriterRef(nullptr);
87}
88
89Reader* SwGetReaderXML() // SW_DLLPUBLIC
90{
91 return ReadXML;
92}
93
94static void SetFltPtr( sal_uInt16 rPos, Reader* pReader )
95{
96 aReaderWriter[ rPos ].pReader = pReader;
97}
98
99namespace sw {
100
102{
104 ReadHTML = new HTMLReader;
105 ReadXML = new XMLReader;
111}
112
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
129oslGenericFunction 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
147namespace SwReaderWriter {
148
150{
152}
153
155{
157}
158
159void GetWriter( std::u16string_view 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
169Reader* 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
188bool Writer::IsStgWriter() const { return false; }
189
190bool 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
229SwFilterOptions::SwFilterOptions( sal_uInt16 nCnt, const char** ppNames,
230 sal_uInt64* pValues )
231 : ConfigItem( "Office.Writer/FilterFlags" )
232{
233 GetValues( nCnt, ppNames, pValues );
234}
235
236void 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
263void SwFilterOptions::Notify( const css::uno::Sequence< OUString >& ) {}
264
265void StgReader::SetFltName( const OUString& rFltNm )
266{
268 m_aFltName = rFltNm;
269}
270
271void CalculateFlySize(SfxItemSet& rFlySet, const SwNode& rAnchor,
272 SwTwips nPageWidth)
273{
274 const SwFormatFrameSize* pFrameSizeItem = rFlySet.GetItemIfSet( RES_FRM_SIZE );
275 if( !pFrameSizeItem || MINFLY > pFrameSizeItem->GetWidth() )
276 {
277 std::unique_ptr<SwFormatFrameSize> aSz(rFlySet.Get(RES_FRM_SIZE).Clone());
278 if (pFrameSizeItem)
279 aSz.reset(pFrameSizeItem->Clone());
280
281 SwTwips nWidth;
282 // determine the width; if there is a table use the width of the table;
283 // otherwise use the width of the page
284 const SwTableNode* pTableNd = rAnchor.FindTableNode();
285 if( pTableNd )
286 nWidth = pTableNd->GetTable().GetFrameFormat()->GetFrameSize().GetWidth();
287 else
288 nWidth = nPageWidth;
289
290 const SwNodeIndex* pSttNd = rFlySet.Get( RES_CNTNT ).GetContentIdx();
291 if( pSttNd )
292 {
293 bool bOnlyOneNode = true;
294 sal_uLong nMinFrame = 0;
295 sal_uLong nMaxFrame = 0;
296 SwTextNode* pFirstTextNd = nullptr;
297 SwNodeIndex aIdx( *pSttNd, 1 );
298 SwNodeIndex aEnd( *pSttNd->GetNode().EndOfSectionNode() );
299 while( aIdx < aEnd )
300 {
301 SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
302 if( pTextNd )
303 {
304 if( !pFirstTextNd )
305 pFirstTextNd = pTextNd;
306 else if( pFirstTextNd != pTextNd )
307 {
308 // forget it
309 bOnlyOneNode = false;
310 break;
311 }
312
313 sal_uLong nAbsMinCnts;
314 pTextNd->GetMinMaxSize( aIdx.GetIndex(), nMinFrame, nMaxFrame, nAbsMinCnts );
315 }
316 ++aIdx;
317 }
318
319 if( bOnlyOneNode )
320 {
321 if( nMinFrame < MINLAY && pFirstTextNd )
322 {
323 // if the first node don't contained any content, then
324 // insert one char in it calc again and delete once again
325 SwContentIndex aNdIdx( pFirstTextNd );
326 pFirstTextNd->InsertText("MM", aNdIdx);
327 sal_uLong nAbsMinCnts;
328 pFirstTextNd->GetMinMaxSize( pFirstTextNd->GetIndex(),
329 nMinFrame, nMaxFrame, nAbsMinCnts );
330 aNdIdx -= 2;
331 pFirstTextNd->EraseText( aNdIdx, 2 );
332 }
333
334 // consider border and distance to content
335 const SvxBoxItem& rBoxItem = rFlySet.Get( RES_BOX );
336 SvxBoxItemLine nLine = SvxBoxItemLine::LEFT;
337 for( int i = 0; i < 2; ++i )
338 {
339 const editeng::SvxBorderLine* pLn = rBoxItem.GetLine( nLine );
340 if( pLn )
341 {
342 sal_uInt16 nWidthTmp = pLn->GetOutWidth() + pLn->GetInWidth();
343 nWidthTmp = nWidthTmp + rBoxItem.GetDistance( nLine );
344 nMinFrame += nWidthTmp;
345 nMaxFrame += nWidthTmp;
346 }
347 nLine = SvxBoxItemLine::RIGHT;
348 }
349
350 // enforce minimum width for contents
351 if( nMinFrame < MINLAY )
352 nMinFrame = MINLAY;
353 if( nMaxFrame < MINLAY )
354 nMaxFrame = MINLAY;
355
356 if( nWidth > o3tl::narrowing<sal_uInt16>(nMaxFrame) )
357 nWidth = nMaxFrame;
358 else if( nWidth > o3tl::narrowing<sal_uInt16>(nMinFrame) )
359 nWidth = nMinFrame;
360 }
361 }
362
363 if( MINFLY > nWidth )
364 nWidth = MINFLY;
365
366 aSz->SetWidth( nWidth );
367 if( MINFLY > aSz->GetHeight() )
368 aSz->SetHeight( MINFLY );
369 rFlySet.Put( std::move(aSz) );
370 }
371 else if( MINFLY > pFrameSizeItem->GetHeight() )
372 {
373 std::unique_ptr<SwFormatFrameSize> aSz(pFrameSizeItem->Clone());
374 aSz->SetHeight( MINFLY );
375 rFlySet.Put( std::move(aSz) );
376 }
377}
378
379namespace
380{
381
382struct CharSetNameMap
383{
384 rtl_TextEncoding eCode;
385 const char* pName;
386};
387
388const CharSetNameMap *GetCharSetNameMap()
389{
390 static const CharSetNameMap aMapArr[] =
391 {
392# define IMPLENTRY(X) { RTL_TEXTENCODING_##X, #X }
393 IMPLENTRY(DONTKNOW),
394 IMPLENTRY(MS_1252),
395 IMPLENTRY(APPLE_ROMAN),
396 IMPLENTRY(IBM_437),
397 IMPLENTRY(IBM_850),
398 IMPLENTRY(IBM_860),
399 IMPLENTRY(IBM_861),
400 IMPLENTRY(IBM_863),
401 IMPLENTRY(IBM_865),
402 IMPLENTRY(SYMBOL),
403 IMPLENTRY(ASCII_US),
404 IMPLENTRY(ISO_8859_1),
405 IMPLENTRY(ISO_8859_2),
406 IMPLENTRY(ISO_8859_3),
407 IMPLENTRY(ISO_8859_4),
408 IMPLENTRY(ISO_8859_5),
409 IMPLENTRY(ISO_8859_6),
410 IMPLENTRY(ISO_8859_7),
411 IMPLENTRY(ISO_8859_8),
412 IMPLENTRY(ISO_8859_9),
413 IMPLENTRY(ISO_8859_14),
414 IMPLENTRY(ISO_8859_15),
415 IMPLENTRY(IBM_737),
416 IMPLENTRY(IBM_775),
417 IMPLENTRY(IBM_852),
418 IMPLENTRY(IBM_855),
419 IMPLENTRY(IBM_857),
420 IMPLENTRY(IBM_862),
421 IMPLENTRY(IBM_864),
422 IMPLENTRY(IBM_866),
423 IMPLENTRY(IBM_869),
424 IMPLENTRY(MS_874),
425 IMPLENTRY(MS_1250),
426 IMPLENTRY(MS_1251),
427 IMPLENTRY(MS_1253),
428 IMPLENTRY(MS_1254),
429 IMPLENTRY(MS_1255),
430 IMPLENTRY(MS_1256),
431 IMPLENTRY(MS_1257),
432 IMPLENTRY(MS_1258),
433 IMPLENTRY(APPLE_ARABIC),
434 IMPLENTRY(APPLE_CENTEURO),
435 IMPLENTRY(APPLE_CROATIAN),
436 IMPLENTRY(APPLE_CYRILLIC),
437 IMPLENTRY(APPLE_DEVANAGARI),
438 IMPLENTRY(APPLE_FARSI),
439 IMPLENTRY(APPLE_GREEK),
440 IMPLENTRY(APPLE_GUJARATI),
441 IMPLENTRY(APPLE_GURMUKHI),
442 IMPLENTRY(APPLE_HEBREW),
443 IMPLENTRY(APPLE_ICELAND),
444 IMPLENTRY(APPLE_ROMANIAN),
445 IMPLENTRY(APPLE_THAI),
446 IMPLENTRY(APPLE_TURKISH),
447 IMPLENTRY(APPLE_UKRAINIAN),
448 IMPLENTRY(APPLE_CHINSIMP),
449 IMPLENTRY(APPLE_CHINTRAD),
450 IMPLENTRY(APPLE_JAPANESE),
451 IMPLENTRY(APPLE_KOREAN),
452 IMPLENTRY(MS_932),
453 IMPLENTRY(MS_936),
454 IMPLENTRY(MS_949),
455 IMPLENTRY(MS_950),
456 IMPLENTRY(SHIFT_JIS),
457 IMPLENTRY(GB_2312),
458 IMPLENTRY(GBT_12345),
459 IMPLENTRY(GBK),
460 IMPLENTRY(BIG5),
461 IMPLENTRY(EUC_JP),
462 IMPLENTRY(EUC_CN),
463 IMPLENTRY(EUC_TW),
464 IMPLENTRY(ISO_2022_JP),
465 IMPLENTRY(ISO_2022_CN),
466 IMPLENTRY(KOI8_R),
467 IMPLENTRY(KOI8_U),
468 IMPLENTRY(UTF7),
469 IMPLENTRY(UTF8),
470 IMPLENTRY(ISO_8859_10),
471 IMPLENTRY(ISO_8859_13),
472 IMPLENTRY(EUC_KR),
473 IMPLENTRY(ISO_2022_KR),
474 IMPLENTRY(JIS_X_0201),
475 IMPLENTRY(JIS_X_0208),
476 IMPLENTRY(JIS_X_0212),
477 IMPLENTRY(MS_1361),
478 IMPLENTRY(GB_18030),
479 IMPLENTRY(BIG5_HKSCS),
480 IMPLENTRY(TIS_620),
481 IMPLENTRY(PT154),
482 IMPLENTRY(UCS4),
483 IMPLENTRY(UCS2),
484 IMPLENTRY(UNICODE),
485 {0,nullptr} //Last
486 };
487 return &aMapArr[0];
488}
489
490/*
491 Get a rtl_TextEncoding from its name
492 */
493rtl_TextEncoding CharSetFromName(const OUString& rChrSetStr)
494{
495 const CharSetNameMap *pStart = GetCharSetNameMap();
496 rtl_TextEncoding nRet = pStart->eCode;
497
498 for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
499 {
500 if(rChrSetStr.equalsIgnoreAsciiCaseAscii(pMap->pName))
501 {
502 nRet = pMap->eCode;
503 break;
504 }
505 }
506
507 OSL_ENSURE(nRet != pStart->eCode, "TXT: That was an unknown language!");
508
509 return nRet;
510}
511
512/*
513 Get the String name of an rtl_TextEncoding
514 */
515OUString NameFromCharSet(rtl_TextEncoding nChrSet)
516{
517 const CharSetNameMap *pStart = GetCharSetNameMap();
518 const char *pRet = pStart->pName;
519
520 for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
521 {
522 if (nChrSet == pMap->eCode)
523 {
524 pRet = pMap->pName;
525 break;
526 }
527 }
528
529 OSL_ENSURE(pRet != pStart->pName, "TXT: That was an unknown language!");
530
531 return OUString::createFromAscii(pRet);
532}
533
534}
535
536// for the automatic conversion (mail/news/...)
537// The user data contains the options for the ascii import/export filter.
538// The format is:
539// 1. CharSet - as ascii chars
540// 2. LineEnd - as CR/LF/CRLF
541// 3. Fontname
542// 4. Language
543// 5. Whether to include byte-order-mark - as true/false
544// 6. Whether to include hidden paragraphs and text - as true/false
545// the delimiter character is ","
546
547void SwAsciiOptions::ReadUserData( std::u16string_view rStr )
548{
549 sal_Int32 nToken = 0;
550 std::u16string_view sToken = o3tl::getToken(rStr, 0, ',', nToken); // 1. Charset name
551 if (!sToken.empty())
552 m_eCharSet = CharSetFromName(OUString(sToken));
553 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 2. Line ending type
554 {
555 if (o3tl::equalsIgnoreAsciiCase(sToken, u"CRLF"))
557 else if (o3tl::equalsIgnoreAsciiCase(sToken, u"LF"))
559 else
561 }
562 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 3. Font name
563 m_sFont = sToken;
564 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 4. Language tag
566 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 5. Include BOM?
567 m_bIncludeBOM = !(o3tl::equalsIgnoreAsciiCase(sToken, u"FALSE"));
568 // 6. Include hidden text
569 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty())
571}
572
573void SwAsciiOptions::WriteUserData(OUString& rStr) const
574{
575 // 1. charset
576 rStr = NameFromCharSet(m_eCharSet) + ",";
577
578 // 2. LineEnd
579 switch(m_eCRLF_Flag)
580 {
581 case LINEEND_CRLF:
582 rStr += "CRLF";
583 break;
584 case LINEEND_CR:
585 rStr += "CR";
586 break;
587 case LINEEND_LF:
588 rStr += "LF";
589 break;
590 }
591 rStr += ",";
592
593 // 3. Fontname
594 rStr += m_sFont + ",";
595
596 // 4. Language
597 if (m_nLanguage)
598 {
600 }
601 rStr += ",";
602
603 // 5. Whether to include byte-order-mark
604 if(m_bIncludeBOM)
605 {
606 rStr += "true";
607 }
608 else
609 {
610 rStr += "false";
611 }
612 rStr += ",";
613
614 // 6. Whether to include hidden paragraphs and text
616 {
617 rStr += "true";
618 }
619 else
620 {
621 rStr += "false";
622 }
623 rStr += ",";
624}
625
626#ifdef DISABLE_DYNLOADING
627
628extern "C" {
629 Reader *ImportRTF();
630 void ExportRTF( std::u16string_view, const OUString& rBaseURL, WriterRef& );
631 Reader *ImportDOC();
632 void ExportDOC( std::u16string_view, const OUString& rBaseURL, WriterRef& );
634 sal_uInt32 SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
636}
637
638#endif
639
641{
642#ifndef DISABLE_DYNLOADING
643
644 FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportRTF" ) );
645
646 if ( pFunction )
647 return (*pFunction)();
648
649 return nullptr;
650#else
651 return ImportRTF();
652#endif
653
654}
655
656void GetRTFWriter( std::u16string_view rFltName, const OUString& rBaseURL, WriterRef& xRet )
657{
658#ifndef DISABLE_DYNLOADING
659 FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportRTF" ) );
660
661 if ( pFunction )
662 (*pFunction)( rFltName, rBaseURL, xRet );
663 else
664 xRet = WriterRef(nullptr);
665#else
666 ExportRTF( rFltName, rBaseURL, xRet );
667#endif
668}
669
671{
672#ifndef DISABLE_DYNLOADING
673 FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOC" ) );
674
675 if ( pFunction )
676 return (*pFunction)();
677
678 return nullptr;
679#else
680 return ImportDOC();
681#endif
682}
683
684void GetWW8Writer( std::u16string_view rFltName, const OUString& rBaseURL, WriterRef& xRet )
685{
686#ifndef DISABLE_DYNLOADING
687 FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportDOC" ) );
688
689 if ( pFunction )
690 (*pFunction)( rFltName, rBaseURL, xRet );
691 else
692 xRet = WriterRef(nullptr);
693#else
694 ExportDOC( rFltName, rBaseURL, xRet );
695#endif
696}
697
699{
700#ifndef DISABLE_DYNLOADING
701 FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOCX" ) );
702
703 if ( pFunction )
704 return (*pFunction)();
705
706 return nullptr;
707#else
708 return ImportDOCX();
709#endif
710}
711
712typedef sal_uInt32 ( *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
713typedef sal_uInt32 ( *GetSaveWarning )( SfxObjectShell& );
714
715ErrCode SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSaveInto, const OUString& rStorageName )
716{
717#ifndef DISABLE_DYNLOADING
718 SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( SwGlobals::getFilters().GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) );
719 if( pFunction )
720 return ErrCode(pFunction( rDoc, rStor, bSaveInto, rStorageName ));
721 return ERRCODE_NONE;
722#else
723 return ErrCode(SaveOrDelMSVBAStorage_ww8( rDoc, rStor, bSaveInto, rStorageName ));
724#endif
725}
726
728{
729#ifndef DISABLE_DYNLOADING
730 GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( SwGlobals::getFilters().GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) );
731 if( pFunction )
732 return ErrCode(pFunction( rDocS ));
733 return ERRCODE_NONE;
734#else
736#endif
737}
738
739/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const PropertyValue * pValues
const char * pName
SvxBoxItemLine
static OUString convertToBcp47(LanguageType nLangID)
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
virtual void SetFltName(const OUString &rFltNm)
Definition: shellio.cxx:617
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
virtual SwReaderType GetReaderType() override
Definition: shellio.cxx:691
virtual void SetFltName(const OUString &r) override
Definition: fltini.cxx:265
OUString m_aFltName
Definition: shellio.hxx:291
virtual bool IsStgWriter() const override
Definition: fltini.cxx:190
const editeng::SvxBorderLine * GetLine(SvxBoxItemLine nLine) const
sal_Int16 GetDistance(SvxBoxItemLine nLine, bool bAllowNegative=false) const
tools::Long GetHeight() const
tools::Long GetWidth() const
bool m_bIncludeHidden
Definition: shellio.hxx:65
void WriteUserData(OUString &) const
Definition: fltini.cxx:573
OUString m_sFont
Definition: shellio.hxx:60
LanguageType m_nLanguage
Definition: shellio.hxx:62
rtl_TextEncoding m_eCharSet
Definition: shellio.hxx:61
void ReadUserData(std::u16string_view)
Definition: fltini.cxx:547
LineEnd m_eCRLF_Flag
Definition: shellio.hxx:63
bool m_bIncludeBOM
Definition: shellio.hxx:64
Marks a character position inside a document model content node (SwContentNode)
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: fltini.cxx:263
virtual void ImplCommit() override
Definition: fltini.cxx:262
void GetValues(sal_uInt16 nCnt, const char **ppNames, sal_uInt64 *pValues)
Definition: fltini.cxx:236
SwFilterOptions(sal_uInt16 nCnt, const char **ppNames, sal_uInt64 *pValues)
Definition: fltini.cxx:229
virtual SwFormatFrameSize * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:254
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:136
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:171
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:897
SwNodeOffset GetIndex() const
Definition: node.hxx:312
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:380
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:731
const SwTable & GetTable() const
Definition: node.hxx:542
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:207
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:111
void EraseText(const SwContentIndex &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:2763
OUString InsertText(const OUString &rStr, const SwContentIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2358
void GetMinMaxSize(SwNodeOffset nIndex, sal_uLong &rMin, sal_uLong &rMax, sal_uLong &rAbs) const
Is in itratr.
Definition: itratr.cxx:1009
virtual bool IsStgWriter() const
Definition: fltini.cxx:188
sal_uInt16 GetOutWidth() const
sal_uInt16 GetInWidth() const
osl::Module msword_
Definition: init.hxx:53
oslGenericFunction GetMswordLibSymbol(const char *pSymbol)
Definition: fltini.cxx:129
static css::uno::Sequence< css::uno::Any > GetProperties(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const css::uno::Sequence< OUString > &rNames, bool bAllLocales)
float u
#define ERRCODE_NONE
static Reader * GetDOCXReader()
Definition: fltini.cxx:698
sal_uInt32(* GetSaveWarning)(SfxObjectShell &)
Definition: fltini.cxx:713
sal_uInt32(* SaveOrDel)(SfxObjectShell &, SotStorage &, sal_Bool, const OUString &)
Definition: fltini.cxx:712
static Reader * GetWW8Reader()
Definition: fltini.cxx:670
void CalculateFlySize(SfxItemSet &rFlySet, const SwNode &rAnchor, SwTwips nPageWidth)
Definition: fltini.cxx:271
#define IMPLENTRY(X)
Reader * ReadXML
Definition: fltini.cxx:46
ErrCode SaveOrDelMSVBAStorage(SfxObjectShell &rDoc, SotStorage &rStor, bool bSaveInto, const OUString &rStorageName)
Definition: fltini.cxx:715
Reader * ReadHTML
Definition: fltini.cxx:46
void GetRTFWriter(std::u16string_view rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: fltini.cxx:656
ErrCode GetSaveWarningOfMSVBAStorage(SfxObjectShell &rDocS)
Definition: fltini.cxx:727
void GetWW8Writer(std::u16string_view rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: fltini.cxx:684
Reader * SwGetReaderXML()
Definition: fltini.cxx:89
static Reader * GetRTFReader()
Definition: fltini.cxx:640
static SwReaderWriterEntry aReaderWriter[]
Definition: fltini.cxx:54
static void SetFltPtr(sal_uInt16 rPos, Reader *pReader)
Definition: fltini.cxx:94
Reader * ReadAscii
Definition: fltini.cxx:46
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
SwIoDetect aFilterDetect[]
Definition: iodetect.cxx:40
@ READER_WRITER_XML
Definition: iodetect.hxx:79
@ MAXFILTER
Definition: iodetect.hxx:83
@ READER_WRITER_DOCX
Definition: iodetect.hxx:82
@ READER_WRITER_TEXT
Definition: iodetect.hxx:81
@ READER_WRITER_BAS
Definition: iodetect.hxx:73
@ READER_WRITER_HTML
Definition: iodetect.hxx:77
@ READER_WRITER_TEXT_DLG
Definition: iodetect.hxx:80
@ READER_WRITER_RTF
Definition: iodetect.hxx:72
sal_Int64 n
LINEEND_LF
LINEEND_CRLF
LINEEND_CR
#define SAL_WARN_IF(condition, area, stream)
sw::Filters & getFilters()
Definition: swdll.cxx:73
void GetWriter(std::u16string_view rFltName, const OUString &rBaseURL, WriterRef &xRet)
Return writer based on the name.
Definition: fltini.cxx:159
Reader * GetReader(const OUString &rFltName)
Return reader based on the name.
Definition: fltini.cxx:169
Reader * GetDOCXReader()
Definition: fltini.cxx:154
Reader * GetRtfReader()
Definition: fltini.cxx:149
int i
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
Dialog to specify the properties of date form field.
DefTokenId nToken
SAL_DLLPUBLIC_EXPORT void ExportRTF(std::u16string_view rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: rtfexport.cxx:1577
Reader *(* FnGetReader)()
Definition: shellio.hxx:524
tools::SvRef< Writer > WriterRef
Definition: shellio.hxx:470
void(* FnGetWriter)(std::u16string_view, const OUString &rBaseURL, WriterRef &)
Definition: shellio.hxx:525
sal_uIntPtr sal_uLong
FnGetReader fnGetReader
Definition: shellio.hxx:532
Reader * GetReader()
Get access to the reader.
Definition: fltini.cxx:69
FnGetWriter fnGetWriter
Definition: shellio.hxx:533
void GetWriter(std::u16string_view rNm, const OUString &rBaseURL, WriterRef &xWrt) const
Get access to the writer.
Definition: fltini.cxx:81
#define SVLIBRARY(Base)
SAL_DLLPUBLIC_EXPORT Reader * ImportDOCX()
SAL_DLLPUBLIC_EXPORT Reader * ImportRTF()
Definition: swparrtf.cxx:177
#define MINLAY
Definition: swtypes.hxx:62
tools::Long SwTwips
Definition: swtypes.hxx:51
#define MINFLY
Definition: swtypes.hxx:61
SvxBoxItem & rBoxItem
unsigned char sal_Bool
void GetASCWriter(std::u16string_view rFltNm, const OUString &, WriterRef &xRet)
Definition: wrtasc.cxx:228
void GetHTMLWriter(std::u16string_view rFilterOptions, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrthtml.cxx:1659
SAL_DLLPUBLIC_EXPORT sal_uInt32 SaveOrDelMSVBAStorage_ww8(SfxObjectShell &rDoc, SotStorage &rStor, sal_Bool bSaveInto, const OUString &rStorageName)
Definition: wrtww8.cxx:3958
SAL_DLLPUBLIC_EXPORT sal_uInt32 GetSaveWarningOfMSVBAStorage_ww8(SfxObjectShell &rDocS)
Definition: wrtww8.cxx:3969
SAL_DLLPUBLIC_EXPORT void ExportDOC(std::u16string_view rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtww8.cxx:3964
void GetXMLWriter(std::u16string_view, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtxml.cxx:580
SAL_DLLPUBLIC_EXPORT Reader * ImportDOC()
Definition: ww8par.cxx:6338