LCOV - code coverage report
Current view: top level - libreoffice/sw/inc - shellio.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 50 69 72.5 %
Date: 2012-12-27 Functions: 51 72 70.8 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef SW_SHELLIO_HXX
      20             : #define SW_SHELLIO_HXX
      21             : 
      22             : #include <memory>
      23             : #include <boost/utility.hpp>
      24             : 
      25             : #include <com/sun/star/uno/Reference.h>
      26             : #include <com/sun/star/embed/XStorage.hpp>
      27             : #include <sfx2/docfile.hxx>
      28             : #include <sfx2/fcontnr.hxx>
      29             : #include <sot/formats.hxx>
      30             : #include <sot/storage.hxx>
      31             : #include <svtools/parhtml.hxx>
      32             : #include <tools/string.hxx>
      33             : #include <tools/date.hxx>
      34             : #include <tools/time.hxx>
      35             : #include <tools/datetime.hxx>
      36             : #include <tools/ref.hxx>
      37             : #include <swdllapi.h>
      38             : #include <swtypes.hxx>
      39             : #include <docfac.hxx>   // SwDocFac
      40             : #include <iodetect.hxx>
      41             : #include <IMark.hxx>
      42             : 
      43             : class SfxFilterContainer;
      44             : class SfxFilter;
      45             : class SfxItemPool;
      46             : class SfxItemSet;
      47             : class SfxMedium;
      48             : class SvStream;
      49             : class SvxFontItem;
      50             : class SvxMacroTableDtor;
      51             : class SwCntntNode;
      52             : class SwCrsrShell;
      53             : class SwDoc;
      54             : class SwPaM;
      55             : class SwTextBlocks;
      56             : struct SwPosition;
      57             : struct Writer_Impl;
      58             : 
      59             : // Defines the count of chars at which a paragraph read via ASCII/W4W-Reader
      60             : // is forced to wrap. It has to be always greater than 200!!!
      61             : #define MAX_ASCII_PARA 10000
      62             : 
      63             : 
      64         226 : class SW_DLLPUBLIC SwAsciiOptions
      65             : {
      66             :     String sFont;
      67             :     rtl_TextEncoding eCharSet;
      68             :     sal_uInt16 nLanguage;
      69             :     LineEnd eCRLF_Flag;
      70             : 
      71             : public:
      72             : 
      73          12 :     const String& GetFontName() const { return sFont; }
      74           0 :     void SetFontName( const String& rFont ) { sFont = rFont; }
      75             : 
      76          49 :     rtl_TextEncoding GetCharSet() const { return eCharSet; }
      77          20 :     void SetCharSet( rtl_TextEncoding nVal ) { eCharSet = nVal; }
      78             : 
      79           6 :     sal_uInt16 GetLanguage() const { return nLanguage; }
      80           0 :     void SetLanguage( sal_uInt16 nVal ) { nLanguage = nVal; }
      81             : 
      82         296 :     LineEnd GetParaFlags() const { return eCRLF_Flag; }
      83           0 :     void SetParaFlags( LineEnd eVal ) { eCRLF_Flag = eVal; }
      84             : 
      85         168 :     void Reset()
      86             :     {
      87         168 :         sFont.Erase();
      88         168 :         eCRLF_Flag = GetSystemLineEnd();
      89         168 :         eCharSet = ::osl_getThreadTextEncoding();
      90         168 :         nLanguage = 0;
      91         168 :     }
      92             :     // for the automatic conversion (mail/news/...)
      93             :     void ReadUserData( const String& );
      94             :     void WriteUserData( String& );
      95             : 
      96         122 :     SwAsciiOptions() { Reset(); }
      97             : };
      98             : 
      99             : /**************** SwReader/Reader ************************/
     100             : // Base class of possible options for a special reader.
     101             : class Reader;
     102             : // Calls reader with its options, document, cursor etc.
     103             : class SwReader;
     104             : // SwRead is pointer to the read-options base class.
     105             : typedef Reader *SwRead;
     106             : 
     107          43 : class SwgReaderOption
     108             : {
     109             :     SwAsciiOptions aASCIIOpts;
     110             :     union
     111             :     {
     112             :         sal_Bool bFmtsOnly;
     113             :         struct
     114             :         {
     115             :             sal_Bool bFrmFmts: 1;
     116             :             sal_Bool bPageDescs: 1;
     117             :             sal_Bool bTxtFmts: 1;
     118             :             sal_Bool bNumRules: 1;
     119             :             sal_Bool bMerge:1;
     120             :         }  Fmts;
     121             :     } What;
     122             : 
     123             : public:
     124          61 :     void ResetAllFmtsOnly() { What.bFmtsOnly = 0; }
     125         144 :     sal_Bool IsFmtsOnly() const { return What.bFmtsOnly; }
     126             : 
     127           0 :     sal_Bool IsFrmFmts() const { return What.Fmts.bFrmFmts; }
     128           0 :     void SetFrmFmts( const sal_Bool bNew) { What.Fmts.bFrmFmts = bNew; }
     129             : 
     130           0 :     sal_Bool IsPageDescs() const { return What.Fmts.bPageDescs; }
     131           0 :     void SetPageDescs( const sal_Bool bNew) { What.Fmts.bPageDescs = bNew; }
     132             : 
     133           0 :     sal_Bool IsTxtFmts() const { return What.Fmts.bTxtFmts; }
     134           0 :     void SetTxtFmts( const sal_Bool bNew) { What.Fmts.bTxtFmts = bNew; }
     135             : 
     136           0 :     sal_Bool IsNumRules() const { return What.Fmts.bNumRules; }
     137           0 :     void SetNumRules( const sal_Bool bNew) { What.Fmts.bNumRules = bNew; }
     138             : 
     139           0 :     sal_Bool IsMerge() const { return What.Fmts.bMerge; }
     140           0 :     void SetMerge( const sal_Bool bNew ) { What.Fmts.bMerge = bNew; }
     141             : 
     142           3 :     const SwAsciiOptions& GetASCIIOpts() const { return aASCIIOpts; }
     143           3 :     void SetASCIIOpts( const SwAsciiOptions& rOpts ) { aASCIIOpts = rOpts; }
     144           3 :     void ResetASCIIOpts() { aASCIIOpts.Reset(); }
     145             : 
     146          43 :     SwgReaderOption()
     147          43 :     {   ResetAllFmtsOnly(); aASCIIOpts.Reset(); }
     148             : };
     149             : 
     150          55 : class SwReader: public SwDocFac
     151             : {
     152             :     SvStream* pStrm;
     153             :     SotStorageRef pStg;
     154             :     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
     155             :     SfxMedium* pMedium;     // Who wants to obtain a Medium (W4W).
     156             : 
     157             :     SwPaM* pCrsr;
     158             :     String aFileName;
     159             :     String sBaseURL;
     160             : 
     161             : public:
     162             : 
     163             :     // Initial reading. Document is created only at Read(...)
     164             :     // or in case it is given, into that.
     165             :     // Special case for Load with Sw3Reader.
     166             :     SwReader( SfxMedium&, const String& rFilename, SwDoc *pDoc = 0 );
     167             : 
     168             :     // Read into existing document.
     169             :     // Document and position in document are taken from SwPaM.
     170             :     SwReader( SvStream&, const String& rFilename, const String& rBaseURL, SwPaM& );
     171             :     SwReader( SfxMedium&, const String& rFilename, SwPaM& );
     172             :     SwReader( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFilename, SwPaM& );
     173             : 
     174             :     // The only export interface is SwReader::Read(...)!!!
     175             :     sal_Bool NeedsPasswd( const Reader& );
     176             :     sal_Bool CheckPasswd( const String&, const Reader& );
     177             :     sal_uLong Read( const Reader& );
     178             : 
     179             :     // Ask for glossaries.
     180             :     sal_Bool HasGlossaries( const Reader& );
     181             :     sal_Bool ReadGlossaries( const Reader&, SwTextBlocks&, sal_Bool bSaveRelFiles );
     182             : 
     183          55 :     const String&       GetBaseURL() const { return sBaseURL;}
     184             : 
     185             : protected:
     186          55 :     void                SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
     187             : };
     188             : 
     189             : 
     190             : 
     191             : /****************  Special Readers ************************/
     192             : 
     193             : // Special Readers can be both!! (Excel, W4W, .. ).
     194             : #define SW_STREAM_READER    1
     195             : #define SW_STORAGE_READER   2
     196             : 
     197             : class SW_DLLPUBLIC Reader
     198             : {
     199             :     friend class SwReader;
     200             :     SwDoc* pTemplate;
     201             :     String aTemplateNm;
     202             : 
     203             :     Date aDStamp;
     204             :     Time aTStamp;
     205             :     DateTime aChkDateTime;
     206             : 
     207             : protected:
     208             :     SvStream* pStrm;
     209             :     SotStorageRef pStg;
     210             :     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
     211             :     SfxMedium* pMedium;     // Who wants to obtain a Medium (W4W).
     212             : 
     213             :     SwgReaderOption aOpt;
     214             :     sal_Bool bInsertMode : 1;
     215             :     sal_Bool bTmplBrowseMode : 1;
     216             :     sal_Bool bReadUTF8: 1;      // Interprete stream as UTF-8.
     217             :     sal_Bool bBlockMode: 1;
     218             :     sal_Bool bOrganizerMode : 1;
     219             :     sal_Bool bHasAskTemplateName : 1;
     220             :     sal_Bool bIgnoreHTMLComments : 1;
     221             : 
     222             :     virtual String GetTemplateName() const;
     223             : 
     224             : public:
     225             :     Reader();
     226             :     virtual ~Reader();
     227             : 
     228             :     virtual int GetReaderType();
     229           3 :     SwgReaderOption& GetReaderOpt() { return aOpt; }
     230             : 
     231             :     virtual void SetFltName( const String& rFltNm );
     232             : 
     233             :     // Adapt item-set of a Frm-Format to the old format.
     234             :     static void ResetFrmFmtAttrs( SfxItemSet &rFrmSet );
     235             : 
     236             :     // Adapt Frame-/Graphics-/OLE- styles to the old format
     237             :     // (without borders etc.).
     238             :     static void ResetFrmFmts( SwDoc& rDoc );
     239             : 
     240             :     // Load filter template, set it and release it again.
     241             :     SwDoc* GetTemplateDoc();
     242             :     sal_Bool SetTemplate( SwDoc& rDoc );
     243             :     void ClearTemplate();
     244             :     void SetTemplateName( const String& rDir );
     245             :     void MakeHTMLDummyTemplateDoc();
     246             : 
     247           0 :     sal_Bool IsReadUTF8() const { return bReadUTF8; }
     248          55 :     void SetReadUTF8( sal_Bool bSet ) { bReadUTF8 = bSet; }
     249             : 
     250          72 :     sal_Bool IsBlockMode() const { return bBlockMode; }
     251          55 :     void SetBlockMode( sal_Bool bSet ) { bBlockMode = bSet; }
     252             : 
     253          89 :     sal_Bool IsOrganizerMode() const { return bOrganizerMode; }
     254          55 :     void SetOrganizerMode( sal_Bool bSet ) { bOrganizerMode = bSet; }
     255             : 
     256          55 :     void SetIgnoreHTMLComments( sal_Bool bSet ) { bIgnoreHTMLComments = bSet; }
     257             : 
     258             :     virtual sal_Bool HasGlossaries() const;
     259             :     virtual sal_Bool ReadGlossaries( SwTextBlocks&, sal_Bool bSaveRelFiles ) const;
     260             : 
     261             :     // Read the sections of the document, which is equal to the medium.
     262             :     // Returns the count of it
     263             :     virtual size_t GetSectionList( SfxMedium& rMedium,
     264             :                                    std::vector<String*>& rStrings ) const;
     265             : 
     266          37 :     SotStorageRef getSotStorageRef() { return pStg; };
     267          37 :     void setSotStorageRef(SotStorageRef pStgRef) { pStg = pStgRef; };
     268             : 
     269             : private:
     270             :     virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &)=0;
     271             : 
     272             :     // Everyone who does not need the streams / storages open
     273             :     // has to overload the method (W4W!!).
     274             :     virtual int SetStrmStgPtr();
     275             : };
     276             : 
     277          20 : class AsciiReader: public Reader
     278             : {
     279             :     friend class SwReader;
     280             :     virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
     281             : public:
     282          10 :     AsciiReader(): Reader() {}
     283             : };
     284             : 
     285           8 : class SW_DLLPUBLIC StgReader : public Reader
     286             : {
     287             :     String aFltName;
     288             : 
     289             : protected:
     290             :     sal_uLong OpenMainStream( SotStorageStreamRef& rRef, sal_uInt16& rBuffSize );
     291             : public:
     292             :     virtual int GetReaderType();
     293          40 :     const String& GetFltName() { return aFltName; }
     294             :     virtual void SetFltName( const String& r );
     295             : };
     296             : 
     297             : 
     298             : // The given stream has to be created dynamically and must
     299             : // be requested via Stream() before the instance is deleted!
     300             : 
     301             : class SwImpBlocks;
     302             : 
     303             : class SW_DLLPUBLIC SwTextBlocks
     304             : {
     305             :     SwImpBlocks* pImp;
     306             :     sal_uLong        nErr;
     307             : 
     308             : public:
     309             :     SwTextBlocks( const String& );
     310             :     ~SwTextBlocks();
     311             : 
     312             :     void Flush(){}
     313             : 
     314             :     SwDoc* GetDoc();
     315             :     void   ClearDoc();                  // Delete Doc-contents.
     316             :     const  String& GetName();
     317             :     void   SetName( const String& );
     318           0 :     sal_uLong GetError() const { return nErr; }
     319             : 
     320             :     String GetBaseURL() const;
     321             :     void   SetBaseURL( const String& rURL );
     322             : 
     323             :     sal_Bool   IsOld() const;
     324             :     sal_uLong  ConvertToNew();              // Convert text modules.
     325             : 
     326             :     sal_uInt16 GetCount() const;                        // Get count text modules.
     327             :     sal_uInt16 GetIndex( const String& ) const;         // Get index of short names.
     328             :     sal_uInt16 GetLongIndex( const String& ) const;     // Get index of long names.
     329             :     const  String& GetShortName( sal_uInt16 ) const;    // Get short name for index.
     330             :     const  String& GetLongName( sal_uInt16 ) const;     // Get long name for index.
     331             : 
     332             :     sal_Bool   Delete( sal_uInt16 );
     333             :     sal_uInt16 Rename( sal_uInt16, const String*, const String* );
     334             :     sal_uLong  CopyBlock( SwTextBlocks& rSource, String& rSrcShort,
     335             :                                     const String& rLong );
     336             : 
     337             :     sal_Bool   BeginGetDoc( sal_uInt16 );   // Read text modules.
     338             :     void   EndGetDoc();                     // Release text modules.
     339             : 
     340             :     sal_Bool   BeginPutDoc( const String&, const String& ); // Begin save.
     341             :     sal_uInt16 PutDoc();                                    // End save.
     342             : 
     343             :     sal_uInt16 PutText( const String&, const String&, const String& ); // Save (short name, text).
     344             : 
     345             :     sal_Bool IsOnlyTextBlock( sal_uInt16 ) const;
     346             :     sal_Bool IsOnlyTextBlock( const String& rShort ) const;
     347             : 
     348             :     const String& GetFileName() const;      // Filename of pImp.
     349             :     sal_Bool IsReadOnly() const;            // ReadOnly-flag of pImp.
     350             : 
     351             :     sal_Bool GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl );
     352             :     sal_Bool SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTbl );
     353             : 
     354             :     sal_Bool StartPutMuchBlockEntries();
     355             :     void EndPutMuchBlockEntries();
     356             : };
     357             : 
     358             : // BEGIN source/filter/basflt/fltini.cxx
     359             : 
     360             : extern SwRead ReadAscii, /*ReadSwg, ReadSw3, */ReadHTML, ReadXML;
     361             : 
     362             : SW_DLLPUBLIC SwRead SwGetReaderXML();
     363             : 
     364             : // END source/filter/basflt/fltini.cxx
     365             : 
     366             : 
     367             : extern sal_Bool SetHTMLTemplate( SwDoc &rDoc ); //For templates from HTML before loading shellio.cxx.
     368             : 
     369             : 
     370             : 
     371             : 
     372             : 
     373             : // Base-class of all writers.
     374             : 
     375             : class IDocumentSettingAccess;
     376             : class IDocumentStylePoolAccess;
     377             : 
     378             : class SW_DLLPUBLIC Writer
     379             :     : public SvRefBase
     380             :     , private ::boost::noncopyable
     381             : {
     382             :     SwAsciiOptions aAscOpts;
     383             :     String          sBaseURL;
     384             : 
     385             :     void _AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont );
     386             :     void _AddFontItems( SfxItemPool& rPool, sal_uInt16 nWhichId );
     387             : 
     388             :     ::std::auto_ptr<Writer_Impl> m_pImpl;
     389             : 
     390             : protected:
     391             : 
     392             :     SwPaM* pOrigPam;            // Last Pam that has to be processed.
     393             :     const String* pOrigFileName;
     394             : 
     395             :     void ResetWriter();
     396             :     sal_Bool CopyNextPam( SwPaM ** );
     397             : 
     398             :     void PutNumFmtFontsInAttrPool();
     399             :     void PutEditEngFontsInAttrPool( sal_Bool bIncl_CJK_CTL = sal_True );
     400             : 
     401             :     virtual sal_uLong WriteStream() = 0;
     402           6 :     void                SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
     403             : 
     404             :     IDocumentSettingAccess* getIDocumentSettingAccess();
     405             :     const IDocumentSettingAccess* getIDocumentSettingAccess() const;
     406             : 
     407             :     IDocumentStylePoolAccess* getIDocumentStylePoolAccess();
     408             :     const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
     409             : 
     410             : public:
     411             :     SwDoc* pDoc;
     412             :     SwPaM* pCurPam;
     413             :     sal_Bool bWriteAll : 1;
     414             :     sal_Bool bShowProgress : 1;
     415             :     sal_Bool bWriteClipboardDoc : 1;
     416             :     sal_Bool bWriteOnlyFirstTable : 1;
     417             :     sal_Bool bASCII_ParaAsCR : 1;
     418             :     sal_Bool bASCII_ParaAsBlanc : 1;
     419             :     sal_Bool bASCII_NoLastLineEnd : 1;
     420             :     sal_Bool bUCS2_WithStartChar : 1;
     421             :     sal_Bool bExportPargraphNumbering : 1;
     422             : 
     423             :     sal_Bool bBlock : 1;
     424             :     sal_Bool bOrganizerMode : 1;
     425             : 
     426             :     Writer();
     427             :     virtual ~Writer();
     428             : 
     429             :     virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 );
     430             :             sal_uLong Write( SwPaM&, SvStream&,  const String* = 0 );
     431             :     virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 );
     432             :     virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 );
     433             : 
     434             :     virtual void SetPasswd( const String& );
     435             :     virtual void SetVersion( const String&, long );
     436             :     virtual sal_Bool IsStgWriter() const;
     437             : 
     438           0 :     void SetShowProgress( sal_Bool bFlag = sal_False )  { bShowProgress = bFlag; }
     439             : 
     440           0 :     const String* GetOrigFileName() const       { return pOrigFileName; }
     441             : 
     442         107 :     const SwAsciiOptions& GetAsciiOptions() const { return aAscOpts; }
     443          41 :     void SetAsciiOptions( const SwAsciiOptions& rOpt ) { aAscOpts = rOpt; }
     444             : 
     445           2 :     const String&       GetBaseURL() const { return sBaseURL;}
     446             : 
     447             :     // Look up next bookmark position from bookmark-table.
     448             :     sal_Int32 FindPos_Bkmk( const SwPosition& rPos ) const;
     449             :     // Build a bookmark table, which is sort by the node position. The
     450             :     // OtherPos of the bookmarks also inserted.
     451             :     void CreateBookmarkTbl();
     452             :     // Search alle Bookmarks in the range and return it in the Array.
     453             :     sal_uInt16 GetBookmarks( const SwCntntNode& rNd,
     454             :                         xub_StrLen nStt, xub_StrLen nEnd,
     455             :                         std::vector< const ::sw::mark::IMark* >& rArr );
     456             : 
     457             :     // Create new PaM at position.
     458             :     static SwPaM * NewSwPaM(SwDoc & rDoc,
     459             :                             sal_uLong const nStartIdx, sal_uLong const nEndIdx);
     460             : 
     461             :     // If applicable copy a local file into internet.
     462             :     sal_Bool CopyLocalFileToINet( String& rFileNm );
     463             : 
     464             : 
     465             :     // Stream-specific routines. Do not use in storage-writer!
     466             : 
     467             :     // Optimizing output on stream.
     468             :     SvStream& OutLong( SvStream& rStrm, long nVal );
     469             :     SvStream& OutULong( SvStream& rStrm, sal_uLong nVal );
     470             : 
     471             :     inline SvStream& OutLong( long nVal )       { return OutLong( Strm(), nVal ); }
     472           0 :     inline SvStream& OutULong( sal_uLong nVal )     { return OutULong( Strm(), nVal ); }
     473             : 
     474             :     void SetStream(SvStream *const pStream);
     475             :     SvStream& Strm();
     476             : 
     477           0 :     void SetOrganizerMode( sal_Bool bSet ) { bOrganizerMode = bSet; }
     478             : };
     479             : 
     480             : #ifndef SW_DECL_WRITER_DEFINED
     481             : #define SW_DECL_WRITER_DEFINED
     482         251 : SV_DECL_REF(Writer)
     483             : #endif
     484         131 : SV_IMPL_REF(Writer)
     485             : 
     486             : // Base class for all storage writers.
     487           6 : class SW_DLLPUBLIC StgWriter : public Writer
     488             : {
     489             : protected:
     490             :     String aFltName;
     491             :     SotStorageRef pStg;
     492             :     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
     493             : 
     494             :     // Create error at call.
     495             :     virtual sal_uLong WriteStream();
     496             :     virtual sal_uLong WriteStorage() = 0;
     497             :     virtual sal_uLong WriteMedium( SfxMedium& ) = 0;
     498             : 
     499             :     using Writer::Write;
     500             : 
     501             : public:
     502           6 :     StgWriter() : Writer() {}
     503             : 
     504             :     virtual sal_Bool IsStgWriter() const;
     505             : 
     506             :     virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 );
     507             :     virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 );
     508             : 
     509          31 :     SotStorage& GetStorage() const       { return *pStg; }
     510             : };
     511             : 
     512             : 
     513             : // Interface class for general access on special writers.
     514             : 
     515          23 : class SwWriter
     516             : {
     517             :     SvStream* pStrm;
     518             :     SotStorageRef pStg;
     519             :     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
     520             :     SfxMedium* pMedium;
     521             : 
     522             :     SwPaM* pOutPam;
     523             :     SwCrsrShell *pShell;
     524             :     SwDoc &rDoc;
     525             : 
     526             :     sal_Bool bWriteAll;
     527             : 
     528             : public:
     529             :     sal_uLong Write( WriterRef& rxWriter, const String* = 0);
     530             : 
     531             :     SwWriter( SvStream&, SwCrsrShell &,sal_Bool bWriteAll = sal_False );
     532             :     SwWriter( SvStream&, SwDoc & );
     533             :     SwWriter( SvStream&, SwPaM &, sal_Bool bWriteAll = sal_False );
     534             : 
     535             :     SwWriter( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, SwDoc& );
     536             : 
     537             :     SwWriter( SfxMedium&, SwCrsrShell &,sal_Bool bWriteAll = sal_False );
     538             :     SwWriter( SfxMedium&, SwDoc & );
     539             : };
     540             : 
     541             : 
     542             : 
     543             : typedef Reader* (*FnGetReader)();
     544             : typedef void (*FnGetWriter)(const String&, const String& rBaseURL, WriterRef&);
     545             : sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, sal_Bool, const String& );
     546             : sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
     547             : 
     548             : struct SwReaderWriterEntry
     549             : {
     550             :     Reader* pReader;
     551             :     FnGetReader fnGetReader;
     552             :     FnGetWriter fnGetWriter;
     553             :     sal_Bool bDelReader;
     554             : 
     555         110 :     SwReaderWriterEntry( const FnGetReader fnReader, const FnGetWriter fnWriter, sal_Bool bDel )
     556         110 :         : pReader( NULL ), fnGetReader( fnReader ), fnGetWriter( fnWriter ), bDelReader( bDel )
     557         110 :     {}
     558             : 
     559             :     /// Get access to the reader.
     560             :     Reader* GetReader();
     561             : 
     562             :     /// Get access to the writer.
     563             :     void GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const;
     564             : };
     565             : 
     566             : namespace SwReaderWriter
     567             : {
     568             :     /// Return reader based on ReaderWriterEnum.
     569             :     Reader* GetReader( ReaderWriterEnum eReader );
     570             : 
     571             :     /// Return reader based on the name.
     572             :     Reader* GetReader( const String& rFltName );
     573             : 
     574             :     /// Return writer based on the name.
     575             :     void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xWrt );
     576             : }
     577             : 
     578             : void GetRTFWriter( const String&, const String&, WriterRef& );
     579             : void GetASCWriter( const String&, const String&, WriterRef& );
     580             : void GetHTMLWriter( const String&, const String&, WriterRef& );
     581             : void GetXMLWriter( const String&, const String&, WriterRef& );
     582             : void GetWW8Writer( const String&, const String&, WriterRef& );
     583             : 
     584             : #endif
     585             : 
     586             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10