LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/inc - htmlexp.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 9 0.0 %
Date: 2012-12-27 Functions: 0 6 0.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 SC_HTMLEXP_HXX
      21             : #define SC_HTMLEXP_HXX
      22             : 
      23             : #include "global.hxx"
      24             : #include <rtl/textenc.h>
      25             : #include <tools/gen.hxx>
      26             : #include <tools/color.hxx>
      27             : #include <boost/ptr_container/ptr_vector.hpp>
      28             : #include <boost/scoped_ptr.hpp>
      29             : 
      30             : #include "expbase.hxx"
      31             : 
      32             : 
      33             : class ScDocument;
      34             : class SfxItemSet;
      35             : class SdrPage;
      36             : class Graphic;
      37             : class SdrObject;
      38             : class OutputDevice;
      39             : class ScDrawLayer;
      40             : class ScEditCell;
      41             : 
      42             : namespace editeng { class SvxBorderLine; }
      43             : 
      44           0 : struct ScHTMLStyle
      45             : {   // Defaults aus StyleSheet
      46             :     Color               aBackgroundColor;
      47             :     String              aFontFamilyName;
      48             :     sal_uInt32              nFontHeight;        // Item-Value
      49             :     sal_uInt16              nFontSizeNumber;    // HTML value 1-7
      50             :     sal_uInt8                nDefaultScriptType; // Font values are valid for the default script type
      51             :     sal_Bool                bInitialized;
      52             : 
      53           0 :     ScHTMLStyle() : nFontHeight(0), nFontSizeNumber(2), nDefaultScriptType(0),
      54           0 :         bInitialized(0) {}
      55             : 
      56             :     const ScHTMLStyle& operator=( const ScHTMLStyle& r )
      57             :         {
      58             :             aBackgroundColor    = r.aBackgroundColor;
      59             :             aFontFamilyName     = r.aFontFamilyName;
      60             :             nFontHeight         = r.nFontHeight;
      61             :             nFontSizeNumber     = r.nFontSizeNumber;
      62             :             nDefaultScriptType  = r.nDefaultScriptType;
      63             :             bInitialized        = r.bInitialized;
      64             :             return *this;
      65             :         }
      66             : };
      67             : 
      68             : struct ScHTMLGraphEntry
      69             : {
      70             :     ScRange             aRange;         // ueberlagerter Zellbereich
      71             :     Size                aSize;          // Groesse in Pixeln
      72             :     Size                aSpace;         // Spacing in Pixeln
      73             :     SdrObject*          pObject;
      74             :     sal_Bool                bInCell;        // ob in Zelle ausgegeben wird
      75             :     sal_Bool                bWritten;
      76             : 
      77           0 :     ScHTMLGraphEntry( SdrObject* pObj, const ScRange& rRange,
      78             :         const Size& rSize,  sal_Bool bIn, const Size& rSpace ) :
      79             :         aRange( rRange ), aSize( rSize ), aSpace( rSpace ),
      80           0 :         pObject( pObj ), bInCell( bIn ), bWritten( false ) {}
      81             : };
      82             : 
      83             : 
      84             : #define SC_HTML_FONTSIZES 7
      85             : const short nIndentMax = 23;
      86             : 
      87             : class ScHTMLExport : public ScExportBase
      88             : {
      89             :     // default HtmlFontSz[1-7]
      90             :     static const sal_uInt16 nDefaultFontSize[SC_HTML_FONTSIZES];
      91             :     // HtmlFontSz[1-7] in s*3.ini [user]
      92             :     static sal_uInt16       nFontSize[SC_HTML_FONTSIZES];
      93             :     static const char*  pFontSizeCss[SC_HTML_FONTSIZES];
      94             :     static const sal_uInt16 nCellSpacing;
      95             :     static const sal_Char sIndentSource[];
      96             : 
      97             :     boost::ptr_vector< ScHTMLGraphEntry > aGraphList;
      98             :     ScHTMLStyle         aHTMLStyle;
      99             :     String              aBaseURL;
     100             :     String              aStreamPath;
     101             :     String              aCId;           // Content-Id fuer Mail-Export
     102             :     OutputDevice*       pAppWin;        // fuer Pixelei
     103             :     boost::scoped_ptr< std::map<String, String> >  pFileNameMap;        // fuer CopyLocalFileToINet
     104             :     String              aNonConvertibleChars;   // collect nonconvertible characters
     105             :     rtl_TextEncoding    eDestEnc;
     106             :     SCTAB               nUsedTables;
     107             :     short               nIndent;
     108             :     sal_Char            sIndent[nIndentMax+1];
     109             :     sal_Bool                bAll;           // ganzes Dokument
     110             :     sal_Bool                bTabHasGraphics;
     111             :     sal_Bool                bTabAlignedLeft;
     112             :     sal_Bool                bCalcAsShown;
     113             :     sal_Bool                bCopyLocalFileToINet;
     114             :     sal_Bool                bTableDataWidth;
     115             :     sal_Bool                bTableDataHeight;
     116             : 
     117             :     const SfxItemSet&   PageDefaults( SCTAB nTab );
     118             : 
     119             :     void                WriteBody();
     120             :     void                WriteHeader();
     121             :     void                WriteOverview();
     122             :     void                WriteTables();
     123             :     void                WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
     124             :     void                WriteGraphEntry( ScHTMLGraphEntry* );
     125             :     void                WriteImage( String& rLinkName,
     126             :                                     const Graphic&, const rtl::OString& rImgOptions,
     127             :                                     sal_uLong nXOutFlags = 0 );
     128             :                             // nXOutFlags fuer XOutBitmap::WriteGraphic
     129             : 
     130             :                         // write to stream if and only if URL fields in edit cell
     131             :     sal_Bool                WriteFieldText( const ScEditCell* pCell );
     132             : 
     133             :                         // kopiere ggfs. eine lokale Datei ins Internet
     134             :     sal_Bool                CopyLocalFileToINet( String& rFileNm,
     135             :                             const String& rTargetNm, sal_Bool bFileToFile = false );
     136           0 :     sal_Bool                HasCId() { return aCId.Len() > 0; }
     137             :     void                MakeCIdURL( String& rURL );
     138             : 
     139             :     void                PrepareGraphics( ScDrawLayer*, SCTAB nTab,
     140             :                                         SCCOL nStartCol, SCROW nStartRow,
     141             :                                         SCCOL nEndCol, SCROW nEndRow );
     142             :     void                FillGraphList( const SdrPage*, SCTAB nTab,
     143             :                                         SCCOL nStartCol, SCROW nStartRow,
     144             :                                         SCCOL nEndCol, SCROW nEndRow );
     145             : 
     146             :     rtl::OString BorderToStyle(const char* pBorderName,
     147             :         const ::editeng::SvxBorderLine* pLine, bool& bInsertSemicolon);
     148             : 
     149             :     sal_uInt16              GetFontSizeNumber( sal_uInt16 nHeight );
     150             :     const char*         GetFontSizeCss( sal_uInt16 nHeight );
     151             :     sal_uInt16              ToPixel( sal_uInt16 nTwips );
     152             :     Size                MMToPixel( const Size& r100thMMSize );
     153             :     void                IncIndent( short nVal );
     154           0 :     const sal_Char*         GetIndentStr() { return sIndent; }
     155             : 
     156             : public:
     157             :                         ScHTMLExport( SvStream&, const String&, ScDocument*, const ScRange&,
     158             :                                         sal_Bool bAll, const String& aStreamPath );
     159             :     virtual             ~ScHTMLExport();
     160             :     sal_uLong               Write();
     161           0 :     const String&       GetNonConvertibleChars() const
     162           0 :                             { return aNonConvertibleChars; }
     163             : };
     164             : 
     165             : #endif
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10