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 
46 namespace 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 
53 namespace oox {
54  class TextInputStream;
55 }
56 
57 namespace oox::core {
58  class FilterBase;
59 }
60 
61 namespace oox::dump {
62 
63 
64 #define OOX_DUMP_UNUSED "unused"
65 #define OOX_DUMP_UNKNOWN "?unknown"
66 
67 #define OOX_DUMP_ERRASCII( ascii ) "?err:" ascii
68 
69 #define OOX_DUMP_ERR_NOMAP "no-map"
70 #define OOX_DUMP_ERR_NONAME "no-name"
71 #define OOX_DUMP_ERR_STREAM "stream-error"
72 
73 #define OOX_DUMP_DUMPEXT ".dump"
74 
91 
92 typedef ::std::pair< OUString, OUString > OUStringPair;
93 
94 typedef ::std::vector< OUString > OUStringVector;
95 typedef ::std::vector< sal_Int64 > Int64Vector;
96 
97 
100 {
101 public:
102  // file names -------------------------------------------------------------
103 
104  static OUString convertFileNameToUrl( const OUString& rFileName );
105  static sal_Int32 getFileNamePos( const OUString& rFileUrl );
106  static OUString getFileNameExtension( const OUString& 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 {
138 public:
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 {
167 };
168 
169 
172 {
180 };
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( const OUString& rFormatStr );
240 };
241 
242 
245 {
246 public:
247  // append string to string ------------------------------------------------
248 
249  static void appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount );
250  static void appendString( OUStringBuffer& rStr, const OUString& 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, const OUString& 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 OUString getToken( const OUString& 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 OUString trimSpaces( const OUString& 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, const OUString& rData );
338  static bool convertFromHex( sal_Int64& ornData, const OUString& rData );
339 
340  static bool convertStringToInt( sal_Int64& ornData, const OUString& rData );
341  static bool convertStringToDouble( double& orfData, const OUString& rData );
342  static bool convertStringToBool( const OUString& 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, const OUString& rData, bool bIgnoreEmpty );
349  static void convertStringToIntList( Int64Vector& orVec, const OUString& rData, bool bIgnoreEmpty );
350 };
351 
352 
353 template< typename Type >
354 void 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 
359 template< typename Type >
360 void 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 
375 class String : public OUString
376 {
377 public:
378  String() {}
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 
439 class Base
440 {
441 public:
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 
452 protected:
453  Base() {}
454 
455  virtual bool implIsValid() const = 0;
456 };
457 
458 
460 {
461 public:
462  virtual ~ConfigItemBase();
464 
465 protected:
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 
481 private:
483 
484  static LineType readConfigLine(
485  TextInputStream& rStrm,
486  OUString& orKey,
487  OUString& orData );
488 
489  void processConfigItem(
490  TextInputStream& rStrm,
491  const OUString& rKey,
492  const OUString& rData );
493 };
494 
495 
496 class SharedConfigData;
497 class Config;
498 
500 typedef std::shared_ptr< NameListBase > NameListRef;
501 
510 class NameListBase : public Base, public ConfigItemBase
511 {
512 public:
513  typedef ::std::map< sal_Int64, OUString > OUStringMap;
514  typedef OUStringMap::const_iterator const_iterator;
515 
516 public:
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 
544 protected:
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 
573 private:
575  void include( const OUString& rListKeys );
577  void exclude( const OUString& rKeys );
578 
579 private:
580  OUStringMap maMap;
582 };
583 
584 
585 class ConstList : public NameListBase
586 {
587 public:
588  explicit ConstList( const SharedConfigData& rCfgData );
589 
591  void setQuoteNames( bool bQuoteNames ) { mbQuoteNames = bQuoteNames; }
592 
593 protected:
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 
608 private:
609  OUString maDefName;
611 };
612 
613 
614 class MultiList : public ConstList
615 {
616 public:
617  explicit MultiList( const SharedConfigData& rCfgData );
618 
619  void setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNames );
620 
621 protected:
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 
629 private:
631 };
632 
633 
634 class FlagsList : public NameListBase
635 {
636 public:
637  explicit FlagsList( const SharedConfigData& rCfgData );
638 
640  sal_Int64 getIgnoreFlags() const { return mnIgnore; }
642  void setIgnoreFlags( sal_Int64 nIgnore ) { mnIgnore = nIgnore; }
643 
644 protected:
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 
659 private:
660  sal_Int64 mnIgnore;
661 };
662 
663 
664 class CombiList : public FlagsList
665 {
666 public:
667  explicit CombiList( const SharedConfigData& rCfgData );
668 
669 protected:
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 
677 private:
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  {
689  ExtItemFormat() : mbShiftValue( true ) {}
690  };
691  typedef ::std::map< ExtItemFormatKey, ExtItemFormat > ExtItemFormatMap;
692  ExtItemFormatMap maFmtMap;
693 };
694 
695 
697 {
698 public:
699  explicit UnitConverter( const SharedConfigData& rCfgData );
700 
701  void setUnitName( const String& rUnitName ) { maUnitName = rUnitName; }
702  void setFactor( double fFactor ) { mfFactor = fFactor; }
703 
704 protected:
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 
714 private:
715  OUString maUnitName;
716  double mfFactor;
717 };
718 
719 
721 {
722 public:
724  /*implicit*/ NameListWrapper( const OUString& rListName ) : maName( rListName ) {}
725  /*implicit*/ NameListWrapper( const char* pcListName ) : maName( pcListName ) {}
726  /*implicit*/ NameListWrapper( const NameListRef& rxList ) : mxList( rxList ) {}
727 
728  bool isEmpty() const { return !mxList && !maName.has(); }
729  const NameListRef & getNameList( const Config& rCfg ) const;
730 
731 private:
733  mutable NameListRef mxList;
734 };
735 
737 
738 
740 {
741 private:
742  ::std::map< sal_Int64, ItemFormat > maMap;
743 
744 public:
745  ItemFormatMap() : maMap() {}
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 
758 class SharedConfigData : public Base, public ConfigItemBase
759 {
760 public:
761  explicit SharedConfigData(
762  const OUString& rFileName,
763  const css::uno::Reference< css::uno::XComponentContext >& rxContext,
764  const StorageRef& rxRootStrg,
765  const OUString& rSysFileName );
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 
781 protected:
782  virtual bool implIsValid() const override;
783  virtual void implProcessConfigItemStr(
784  TextInputStream& rStrm,
785  const OUString& rKey,
786  const OUString& rData ) override;
787 
788 private:
789  bool readConfigFile( const OUString& rFileUrl );
790  template< typename ListType >
791  void readNameList( TextInputStream& rStrm, const OUString& rListName );
792  void createShortList( const OUString& rData );
793  void createUnitConverter( const OUString& rData );
794 
795 private:
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;
802  OUString maSysFileName;
803  ConfigFileSet maConfigFiles;
804  ConfigDataMap maConfigData;
805  NameListMap maNameLists;
806  OUString maConfigPath;
807  bool mbLoaded;
808 };
809 
810 
811 template< typename ListType >
812 std::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 
823 template< typename ListType >
824 void SharedConfigData::readNameList( TextInputStream& rStrm, const OUString& rListName )
825 {
826  NameListRef xList = createNameList< ListType >( rListName );
827  if( xList )
828  xList->readConfigBlock( rStrm );
829 }
830 
831 
832 class Config : public Base
833 {
834 public:
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 
875 protected:
876  Config() {}
877  void construct(
878  const char* pcEnvVar,
879  const ::oox::core::FilterBase& rFilter );
880  void construct(
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 
889 private:
890  std::shared_ptr< SharedConfigData > mxCfgData;
891 };
892 
893 typedef std::shared_ptr< Config > ConfigRef;
894 
895 
896 template< typename Type >
897 Type 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 
905 template< typename ListType >
906 std::shared_ptr< ListType > Config::createNameList( const String& rListName )
907 {
908  return mxCfgData->createNameList< ListType >( rListName );
909 }
910 
911 template< typename Type >
912 OUString 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 
918 template< typename Type >
919 bool 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 
926 class Output : public Base
927 {
928 public:
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( const OUString& 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 
986 protected:
987  virtual bool implIsValid() const override;
988 
989 private:
990  void writeItemName( const String& rItemName );
991 
992 private:
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;
1000  size_t mnItemLevel;
1002  sal_Int64 mnItemIdx;
1003  sal_Int32 mnLastItem;
1004 };
1005 
1006 typedef std::shared_ptr< Output > OutputRef;
1007 
1008 
1010 {
1011 public:
1012  explicit IndentGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.incIndent(); }
1014 private:
1015  IndentGuard( const IndentGuard& ) = delete;
1016  IndentGuard& operator=( const IndentGuard& ) = delete;
1017 private:
1019 };
1020 
1021 
1023 {
1024 public:
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 ); }
1036 private:
1037  TableGuard( const TableGuard& ) = delete;
1038  TableGuard& operator=( const TableGuard& ) = delete;
1039 private:
1041 };
1042 
1043 
1045 {
1046 public:
1047  explicit ItemGuard( const OutputRef& rxOut, const String& rName ) :
1048  mrOut( *rxOut ) { mrOut.startItem( rName ); }
1050  void cont() { mrOut.contItem(); }
1051 private:
1052  ItemGuard( const ItemGuard& ) = delete;
1053  ItemGuard& operator=( const ItemGuard& ) = delete;
1054 private:
1056 };
1057 
1058 
1060 {
1061 public:
1062  explicit MultiItemsGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.startMultiItems(); }
1064 private:
1065  MultiItemsGuard( const MultiItemsGuard& ) = delete;
1066  MultiItemsGuard& operator=( const MultiItemsGuard& ) = delete;
1067 private:
1069 };
1070 
1071 
1072 class StorageIterator : public Base
1073 {
1074 public:
1075  explicit StorageIterator( const StorageRef& rxStrg );
1076  virtual ~StorageIterator() override;
1077 
1079 
1080  OUString getName() const;
1081  bool isStream() const;
1082  bool isStorage() const;
1083 
1084 private:
1085  virtual bool implIsValid() const override;
1086 
1087 private:
1089  OUStringVector maNames;
1090  OUStringVector::const_iterator maIt;
1091 };
1092 
1093 
1094 class ObjectBase : public Base
1095 {
1096 public:
1097  virtual ~ObjectBase() override;
1098 
1099  ObjectBase(ObjectBase const &) = default;
1100  ObjectBase(ObjectBase &&) = default;
1101  ObjectBase & operator =(ObjectBase const &) = default;
1102  ObjectBase & operator =(ObjectBase &&) = default;
1103 
1104  const css::uno::Reference< css::uno::XComponentContext >&
1105  getContext() const { return mxConfig->getContext(); }
1106 
1107  void dump();
1108 
1109 
1110 protected:
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 
1122 private:
1123  ConfigRef mxConfig;
1124 };
1125 
1126 typedef std::shared_ptr< ObjectBase > ObjectRef;
1127 
1128 
1130 {
1131 protected:
1133 
1134 protected:
1135  using ObjectBase::construct;
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 
1160 private:
1161  static OUString getSysFileName(
1162  const OUString& 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 
1182 private:
1184  {
1185  OUString maName;
1187 
1188  explicit PreferredItem( const OUString& rName, bool bStorage ) :
1189  maName( rName ), mbStorage( bStorage ) {}
1190  };
1191  typedef ::std::vector< PreferredItem > PreferredItemVector;
1192 
1194  OUString maSysPath;
1195  PreferredItemVector maPreferred;
1196 };
1197 
1198 
1200 {
1201 public:
1202  virtual ~OutputObjectBase() override;
1203 
1204  OutputObjectBase(OutputObjectBase const &) = default;
1205  OutputObjectBase(OutputObjectBase &&) = default;
1206  OutputObjectBase & operator =(OutputObjectBase const &) = default;
1208 
1209 protected:
1211 
1212  using ObjectBase::construct;
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, const OUString& 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 
1255 protected:
1256  OutputRef mxOut;
1257  OUString maSysFileName;
1258 };
1259 
1260 
1261 template< typename Type >
1263 {
1264  if( !rListWrp.isEmpty() )
1265  {
1266  mxOut->contItem();
1267  mxOut->writeName( cfg(), nData, rListWrp );
1268  }
1269 }
1270 
1271 template< typename Type >
1272 void OutputObjectBase::writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1273 {
1274  ItemGuard aItem( mxOut, rName );
1275  mxOut->writeName( cfg(), nData, rListWrp );
1276 }
1277 
1278 template< typename Type >
1279 void 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 
1286 template< typename Type >
1287 void 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 
1294 template< typename Type >
1295 void 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 
1302 template< typename Type >
1303 void 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 
1310 template< typename Type >
1311 void 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 
1318 template< typename Type >
1319 void 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 
1328 template< typename Type >
1329 void 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 
1341 template< typename Type >
1342 void OutputObjectBase::writeValueItem( const ItemFormat& rItemFmt, Type nData )
1343 {
1344  OString aNameUtf8 = StringHelper::convertToUtf8( rItemFmt.maItemName );
1345  writeValueItem( aNameUtf8.getStr(), nData, rItemFmt.meFmtType, rItemFmt.maListName );
1346 }
1347 
1348 template< typename Type >
1349 void 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 
1357 template< typename Type >
1358 void 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 {
1369 public:
1370  virtual ~InputObjectBase() override;
1371 
1372  InputObjectBase(InputObjectBase const &) = default;
1373  InputObjectBase(InputObjectBase &&) = default;
1374  InputObjectBase & operator =(InputObjectBase const &) = default;
1375  InputObjectBase & operator =(InputObjectBase &&) = default;
1376 
1377 protected:
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( OOX_DUMP_UNUSED, nBytes ); }
1397  void dumpUnknown( sal_Int32 nBytes ) { dumpArray( 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 
1444 protected:
1446 };
1447 
1448 
1449 template< typename Type >
1450 Type InputObjectBase::dumpName( const String& rName, const NameListWrapper& rListWrp )
1451 {
1452  Type nData = mxStrm->readValue<Type>();
1453  writeNameItem( rName, nData, rListWrp );
1454  return nData;
1455 }
1456 
1457 template< typename Type >
1458 Type 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 
1465 template< typename Type >
1466 Type 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 
1473 template< typename Type >
1474 Type 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 
1481 template< typename Type >
1482 Type 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 
1489 template< typename Type >
1490 Type InputObjectBase::dumpBool( const String& rName, const NameListWrapper& rListWrp )
1491 {
1492  Type nData = mxStrm->readValue<Type>();
1493  writeDecBoolItem( rName, nData, rListWrp );
1494  return nData;
1495 }
1496 
1497 template< typename Type >
1499 {
1500  Type nData = mxStrm->readValue<Type>();
1501  writeValueItem( rItemFmt, nData );
1502  return nData;
1503 }
1504 
1505 template< typename Type1, typename Type2 >
1506 Type1 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 
1511 template< typename Type1, typename Type2 >
1512 Type1 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 
1517 template< typename Type1, typename Type2 >
1518 Type1 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 
1523 template< typename Type1, typename Type2 >
1524 Type1 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 
1529 template< typename Type1, typename Type2 >
1530 Type1 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 
1535 template< typename Type1, typename Type2 >
1536 Type1 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 
1541 template< typename Type1, typename Type2 >
1542 Type1 InputObjectBase::dumpValue( bool bType1, const ItemFormat& rItemFmt )
1543 {
1544  return bType1 ? dumpValue< Type1 >( rItemFmt ) : static_cast< Type1 >( dumpValue< Type2 >( rItemFmt ) );
1545 }
1546 
1547 template< typename Type >
1549 {
1550  Type nData1, nData2;
1551  *mxStrm >> nData1 >> nData2;
1552  writeDecPairItem( rName, nData1, nData2, cSep );
1553 }
1554 
1555 template< typename Type >
1557 {
1558  Type nData1, nData2;
1559  *mxStrm >> nData1 >> nData2;
1560  writeHexPairItem( rName, nData1, nData2, cSep );
1561 }
1562 
1563 
1565 {
1566 public:
1567  explicit BinaryStreamObject(
1568  const ObjectBase& rParent,
1569  const BinaryInputStreamRef& rxStrm,
1570  const OUString& rSysFileName );
1571 
1572 private:
1573  void dumpBinaryStream( bool bShowOffset = true );
1574 
1575  virtual void implDump() override;
1576 };
1577 
1578 
1580 {
1581 protected:
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 
1600 private:
1601  void constructTextStrmObj( rtl_TextEncoding eTextEnc );
1602 
1603  std::shared_ptr< TextInputStream > mxTextStrm;
1604 };
1605 
1606 
1608 {
1609 public:
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 
1621 private:
1622  virtual void implDumpText( TextInputStream& rTextStrm ) override;
1623  void implDumpLine( const OUString& rLine, sal_uInt32 nLine );
1624 };
1625 
1626 
1628 {
1629 public:
1630  explicit XmlStreamObject(
1631  const ObjectBase& rParent,
1632  const BinaryInputStreamRef& rxStrm,
1633  const OUString& rSysFileName );
1634 
1635 protected:
1636  virtual void implDumpText( TextInputStream& rTextStrm ) override;
1637 };
1638 
1639 
1641 {
1642 protected:
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 
1664 private:
1665  void constructRecObjBase(
1666  const BinaryInputStreamRef& rxBaseStrm,
1667  const String& rRecNames,
1668  const String& rSimpleRecs );
1669 
1670  void writeHeader();
1671 
1672 private:
1676  sal_Int64 mnRecPos;
1677  sal_Int64 mnRecId;
1678  sal_Int64 mnRecSize;
1681 };
1682 
1683 
1685 {
1686 protected:
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 
1700 private:
1701  std::shared_ptr< StreamDataSequence > mxRecData;
1702 };
1703 
1704 
1708 class DumperBase : public ObjectBase
1709 {
1710 public:
1711  virtual ~DumperBase() override;
1712 
1713  bool isImportEnabled() const;
1714 
1715 protected:
1717 
1718  using ObjectBase::construct;
1719  void construct( const ConfigRef& rxConfig );
1720 };
1721 
1722 
1723 } // namespace oox::dump
1724 
1725 #define OOX_DUMP_FILE( DumperClassName ) \
1726 do { \
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: */
OUString maItemName
Name of the item.
Definition: dumperbase.hxx:207
virtual void implDumpText(TextInputStream &rTextStrm) override
Unsigned 32-bit integer.
Definition: dumperbase.hxx:162
virtual OUString implGetName(const Config &rCfg, sal_Int64 nKey) const override
Returns the name for the passed key.
virtual void implDumpBaseStream(const BinaryInputStreamRef &rxStrm, const OUString &rSysFileName)
Type
void dumpUnknown(sal_Int32 nBytes)
bool getBoolOption(const String &rKey, bool bDefault) const
const_iterator end() const
Returns a map iterator pointing one past the last contained name.
Definition: dumperbase.hxx:542
XmlStreamObject(const ObjectBase &rParent, const BinaryInputStreamRef &rxStrm, const OUString &rSysFileName)
static LineType readConfigLine(TextInputStream &rStrm, OUString &orKey, OUString &orData)
Definition: dumperbase.cxx:825
void writeStringItem(const String &rName, const OUString &rData)
const OUString & getStringOption(const String &rKey, const OUString &rDefault) const
void writeHexItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
bool isImportEnabled() const
void writeItemName(const String &rItemName)
void writeDecBoolItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
virtual void implProcessConfigItemInt(TextInputStream &rStrm, sal_Int64 nKey, const OUString &rData) override
Definition: dumperbase.cxx:896
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
Wraps a UNO input stream and provides convenient access functions.
static void convertStringToStringList(OUStringVector &orVec, const OUString &rData, bool bIgnoreEmpty)
Definition: dumperbase.cxx:755
const sal_Unicode OOX_DUMP_RANGESEP
Definition: dumperbase.hxx:82
::std::map< sal_Int64, ItemFormat > maMap
Definition: dumperbase.hxx:742
std::shared_ptr< ObjectBase > ObjectRef
Hexadecimal, as short as possible (no leading zeros).
Definition: dumperbase.hxx:176
static OUString getToken(const OUString &rData, sal_Int32 &rnPos, sal_Unicode cSep=OOX_DUMP_LISTSEP)
Definition: dumperbase.cxx:528
std::shared_ptr< Output > OutputRef
exports com.sun.star. io
const sal_Unicode OOX_DUMP_R1C1ROW
Definition: dumperbase.hxx:78
void construct(const ConfigRef &rxConfig)
TableGuard(const OutputRef &rxOut, size_t nColCount, const sal_Int32 *pnColWidths)
TableGuard(const OutputRef &rxOut, sal_Int32 nW1, sal_Int32 nW2)
static OUStringPair convertStringToPair(const OUString &rString, sal_Unicode cSep= '=')
Definition: dumperbase.cxx:736
void writeHex(Type nData, bool bPrefix=true)
Definition: dumperbase.hxx:967
void setNamesFromVec(sal_Int64 nStartKey, const OUStringVector &rNames)
Definition: dumperbase.cxx:994
bool readConfigFile(const OUString &rFileUrl)
std::unique_ptr< ContentProperties > pData
PreferredItemVector maPreferred
OutputObjectBase & operator=(OutputObjectBase const &)=default
UnitConverter(const SharedConfigData &rCfgData)
virtual void implSetName(sal_Int64 nKey, const OUString &rName) override
Sets the name for the passed key.
static void appendBin(OUStringBuffer &rStr, sal_uInt8 nData, bool bDots=true)
Definition: dumperbase.cxx:383
signed char sal_Int8
virtual bool implIsValid() const override
virtual ~ObjectBase() override
Unsigned 64-bit integer.
Definition: dumperbase.hxx:164
Static helper functions for system file and stream access.
Definition: dumperbase.hxx:99
::std::map< ExtItemFormatKey, ExtItemFormat > ExtItemFormatMap
Definition: dumperbase.hxx:691
static void appendDec(OUStringBuffer &rStr, sal_uInt8 nData, sal_Int32 nWidth=0, sal_Unicode cFill= ' ')
Definition: dumperbase.cxx:209
bool operator<(const ExtItemFormatKey &rRight) const
FormatType
Specifiers for the output format of values.
Definition: dumperbase.hxx:171
virtual void implIncludeList(const NameListBase &rList)=0
Derived classes insert all names and other settings from the passed list.
bool isDumperEnabled() const
bool isImportEnabled() const
IndentGuard & operator=(const IndentGuard &)=delete
void emptyLine(size_t nCount=1)
virtual ~NameListBase() override
Definition: dumperbase.cxx:861
void createUnitConverter(const OUString &rData)
sal_Int32 mnLastItem
void writeFix(Type nData, sal_Int32 nWidth)
Definition: dumperbase.hxx:976
void setNameList(const OUString &rListName, const NameListRef &rxList)
const sal_Unicode OOX_DUMP_PLACEHOLDER
Definition: dumperbase.hxx:90
static bool convertStringToBool(const OUString &rData)
Definition: dumperbase.cxx:726
static OUString getFileNameExtension(const OUString &rFileUrl)
Definition: dumperbase.cxx:80
::std::vector< OUString > OUStringVector
Definition: dumperbase.hxx:94
void implDumpLine(const OUString &rLine, sal_uInt32 nLine)
void dumpArray(const String &rName, sal_Int32 nBytes, sal_Unicode cSep=OOX_DUMP_LISTSEP)
sal_Int16 nId
Definition: olehelper.cxx:97
Config & operator=(Config const &)=default
std::shared_ptr< BinaryInputStream > BinaryInputStreamRef
Base class for all dumper classes.
Definition: dumperbase.hxx:439
void dumpHexPair(const String &rName, sal_Unicode cSep= ',')
Boolean ('true' or 'false').
Definition: dumperbase.hxx:179
void addPreferredStream(const String &rStrmName)
const NameListRef & getNameList(const Config &rCfg) const
const ContentProperties & rData
Type getIntOption(const String &rKey, Type nDefault) const
Definition: dumperbase.hxx:897
static sal_Int32 getFileNamePos(const OUString &rFileUrl)
Definition: dumperbase.cxx:74
MultiItemsGuard & operator=(const MultiItemsGuard &)=delete
::std::pair< OUString, OUString > OUStringPair
Definition: dumperbase.hxx:92
Base & operator=(Base const &)=default
::std::map< sal_Int64, ItemFormat >::const_iterator find(sal_Int64 nId) const
Definition: dumperbase.hxx:749
virtual void implDump() override
std::shared_ptr< T > make_shared(Args &&...args)
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData) override
virtual bool implIsValid() const override
std::shared_ptr< StorageBase > StorageRef
Definition: storagebase.hxx:42
virtual void implDumpText(TextInputStream &rTextStrm) override
static void appendChar(OUStringBuffer &rStr, sal_Unicode cChar, sal_Int32 nCount)
Definition: dumperbase.cxx:195
BinaryInputStreamRef(std::shared_ptr< BinaryInputStream > const &pInStrm)
Definition: dumperbase.hxx:141
OUString getName() const
void readConfigBlockContents(TextInputStream &rStrm)
Definition: dumperbase.cxx:807
virtual OUString implGetName(const Config &rCfg, sal_Int64 nKey) const override
Returns the converted value with appended unit name.
NameListWrapper maSimpleRecs
static void appendIndex(OUStringBuffer &rStr, sal_Int64 nIdx)
Definition: dumperbase.cxx:521
void writeArray(const sal_uInt8 *pnData, std::size_t nSize, sal_Unicode cSep=OOX_DUMP_LISTSEP)
MultiItemsGuard(const OutputRef &rxOut)
Signed 8-bit integer.
Definition: dumperbase.hxx:157
NameListRef getNameList(const String &rListName) const
const StorageRef & getRootStorage() const
Definition: dumperbase.hxx:770
virtual ~OutputObjectBase() override
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData)
Definition: dumperbase.cxx:797
static bool convertFromHex(sal_Int64 &ornData, const OUString &rData)
Definition: dumperbase.cxx:692
void dumpRemainingTo(sal_Int64 nPos)
void construct(const ObjectBase &rParent, const BinaryInputStreamRef &rxBaseStrm, const OUString &rSysFileName, const BinaryInputStreamRef &rxRecStrm, const String &rRecNames, const String &rSimpleRecs)
static OUString convertFileNameToUrl(const OUString &rFileName)
Definition: dumperbase.cxx:66
virtual void implDumpRecordBody()
void createShortList(const OUString &rData)
sal_uInt16 sal_Unicode
const sal_Unicode OOX_DUMP_R1C1CLOSE
Definition: dumperbase.hxx:81
PreferredItem(const OUString &rName, bool bStorage)
::std::vector< sal_Int64 > Int64Vector
Definition: dumperbase.hxx:95
bool has() const
Definition: dumperbase.hxx:383
Floating-point, double precision.
Definition: dumperbase.hxx:166
OUString dumpCharArray(const String &rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul=false)
void eraseNameList(const OUString &rListName)
virtual bool implIsValid() const override
static bool isValid(const std::shared_ptr< Base > &rxBase)
Definition: dumperbase.hxx:450
OUStringVector::const_iterator maIt
void dumpRawBinary(sal_Int64 nBytes, bool bShowOffset, bool bStream=false)
std::shared_ptr< SharedConfigData > mxCfgData
Definition: dumperbase.hxx:890
std::shared_ptr< TextInputStream > mxTextStrm
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
StorageIterator(const StorageRef &rxStrg)
OUStringBuffer maLine
Definition: dumperbase.hxx:995
DataType
Specifiers for atomic data types.
Definition: dumperbase.hxx:154
void writeNameItem(const String &rName, Type nData, const NameListWrapper &rListWrp)
Signed 16-bit integer.
Definition: dumperbase.hxx:159
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
Definition: dumperbase.hxx:769
static OUString trimSpaces(const OUString &rStr)
Definition: dumperbase.cxx:601
int nCount
Output(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rFileName)
void writeDateTimeItem(const String &rName, const css::util::DateTime &rDateTime)
Type dumpBin(const String &rName, const NameListWrapper &rListWrp=NO_LIST)
void constructTextStrmObj(rtl_TextEncoding eTextEnc)
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
Definition: dumperbase.hxx:851
void construct(const ObjectBase &rParent, const BinaryInputStreamRef &rxStrm, rtl_TextEncoding eTextEnc, const OUString &rSysFileName)
virtual void implSetName(sal_Int64 nKey, const OUString &rName) override
Sets the name for the passed key.
void writeFixItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
const OUString & getSysFileName() const
Definition: dumperbase.hxx:853
void writeBool(bool bData)
TableGuard(const OutputRef &rxOut, sal_Int32 nW1)
IndentGuard(const OutputRef &rxOut)
void writeDec(Type nData, sal_Int32 nWidth=0, sal_Unicode cFill= ' ')
Definition: dumperbase.hxx:964
virtual OUString implGetNameDbl(const Config &rCfg, double fValue) const override
Returns the converted value with appended unit name.
const sal_Unicode OOX_DUMP_R1C1OPEN
Definition: dumperbase.hxx:80
void include(const OUString &rListKeys)
Includes name lists, given in a comma separated list of names of the lists.
Definition: dumperbase.cxx:913
static void appendValue(OUStringBuffer &rStr, Type nData, FormatType eFmtType)
Definition: dumperbase.hxx:360
virtual void implSetName(sal_Int64 nKey, const OUString &rName) override
Sets the name for the passed key.
virtual bool implIsValid() const override
const sal_Unicode OOX_DUMP_TABSEP
Definition: dumperbase.hxx:86
virtual void implDumpText(TextInputStream &rTextStrm)=0
FormatType meFmtType
Output format for the value.
Definition: dumperbase.hxx:206
void writeValueItem(const String &rName, Type nData, FormatType eFmtType, const NameListWrapper &rListWrp=NO_LIST)
void writeBin(Type nData, bool bDots=true)
Definition: dumperbase.hxx:973
Type dumpBool(const String &rName, const NameListWrapper &rListWrp=NO_LIST)
const sal_Unicode OOX_DUMP_R1C1COL
Definition: dumperbase.hxx:79
ItemGuard(const OutputRef &rxOut, const String &rName)
virtual OUString implGetName(const Config &rCfg, sal_Int64 nKey) const override
Returns the name for the passed key.
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData) override
const String EMPTY_STRING
Definition: dumperbase.hxx:387
OUString getName(const Config &rCfg, double fValue) const
Returns a display name for the passed double value.
Definition: dumperbase.hxx:536
void writeValue(Type nData, FormatType eFmtType)
Definition: dumperbase.hxx:979
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:961
::std::map< sal_Int64, ItemFormat >::const_iterator end() const
Definition: dumperbase.hxx:748
void writeAscii(const char *pcStr)
virtual void implIncludeList(const NameListBase &rList) override
Inserts all flags from the passed list.
const sal_Unicode OOX_DUMP_LISTSEP
Definition: dumperbase.hxx:85
Signed 64-bit integer.
Definition: dumperbase.hxx:163
void construct(const ObjectBase &rParent, const StorageRef &rxStrg, const OUString &rSysPath)
OUString dumpUnicodeArray(const String &rName, sal_Int32 nLen, bool bHideTrailingNul=false)
static void appendFix(OUStringBuffer &rStr, Type nData, sal_Int32 nWidth=0)
Definition: dumperbase.hxx:354
Interface for binary input stream classes.
const SharedConfigData & mrCfgData
Definition: dumperbase.hxx:581
std::shared_ptr< StreamDataSequence > mxRecData
DataType meDataType
Data type of the item.
Definition: dumperbase.hxx:205
::std::pair< sal_Int64, sal_Int64 > maFilter
Definition: dumperbase.hxx:681
::std::map< sal_Int64, OUString > OUStringMap
Definition: dumperbase.hxx:513
const sal_Unicode OOX_DUMP_EMPTYVALUE
Definition: dumperbase.hxx:88
void writeGuidItem(const String &rName, const OUString &rGuid)
Base class for storage access implementations.
Definition: storagebase.hxx:51
css::uno::Reference< css::uno::XComponentContext > mxContext
Definition: dumperbase.hxx:800
void writeDecItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
virtual ~DumperBase() override
css::uno::Sequence< sal_Int8 > StreamDataSequence
void addNameToItem(Type nData, const NameListWrapper &rListWrp)
OUString dumpGuid(const String &rName=EMPTY_STRING)
::std::set< OUString > ConfigFileSet
Definition: dumperbase.hxx:796
void dumpBinary(const String &rName, sal_Int64 nBytes, bool bShowOffset=true)
void dumpItem(const ItemFormat &rItemFmt)
sal_Unicode dumpUnicode(const String &rName)
css::util::DateTime dumpFileTime(const String &rName=EMPTY_STRING)
NameListBase(const SharedConfigData &rCfgData)
Definition: dumperbase.hxx:545
Describes the output format of a data item.
Definition: dumperbase.hxx:203
static void appendShortHex(OUStringBuffer &rStr, sal_uInt8 nData, bool bPrefix=true)
Definition: dumperbase.cxx:327
Unsigned 16-bit integer.
Definition: dumperbase.hxx:160
void construct(const ObjectBase &rParent, const BinaryInputStreamRef &rxBaseStrm, const OUString &rSysFileName, const String &rRecNames, const String &rSimpleRecs)
void processConfigItem(TextInputStream &rStrm, const OUString &rKey, const OUString &rData)
Definition: dumperbase.cxx:851
void construct(const ObjectBase &rParent, const BinaryInputStreamRef &rxStrm, const OUString &rSysFileName)
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData) override
Definition: dumperbase.cxx:945
void insertRawName(sal_Int64 nKey, const OUString &rName)
Inserts the passed name into the internal map.
Definition: dumperbase.cxx:902
String(const char *pcStr)
Definition: dumperbase.hxx:380
void dumpUnused(sal_Int32 nBytes)
const OUString & getSysFileName() const
Definition: dumperbase.hxx:771
TableGuard & operator=(const TableGuard &)=delete
#define OOX_DUMP_UNUSED
Definition: dumperbase.hxx:64
virtual void implIncludeList(const NameListBase &rList) override
Inserts all flags from the passed list.
static css::uno::Reference< css::io::XInputStream > openInputStream(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rFileName)
Definition: dumperbase.cxx:91
void writeBinItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
void writeHexPairItem(const String &rName, Type nData1, Type nData2, sal_Unicode cSep= ',')
void constructRecObjBase(const BinaryInputStreamRef &rxBaseStrm, const String &rRecNames, const String &rSimpleRecs)
bool hasName(Type nKey) const
Returns true, if the map contains an entry for the passed key.
Definition: dumperbase.hxx:527
virtual bool implIsValid() const override
void skipBlock(sal_Int64 nBytes, bool bShowSize=true)
virtual bool implIsValid() const override
const sal_Unicode OOX_DUMP_BASECLASS
Definition: dumperbase.hxx:83
SharedConfigData(const OUString &rFileName, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const StorageRef &rxRootStrg, const OUString &rSysFileName)
void writeCharItem(const String &rName, sal_Unicode cData)
static FormatType convertToFormatType(std::u16string_view rStr)
Definition: dumperbase.cxx:651
void set(DataType eDataType, FormatType eFmtType, const OUString &rItemName)
Definition: dumperbase.cxx:152
BinaryInputStreamRef(const std::shared_ptr< StreamType > &rxInStrm)
Definition: dumperbase.hxx:148
ExtItemFormatMap maFmtMap
Definition: dumperbase.hxx:692
::std::vector< sal_Int32 > maColPos
Definition: dumperbase.hxx:998
virtual bool implReadRecordHeader(BinaryInputStream &rBaseStrm, sal_Int64 &ornRecId, sal_Int64 &ornRecSize)=0
virtual void implSetName(sal_Int64 nKey, const OUString &rName) override
Sets the name for the passed key.
bool isValid() const
Definition: dumperbase.hxx:449
virtual bool implIsValid() const override
Definition: dumperbase.cxx:880
::std::map< OUString, OUString > ConfigDataMap
Definition: dumperbase.hxx:797
void writeShortHex(Type nData, bool bPrefix=true)
Definition: dumperbase.hxx:970
const sal_Unicode OOX_DUMP_ADDRABS
Definition: dumperbase.hxx:77
virtual bool implIsValid() const override
static OString convertToUtf8(std::u16string_view rStr)
Definition: dumperbase.cxx:620
const OUString * implGetOption(const OUString &rKey) const
void setQuoteNames(bool bQuoteNames)
Enables or disables automatic quotation of returned names.
Definition: dumperbase.hxx:591
#define OOX_DUMP_UNKNOWN
Definition: dumperbase.hxx:65
void construct(const ObjectBase &rParent, const OUString &rSysFileName)
Config & cfg() const
NameListWrapper(const NameListRef &rxList)
Definition: dumperbase.hxx:726
FlagsList(const SharedConfigData &rCfgData)
void dumpDecPair(const String &rName, sal_Unicode cSep= ',')
NameListWrapper(const char *pcListName)
Definition: dumperbase.hxx:725
void readNameList(TextInputStream &rStrm, const OUString &rListName)
Definition: dumperbase.hxx:824
void includeList(const NameListRef &rxList)
Include all names of the passed list.
Definition: dumperbase.cxx:870
virtual void implDumpStorage(const StorageRef &rxStrg, const OUString &rStrgPath, const OUString &rSysPath)
std::shared_ptr< ListType > createNameList(const OUString &rListName)
Definition: dumperbase.hxx:812
OUString getName(const Config &rCfg, Type nKey) const
Returns the name for the passed key.
Definition: dumperbase.hxx:532
Type dumpHex(const String &rName, const NameListWrapper &rListWrp=NO_LIST)
::std::map< OUString, NameListRef > NameListMap
Definition: dumperbase.hxx:798
static void appendString(OUStringBuffer &rStr, const OUString &rData, sal_Int32 nWidth, sal_Unicode cFill= ' ')
Definition: dumperbase.cxx:201
static void appendCChar(OUStringBuffer &rStr, sal_Unicode cChar, bool bPrefix=true)
Definition: dumperbase.cxx:451
virtual OUString implGetNameDbl(const Config &rCfg, double fValue) const =0
Derived classes generate and return the name for the passed double value.
TableGuard(const OutputRef &rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4)
static OUString getSysFileName(const OUString &rStrmName, std::u16string_view rSysOutPath)
void extractStorage(const StorageRef &rxStrg, const OUString &rStrgPath, const OUString &rSysPath)
ItemFormatMap(const NameListRef &rxNameList)
Definition: dumperbase.hxx:746
void writeArrayItem(const String &rName, const sal_uInt8 *pnData, std::size_t nSize, sal_Unicode cSep=OOX_DUMP_LISTSEP)
void insertFormats(const NameListRef &rxNameList)
Definition: dumperbase.cxx:929
virtual bool implIsValid() const override
void setIgnoreFlags(sal_Int64 nIgnore)
Sets flags to be ignored on output.
Definition: dumperbase.hxx:642
void addPreferredStorage(const String &rStrgPath)
static void appendHex(OUStringBuffer &rStr, sal_uInt8 nData, bool bPrefix=true)
Definition: dumperbase.cxx:263
virtual ~SharedConfigData() override
sal_Int64 getIgnoreFlags() const
Returns the flags to be ignored on output.
Definition: dumperbase.hxx:640
virtual ~InputObjectBase() override
virtual void implDump() override
Type dumpValue(const ItemFormat &rItemFmt)
void dumpBinaryStream(bool bShowOffset=true)
void writeName(const Config &rCfg, Type nData, const NameListWrapper &rListWrp)
Definition: dumperbase.hxx:982
void writeChar(sal_Unicode cChar, sal_Int32 nCount=1)
void construct(const char *pcEnvVar, const ::oox::core::FilterBase &rFilter)
const sal_Unicode OOX_DUMP_STRQUOTE
Definition: dumperbase.hxx:75
String(const OUString &rStr)
Definition: dumperbase.hxx:379
OUStringVector::const_iterator parse(const OUStringVector &rFormatVec)
Initializes the struct from a vector of strings containing the item format.
Definition: dumperbase.cxx:160
virtual ~Base()
Definition: dumperbase.cxx:784
virtual ~Config() override
std::shared_ptr< ListType > createNameList(const String &rListName)
Definition: dumperbase.hxx:906
Static helper functions for formatted output to strings.
Definition: dumperbase.hxx:244
static void convertStringToIntList(Int64Vector &orVec, const OUString &rData, bool bIgnoreEmpty)
Definition: dumperbase.cxx:769
static bool convertFromDec(sal_Int64 &ornData, const OUString &rData)
Definition: dumperbase.cxx:669
virtual OUString implGetNameDbl(const Config &rCfg, double fValue) const override
Returns the name for the passed double value.
virtual bool implStartRecord(BinaryInputStream &rBaseStrm, sal_Int64 &ornRecPos, sal_Int64 &ornRecId, sal_Int64 &ornRecSize)=0
const NameListWrapper NO_LIST
Definition: dumperbase.hxx:736
std::shared_ptr< NameListBase > NameListRef
Definition: dumperbase.hxx:499
void writeDecPairItem(const String &rName, Type nData1, Type nData2, sal_Unicode cSep= ',')
virtual void implDump()
virtual bool implIsValid() const override
void writeString(const OUString &rStr)
::std::vector< PreferredItem > PreferredItemVector
void startTable(sal_Int32 nW1)
virtual void implSetName(sal_Int64 nKey, const OUString &rName)=0
Derived classes set the name for the passed key.
Base class of all classes providing names for specific values (name lists).
Definition: dumperbase.hxx:510
StorageIterator & operator++()
virtual void implSetName(sal_Int64 nKey, const OUString &rName) override
Sets the name for the passed key.
Definition: dumperbase.cxx:956
virtual ~StorageIterator() override
void writeDateTime(const css::util::DateTime &rDateTime)
unsigned char sal_uInt8
Type dumpName(const String &rName, const NameListWrapper &rListWrp)
void extractStream(StorageBase &rStrg, const OUString &rStrgPath, const OUString &rStrmName, const OUString &rSysFileName)
Type dumpDec(const String &rName, const NameListWrapper &rListWrp=NO_LIST)
Signed 32-bit integer.
Definition: dumperbase.hxx:161
OUString operator()(const char *pcDefault) const
Definition: dumperbase.hxx:384
MultiList(const SharedConfigData &rCfgData)
Definition: dumperbase.cxx:988
void construct(const ConfigRef &rxConfig)
void resetItemIndex(sal_Int64 nIdx=0)
ObjectBase & operator=(ObjectBase const &)=default
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData) override
Definition: dumperbase.cxx:885
void setUnitName(const String &rUnitName)
Definition: dumperbase.hxx:701
void startItem(const String &rItemName)
NameListRef getNameList(const OUString &rListName) const
static void appendEncString(OUStringBuffer &rStr, const OUString &rData, bool bPrefix=true)
Definition: dumperbase.cxx:484
NameListWrapper(const OUString &rListName)
Definition: dumperbase.hxx:724
double getLength(const B2DPolygon &rCandidate)
OUString getName(const NameListWrapper &rListWrp, Type nKey) const
Returns the name for the passed key from the passed name list.
Definition: dumperbase.hxx:912
Base class for a file dumper.
CombiList(const SharedConfigData &rCfgData)
sal_Int64 getRecId() const
static DataType convertToDataType(std::u16string_view rStr)
Definition: dumperbase.cxx:625
virtual void implDumpStream(const css::uno::Reference< css::io::XInputStream > &rxStrm, const OUString &rStrgPath, const OUString &rStrmName, const OUString &rSysFileName)
void readConfigBlock(TextInputStream &rStrm)
Definition: dumperbase.cxx:792
void setFactor(double fFactor)
Definition: dumperbase.hxx:702
virtual bool implStartRecord(BinaryInputStream &rBaseStrm, sal_Int64 &ornRecPos, sal_Int64 &ornRecId, sal_Int64 &ornRecSize) override
const OUString * findRawName(sal_Int64 nKey) const
Returns the name for the passed key, or 0, if nothing found.
Definition: dumperbase.cxx:907
const OUString * getOption(const OUString &rKey) const
virtual void implIncludeList(const NameListBase &rList) override
Inserts all names from the passed list.
Definition: dumperbase.cxx:979
void writeInfoItem(const String &rName, const String &rData)
virtual bool implIsValid() const override
static void appendEncChar(OUStringBuffer &rStr, sal_Unicode cChar, sal_Int32 nCount, bool bPrefix=true)
Definition: dumperbase.cxx:467
std::shared_ptr< Config > ConfigRef
Definition: dumperbase.hxx:893
const sal_Unicode OOX_DUMP_FMLASTRQUOTE
Definition: dumperbase.hxx:76
virtual OUString implGetName(const Config &rCfg, sal_Int64 nKey) const =0
Derived classes generate and return the name for the passed key.
static void appendToken(OUStringBuffer &rStr, std::u16string_view rToken, sal_Unicode cSep=OOX_DUMP_LISTSEP)
Definition: dumperbase.cxx:514
void writeEmptyItem(const String &rName)
#define OOX_DUMP_ERR_NOMAP
Definition: dumperbase.hxx:69
BinaryInputStreamRef mxBaseStrm
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)
const sal_Unicode OOX_DUMP_FUNCSEP
Definition: dumperbase.hxx:84
virtual void implIncludeList(const NameListBase &rList) override
Empty implementation.
BinaryInputStreamRef(const css::uno::Reference< css::io::XInputStream > &rxInStrm)
Definition: dumperbase.hxx:144
OUString maListName
Name of a name list to be used for this item.
Definition: dumperbase.hxx:208
virtual void implProcessConfigItemStr(TextInputStream &rStrm, const OUString &rKey, const OUString &rData) override
Type dumpFix(const String &rName, const NameListWrapper &rListWrp=NO_LIST)
TextLineStreamObject(const ObjectBase &rParent, const BinaryInputStreamRef &rxStrm, rtl_TextEncoding eTextEnc, const OUString &rSysFileName)
const sal_Unicode OOX_DUMP_CMDPROMPT
Definition: dumperbase.hxx:89
const StorageRef & getRootStorage() const
Definition: dumperbase.hxx:852
void SvStream & rStrm
Floating-point, single precision.
Definition: dumperbase.hxx:165
sal_Int64 getRecSize() const
String(sal_Unicode cChar)
Definition: dumperbase.hxx:381
virtual void implProcessConfigItemInt(TextInputStream &rStrm, sal_Int64 nKey, const OUString &rData)
Definition: dumperbase.cxx:802
static bool convertStringToDouble(double &orfData, const OUString &rData)
Definition: dumperbase.cxx:718
OUStringMap::const_iterator const_iterator
Definition: dumperbase.hxx:514
BinaryStreamObject(const ObjectBase &rParent, const BinaryInputStreamRef &rxStrm, const OUString &rSysFileName)
void setName(sal_Int64 nKey, const String &rName)
Sets a name for the specified key.
Definition: dumperbase.cxx:865
void tab(size_t nCol)
void dumpRemaining(sal_Int64 nBytes)
void eraseNameList(const String &rListName)
static void appendBool(OUStringBuffer &rStr, bool bData)
Definition: dumperbase.cxx:444
virtual bool implIsValid() const =0
void extractItem(const StorageRef &rxStrg, const OUString &rStrgPath, const OUString &rItemName, std::u16string_view rSysPath, bool bIsStrg, bool bIsStrm)
virtual OUString implGetNameDbl(const Config &rCfg, double fValue) const override
Returns the name for the passed double value.
Definition: dumperbase.cxx:974
virtual void implDump() override
No numeric format (e.g. show name only).
Definition: dumperbase.hxx:173
virtual void implWriteExtHeader()
static OUString trimTrailingNul(const OUString &rStr)
Definition: dumperbase.cxx:612
static bool convertStringToInt(sal_Int64 &ornData, const OUString &rData)
Definition: dumperbase.cxx:711
BinaryInputStreamRef mxStrm
LineType
void writeShortHexItem(const String &rName, Type nData, const NameListWrapper &rListWrp=NO_LIST)
InputObjectBase & operator=(InputObjectBase const &)=default
void exclude(const OUString &rKeys)
Excludes names from the list, given in a comma separated list of their keys.
Definition: dumperbase.cxx:921
const sal_Unicode OOX_DUMP_ARRAYSEP
Definition: dumperbase.hxx:87
static css::uno::Reference< css::io::XOutputStream > openOutputStream(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rFileName)
Definition: dumperbase.cxx:108
static void enclose(OUStringBuffer &rStr, sal_Unicode cOpen, sal_Unicode cClose= '\0')
Encloses the passed string with the passed characters.
Definition: dumperbase.cxx:533
ItemGuard & operator=(const ItemGuard &)=delete
const_iterator begin() const
Returns a map iterator pointing to the first contained name.
Definition: dumperbase.hxx:540
Unsigned 8-bit integer.
Definition: dumperbase.hxx:158
ConstList(const SharedConfigData &rCfgData)
Definition: dumperbase.cxx:938
virtual void implDump() override
css::uno::Reference< css::io::XTextOutputStream2 > mxStrm
Definition: dumperbase.hxx:993