LibreOffice Module oox (master) 1
dumperbase.hxx
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#ifndef INCLUDED_OOX_DUMP_DUMPERBASE_HXX
21#define INCLUDED_OOX_DUMP_DUMPERBASE_HXX
22
23#include <cmath>
24#include <cstddef>
25#include <map>
26#include <memory>
27#include <set>
28#include <string_view>
29#include <utility>
30#include <vector>
31
32#include <com/sun/star/uno/Reference.hxx>
33#include <com/sun/star/uno/Sequence.hxx>
34#include <com/sun/star/util/DateTime.hpp>
38#include <rtl/string.hxx>
39#include <rtl/textenc.h>
40#include <rtl/ustring.hxx>
41#include <rtl/ustrbuf.hxx>
42#include <sal/types.h>
43
44#ifdef DBG_UTIL
45
46namespace com::sun::star {
47 namespace io { class XInputStream; }
48 namespace io { class XOutputStream; }
49 namespace io { class XTextOutputStream2; }
50 namespace uno { class XComponentContext; }
51}
52
53namespace oox {
54 class TextInputStream;
55}
56
57namespace oox::core {
58 class FilterBase;
59}
60
61namespace oox::dump {
62
63
64inline constexpr OUStringLiteral OOX_DUMP_UNUSED = u"unused";
65inline constexpr OUStringLiteral OOX_DUMP_UNKNOWN = u"?unknown";
66
67#define OOX_DUMP_ERRASCII( ascii ) "?err:" ascii
68
69#define OOX_DUMP_ERR_NOMAP "no-map"
70inline constexpr OUStringLiteral OOX_DUMP_ERR_NONAME = u"no-name";
71#define OOX_DUMP_ERR_STREAM "stream-error"
72
73#define OOX_DUMP_DUMPEXT ".dump"
74
91
92typedef ::std::pair< OUString, OUString > OUStringPair;
93
94typedef ::std::vector< OUString > OUStringVector;
95typedef ::std::vector< sal_Int64 > Int64Vector;
96
97
100{
101public:
102 // file names -------------------------------------------------------------
103
104 static OUString convertFileNameToUrl( const OUString& rFileName );
105 static sal_Int32 getFileNamePos( std::u16string_view rFileUrl );
106 static std::u16string_view getFileNameExtension( std::u16string_view rFileUrl );
107
108 // input streams ----------------------------------------------------------
109
110 static css::uno::Reference< css::io::XInputStream >
112 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
113 const OUString& rFileName );
114
115 // output streams ---------------------------------------------------------
116
117 static css::uno::Reference< css::io::XOutputStream >
119 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
120 const OUString& rFileName );
121
122 static css::uno::Reference< css::io::XTextOutputStream2 >
124 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
125 const css::uno::Reference< css::io::XOutputStream >& rxOutStrm,
126 rtl_TextEncoding eTextEnc );
127
128 static css::uno::Reference< css::io::XTextOutputStream2 >
130 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
131 const OUString& rFileName,
132 rtl_TextEncoding eTextEnc );
133};
134
135
137{
138public:
140
141 /*implicit*/ BinaryInputStreamRef( std::shared_ptr<BinaryInputStream> const & pInStrm ) :
142 ::oox::BinaryInputStreamRef( pInStrm ) {}
143
144 /*implicit*/ BinaryInputStreamRef( const css::uno::Reference< css::io::XInputStream >& rxInStrm ) :
145 ::oox::BinaryInputStreamRef( std::make_shared<BinaryXInputStream>( rxInStrm, true ) ) {}
146
147 template< typename StreamType >
148 /*implicit*/ BinaryInputStreamRef( const std::shared_ptr< StreamType >& rxInStrm ) :
149 ::oox::BinaryInputStreamRef( rxInStrm ) {}
150};
151
152
155{
168
169
172{
181
182
204{
207 OUString maItemName;
208 OUString maListName;
209
210 explicit ItemFormat();
211
212 void set( DataType eDataType, FormatType eFmtType, const OUString& rItemName );
213
225 OUStringVector::const_iterator parse( const OUStringVector& rFormatVec );
226
239 OUStringVector parse( std::u16string_view rFormatStr );
240};
241
242
245{
246public:
247 // append string to string ------------------------------------------------
248
249 static void appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount );
250 static void appendString( OUStringBuffer& rStr, std::u16string_view rData, sal_Int32 nWidth, sal_Unicode cFill = ' ' );
251
252 // append decimal ---------------------------------------------------------
253
254 static void appendDec( OUStringBuffer& rStr, sal_uInt8 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
255 static void appendDec( OUStringBuffer& rStr, sal_Int8 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
256 static void appendDec( OUStringBuffer& rStr, sal_uInt16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
257 static void appendDec( OUStringBuffer& rStr, sal_Int16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
258 static void appendDec( OUStringBuffer& rStr, sal_uInt32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
259 static void appendDec( OUStringBuffer& rStr, sal_Int32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
260 static void appendDec( OUStringBuffer& rStr, sal_uInt64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
261 static void appendDec( OUStringBuffer& rStr, sal_Int64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
262 static void appendDec( OUStringBuffer& rStr, double fData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
263
264 // append hexadecimal -----------------------------------------------------
265
266 static void appendHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix = true );
267 static void appendHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix = true );
268 static void appendHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
269 static void appendHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix = true );
270 static void appendHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
271 static void appendHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix = true );
272 static void appendHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
273 static void appendHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix = true );
274 static void appendHex( OUStringBuffer& rStr, double fData, bool bPrefix = true );
275
276 // append shortened hexadecimal -------------------------------------------
277
278 static void appendShortHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix = true );
279 static void appendShortHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix = true );
280 static void appendShortHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
281 static void appendShortHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix = true );
282 static void appendShortHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
283 static void appendShortHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix = true );
284 static void appendShortHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
285 static void appendShortHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix = true );
286 static void appendShortHex( OUStringBuffer& rStr, double fData, bool bPrefix = true );
287
288 // append binary ----------------------------------------------------------
289
290 static void appendBin( OUStringBuffer& rStr, sal_uInt8 nData, bool bDots = true );
291 static void appendBin( OUStringBuffer& rStr, sal_Int8 nData, bool bDots = true );
292 static void appendBin( OUStringBuffer& rStr, sal_uInt16 nData, bool bDots = true );
293 static void appendBin( OUStringBuffer& rStr, sal_Int16 nData, bool bDots = true );
294 static void appendBin( OUStringBuffer& rStr, sal_uInt32 nData, bool bDots = true );
295 static void appendBin( OUStringBuffer& rStr, sal_Int32 nData, bool bDots = true );
296 static void appendBin( OUStringBuffer& rStr, sal_uInt64 nData, bool bDots = true );
297 static void appendBin( OUStringBuffer& rStr, sal_Int64 nData, bool bDots = true );
298 static void appendBin( OUStringBuffer& rStr, double fData, bool bDots = true );
299
300 // append fixed-point decimal ---------------------------------------------
301
302 template< typename Type >
303 static void appendFix( OUStringBuffer& rStr, Type nData, sal_Int32 nWidth = 0 );
304
305 // append formatted value -------------------------------------------------
306
307 static void appendBool( OUStringBuffer& rStr, bool bData );
308 template< typename Type >
309 static void appendValue( OUStringBuffer& rStr, Type nData, FormatType eFmtType );
310
311 // encoded text output ----------------------------------------------------
312
313 static void appendCChar( OUStringBuffer& rStr, sal_Unicode cChar, bool bPrefix = true );
314 static void appendEncChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount, bool bPrefix = true );
315 static void appendEncString( OUStringBuffer& rStr, std::u16string_view rData, bool bPrefix = true );
316
317 // token list -------------------------------------------------------------
318
319 static void appendToken( OUStringBuffer& rStr, std::u16string_view rToken, sal_Unicode cSep = OOX_DUMP_LISTSEP );
320
321 static void appendIndex( OUStringBuffer& rStr, sal_Int64 nIdx );
322
323 static std::u16string_view getToken( std::u16string_view rData, sal_Int32& rnPos, sal_Unicode cSep = OOX_DUMP_LISTSEP );
324
326 static void enclose( OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode cClose = '\0' );
327
328 // string conversion ------------------------------------------------------
329
330 static std::u16string_view trimSpaces( std::u16string_view rStr );
331 static OUString trimTrailingNul( const OUString& rStr );
332
333 static OString convertToUtf8( std::u16string_view rStr );
334 static DataType convertToDataType( std::u16string_view rStr );
335 static FormatType convertToFormatType( std::u16string_view rStr );
336
337 static bool convertFromDec( sal_Int64& ornData, std::u16string_view rData );
338 static bool convertFromHex( sal_Int64& ornData, std::u16string_view rData );
339
340 static bool convertStringToInt( sal_Int64& ornData, std::u16string_view rData );
341 static bool convertStringToDouble( double& orfData, std::u16string_view rData );
342 static bool convertStringToBool( std::u16string_view rData );
343
344 static OUStringPair convertStringToPair( const OUString& rString, sal_Unicode cSep = '=' );
345
346 // string to list conversion ----------------------------------------------
347
348 static void convertStringToStringList( OUStringVector& orVec, std::u16string_view rData, bool bIgnoreEmpty );
349 static void convertStringToIntList( Int64Vector& orVec, std::u16string_view rData, bool bIgnoreEmpty );
350};
351
352
353template< typename Type >
354void StringHelper::appendFix( OUStringBuffer& rStr, Type nData, sal_Int32 nWidth )
355{
356 appendDec( rStr, static_cast< double >( nData ) / std::pow( 2.0, 4.0 * sizeof( Type ) ), nWidth );
357}
358
359template< typename Type >
360void StringHelper::appendValue( OUStringBuffer& rStr, Type nData, FormatType eFmtType )
361{
362 switch( eFmtType )
363 {
364 case FORMATTYPE_DEC: appendDec( rStr, nData ); break;
365 case FORMATTYPE_HEX: appendHex( rStr, nData ); break;
366 case FORMATTYPE_SHORTHEX: appendShortHex( rStr, nData ); break;
367 case FORMATTYPE_BIN: appendBin( rStr, nData ); break;
368 case FORMATTYPE_FIX: appendFix( rStr, nData ); break;
369 case FORMATTYPE_BOOL: appendBool( rStr, static_cast<bool>(nData) ); break; // avoid loplugin:pointerbool warning
370 default:;
371 }
372}
373
374
375class String : public OUString
376{
377public:
379 /*implicit*/ String( const OUString& rStr ) : OUString( rStr ) {}
380 /*implicit*/ String( const char* pcStr ) : OUString( OUString::createFromAscii( pcStr ? pcStr : "" ) ) {}
381 /*implicit*/ String( sal_Unicode cChar ) : OUString( cChar ) {}
382
383 bool has() const { return getLength() > 0; }
384 OUString operator()( const char* pcDefault ) const { if( has() ) return *this; return String( pcDefault ); }
385};
386
388
389
439class Base
440{
441public:
442 virtual ~Base();
443
444 Base(Base const &) = default;
445 Base(Base &&) = default;
446 Base & operator =(Base const &) = default;
447 Base & operator =(Base &&) = default;
448
449 bool isValid() const { return implIsValid(); }
450 static bool isValid( const std::shared_ptr< Base >& rxBase ) { return rxBase && rxBase->isValid(); }
451
452protected:
453 Base() {}
454
455 virtual bool implIsValid() const = 0;
456};
457
458
460{
461public:
462 virtual ~ConfigItemBase();
464
465protected:
467
468 virtual void implProcessConfigItemStr(
469 TextInputStream& rStrm,
470 const OUString& rKey,
471 const OUString& rData );
472
473 virtual void implProcessConfigItemInt(
474 TextInputStream& rStrm,
475 sal_Int64 nKey,
476 const OUString& rData );
477
479 TextInputStream& rStrm );
480
481private:
483
485 TextInputStream& rStrm,
486 OUString& orKey,
487 OUString& orData );
488
490 TextInputStream& rStrm,
491 const OUString& rKey,
492 const OUString& rData );
493};
494
495
496class SharedConfigData;
497class Config;
498
499class NameListBase;
500typedef std::shared_ptr< NameListBase > NameListRef;
501
510class NameListBase : public Base, public ConfigItemBase
511{
512public:
513 typedef ::std::map< sal_Int64, OUString > OUStringMap;
514 typedef OUStringMap::const_iterator const_iterator;
515
516public:
517 virtual ~NameListBase() override;
518
520 void setName( sal_Int64 nKey, const String& rName );
521
523 void includeList( const NameListRef& rxList );
524
526 template< typename Type >
527 bool hasName( Type nKey ) const
528 { return maMap.count( static_cast< sal_Int64 >( nKey ) ) != 0; }
529
531 template< typename Type >
532 OUString getName( const Config& rCfg, Type nKey ) const
533 { return implGetName( rCfg, static_cast< sal_Int64 >( nKey ) ); }
534
536 OUString getName( const Config& rCfg, double fValue ) const
537 { return implGetNameDbl( rCfg, fValue ); }
538
540 const_iterator begin() const { return maMap.begin(); }
542 const_iterator end() const { return maMap.end(); }
543
544protected:
545 explicit NameListBase( const SharedConfigData& rCfgData ) : mrCfgData( rCfgData ) {}
546
547 virtual bool implIsValid() const override;
548
549 virtual void implProcessConfigItemStr(
550 TextInputStream& rStrm,
551 const OUString& rKey,
552 const OUString& rData ) override;
553
554 virtual void implProcessConfigItemInt(
555 TextInputStream& rStrm,
556 sal_Int64 nKey,
557 const OUString& rData ) override;
558
560 virtual void implSetName( sal_Int64 nKey, const OUString& rName ) = 0;
562 virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const = 0;
564 virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const = 0;
566 virtual void implIncludeList( const NameListBase& rList ) = 0;
567
569 void insertRawName( sal_Int64 nKey, const OUString& rName );
571 const OUString* findRawName( sal_Int64 nKey ) const;
572
573private:
575 void include( std::u16string_view rListKeys );
577 void exclude( std::u16string_view rKeys );
578
579private:
582};
583
584
586{
587public:
588 explicit ConstList( const SharedConfigData& rCfgData );
589
591 void setQuoteNames( bool bQuoteNames ) { mbQuoteNames = bQuoteNames; }
592
593protected:
594 virtual void implProcessConfigItemStr(
595 TextInputStream& rStrm,
596 const OUString& rKey,
597 const OUString& rData ) override;
598
600 virtual void implSetName( sal_Int64 nKey, const OUString& rName ) override;
602 virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const override;
604 virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const override;
606 virtual void implIncludeList( const NameListBase& rList ) override;
607
608private:
609 OUString maDefName;
611};
612
613
614class MultiList : public ConstList
615{
616public:
617 explicit MultiList( const SharedConfigData& rCfgData );
618
619 void setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNames );
620
621protected:
622 virtual void implProcessConfigItemStr(
624 const OUString& rKey,
625 const OUString& rData ) override;
626
627 virtual void implSetName( sal_Int64 nKey, const OUString& rName ) override;
628
629private:
631};
632
633
635{
636public:
637 explicit FlagsList( const SharedConfigData& rCfgData );
638
640 sal_Int64 getIgnoreFlags() const { return mnIgnore; }
642 void setIgnoreFlags( sal_Int64 nIgnore ) { mnIgnore = nIgnore; }
643
644protected:
645 virtual void implProcessConfigItemStr(
646 TextInputStream& rStrm,
647 const OUString& rKey,
648 const OUString& rData ) override;
649
651 virtual void implSetName( sal_Int64 nKey, const OUString& rName ) override;
653 virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const override;
655 virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const override;
657 virtual void implIncludeList( const NameListBase& rList ) override;
658
659private:
660 sal_Int64 mnIgnore;
661};
662
663
664class CombiList : public FlagsList
665{
666public:
667 explicit CombiList( const SharedConfigData& rCfgData );
668
669protected:
671 virtual void implSetName( sal_Int64 nKey, const OUString& rName ) override;
673 virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const override;
675 virtual void implIncludeList( const NameListBase& rList ) override;
676
677private:
679 {
680 sal_Int64 mnKey;
681 ::std::pair< sal_Int64, sal_Int64 > maFilter;
682 explicit ExtItemFormatKey( sal_Int64 nKey ) : mnKey( nKey ), maFilter( 0, 0 ) {}
683 bool operator<( const ExtItemFormatKey& rRight ) const;
684
685 };
686 struct ExtItemFormat : public ItemFormat
687 {
690 };
691 typedef ::std::map< ExtItemFormatKey, ExtItemFormat > ExtItemFormatMap;
693};
694
695
697{
698public:
699 explicit UnitConverter( const SharedConfigData& rCfgData );
700
701 void setUnitName( const String& rUnitName ) { maUnitName = rUnitName; }
702 void setFactor( double fFactor ) { mfFactor = fFactor; }
703
704protected:
706 virtual void implSetName( sal_Int64 nKey, const OUString& rName ) override;
708 virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const override;
710 virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const override;
712 virtual void implIncludeList( const NameListBase& rList ) override;
713
714private:
715 OUString maUnitName;
716 double mfFactor;
717};
718
719
721{
722public:
724 /*implicit*/ NameListWrapper( const OUString& rListName ) : maName( rListName ) {}
725 /*implicit*/ NameListWrapper( const char* pcListName ) : maName( pcListName ) {}
726 /*implicit*/ NameListWrapper( NameListRef xList ) : mxList(std::move( xList )) {}
727
728 bool isEmpty() const { return !mxList && !maName.has(); }
729 const NameListRef & getNameList( const Config& rCfg ) const;
730
731private:
734};
735
737
738
740{
741private:
742 ::std::map< sal_Int64, ItemFormat > maMap;
743
744public:
746 explicit ItemFormatMap( const NameListRef& rxNameList ) { insertFormats( rxNameList ); }
747
748 ::std::map< sal_Int64, ItemFormat >::const_iterator end() const { return maMap.end(); }
749 ::std::map< sal_Int64, ItemFormat >::const_iterator find(sal_Int64 nId) const
750 {
751 return maMap.find(nId);
752 }
753
754 void insertFormats( const NameListRef& rxNameList );
755};
756
757
759{
760public:
761 explicit SharedConfigData(
762 const OUString& rFileName,
763 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
764 StorageRef xRootStrg,
765 OUString aSysFileName );
766
767 virtual ~SharedConfigData() override;
768
769 const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return mxContext; }
770 const StorageRef& getRootStorage() const { return mxRootStrg; }
771 const OUString& getSysFileName() const { return maSysFileName; }
772
773 const OUString* getOption( const OUString& rKey ) const;
774
775 template< typename ListType >
776 std::shared_ptr< ListType > createNameList( const OUString& rListName );
777 void setNameList( const OUString& rListName, const NameListRef& rxList );
778 void eraseNameList( const OUString& rListName );
779 NameListRef getNameList( const OUString& rListName ) const;
780
781protected:
782 virtual bool implIsValid() const override;
783 virtual void implProcessConfigItemStr(
784 TextInputStream& rStrm,
785 const OUString& rKey,
786 const OUString& rData ) override;
787
788private:
789 bool readConfigFile( const OUString& rFileUrl );
790 template< typename ListType >
791 void readNameList( TextInputStream& rStrm, const OUString& rListName );
792 void createShortList( std::u16string_view rData );
793 void createUnitConverter( std::u16string_view rData );
794
795private:
796 typedef ::std::set< OUString > ConfigFileSet;
797 typedef ::std::map< OUString, OUString > ConfigDataMap;
798 typedef ::std::map< OUString, NameListRef > NameListMap;
799
800 css::uno::Reference< css::uno::XComponentContext > mxContext;
806 OUString maConfigPath;
808};
809
810
811template< typename ListType >
812std::shared_ptr< ListType > SharedConfigData::createNameList( const OUString& rListName )
813{
814 std::shared_ptr< ListType > xList;
815 if( !rListName.isEmpty() )
816 {
817 xList = std::make_shared<ListType>( *this );
818 setNameList( rListName, xList );
819 }
820 return xList;
821}
822
823template< typename ListType >
824void SharedConfigData::readNameList( TextInputStream& rStrm, const OUString& rListName )
825{
826 NameListRef xList = createNameList< ListType >( rListName );
827 if( xList )
828 xList->readConfigBlock( rStrm );
829}
830
831
832class Config : public Base
833{
834public:
835 explicit Config(
836 const char* pcEnvVar,
837 const ::oox::core::FilterBase& rFilter );
838 explicit Config(
839 const char* pcEnvVar,
840 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
841 const StorageRef& rxRootStrg,
842 const OUString& rSysFileName );
843
844 virtual ~Config() override;
845
846 Config(Config const &) = default;
847 Config(Config &&) = default;
848 Config & operator =(Config const &) = default;
849 Config & operator =(Config &&) = default;
850
851 const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return mxCfgData->getContext(); }
852 const StorageRef& getRootStorage() const { return mxCfgData->getRootStorage(); }
853 const OUString& getSysFileName() const { return mxCfgData->getSysFileName(); }
854
855 const OUString& getStringOption( const String& rKey, const OUString& rDefault ) const;
856 bool getBoolOption( const String& rKey, bool bDefault ) const;
857 template< typename Type >
858 Type getIntOption( const String& rKey, Type nDefault ) const;
859
860 bool isDumperEnabled() const;
861 bool isImportEnabled() const;
862
863 template< typename ListType >
864 std::shared_ptr< ListType > createNameList( const String& rListName );
865 void eraseNameList( const String& rListName );
866 NameListRef getNameList( const String& rListName ) const;
867
869 template< typename Type >
870 OUString getName( const NameListWrapper& rListWrp, Type nKey ) const;
872 template< typename Type >
873 bool hasName( const NameListWrapper& rListWrp, Type nKey ) const;
874
875protected:
878 const char* pcEnvVar,
879 const ::oox::core::FilterBase& rFilter );
881 const char* pcEnvVar,
882 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
883 const StorageRef& rxRootStrg,
884 const OUString& rSysFileName );
885
886 virtual bool implIsValid() const override;
887 const OUString* implGetOption( const OUString& rKey ) const;
888
889private:
890 std::shared_ptr< SharedConfigData > mxCfgData;
891};
892
893typedef std::shared_ptr< Config > ConfigRef;
894
895
896template< typename Type >
897Type Config::getIntOption( const String& rKey, Type nDefault ) const
898{
899 sal_Int64 nRawData;
900 const OUString* pData = implGetOption( rKey );
901 return (pData && StringHelper::convertStringToInt( nRawData, *pData )) ?
902 static_cast< Type >( nRawData ) : nDefault;
903}
904
905template< typename ListType >
906std::shared_ptr< ListType > Config::createNameList( const String& rListName )
907{
908 return mxCfgData->createNameList< ListType >( rListName );
909}
910
911template< typename Type >
912OUString Config::getName( const NameListWrapper& rListWrp, Type nKey ) const
913{
914 NameListRef xList = rListWrp.getNameList( *this );
915 return xList ? xList->getName( *this, nKey ) : OOX_DUMP_ERR_NOMAP;
916}
917
918template< typename Type >
919bool Config::hasName( const NameListWrapper& rListWrp, Type nKey ) const
920{
921 NameListRef xList = rListWrp.getNameList( *this );
922 return xList.get() && xList->hasName( nKey );
923}
924
925
926class Output : public Base
927{
928public:
929 explicit Output(
930 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
931 const OUString& rFileName );
932
933
934 void newLine();
935 void emptyLine( size_t nCount = 1 );
936
937 void incIndent();
938 void decIndent();
939
940 void startTable( sal_Int32 nW1 );
941 void startTable( sal_Int32 nW1, sal_Int32 nW2 );
942 void startTable( sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 );
943 void startTable( size_t nColCount, const sal_Int32* pnColWidths );
944 void tab();
945 void tab( size_t nCol );
946 void endTable();
947
948 void resetItemIndex( sal_Int64 nIdx = 0 );
949 void startItem( const String& rItemName );
950 void contItem();
951 void endItem();
952
953 void startMultiItems();
954 void endMultiItems();
955
956 void writeChar( sal_Unicode cChar, sal_Int32 nCount = 1 );
957 void writeAscii( const char* pcStr );
958 void writeString( std::u16string_view rStr );
959 void writeArray( const sal_uInt8* pnData, std::size_t nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
960 void writeBool( bool bData );
961 void writeDateTime( const css::util::DateTime& rDateTime );
962
963 template< typename Type >
964 void writeDec( Type nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' )
965 { StringHelper::appendDec( maLine, nData, nWidth, cFill ); }
966 template< typename Type >
967 void writeHex( Type nData, bool bPrefix = true )
968 { StringHelper::appendHex( maLine, nData, bPrefix ); }
969 template< typename Type >
970 void writeShortHex( Type nData, bool bPrefix = true )
971 { StringHelper::appendShortHex( maLine, nData, bPrefix ); }
972 template< typename Type >
973 void writeBin( Type nData, bool bDots = true )
974 { StringHelper::appendBin( maLine, nData, bDots ); }
975 template< typename Type >
976 void writeFix( Type nData, sal_Int32 nWidth )
977 { StringHelper::appendFix( maLine, nData, nWidth ); }
978 template< typename Type >
979 void writeValue( Type nData, FormatType eFmtType )
980 { StringHelper::appendValue( maLine, nData, eFmtType ); }
981 template< typename Type >
982 void writeName( const Config& rCfg, Type nData, const NameListWrapper& rListWrp )
983 { writeString( rCfg.getName( rListWrp, nData ) ); }
984
985
986protected:
987 virtual bool implIsValid() const override;
988
989private:
990 void writeItemName( const String& rItemName );
991
992private:
993 css::uno::Reference< css::io::XTextOutputStream2 > mxStrm;
994 OUString maIndent;
995 OUStringBuffer maLine;
996 OUString maLastItem;
997 ::std::vector< sal_Int32 >
999 size_t mnCol;
1002 sal_Int64 mnItemIdx;
1003 sal_Int32 mnLastItem;
1004};
1005
1006typedef std::shared_ptr< Output > OutputRef;
1007
1008
1010{
1011public:
1012 explicit IndentGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.incIndent(); }
1014private:
1015 IndentGuard( const IndentGuard& ) = delete;
1016 IndentGuard& operator=( const IndentGuard& ) = delete;
1017private:
1019};
1020
1021
1023{
1024public:
1025 explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1 ) :
1026 mrOut( *rxOut ) { mrOut.startTable( nW1 ); }
1027 explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2 ) :
1028 mrOut( *rxOut ) { mrOut.startTable( nW1, nW2 ); }
1029 explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 ) :
1030 mrOut( *rxOut ) { mrOut.startTable( nW1, nW2, nW3, nW4 ); }
1031 explicit TableGuard( const OutputRef& rxOut, size_t nColCount,
1032 const sal_Int32* pnColWidths ) :
1033 mrOut( *rxOut ) { mrOut.startTable( nColCount, pnColWidths ); }
1035 void tab( size_t nCol ) { mrOut.tab( nCol ); }
1036private:
1037 TableGuard( const TableGuard& ) = delete;
1038 TableGuard& operator=( const TableGuard& ) = delete;
1039private:
1041};
1042
1043
1045{
1046public:
1047 explicit ItemGuard( const OutputRef& rxOut, const String& rName ) :
1048 mrOut( *rxOut ) { mrOut.startItem( rName ); }
1050 void cont() { mrOut.contItem(); }
1051private:
1052 ItemGuard( const ItemGuard& ) = delete;
1053 ItemGuard& operator=( const ItemGuard& ) = delete;
1054private:
1056};
1057
1058
1060{
1061public:
1062 explicit MultiItemsGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.startMultiItems(); }
1064private:
1067private:
1069};
1070
1071
1072class StorageIterator : public Base
1073{
1074public:
1075 explicit StorageIterator( StorageRef xStrg );
1076 virtual ~StorageIterator() override;
1077
1079
1080 OUString getName() const;
1081 bool isStream() const;
1082 bool isStorage() const;
1083
1084private:
1085 virtual bool implIsValid() const override;
1086
1087private:
1090 OUStringVector::const_iterator maIt;
1091};
1092
1093
1094class ObjectBase : public Base
1095{
1096public:
1097 virtual ~ObjectBase() override;
1098
1099 ObjectBase(ObjectBase const &) = default;
1100 ObjectBase(ObjectBase &&) = default;
1101 ObjectBase & operator =(ObjectBase const &) = default;
1103
1104 const css::uno::Reference< css::uno::XComponentContext >&
1105 getContext() const { return mxConfig->getContext(); }
1106
1107 void dump();
1108
1109
1110protected:
1112
1113 void construct( const ConfigRef& rxConfig );
1114 void construct( const ObjectBase& rParent );
1115
1116 virtual bool implIsValid() const override;
1117 virtual void implDump();
1118
1119
1120 Config& cfg() const { return *mxConfig; }
1121
1122private:
1124};
1125
1126typedef std::shared_ptr< ObjectBase > ObjectRef;
1127
1128
1130{
1131protected:
1133
1134protected:
1136 void construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
1137 void construct( const ObjectBase& rParent );
1138
1139 virtual bool implIsValid() const override;
1140 virtual void implDump() override;
1141
1142 virtual void implDumpStream(
1143 const css::uno::Reference< css::io::XInputStream >& rxStrm,
1144 const OUString& rStrgPath,
1145 const OUString& rStrmName,
1146 const OUString& rSysFileName );
1147
1148 virtual void implDumpStorage(
1149 const StorageRef& rxStrg,
1150 const OUString& rStrgPath,
1151 const OUString& rSysPath );
1152
1153 virtual void implDumpBaseStream(
1154 const BinaryInputStreamRef& rxStrm,
1155 const OUString& rSysFileName );
1156
1157 void addPreferredStream( const String& rStrmName );
1158 void addPreferredStorage( const String& rStrgPath );
1159
1160private:
1161 static OUString getSysFileName(
1162 std::u16string_view rStrmName,
1163 std::u16string_view rSysOutPath );
1164
1165 void extractStream(
1166 StorageBase& rStrg,
1167 const OUString& rStrgPath,
1168 const OUString& rStrmName,
1169 const OUString& rSysFileName );
1170 void extractStorage(
1171 const StorageRef& rxStrg,
1172 const OUString& rStrgPath,
1173 const OUString& rSysPath );
1174
1175 void extractItem(
1176 const StorageRef& rxStrg,
1177 const OUString& rStrgPath,
1178 const OUString& rItemName,
1179 std::u16string_view rSysPath,
1180 bool bIsStrg, bool bIsStrm );
1181
1182private:
1184 {
1185 OUString maName;
1187
1188 explicit PreferredItem( OUString aName, bool bStorage ) :
1189 maName(std::move( aName )), mbStorage( bStorage ) {}
1190 };
1191 typedef ::std::vector< PreferredItem > PreferredItemVector;
1192
1194 OUString maSysPath;
1196};
1197
1198
1200{
1201public:
1202 virtual ~OutputObjectBase() override;
1203
1208
1209protected:
1211
1213 void construct( const ObjectBase& rParent, const OUString& rSysFileName );
1214 void construct( const OutputObjectBase& rParent );
1215
1216 virtual bool implIsValid() const override;
1217
1218
1219 void writeEmptyItem( const String& rName );
1220 void writeInfoItem( const String& rName, const String& rData );
1221 void writeCharItem( const String& rName, sal_Unicode cData );
1222 void writeStringItem( const String& rName, std::u16string_view rData );
1223 void writeArrayItem( const String& rName, const sal_uInt8* pnData, std::size_t nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
1224 void writeDateTimeItem( const String& rName, const css::util::DateTime& rDateTime );
1225 void writeGuidItem( const String& rName, const OUString& rGuid );
1226
1227 template< typename Type >
1228 void addNameToItem( Type nData, const NameListWrapper& rListWrp );
1229
1230 template< typename Type >
1231 void writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp );
1232 template< typename Type >
1233 void writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1234 template< typename Type >
1235 void writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1236 template< typename Type >
1237 void writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1238 template< typename Type >
1239 void writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1240 template< typename Type >
1241 void writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1242 template< typename Type >
1243 void writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1244 template< typename Type >
1245 void writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp = NO_LIST );
1246
1247 template< typename Type >
1248 void writeValueItem( const ItemFormat& rItemFmt, Type nData );
1249
1250 template< typename Type >
1251 void writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
1252 template< typename Type >
1253 void writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
1254
1255protected:
1258};
1259
1260
1261template< typename Type >
1263{
1264 if( !rListWrp.isEmpty() )
1265 {
1266 mxOut->contItem();
1267 mxOut->writeName( cfg(), nData, rListWrp );
1268 }
1269}
1270
1271template< typename Type >
1272void OutputObjectBase::writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1273{
1274 ItemGuard aItem( mxOut, rName );
1275 mxOut->writeName( cfg(), nData, rListWrp );
1276}
1277
1278template< typename Type >
1279void OutputObjectBase::writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1280{
1281 ItemGuard aItem( mxOut, rName );
1282 mxOut->writeDec( nData );
1283 addNameToItem( nData, rListWrp );
1284}
1285
1286template< typename Type >
1287void OutputObjectBase::writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1288{
1289 ItemGuard aItem( mxOut, rName );
1290 mxOut->writeHex( nData );
1291 addNameToItem( nData, rListWrp );
1292}
1293
1294template< typename Type >
1295void OutputObjectBase::writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1296{
1297 ItemGuard aItem( mxOut, rName );
1298 mxOut->writeShortHex( nData );
1299 addNameToItem( nData, rListWrp );
1300}
1301
1302template< typename Type >
1303void OutputObjectBase::writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1304{
1305 ItemGuard aItem( mxOut, rName );
1306 mxOut->writeBin( nData );
1307 addNameToItem( nData, rListWrp );
1308}
1309
1310template< typename Type >
1311void OutputObjectBase::writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1312{
1313 ItemGuard aItem( mxOut, rName );
1314 mxOut->writeFix( nData );
1315 addNameToItem( nData, rListWrp );
1316}
1317
1318template< typename Type >
1319void OutputObjectBase::writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1320{
1321 ItemGuard aItem( mxOut, rName );
1322 mxOut->writeDec( nData );
1323 aItem.cont();
1324 mxOut->writeBool( nData != 0 );
1325 addNameToItem( nData, rListWrp );
1326}
1327
1328template< typename Type >
1329void OutputObjectBase::writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp )
1330{
1331 if( eFmtType == FORMATTYPE_BOOL )
1332 writeDecBoolItem( rName, nData, rListWrp );
1333 else
1334 {
1335 ItemGuard aItem( mxOut, rName );
1336 mxOut->writeValue( nData, eFmtType );
1337 addNameToItem( nData, rListWrp );
1338 }
1339}
1340
1341template< typename Type >
1343{
1344 OString aNameUtf8 = StringHelper::convertToUtf8( rItemFmt.maItemName );
1345 writeValueItem( aNameUtf8.getStr(), nData, rItemFmt.meFmtType, rItemFmt.maListName );
1346}
1347
1348template< typename Type >
1349void OutputObjectBase::writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
1350{
1351 ItemGuard aItem( mxOut, rName );
1352 mxOut->writeDec( nData1 );
1353 mxOut->writeChar( cSep );
1354 mxOut->writeDec( nData2 );
1355}
1356
1357template< typename Type >
1358void OutputObjectBase::writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
1359{
1360 ItemGuard aItem( mxOut, rName );
1361 mxOut->writeHex( nData1 );
1362 mxOut->writeChar( cSep );
1363 mxOut->writeHex( nData2 );
1364}
1365
1366
1368{
1369public:
1370 virtual ~InputObjectBase() override;
1371
1376
1377protected:
1379
1381 void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
1382 void construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
1383 void construct( const InputObjectBase& rParent );
1384
1385 virtual bool implIsValid() const override;
1386
1387 void skipBlock( sal_Int64 nBytes, bool bShowSize = true );
1388 void dumpRawBinary( sal_Int64 nBytes, bool bShowOffset, bool bStream = false );
1389
1390 void dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset = true );
1391 void dumpRemaining( sal_Int64 nBytes );
1392 void dumpRemainingTo( sal_Int64 nPos );
1393 void dumpRemainingStream();
1394
1395 void dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep = OOX_DUMP_LISTSEP );
1396 void dumpUnused( sal_Int32 nBytes ) { dumpArray( OUString(OOX_DUMP_UNUSED), nBytes ); }
1397 void dumpUnknown( sal_Int32 nBytes ) { dumpArray( OUString(OOX_DUMP_UNKNOWN), nBytes ); }
1398
1399 sal_Unicode dumpUnicode( const String& rName );
1400
1401 OUString dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul = false );
1402 OUString dumpUnicodeArray( const String& rName, sal_Int32 nLen, bool bHideTrailingNul = false );
1403
1404 css::util::DateTime dumpFileTime( const String& rName = EMPTY_STRING );
1405 OUString dumpGuid( const String& rName = EMPTY_STRING );
1406
1407 void dumpItem( const ItemFormat& rItemFmt );
1408
1409 template< typename Type >
1410 Type dumpName( const String& rName, const NameListWrapper& rListWrp );
1411 template< typename Type >
1412 Type dumpDec( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1413 template< typename Type >
1414 Type dumpHex( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1415 template< typename Type >
1416 Type dumpBin( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1417 template< typename Type >
1418 Type dumpFix( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1419 template< typename Type >
1420 Type dumpBool( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1421 template< typename Type >
1422 Type dumpValue( const ItemFormat& rItemFmt );
1423
1424 template< typename Type1, typename Type2 >
1425 Type1 dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1426 template< typename Type1, typename Type2 >
1427 Type1 dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1428 template< typename Type1, typename Type2 >
1429 Type1 dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1430 template< typename Type1, typename Type2 >
1431 Type1 dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1432 template< typename Type1, typename Type2 >
1433 Type1 dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1434 template< typename Type1, typename Type2 >
1435 Type1 dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1436 template< typename Type1, typename Type2 >
1437 Type1 dumpValue( bool bType1, const ItemFormat& rItemFmt );
1438
1439 template< typename Type >
1440 void dumpDecPair( const String& rName, sal_Unicode cSep = ',' );
1441 template< typename Type >
1442 void dumpHexPair( const String& rName, sal_Unicode cSep = ',' );
1443
1444protected:
1446};
1447
1448
1449template< typename Type >
1451{
1452 Type nData = mxStrm->readValue<Type>();
1453 writeNameItem( rName, nData, rListWrp );
1454 return nData;
1455}
1456
1457template< typename Type >
1458Type InputObjectBase::dumpDec( const String& rName, const NameListWrapper& rListWrp )
1459{
1460 Type nData = mxStrm->readValue<Type>();
1461 writeDecItem( rName, nData, rListWrp );
1462 return nData;
1463}
1464
1465template< typename Type >
1466Type InputObjectBase::dumpHex( const String& rName, const NameListWrapper& rListWrp )
1467{
1468 Type nData = mxStrm->readValue<Type>();
1469 writeHexItem( rName, nData, rListWrp );
1470 return nData;
1471}
1472
1473template< typename Type >
1474Type InputObjectBase::dumpBin( const String& rName, const NameListWrapper& rListWrp )
1475{
1476 Type nData = mxStrm->readValue<Type>();
1477 writeBinItem( rName, nData, rListWrp );
1478 return nData;
1479}
1480
1481template< typename Type >
1482Type InputObjectBase::dumpFix( const String& rName, const NameListWrapper& rListWrp )
1483{
1484 Type nData = mxStrm->readValue<Type>();
1485 writeFixItem( rName, nData, rListWrp );
1486 return nData;
1487}
1488
1489template< typename Type >
1491{
1492 Type nData = mxStrm->readValue<Type>();
1493 writeDecBoolItem( rName, nData, rListWrp );
1494 return nData;
1495}
1496
1497template< typename Type >
1499{
1500 Type nData = mxStrm->readValue<Type>();
1501 writeValueItem( rItemFmt, nData );
1502 return nData;
1503}
1504
1505template< typename Type1, typename Type2 >
1506Type1 InputObjectBase::dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1507{
1508 return bType1 ? dumpName< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpName< Type2 >( rName, rListWrp ) );
1509}
1510
1511template< typename Type1, typename Type2 >
1512Type1 InputObjectBase::dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1513{
1514 return bType1 ? dumpDec< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpDec< Type2 >( rName, rListWrp ) );
1515}
1516
1517template< typename Type1, typename Type2 >
1518Type1 InputObjectBase::dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1519{
1520 return bType1 ? dumpHex< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpHex< Type2 >( rName, rListWrp ) );
1521}
1522
1523template< typename Type1, typename Type2 >
1524Type1 InputObjectBase::dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1525{
1526 return bType1 ? dumpBin< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBin< Type2 >( rName, rListWrp ) );
1527}
1528
1529template< typename Type1, typename Type2 >
1530Type1 InputObjectBase::dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1531{
1532 return bType1 ? dumpFix< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpFix< Type2 >( rName, rListWrp ) );
1533}
1534
1535template< typename Type1, typename Type2 >
1536Type1 InputObjectBase::dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1537{
1538 return bType1 ? dumpBool< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBool< Type2 >( rName, rListWrp ) );
1539}
1540
1541template< typename Type1, typename Type2 >
1542Type1 InputObjectBase::dumpValue( bool bType1, const ItemFormat& rItemFmt )
1543{
1544 return bType1 ? dumpValue< Type1 >( rItemFmt ) : static_cast< Type1 >( dumpValue< Type2 >( rItemFmt ) );
1545}
1546
1547template< typename Type >
1549{
1550 Type nData1, nData2;
1551 *mxStrm >> nData1 >> nData2;
1552 writeDecPairItem( rName, nData1, nData2, cSep );
1553}
1554
1555template< typename Type >
1557{
1558 Type nData1, nData2;
1559 *mxStrm >> nData1 >> nData2;
1560 writeHexPairItem( rName, nData1, nData2, cSep );
1561}
1562
1563
1565{
1566public:
1567 explicit BinaryStreamObject(
1568 const ObjectBase& rParent,
1569 const BinaryInputStreamRef& rxStrm,
1570 const OUString& rSysFileName );
1571
1572private:
1573 void dumpBinaryStream( bool bShowOffset = true );
1574
1575 virtual void implDump() override;
1576};
1577
1578
1580{
1581protected:
1583
1585 void construct(
1586 const ObjectBase& rParent,
1587 const BinaryInputStreamRef& rxStrm,
1588 rtl_TextEncoding eTextEnc,
1589 const OUString& rSysFileName );
1590 void construct(
1591 const OutputObjectBase& rParent,
1592 const BinaryInputStreamRef& rxStrm,
1593 rtl_TextEncoding eTextEnc );
1594
1595 virtual bool implIsValid() const override;
1596 virtual void implDump() override;
1597
1598 virtual void implDumpText( TextInputStream& rTextStrm ) = 0;
1599
1600private:
1601 void constructTextStrmObj( rtl_TextEncoding eTextEnc );
1602
1603 std::shared_ptr< TextInputStream > mxTextStrm;
1604};
1605
1606
1608{
1609public:
1610 explicit TextLineStreamObject(
1611 const ObjectBase& rParent,
1612 const BinaryInputStreamRef& rxStrm,
1613 rtl_TextEncoding eTextEnc,
1614 const OUString& rSysFileName );
1615
1616 explicit TextLineStreamObject(
1617 const OutputObjectBase& rParent,
1618 const BinaryInputStreamRef& rxStrm,
1619 rtl_TextEncoding eTextEnc );
1620
1621private:
1622 virtual void implDumpText( TextInputStream& rTextStrm ) override;
1623 void implDumpLine( std::u16string_view rLine, sal_uInt32 nLine );
1624};
1625
1626
1628{
1629public:
1630 explicit XmlStreamObject(
1631 const ObjectBase& rParent,
1632 const BinaryInputStreamRef& rxStrm,
1633 const OUString& rSysFileName );
1634
1635protected:
1636 virtual void implDumpText( TextInputStream& rTextStrm ) override;
1637};
1638
1639
1641{
1642protected:
1644
1646 void construct(
1647 const ObjectBase& rParent,
1648 const BinaryInputStreamRef& rxBaseStrm,
1649 const OUString& rSysFileName,
1650 const BinaryInputStreamRef& rxRecStrm,
1651 const String& rRecNames,
1652 const String& rSimpleRecs );
1653
1654 sal_Int64 getRecId() const { return mnRecId; }
1655 sal_Int64 getRecSize() const { return mnRecSize; }
1656
1657 virtual bool implIsValid() const override;
1658 virtual void implDump() override;
1659
1660 virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
1661 virtual void implWriteExtHeader();
1662 virtual void implDumpRecordBody();
1663
1664private:
1666 const BinaryInputStreamRef& rxBaseStrm,
1667 const String& rRecNames,
1668 const String& rSimpleRecs );
1669
1670 void writeHeader();
1671
1672private:
1676 sal_Int64 mnRecPos;
1677 sal_Int64 mnRecId;
1678 sal_Int64 mnRecSize;
1681};
1682
1683
1685{
1686protected:
1688
1690 void construct(
1691 const ObjectBase& rParent,
1692 const BinaryInputStreamRef& rxBaseStrm,
1693 const OUString& rSysFileName,
1694 const String& rRecNames,
1695 const String& rSimpleRecs );
1696
1697 virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize ) override;
1698 virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
1699
1700private:
1701 std::shared_ptr< StreamDataSequence > mxRecData;
1702};
1703
1704
1709{
1710public:
1711 virtual ~DumperBase() override;
1712
1713 bool isImportEnabled() const;
1714
1715protected:
1717
1719 void construct( const ConfigRef& rxConfig );
1720};
1721
1722
1723} // namespace oox::dump
1724
1725#define OOX_DUMP_FILE( DumperClassName ) \
1726do { \
1727 DumperClassName aDumper( *this ); \
1728 aDumper.dump(); \
1729 if( !aDumper.isImportEnabled() ) \
1730 return aDumper.isValid(); \
1731} while( false )
1732
1733#else // DBG_UTIL
1734
1735#define OOX_DUMP_FILE( DumperClassName ) (void)0
1736
1737#endif // DBG_UTIL
1738#endif
1739
1740/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
LineType
Interface for binary input stream classes.
Wraps a UNO input stream and provides convenient access functions.
Base class for storage access implementations.
Definition: storagebase.hxx:52
Base class for all dumper classes.
Definition: dumperbase.hxx:440
Base(Base &&)=default
virtual bool implIsValid() const =0
Base(Base const &)=default
virtual ~Base()
Definition: dumperbase.cxx:792
static bool isValid(const std::shared_ptr< Base > &rxBase)
Definition: dumperbase.hxx:450
bool isValid() const
Definition: dumperbase.hxx:449
Base & operator=(Base const &)=default
BinaryInputStreamRef(const css::uno::Reference< css::io::XInputStream > &rxInStrm)
Definition: dumperbase.hxx:144
BinaryInputStreamRef(std::shared_ptr< BinaryInputStream > const &pInStrm)
Definition: dumperbase.hxx:141
BinaryInputStreamRef(const std::shared_ptr< StreamType > &rxInStrm)
Definition: dumperbase.hxx:148
void dumpBinaryStream(bool bShowOffset=true)
virtual void implDump() override
BinaryStreamObject(const ObjectBase &rParent, const BinaryInputStreamRef &rxStrm, const OUString &rSysFileName)
::std::map< ExtItemFormatKey, ExtItemFormat > ExtItemFormatMap
Definition: dumperbase.hxx:691
virtual void implSetName(sal_Int64 nKey, const OUString &rName) override
Sets the name for the passed key.
ExtItemFormatMap maFmtMap
Definition: dumperbase.hxx:692
CombiList(const SharedConfigData &rCfgData)
virtual OUString implGetName(const Config &rCfg, sal_Int64 nKey) const override
Returns the name for the passed key.
virtual void implIncludeList(const NameListBase &rList) override
Inserts all flags from the passed list.
void readConfigBlock(TextInputStream &rStrm)
Definition: dumperbase.cxx:800
void processConfigItem(TextInputStream &rStrm, const OUString &rKey, const OUString &rData)
Definition: dumperbase.cxx:859
virtual void implProcessConfigItemInt(TextInputStream &rStrm, sal_Int64 nKey, const OUString &rData)
Definition: dumperbase.cxx:810
void readConfigBlockContents(TextInputStream &rStrm)
Definition: dumperbase.cxx:815
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData)
Definition: dumperbase.cxx:805
static LineType readConfigLine(TextInputStream &rStrm, OUString &orKey, OUString &orData)
Definition: dumperbase.cxx:833
const OUString & getStringOption(const String &rKey, const OUString &rDefault) const
const StorageRef & getRootStorage() const
Definition: dumperbase.hxx:852
Config(Config const &)=default
virtual ~Config() override
const OUString & getSysFileName() const
Definition: dumperbase.hxx:853
Type getIntOption(const String &rKey, Type nDefault) const
Definition: dumperbase.hxx:897
bool isDumperEnabled() const
bool isImportEnabled() const
NameListRef getNameList(const String &rListName) const
void eraseNameList(const String &rListName)
OUString getName(const NameListWrapper &rListWrp, Type nKey) const
Returns the name for the passed key from the passed name list.
Definition: dumperbase.hxx:912
Config & operator=(Config const &)=default
Config(Config &&)=default
void construct(const char *pcEnvVar, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const StorageRef &rxRootStrg, const OUString &rSysFileName)
std::shared_ptr< ListType > createNameList(const String &rListName)
Definition: dumperbase.hxx:906
std::shared_ptr< SharedConfigData > mxCfgData
Definition: dumperbase.hxx:890
bool getBoolOption(const String &rKey, bool bDefault) const
Config(const char *pcEnvVar, const ::oox::core::FilterBase &rFilter)
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
Definition: dumperbase.hxx:851
void construct(const char *pcEnvVar, const ::oox::core::FilterBase &rFilter)
Config(const char *pcEnvVar, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const StorageRef &rxRootStrg, const OUString &rSysFileName)
bool hasName(const NameListWrapper &rListWrp, Type nKey) const
Returns true, if the passed name list contains an entry for the passed key.
Definition: dumperbase.hxx:919
const OUString * implGetOption(const OUString &rKey) const
virtual bool implIsValid() const override
virtual void implSetName(sal_Int64 nKey, const OUString &rName) override
Sets the name for the passed key.
Definition: dumperbase.cxx:964
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData) override
Definition: dumperbase.cxx:953
virtual void implIncludeList(const NameListBase &rList) override
Inserts all names from the passed list.
Definition: dumperbase.cxx:987
virtual OUString implGetNameDbl(const Config &rCfg, double fValue) const override
Returns the name for the passed double value.
Definition: dumperbase.cxx:982
void setQuoteNames(bool bQuoteNames)
Enables or disables automatic quotation of returned names.
Definition: dumperbase.hxx:591
virtual OUString implGetName(const Config &rCfg, sal_Int64 nKey) const override
Returns the name for the passed key, or the default name, if key is not contained.
Definition: dumperbase.cxx:969
ConstList(const SharedConfigData &rCfgData)
Definition: dumperbase.cxx:946
Base class for a file dumper.
virtual ~DumperBase() override
void construct(const ConfigRef &rxConfig)
bool isImportEnabled() const
virtual void implSetName(sal_Int64 nKey, const OUString &rName) override
Sets the name for the passed key.
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData) override
virtual OUString implGetNameDbl(const Config &rCfg, double fValue) const override
Returns the name for the passed double value.
sal_Int64 getIgnoreFlags() const
Returns the flags to be ignored on output.
Definition: dumperbase.hxx:640
FlagsList(const SharedConfigData &rCfgData)
virtual void implIncludeList(const NameListBase &rList) override
Inserts all flags from the passed list.
void setIgnoreFlags(sal_Int64 nIgnore)
Sets flags to be ignored on output.
Definition: dumperbase.hxx:642
virtual OUString implGetName(const Config &rCfg, sal_Int64 nKey) const override
Returns the name for the passed key.
IndentGuard & operator=(const IndentGuard &)=delete
IndentGuard(const OutputRef &rxOut)
IndentGuard(const IndentGuard &)=delete
void dumpRemainingTo(sal_Int64 nPos)
InputObjectBase(InputObjectBase &&)=default
Type dumpValue(const ItemFormat &rItemFmt)
void construct(const ObjectBase &rParent, const BinaryInputStreamRef &rxStrm, const OUString &rSysFileName)
css::util::DateTime dumpFileTime(const String &rName=EMPTY_STRING)
void skipBlock(sal_Int64 nBytes, bool bShowSize=true)
sal_Unicode dumpUnicode(const String &rName)
void dumpUnused(sal_Int32 nBytes)
OUString dumpCharArray(const String &rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul=false)
InputObjectBase(InputObjectBase const &)=default
OUString dumpUnicodeArray(const String &rName, sal_Int32 nLen, bool bHideTrailingNul=false)
void dumpBinary(const String &rName, sal_Int64 nBytes, bool bShowOffset=true)
Type dumpHex(const String &rName, const NameListWrapper &rListWrp=NO_LIST)
void dumpRemaining(sal_Int64 nBytes)
Type dumpName(const String &rName, const NameListWrapper &rListWrp)
virtual ~InputObjectBase() override
Type dumpBool(const String &rName, const NameListWrapper &rListWrp=NO_LIST)
void dumpDecPair(const String &rName, sal_Unicode cSep=',')
void dumpUnknown(sal_Int32 nBytes)
void dumpItem(const ItemFormat &rItemFmt)
Type dumpDec(const String &rName, const NameListWrapper &rListWrp=NO_LIST)
Type dumpBin(const String &rName, const NameListWrapper &rListWrp=NO_LIST)
OUString dumpGuid(const String &rName=EMPTY_STRING)
Type dumpFix(const String &rName, const NameListWrapper &rListWrp=NO_LIST)
virtual bool implIsValid() const override
BinaryInputStreamRef mxStrm
void dumpArray(const String &rName, sal_Int32 nBytes, sal_Unicode cSep=OOX_DUMP_LISTSEP)
void dumpHexPair(const String &rName, sal_Unicode cSep=',')
InputObjectBase & operator=(InputObjectBase const &)=default
void dumpRawBinary(sal_Int64 nBytes, bool bShowOffset, bool bStream=false)
Static helper functions for system file and stream access.
Definition: dumperbase.hxx:100
static css::uno::Reference< css::io::XOutputStream > openOutputStream(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rFileName)
Definition: dumperbase.cxx:110
static std::u16string_view getFileNameExtension(std::u16string_view rFileUrl)
Definition: dumperbase.cxx:82
static OUString convertFileNameToUrl(const OUString &rFileName)
Definition: dumperbase.cxx:68
static css::uno::Reference< css::io::XTextOutputStream2 > openTextOutputStream(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::io::XOutputStream > &rxOutStrm, rtl_TextEncoding eTextEnc)
static sal_Int32 getFileNamePos(std::u16string_view rFileUrl)
Definition: dumperbase.cxx:76
static css::uno::Reference< css::io::XTextOutputStream2 > openTextOutputStream(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rFileName, rtl_TextEncoding eTextEnc)
static css::uno::Reference< css::io::XInputStream > openInputStream(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rFileName)
Definition: dumperbase.cxx:93
::std::map< sal_Int64, ItemFormat > maMap
Definition: dumperbase.hxx:742
ItemFormatMap(const NameListRef &rxNameList)
Definition: dumperbase.hxx:746
void insertFormats(const NameListRef &rxNameList)
Definition: dumperbase.cxx:937
::std::map< sal_Int64, ItemFormat >::const_iterator end() const
Definition: dumperbase.hxx:748
::std::map< sal_Int64, ItemFormat >::const_iterator find(sal_Int64 nId) const
Definition: dumperbase.hxx:749
ItemGuard & operator=(const ItemGuard &)=delete
ItemGuard(const OutputRef &rxOut, const String &rName)
ItemGuard(const ItemGuard &)=delete
MultiItemsGuard(const OutputRef &rxOut)
MultiItemsGuard(const MultiItemsGuard &)=delete
MultiItemsGuard & operator=(const MultiItemsGuard &)=delete
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData) override
MultiList(const SharedConfigData &rCfgData)
Definition: dumperbase.cxx:996
void setNamesFromVec(sal_Int64 nStartKey, const OUStringVector &rNames)
virtual void implSetName(sal_Int64 nKey, const OUString &rName) override
Sets the name for the passed key.
Base class of all classes providing names for specific values (name lists).
Definition: dumperbase.hxx:511
void exclude(std::u16string_view rKeys)
Excludes names from the list, given in a comma separated list of their keys.
Definition: dumperbase.cxx:929
virtual OUString implGetName(const Config &rCfg, sal_Int64 nKey) const =0
Derived classes generate and return the name for the passed key.
NameListBase(const SharedConfigData &rCfgData)
Definition: dumperbase.hxx:545
bool hasName(Type nKey) const
Returns true, if the map contains an entry for the passed key.
Definition: dumperbase.hxx:527
void insertRawName(sal_Int64 nKey, const OUString &rName)
Inserts the passed name into the internal map.
Definition: dumperbase.cxx:910
virtual void implProcessConfigItemInt(TextInputStream &rStrm, sal_Int64 nKey, const OUString &rData) override
Definition: dumperbase.cxx:904
OUString getName(const Config &rCfg, Type nKey) const
Returns the name for the passed key.
Definition: dumperbase.hxx:532
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData) override
Definition: dumperbase.cxx:893
void include(std::u16string_view rListKeys)
Includes name lists, given in a comma separated list of names of the lists.
Definition: dumperbase.cxx:921
const OUString * findRawName(sal_Int64 nKey) const
Returns the name for the passed key, or 0, if nothing found.
Definition: dumperbase.cxx:915
OUString getName(const Config &rCfg, double fValue) const
Returns a display name for the passed double value.
Definition: dumperbase.hxx:536
virtual void implSetName(sal_Int64 nKey, const OUString &rName)=0
Derived classes set the name for the passed key.
void includeList(const NameListRef &rxList)
Include all names of the passed list.
Definition: dumperbase.cxx:878
const_iterator end() const
Returns a map iterator pointing one past the last contained name.
Definition: dumperbase.hxx:542
const_iterator begin() const
Returns a map iterator pointing to the first contained name.
Definition: dumperbase.hxx:540
virtual void implIncludeList(const NameListBase &rList)=0
Derived classes insert all names and other settings from the passed list.
const SharedConfigData & mrCfgData
Definition: dumperbase.hxx:581
virtual bool implIsValid() const override
Definition: dumperbase.cxx:888
::std::map< sal_Int64, OUString > OUStringMap
Definition: dumperbase.hxx:513
virtual ~NameListBase() override
Definition: dumperbase.cxx:869
void setName(sal_Int64 nKey, const String &rName)
Sets a name for the specified key.
Definition: dumperbase.cxx:873
virtual OUString implGetNameDbl(const Config &rCfg, double fValue) const =0
Derived classes generate and return the name for the passed double value.
OUStringMap::const_iterator const_iterator
Definition: dumperbase.hxx:514
const NameListRef & getNameList(const Config &rCfg) const
NameListWrapper(NameListRef xList)
Definition: dumperbase.hxx:726
NameListWrapper(const char *pcListName)
Definition: dumperbase.hxx:725
NameListWrapper(const OUString &rListName)
Definition: dumperbase.hxx:724
ObjectBase & operator=(ObjectBase const &)=default
virtual ~ObjectBase() override
Config & cfg() const
virtual bool implIsValid() const override
ObjectBase(ObjectBase const &)=default
virtual void implDump()
void construct(const ConfigRef &rxConfig)
ObjectBase(ObjectBase &&)=default
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
void writeShortHexItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
void writeEmptyItem(const String &rName)
void writeGuidItem(const String &rName, const OUString &rGuid)
void addNameToItem(Type nData, const NameListWrapper &rListWrp)
void writeNameItem(const String &rName, Type nData, const NameListWrapper &rListWrp)
void writeFixItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
void writeCharItem(const String &rName, sal_Unicode cData)
void writeDecItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
virtual bool implIsValid() const override
void writeStringItem(const String &rName, std::u16string_view rData)
OutputObjectBase(OutputObjectBase const &)=default
void writeBinItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
void writeHexItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
virtual ~OutputObjectBase() override
OutputObjectBase(OutputObjectBase &&)=default
void writeValueItem(const String &rName, Type nData, FormatType eFmtType, const NameListWrapper &rListWrp=NO_LIST)
void writeDateTimeItem(const String &rName, const css::util::DateTime &rDateTime)
void writeDecPairItem(const String &rName, Type nData1, Type nData2, sal_Unicode cSep=',')
void construct(const ObjectBase &rParent, const OUString &rSysFileName)
void writeDecBoolItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
void writeInfoItem(const String &rName, const String &rData)
void writeArrayItem(const String &rName, const sal_uInt8 *pnData, std::size_t nSize, sal_Unicode cSep=OOX_DUMP_LISTSEP)
void writeHexPairItem(const String &rName, Type nData1, Type nData2, sal_Unicode cSep=',')
OutputObjectBase & operator=(OutputObjectBase const &)=default
virtual bool implIsValid() const override
OUStringBuffer maLine
Definition: dumperbase.hxx:995
css::uno::Reference< css::io::XTextOutputStream2 > mxStrm
Definition: dumperbase.hxx:993
void writeHex(Type nData, bool bPrefix=true)
Definition: dumperbase.hxx:967
void writeArray(const sal_uInt8 *pnData, std::size_t nSize, sal_Unicode cSep=OOX_DUMP_LISTSEP)
void writeDec(Type nData, sal_Int32 nWidth=0, sal_Unicode cFill=' ')
Definition: dumperbase.hxx:964
void writeBin(Type nData, bool bDots=true)
Definition: dumperbase.hxx:973
::std::vector< sal_Int32 > maColPos
Definition: dumperbase.hxx:998
void writeValue(Type nData, FormatType eFmtType)
Definition: dumperbase.hxx:979
void writeAscii(const char *pcStr)
void resetItemIndex(sal_Int64 nIdx=0)
void writeFix(Type nData, sal_Int32 nWidth)
Definition: dumperbase.hxx:976
sal_Int32 mnLastItem
void writeString(std::u16string_view rStr)
void writeItemName(const String &rItemName)
void writeBool(bool bData)
void startTable(sal_Int32 nW1)
void writeDateTime(const css::util::DateTime &rDateTime)
void emptyLine(size_t nCount=1)
Output(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rFileName)
void writeShortHex(Type nData, bool bPrefix=true)
Definition: dumperbase.hxx:970
void startItem(const String &rItemName)
void writeName(const Config &rCfg, Type nData, const NameListWrapper &rListWrp)
Definition: dumperbase.hxx:982
void writeChar(sal_Unicode cChar, sal_Int32 nCount=1)
BinaryInputStreamRef mxBaseStrm
virtual void implDump() override
virtual bool implStartRecord(BinaryInputStream &rBaseStrm, sal_Int64 &ornRecPos, sal_Int64 &ornRecId, sal_Int64 &ornRecSize)=0
void construct(const ObjectBase &rParent, const BinaryInputStreamRef &rxBaseStrm, const OUString &rSysFileName, const BinaryInputStreamRef &rxRecStrm, const String &rRecNames, const String &rSimpleRecs)
virtual void implWriteExtHeader()
virtual bool implIsValid() const override
void constructRecObjBase(const BinaryInputStreamRef &rxBaseStrm, const String &rRecNames, const String &rSimpleRecs)
NameListWrapper maSimpleRecs
virtual void implDumpRecordBody()
sal_Int64 getRecSize() const
sal_Int64 getRecId() const
std::shared_ptr< StreamDataSequence > mxRecData
virtual bool implStartRecord(BinaryInputStream &rBaseStrm, sal_Int64 &ornRecPos, sal_Int64 &ornRecId, sal_Int64 &ornRecSize) override
void construct(const ObjectBase &rParent, const BinaryInputStreamRef &rxBaseStrm, const OUString &rSysFileName, const String &rRecNames, const String &rSimpleRecs)
virtual bool implReadRecordHeader(BinaryInputStream &rBaseStrm, sal_Int64 &ornRecId, sal_Int64 &ornRecSize)=0
void eraseNameList(const OUString &rListName)
const OUString * getOption(const OUString &rKey) const
NameListRef getNameList(const OUString &rListName) const
const OUString & getSysFileName() const
Definition: dumperbase.hxx:771
void readNameList(TextInputStream &rStrm, const OUString &rListName)
Definition: dumperbase.hxx:824
::std::set< OUString > ConfigFileSet
Definition: dumperbase.hxx:796
virtual ~SharedConfigData() override
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData) override
::std::map< OUString, OUString > ConfigDataMap
Definition: dumperbase.hxx:797
SharedConfigData(const OUString &rFileName, const css::uno::Reference< css::uno::XComponentContext > &rxContext, StorageRef xRootStrg, OUString aSysFileName)
void setNameList(const OUString &rListName, const NameListRef &rxList)
const StorageRef & getRootStorage() const
Definition: dumperbase.hxx:770
std::shared_ptr< ListType > createNameList(const OUString &rListName)
Definition: dumperbase.hxx:812
bool readConfigFile(const OUString &rFileUrl)
::std::map< OUString, NameListRef > NameListMap
Definition: dumperbase.hxx:798
css::uno::Reference< css::uno::XComponentContext > mxContext
Definition: dumperbase.hxx:800
void createShortList(std::u16string_view rData)
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
Definition: dumperbase.hxx:769
virtual bool implIsValid() const override
void createUnitConverter(std::u16string_view rData)
virtual ~StorageIterator() override
virtual bool implIsValid() const override
StorageIterator(StorageRef xStrg)
StorageIterator & operator++()
OUStringVector::const_iterator maIt
OUString getName() const
void extractItem(const StorageRef &rxStrg, const OUString &rStrgPath, const OUString &rItemName, std::u16string_view rSysPath, bool bIsStrg, bool bIsStrm)
void construct(const ObjectBase &rParent, const StorageRef &rxStrg, const OUString &rSysPath)
PreferredItemVector maPreferred
void extractStorage(const StorageRef &rxStrg, const OUString &rStrgPath, const OUString &rSysPath)
static OUString getSysFileName(std::u16string_view rStrmName, std::u16string_view rSysOutPath)
virtual void implDumpBaseStream(const BinaryInputStreamRef &rxStrm, const OUString &rSysFileName)
virtual bool implIsValid() const override
virtual void implDumpStream(const css::uno::Reference< css::io::XInputStream > &rxStrm, const OUString &rStrgPath, const OUString &rStrmName, const OUString &rSysFileName)
::std::vector< PreferredItem > PreferredItemVector
void addPreferredStorage(const String &rStrgPath)
void addPreferredStream(const String &rStrmName)
virtual void implDump() override
virtual void implDumpStorage(const StorageRef &rxStrg, const OUString &rStrgPath, const OUString &rSysPath)
void extractStream(StorageBase &rStrg, const OUString &rStrgPath, const OUString &rStrmName, const OUString &rSysFileName)
Static helper functions for formatted output to strings.
Definition: dumperbase.hxx:245
static void appendShortHex(OUStringBuffer &rStr, sal_uInt8 nData, bool bPrefix=true)
Definition: dumperbase.cxx:329
static void appendIndex(OUStringBuffer &rStr, sal_Int64 nIdx)
Definition: dumperbase.cxx:523
static bool convertStringToInt(sal_Int64 &ornData, std::u16string_view rData)
Definition: dumperbase.cxx:713
static bool convertFromDec(sal_Int64 &ornData, std::u16string_view rData)
Definition: dumperbase.cxx:671
static bool convertStringToBool(std::u16string_view rData)
Definition: dumperbase.cxx:734
static void appendCChar(OUStringBuffer &rStr, sal_Unicode cChar, bool bPrefix=true)
Definition: dumperbase.cxx:453
static FormatType convertToFormatType(std::u16string_view rStr)
Definition: dumperbase.cxx:653
static void appendEncChar(OUStringBuffer &rStr, sal_Unicode cChar, sal_Int32 nCount, bool bPrefix=true)
Definition: dumperbase.cxx:469
static void enclose(OUStringBuffer &rStr, sal_Unicode cOpen, sal_Unicode cClose='\0')
Encloses the passed string with the passed characters.
Definition: dumperbase.cxx:535
static bool convertFromHex(sal_Int64 &ornData, std::u16string_view rData)
Definition: dumperbase.cxx:694
static void appendValue(OUStringBuffer &rStr, Type nData, FormatType eFmtType)
Definition: dumperbase.hxx:360
static OString convertToUtf8(std::u16string_view rStr)
Definition: dumperbase.cxx:622
static void appendToken(OUStringBuffer &rStr, std::u16string_view rToken, sal_Unicode cSep=OOX_DUMP_LISTSEP)
Definition: dumperbase.cxx:516
static void appendBool(OUStringBuffer &rStr, bool bData)
Definition: dumperbase.cxx:446
static void appendString(OUStringBuffer &rStr, std::u16string_view rData, sal_Int32 nWidth, sal_Unicode cFill=' ')
Definition: dumperbase.cxx:203
static void appendBin(OUStringBuffer &rStr, sal_uInt8 nData, bool bDots=true)
Definition: dumperbase.cxx:385
static OUStringPair convertStringToPair(const OUString &rString, sal_Unicode cSep='=')
Definition: dumperbase.cxx:744
static OUString trimTrailingNul(const OUString &rStr)
Definition: dumperbase.cxx:614
static std::u16string_view trimSpaces(std::u16string_view rStr)
Definition: dumperbase.cxx:603
static void appendChar(OUStringBuffer &rStr, sal_Unicode cChar, sal_Int32 nCount)
Definition: dumperbase.cxx:197
static void convertStringToStringList(OUStringVector &orVec, std::u16string_view rData, bool bIgnoreEmpty)
Definition: dumperbase.cxx:763
static void appendEncString(OUStringBuffer &rStr, std::u16string_view rData, bool bPrefix=true)
Definition: dumperbase.cxx:486
static void appendHex(OUStringBuffer &rStr, sal_uInt8 nData, bool bPrefix=true)
Definition: dumperbase.cxx:265
static DataType convertToDataType(std::u16string_view rStr)
Definition: dumperbase.cxx:627
static void appendFix(OUStringBuffer &rStr, Type nData, sal_Int32 nWidth=0)
Definition: dumperbase.hxx:354
static std::u16string_view getToken(std::u16string_view rData, sal_Int32 &rnPos, sal_Unicode cSep=OOX_DUMP_LISTSEP)
Definition: dumperbase.cxx:530
static void convertStringToIntList(Int64Vector &orVec, std::u16string_view rData, bool bIgnoreEmpty)
Definition: dumperbase.cxx:777
static void appendDec(OUStringBuffer &rStr, sal_uInt8 nData, sal_Int32 nWidth=0, sal_Unicode cFill=' ')
Definition: dumperbase.cxx:211
static bool convertStringToDouble(double &orfData, std::u16string_view rData)
Definition: dumperbase.cxx:720
String(sal_Unicode cChar)
Definition: dumperbase.hxx:381
String(const char *pcStr)
Definition: dumperbase.hxx:380
String(const OUString &rStr)
Definition: dumperbase.hxx:379
bool has() const
Definition: dumperbase.hxx:383
OUString operator()(const char *pcDefault) const
Definition: dumperbase.hxx:384
TableGuard & operator=(const TableGuard &)=delete
TableGuard(const OutputRef &rxOut, size_t nColCount, const sal_Int32 *pnColWidths)
TableGuard(const OutputRef &rxOut, sal_Int32 nW1)
TableGuard(const OutputRef &rxOut, sal_Int32 nW1, sal_Int32 nW2)
TableGuard(const TableGuard &)=delete
void tab(size_t nCol)
TableGuard(const OutputRef &rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4)
TextLineStreamObject(const ObjectBase &rParent, const BinaryInputStreamRef &rxStrm, rtl_TextEncoding eTextEnc, const OUString &rSysFileName)
virtual void implDumpText(TextInputStream &rTextStrm) override
void implDumpLine(std::u16string_view rLine, sal_uInt32 nLine)
std::shared_ptr< TextInputStream > mxTextStrm
virtual void implDump() override
void construct(const ObjectBase &rParent, const BinaryInputStreamRef &rxStrm, rtl_TextEncoding eTextEnc, const OUString &rSysFileName)
virtual bool implIsValid() const override
virtual void implDumpText(TextInputStream &rTextStrm)=0
void constructTextStrmObj(rtl_TextEncoding eTextEnc)
void setUnitName(const String &rUnitName)
Definition: dumperbase.hxx:701
virtual void implIncludeList(const NameListBase &rList) override
Empty implementation.
virtual OUString implGetNameDbl(const Config &rCfg, double fValue) const override
Returns the converted value with appended unit name.
UnitConverter(const SharedConfigData &rCfgData)
virtual OUString implGetName(const Config &rCfg, sal_Int64 nKey) const override
Returns the converted value with appended unit name.
void setFactor(double fFactor)
Definition: dumperbase.hxx:702
virtual void implSetName(sal_Int64 nKey, const OUString &rName) override
Sets the name for the passed key.
virtual void implDumpText(TextInputStream &rTextStrm) override
XmlStreamObject(const ObjectBase &rParent, const BinaryInputStreamRef &rxStrm, const OUString &rSysFileName)
int nCount
#define OOX_DUMP_ERR_NOMAP
Definition: dumperbase.hxx:69
float u
OUString aName
std::unique_ptr< sal_Int32[]> pData
double getLength(const B2DPolygon &rCandidate)
Type
void SvStream & rStrm
std::shared_ptr< T > make_shared(Args &&... args)
const sal_Unicode OOX_DUMP_BASECLASS
Definition: dumperbase.hxx:83
::std::pair< OUString, OUString > OUStringPair
Definition: dumperbase.hxx:92
const sal_Unicode OOX_DUMP_LISTSEP
Definition: dumperbase.hxx:85
::std::vector< OUString > OUStringVector
Definition: dumperbase.hxx:94
std::shared_ptr< Config > ConfigRef
Definition: dumperbase.hxx:893
constexpr OUStringLiteral OOX_DUMP_UNKNOWN
Definition: dumperbase.hxx:65
FormatType
Specifiers for the output format of values.
Definition: dumperbase.hxx:172
@ FORMATTYPE_BIN
Binary.
Definition: dumperbase.hxx:177
@ FORMATTYPE_HEX
Hexadecimal.
Definition: dumperbase.hxx:175
@ FORMATTYPE_DEC
Decimal.
Definition: dumperbase.hxx:174
@ FORMATTYPE_SHORTHEX
Hexadecimal, as short as possible (no leading zeros).
Definition: dumperbase.hxx:176
@ FORMATTYPE_FIX
Fixed-point.
Definition: dumperbase.hxx:178
@ FORMATTYPE_NONE
No numeric format (e.g. show name only).
Definition: dumperbase.hxx:173
@ FORMATTYPE_BOOL
Boolean ('true' or 'false').
Definition: dumperbase.hxx:179
constexpr OUStringLiteral OOX_DUMP_UNUSED
Definition: dumperbase.hxx:64
const sal_Unicode OOX_DUMP_EMPTYVALUE
Definition: dumperbase.hxx:88
const sal_Unicode OOX_DUMP_R1C1ROW
Definition: dumperbase.hxx:78
const sal_Unicode OOX_DUMP_RANGESEP
Definition: dumperbase.hxx:82
const sal_Unicode OOX_DUMP_R1C1OPEN
Definition: dumperbase.hxx:80
const String EMPTY_STRING
Definition: dumperbase.hxx:387
const sal_Unicode OOX_DUMP_ADDRABS
Definition: dumperbase.hxx:77
const sal_Unicode OOX_DUMP_TABSEP
Definition: dumperbase.hxx:86
std::shared_ptr< NameListBase > NameListRef
Definition: dumperbase.hxx:499
const sal_Unicode OOX_DUMP_PLACEHOLDER
Definition: dumperbase.hxx:90
::std::vector< sal_Int64 > Int64Vector
Definition: dumperbase.hxx:95
DataType
Specifiers for atomic data types.
Definition: dumperbase.hxx:155
@ DATATYPE_UINT64
Unsigned 64-bit integer.
Definition: dumperbase.hxx:164
@ DATATYPE_VOID
No data type.
Definition: dumperbase.hxx:156
@ DATATYPE_FLOAT
Floating-point, single precision.
Definition: dumperbase.hxx:165
@ DATATYPE_INT32
Signed 32-bit integer.
Definition: dumperbase.hxx:161
@ DATATYPE_UINT32
Unsigned 32-bit integer.
Definition: dumperbase.hxx:162
@ DATATYPE_INT16
Signed 16-bit integer.
Definition: dumperbase.hxx:159
@ DATATYPE_INT8
Signed 8-bit integer.
Definition: dumperbase.hxx:157
@ DATATYPE_INT64
Signed 64-bit integer.
Definition: dumperbase.hxx:163
@ DATATYPE_UINT8
Unsigned 8-bit integer.
Definition: dumperbase.hxx:158
@ DATATYPE_DOUBLE
Floating-point, double precision.
Definition: dumperbase.hxx:166
@ DATATYPE_UINT16
Unsigned 16-bit integer.
Definition: dumperbase.hxx:160
const sal_Unicode OOX_DUMP_ARRAYSEP
Definition: dumperbase.hxx:87
const sal_Unicode OOX_DUMP_CMDPROMPT
Definition: dumperbase.hxx:89
const NameListWrapper NO_LIST
Definition: dumperbase.hxx:736
const sal_Unicode OOX_DUMP_STRQUOTE
Definition: dumperbase.hxx:75
const sal_Unicode OOX_DUMP_FUNCSEP
Definition: dumperbase.hxx:84
const sal_Unicode OOX_DUMP_R1C1COL
Definition: dumperbase.hxx:79
const sal_Unicode OOX_DUMP_R1C1CLOSE
Definition: dumperbase.hxx:81
std::shared_ptr< ObjectBase > ObjectRef
std::shared_ptr< Output > OutputRef
const sal_Unicode OOX_DUMP_FMLASTRQUOTE
Definition: dumperbase.hxx:76
constexpr OUStringLiteral OOX_DUMP_ERR_NONAME
Definition: dumperbase.hxx:70
std::shared_ptr< StorageBase > StorageRef
Definition: storagebase.hxx:42
std::shared_ptr< BinaryInputStream > BinaryInputStreamRef
css::uno::Sequence< sal_Int8 > StreamDataSequence
sal_Int16 nId
Definition: olehelper.cxx:98
bool operator<(const ExtItemFormatKey &rRight) const
::std::pair< sal_Int64, sal_Int64 > maFilter
Definition: dumperbase.hxx:681
Describes the output format of a data item.
Definition: dumperbase.hxx:204
OUString maItemName
Name of the item.
Definition: dumperbase.hxx:207
OUStringVector::const_iterator parse(const OUStringVector &rFormatVec)
Initializes the struct from a vector of strings containing the item format.
Definition: dumperbase.cxx:162
DataType meDataType
Data type of the item.
Definition: dumperbase.hxx:205
void set(DataType eDataType, FormatType eFmtType, const OUString &rItemName)
Definition: dumperbase.cxx:154
FormatType meFmtType
Output format for the value.
Definition: dumperbase.hxx:206
OUString maListName
Name of a name list to be used for this item.
Definition: dumperbase.hxx:208
PreferredItem(OUString aName, bool bStorage)
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
signed char sal_Int8