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 <WinWord>
197 <WW1F cfg:type="long">0</WW1F>
198 <WW cfg:type="long">0</WW>
199 <WW8 cfg:type="long">0</WW8>
200 <WWF cfg:type="long">0</WWF>
201 <WWFA0 cfg:type="long">0</WWFA0>
202 <WWFA1 cfg:type="long">0</WWFA1>
203 <WWFA2 cfg:type="long">0</WWFA2>
204 <WWFB0 cfg:type="long">0</WWFB0>
205 <WWFB1 cfg:type="long">0</WWFB1>
206 <WWFB2 cfg:type="long">0</WWFB2>
207 <WWFLX cfg:type="long">0</WWFLX>
208 <WWFLY cfg:type="long">0</WWFLY>
209 <WWFT cfg:type="long">0</WWFT>
210 <WWWR cfg:type="long">0</WWWR>
211 </WinWord>
212</FilterFlags>
213*/
214
215SwFilterOptions::SwFilterOptions( sal_uInt16 nCnt, const char** ppNames,
216 sal_uInt64* pValues )
217 : ConfigItem( "Office.Writer/FilterFlags" )
218{
219 GetValues( nCnt, ppNames, pValues );
220}
221
222void SwFilterOptions::GetValues( sal_uInt16 nCnt, const char** ppNames,
223 sal_uInt64* pValues )
224{
225 Sequence<OUString> aNames( nCnt );
226 OUString* pNames = aNames.getArray();
227 sal_uInt16 n;
228
229 for( n = 0; n < nCnt; ++n )
230 pNames[ n ] = OUString::createFromAscii( ppNames[ n ] );
231 Sequence<Any> aValues = GetProperties( aNames );
232
233 if( nCnt == aValues.getLength() )
234 {
235 const Any* pAnyValues = aValues.getConstArray();
236 for( n = 0; n < nCnt; ++n )
237 pValues[ n ] = pAnyValues[ n ].hasValue()
238 ? *o3tl::doAccess<sal_uInt64>(pAnyValues[ n ])
239 : 0;
240 }
241 else
242 {
243 for( n = 0; n < nCnt; ++n )
244 pValues[ n ] = 0;
245 }
246}
247
249void SwFilterOptions::Notify( const css::uno::Sequence< OUString >& ) {}
250
251void StgReader::SetFltName( const OUString& rFltNm )
252{
254 m_aFltName = rFltNm;
255}
256
257void CalculateFlySize(SfxItemSet& rFlySet, const SwNode& rAnchor,
258 SwTwips nPageWidth)
259{
260 const SwFormatFrameSize* pFrameSizeItem = rFlySet.GetItemIfSet( RES_FRM_SIZE );
261 if( !pFrameSizeItem || MINFLY > pFrameSizeItem->GetWidth() )
262 {
263 std::unique_ptr<SwFormatFrameSize> aSz(rFlySet.Get(RES_FRM_SIZE).Clone());
264 if (pFrameSizeItem)
265 aSz.reset(pFrameSizeItem->Clone());
266
267 SwTwips nWidth;
268 // determine the width; if there is a table use the width of the table;
269 // otherwise use the width of the page
270 const SwTableNode* pTableNd = rAnchor.FindTableNode();
271 if( pTableNd )
272 nWidth = pTableNd->GetTable().GetFrameFormat()->GetFrameSize().GetWidth();
273 else
274 nWidth = nPageWidth;
275
276 const SwNodeIndex* pSttNd = rFlySet.Get( RES_CNTNT ).GetContentIdx();
277 if( pSttNd )
278 {
279 bool bOnlyOneNode = true;
280 sal_uLong nMinFrame = 0;
281 sal_uLong nMaxFrame = 0;
282 SwTextNode* pFirstTextNd = nullptr;
283 SwNodeIndex aIdx( *pSttNd, 1 );
284 SwNodeIndex aEnd( *pSttNd->GetNode().EndOfSectionNode() );
285 while( aIdx < aEnd )
286 {
287 SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
288 if( pTextNd )
289 {
290 if( !pFirstTextNd )
291 pFirstTextNd = pTextNd;
292 else if( pFirstTextNd != pTextNd )
293 {
294 // forget it
295 bOnlyOneNode = false;
296 break;
297 }
298
299 sal_uLong nAbsMinCnts;
300 pTextNd->GetMinMaxSize( aIdx.GetIndex(), nMinFrame, nMaxFrame, nAbsMinCnts );
301 }
302 ++aIdx;
303 }
304
305 if( bOnlyOneNode )
306 {
307 if( nMinFrame < MINLAY && pFirstTextNd )
308 {
309 // if the first node don't contained any content, then
310 // insert one char in it calc again and delete once again
311 SwContentIndex aNdIdx( pFirstTextNd );
312 pFirstTextNd->InsertText("MM", aNdIdx);
313 sal_uLong nAbsMinCnts;
314 pFirstTextNd->GetMinMaxSize( pFirstTextNd->GetIndex(),
315 nMinFrame, nMaxFrame, nAbsMinCnts );
316 aNdIdx -= 2;
317 pFirstTextNd->EraseText( aNdIdx, 2 );
318 }
319
320 // consider border and distance to content
321 const SvxBoxItem& rBoxItem = rFlySet.Get( RES_BOX );
322 SvxBoxItemLine nLine = SvxBoxItemLine::LEFT;
323 for( int i = 0; i < 2; ++i )
324 {
325 const editeng::SvxBorderLine* pLn = rBoxItem.GetLine( nLine );
326 if( pLn )
327 {
328 sal_uInt16 nWidthTmp = pLn->GetOutWidth() + pLn->GetInWidth();
329 nWidthTmp = nWidthTmp + rBoxItem.GetDistance( nLine );
330 nMinFrame += nWidthTmp;
331 nMaxFrame += nWidthTmp;
332 }
333 nLine = SvxBoxItemLine::RIGHT;
334 }
335
336 // enforce minimum width for contents
337 if( nMinFrame < MINLAY )
338 nMinFrame = MINLAY;
339 if( nMaxFrame < MINLAY )
340 nMaxFrame = MINLAY;
341
342 if( nWidth > o3tl::narrowing<sal_uInt16>(nMaxFrame) )
343 nWidth = nMaxFrame;
344 else if( nWidth > o3tl::narrowing<sal_uInt16>(nMinFrame) )
345 nWidth = nMinFrame;
346 }
347 }
348
349 if( MINFLY > nWidth )
350 nWidth = MINFLY;
351
352 aSz->SetWidth( nWidth );
353 if( MINFLY > aSz->GetHeight() )
354 aSz->SetHeight( MINFLY );
355 rFlySet.Put( std::move(aSz) );
356 }
357 else if( MINFLY > pFrameSizeItem->GetHeight() )
358 {
359 std::unique_ptr<SwFormatFrameSize> aSz(pFrameSizeItem->Clone());
360 aSz->SetHeight( MINFLY );
361 rFlySet.Put( std::move(aSz) );
362 }
363}
364
365namespace
366{
367
368struct CharSetNameMap
369{
370 rtl_TextEncoding eCode;
371 const char* pName;
372};
373
374const CharSetNameMap *GetCharSetNameMap()
375{
376 static const CharSetNameMap aMapArr[] =
377 {
378# define IMPLENTRY(X) { RTL_TEXTENCODING_##X, #X }
379 IMPLENTRY(DONTKNOW),
380 IMPLENTRY(MS_1252),
381 IMPLENTRY(APPLE_ROMAN),
382 IMPLENTRY(IBM_437),
383 IMPLENTRY(IBM_850),
384 IMPLENTRY(IBM_860),
385 IMPLENTRY(IBM_861),
386 IMPLENTRY(IBM_863),
387 IMPLENTRY(IBM_865),
388 IMPLENTRY(SYMBOL),
389 IMPLENTRY(ASCII_US),
390 IMPLENTRY(ISO_8859_1),
391 IMPLENTRY(ISO_8859_2),
392 IMPLENTRY(ISO_8859_3),
393 IMPLENTRY(ISO_8859_4),
394 IMPLENTRY(ISO_8859_5),
395 IMPLENTRY(ISO_8859_6),
396 IMPLENTRY(ISO_8859_7),
397 IMPLENTRY(ISO_8859_8),
398 IMPLENTRY(ISO_8859_9),
399 IMPLENTRY(ISO_8859_14),
400 IMPLENTRY(ISO_8859_15),
401 IMPLENTRY(IBM_737),
402 IMPLENTRY(IBM_775),
403 IMPLENTRY(IBM_852),
404 IMPLENTRY(IBM_855),
405 IMPLENTRY(IBM_857),
406 IMPLENTRY(IBM_862),
407 IMPLENTRY(IBM_864),
408 IMPLENTRY(IBM_866),
409 IMPLENTRY(IBM_869),
410 IMPLENTRY(MS_874),
411 IMPLENTRY(MS_1250),
412 IMPLENTRY(MS_1251),
413 IMPLENTRY(MS_1253),
414 IMPLENTRY(MS_1254),
415 IMPLENTRY(MS_1255),
416 IMPLENTRY(MS_1256),
417 IMPLENTRY(MS_1257),
418 IMPLENTRY(MS_1258),
419 IMPLENTRY(APPLE_ARABIC),
420 IMPLENTRY(APPLE_CENTEURO),
421 IMPLENTRY(APPLE_CROATIAN),
422 IMPLENTRY(APPLE_CYRILLIC),
423 IMPLENTRY(APPLE_DEVANAGARI),
424 IMPLENTRY(APPLE_FARSI),
425 IMPLENTRY(APPLE_GREEK),
426 IMPLENTRY(APPLE_GUJARATI),
427 IMPLENTRY(APPLE_GURMUKHI),
428 IMPLENTRY(APPLE_HEBREW),
429 IMPLENTRY(APPLE_ICELAND),
430 IMPLENTRY(APPLE_ROMANIAN),
431 IMPLENTRY(APPLE_THAI),
432 IMPLENTRY(APPLE_TURKISH),
433 IMPLENTRY(APPLE_UKRAINIAN),
434 IMPLENTRY(APPLE_CHINSIMP),
435 IMPLENTRY(APPLE_CHINTRAD),
436 IMPLENTRY(APPLE_JAPANESE),
437 IMPLENTRY(APPLE_KOREAN),
438 IMPLENTRY(MS_932),
439 IMPLENTRY(MS_936),
440 IMPLENTRY(MS_949),
441 IMPLENTRY(MS_950),
442 IMPLENTRY(SHIFT_JIS),
443 IMPLENTRY(GB_2312),
444 IMPLENTRY(GBT_12345),
445 IMPLENTRY(GBK),
446 IMPLENTRY(BIG5),
447 IMPLENTRY(EUC_JP),
448 IMPLENTRY(EUC_CN),
449 IMPLENTRY(EUC_TW),
450 IMPLENTRY(ISO_2022_JP),
451 IMPLENTRY(ISO_2022_CN),
452 IMPLENTRY(KOI8_R),
453 IMPLENTRY(KOI8_U),
454 IMPLENTRY(UTF7),
455 IMPLENTRY(UTF8),
456 IMPLENTRY(ISO_8859_10),
457 IMPLENTRY(ISO_8859_13),
458 IMPLENTRY(EUC_KR),
459 IMPLENTRY(ISO_2022_KR),
460 IMPLENTRY(JIS_X_0201),
461 IMPLENTRY(JIS_X_0208),
462 IMPLENTRY(JIS_X_0212),
463 IMPLENTRY(MS_1361),
464 IMPLENTRY(GB_18030),
465 IMPLENTRY(BIG5_HKSCS),
466 IMPLENTRY(TIS_620),
467 IMPLENTRY(PT154),
468 IMPLENTRY(UCS4),
469 IMPLENTRY(UCS2),
470 IMPLENTRY(UNICODE),
471 {0,nullptr} //Last
472 };
473 return &aMapArr[0];
474}
475
476/*
477 Get a rtl_TextEncoding from its name
478 */
479rtl_TextEncoding CharSetFromName(std::u16string_view rChrSetStr)
480{
481 const CharSetNameMap *pStart = GetCharSetNameMap();
482 rtl_TextEncoding nRet = pStart->eCode;
483
484 for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
485 {
486 if(o3tl::equalsIgnoreAsciiCase(rChrSetStr, pMap->pName))
487 {
488 nRet = pMap->eCode;
489 break;
490 }
491 }
492
493 OSL_ENSURE(nRet != pStart->eCode, "TXT: That was an unknown language!");
494
495 return nRet;
496}
497
498/*
499 Get the String name of an rtl_TextEncoding
500 */
501OUString NameFromCharSet(rtl_TextEncoding nChrSet)
502{
503 const CharSetNameMap *pStart = GetCharSetNameMap();
504 const char *pRet = pStart->pName;
505
506 for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
507 {
508 if (nChrSet == pMap->eCode)
509 {
510 pRet = pMap->pName;
511 break;
512 }
513 }
514
515 OSL_ENSURE(pRet != pStart->pName, "TXT: That was an unknown language!");
516
517 return OUString::createFromAscii(pRet);
518}
519
520}
521
522// for the automatic conversion (mail/news/...)
523// The user data contains the options for the ascii import/export filter.
524// The format is:
525// 1. CharSet - as ascii chars
526// 2. LineEnd - as CR/LF/CRLF
527// 3. Fontname
528// 4. Language
529// 5. Whether to include byte-order-mark - as true/false
530// 6. Whether to include hidden paragraphs and text - as true/false
531// the delimiter character is ","
532
533void SwAsciiOptions::ReadUserData( std::u16string_view rStr )
534{
535 sal_Int32 nToken = 0;
536 std::u16string_view sToken = o3tl::getToken(rStr, 0, ',', nToken); // 1. Charset name
537 if (!sToken.empty())
538 m_eCharSet = CharSetFromName(sToken);
539 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 2. Line ending type
540 {
541 if (o3tl::equalsIgnoreAsciiCase(sToken, u"CRLF"))
543 else if (o3tl::equalsIgnoreAsciiCase(sToken, u"LF"))
545 else
547 }
548 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 3. Font name
549 m_sFont = sToken;
550 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 4. Language tag
552 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 5. Include BOM?
553 m_bIncludeBOM = !(o3tl::equalsIgnoreAsciiCase(sToken, u"FALSE"));
554 // 6. Include hidden text
555 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty())
557}
558
559void SwAsciiOptions::WriteUserData(OUString& rStr) const
560{
561 // 1. charset
562 rStr = NameFromCharSet(m_eCharSet) + ",";
563
564 // 2. LineEnd
565 switch(m_eCRLF_Flag)
566 {
567 case LINEEND_CRLF:
568 rStr += "CRLF";
569 break;
570 case LINEEND_CR:
571 rStr += "CR";
572 break;
573 case LINEEND_LF:
574 rStr += "LF";
575 break;
576 }
577 rStr += ",";
578
579 // 3. Fontname
580 rStr += m_sFont + ",";
581
582 // 4. Language
583 if (m_nLanguage)
584 {
586 }
587 rStr += ",";
588
589 // 5. Whether to include byte-order-mark
590 if(m_bIncludeBOM)
591 {
592 rStr += "true";
593 }
594 else
595 {
596 rStr += "false";
597 }
598 rStr += ",";
599
600 // 6. Whether to include hidden paragraphs and text
602 {
603 rStr += "true";
604 }
605 else
606 {
607 rStr += "false";
608 }
609 rStr += ",";
610}
611
612#ifdef DISABLE_DYNLOADING
613
614extern "C" {
615 Reader *ImportRTF();
616 void ExportRTF( std::u16string_view, const OUString& rBaseURL, WriterRef& );
617 Reader *ImportDOC();
618 void ExportDOC( std::u16string_view, const OUString& rBaseURL, WriterRef& );
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
642void GetRTFWriter( std::u16string_view 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
670void GetWW8Writer( std::u16string_view 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
698typedef sal_uInt32 ( *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
699typedef sal_uInt32 ( *GetSaveWarning )( SfxObjectShell& );
700
701ErrCode 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
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
722#endif
723}
724
725/* 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:251
OUString m_aFltName
Definition: shellio.hxx:295
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:69
void WriteUserData(OUString &) const
Definition: fltini.cxx:559
OUString m_sFont
Definition: shellio.hxx:64
LanguageType m_nLanguage
Definition: shellio.hxx:66
rtl_TextEncoding m_eCharSet
Definition: shellio.hxx:65
void ReadUserData(std::u16string_view)
Definition: fltini.cxx:533
LineEnd m_eCRLF_Flag
Definition: shellio.hxx:67
bool m_bIncludeBOM
Definition: shellio.hxx:68
Marks a character position inside a document model content node (SwContentNode)
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: fltini.cxx:249
virtual void ImplCommit() override
Definition: fltini.cxx:248
void GetValues(sal_uInt16 nCnt, const char **ppNames, sal_uInt64 *pValues)
Definition: fltini.cxx:222
SwFilterOptions(sal_uInt16 nCnt, const char **ppNames, sal_uInt64 *pValues)
Definition: fltini.cxx:215
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:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
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:695
const SwTable & GetTable() const
Definition: node.hxx:542
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:209
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
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:2777
OUString InsertText(const OUString &rStr, const SwContentIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2372
void GetMinMaxSize(SwNodeOffset nIndex, sal_uLong &rMin, sal_uLong &rMax, sal_uLong &rAbs) const
Is in itratr.
Definition: itratr.cxx:1012
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:684
sal_uInt32(* GetSaveWarning)(SfxObjectShell &)
Definition: fltini.cxx:699
sal_uInt32(* SaveOrDel)(SfxObjectShell &, SotStorage &, sal_Bool, const OUString &)
Definition: fltini.cxx:698
static Reader * GetWW8Reader()
Definition: fltini.cxx:656
void CalculateFlySize(SfxItemSet &rFlySet, const SwNode &rAnchor, SwTwips nPageWidth)
Definition: fltini.cxx:257
#define IMPLENTRY(X)
Reader * ReadXML
Definition: fltini.cxx:46
ErrCode SaveOrDelMSVBAStorage(SfxObjectShell &rDoc, SotStorage &rStor, bool bSaveInto, const OUString &rStorageName)
Definition: fltini.cxx:701
Reader * ReadHTML
Definition: fltini.cxx:46
void GetRTFWriter(std::u16string_view rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: fltini.cxx:642
ErrCode GetSaveWarningOfMSVBAStorage(SfxObjectShell &rDocS)
Definition: fltini.cxx:713
void GetWW8Writer(std::u16string_view rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: fltini.cxx:670
Reader * SwGetReaderXML()
Definition: fltini.cxx:89
static Reader * GetRTFReader()
Definition: fltini.cxx:626
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< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(101)
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:77
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:1578
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:224
void GetHTMLWriter(std::u16string_view rFilterOptions, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrthtml.cxx:1675
SAL_DLLPUBLIC_EXPORT sal_uInt32 SaveOrDelMSVBAStorage_ww8(SfxObjectShell &rDoc, SotStorage &rStor, sal_Bool bSaveInto, const OUString &rStorageName)
Definition: wrtww8.cxx:4039
SAL_DLLPUBLIC_EXPORT sal_uInt32 GetSaveWarningOfMSVBAStorage_ww8(SfxObjectShell &rDocS)
Definition: wrtww8.cxx:4050
SAL_DLLPUBLIC_EXPORT void ExportDOC(std::u16string_view rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtww8.cxx:4045
void GetXMLWriter(std::u16string_view, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtxml.cxx:580
SAL_DLLPUBLIC_EXPORT Reader * ImportDOC()
Definition: ww8par.cxx:6314