LCOV - code coverage report
Current view: top level - sw/inc - iodetect.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 6 100.0 %
Date: 2015-06-13 12:38:46 Functions: 3 3 100.0 %
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             : 
      20             : #ifndef INCLUDED_SW_INC_IODETECT_HXX
      21             : #define INCLUDED_SW_INC_IODETECT_HXX
      22             : 
      23             : #include <osl/endian.h>
      24             : #include <rtl/ustring.hxx>
      25             : #include <sfx2/docfilt.hxx>
      26             : #include <sfx2/docfile.hxx>
      27             : #include <sfx2/fcontnr.hxx>
      28             : #include <swdllapi.h>
      29             : 
      30             : #define FILTER_RTF      "RTF"       ///< RTF filter
      31             : #define sRtfWH          "WH_RTF"
      32             : #define FILTER_TEXT     "TEXT"      ///< text filter with default codeset
      33             : #define FILTER_BAS      "BAS"       ///< StarBasic (identical to ANSI)
      34             : #define FILTER_WW8      "CWW8"      ///< WinWord 97 filter
      35             : #define FILTER_TEXT_DLG "TEXT_DLG"  ///< text filter with encoding dialog
      36             : #define FILTER_XML      "CXML"      ///< XML filter
      37             : #define FILTER_XMLV     "CXMLV"     ///< XML filter
      38             : #define FILTER_XMLVW    "CXMLVWEB"  ///< XML filter
      39             : #define sHTML           "HTML"
      40             : #define sWW5            "WW6"
      41             : #define sWW6            "CWW6"
      42             : 
      43             : #define sSWRITER        "swriter"
      44             : #define sSWRITERWEB     "swriter/web"
      45             : 
      46         590 : struct SwIoDetect
      47             : {
      48             :     const OUString sName;
      49             : 
      50         590 :     SwIoDetect(const OUString &rN)
      51         590 :         : sName(rN)
      52             :     {
      53         590 :     }
      54             : 
      55       73556 :     bool IsFilter( const OUString& rNm ) const
      56             :     {
      57       73556 :         return rNm.startsWith(sName);
      58             :     }
      59             : };
      60             : 
      61             : enum ReaderWriterEnum {
      62             :     READER_WRITER_RTF,
      63             :     READER_WRITER_BAS,
      64             :     READER_WRITER_WW6,
      65             :     READER_WRITER_WW8,
      66             :     READER_WRITER_RTF_WH,
      67             :     READER_WRITER_HTML,
      68             :     READER_WRITER_WW5,
      69             :     READER_WRITER_XML,
      70             :     READER_WRITER_TEXT_DLG,
      71             :     READER_WRITER_TEXT,
      72             :     MAXFILTER
      73             : };
      74             : 
      75             : extern SwIoDetect aFilterDetect[];
      76             : 
      77             : /** The following class is a wrapper for basic i/o functions of Writer 3.0.
      78             :  Everything is static. All filter names mentioned are Writer-internal
      79             :  names, i.e. the names in front of the equality sign in INSTALL.INI, like SWG
      80             :  or ASCII.*/
      81             : 
      82             : class SwIoSystem
      83             : {
      84             : public:
      85             :     /// find for an internal format name the corresponding filter entry
      86             :     SW_DLLPUBLIC static const SfxFilter*
      87             :         GetFilterOfFormat( const OUString& rFormat,
      88             :             const SfxFilterContainer* pCnt = 0 );
      89             : 
      90             :     /** Detect for the given file which filter should be used. The filter name
      91             :      is returned. If no filter could be found, the name of the ASCII filter
      92             :      is returned! */
      93             :     static const SfxFilter* GetFileFilter(const OUString& rFileName);
      94             : 
      95             :     static bool IsValidStgFilter( SotStorage& , const SfxFilter& );
      96             :     static bool IsValidStgFilter( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const SfxFilter& rFilter);
      97             : 
      98             :     static bool IsDetectableText( const sal_Char* pBuf, sal_uLong &rLen,
      99             :             rtl_TextEncoding *pCharSet=0, bool *pSwap=0, LineEnd *pLineEnd=0, bool bEncodedFilter = false );
     100             : 
     101             :     static const OUString GetSubStorageName( const SfxFilter& rFltr );
     102             : };
     103             : 
     104             : #endif
     105             : 
     106             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11