merged tag ooo/OOO330_m14
[LibreOffice.git] / sc / source / filter / inc / htmlexp.hxx
blob4cdf71b8610de9b74fca288170cf840aa9e888ce
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SC_HTMLEXP_HXX
29 #define SC_HTMLEXP_HXX
31 #include "global.hxx"
32 #include <rtl/textenc.h>
33 #include <tools/gen.hxx>
34 #include <tools/color.hxx>
36 #include "expbase.hxx"
39 class ScDocument;
40 class SfxItemSet;
41 class SdrPage;
42 class Graphic;
43 class SdrObject;
44 class OutputDevice;
45 class ScDrawLayer;
46 class SvStringsSortDtor;
47 class ScEditCell;
48 class SvxBorderLine;
50 struct ScHTMLStyle
51 { // Defaults aus StyleSheet
52 Color aBackgroundColor;
53 String aFontFamilyName;
54 UINT32 nFontHeight; // Item-Value
55 USHORT nFontSizeNumber; // HTML value 1-7
56 BYTE nDefaultScriptType; // Font values are valid for the default script type
57 BOOL bInitialized;
59 ScHTMLStyle() : nFontHeight(0), nFontSizeNumber(2), nDefaultScriptType(0),
60 bInitialized(0) {}
62 const ScHTMLStyle& operator=( const ScHTMLStyle& r )
64 aBackgroundColor = r.aBackgroundColor;
65 aFontFamilyName = r.aFontFamilyName;
66 nFontHeight = r.nFontHeight;
67 nFontSizeNumber = r.nFontSizeNumber;
68 nDefaultScriptType = r.nDefaultScriptType;
69 bInitialized = r.bInitialized;
70 return *this;
74 struct ScHTMLGraphEntry
76 ScRange aRange; // ueberlagerter Zellbereich
77 Size aSize; // Groesse in Pixeln
78 Size aSpace; // Spacing in Pixeln
79 SdrObject* pObject;
80 BOOL bInCell; // ob in Zelle ausgegeben wird
81 BOOL bWritten;
83 ScHTMLGraphEntry( SdrObject* pObj, const ScRange& rRange,
84 const Size& rSize, BOOL bIn, const Size& rSpace ) :
85 aRange( rRange ), aSize( rSize ), aSpace( rSpace ),
86 pObject( pObj ), bInCell( bIn ), bWritten( FALSE ) {}
89 DECLARE_LIST( ScHTMLGraphList, ScHTMLGraphEntry* )
91 #define SC_HTML_FONTSIZES 7
92 const short nIndentMax = 23;
94 class ScHTMLExport : public ScExportBase
96 // default HtmlFontSz[1-7]
97 static const USHORT nDefaultFontSize[SC_HTML_FONTSIZES];
98 // HtmlFontSz[1-7] in s*3.ini [user]
99 static USHORT nFontSize[SC_HTML_FONTSIZES];
100 static const char* pFontSizeCss[SC_HTML_FONTSIZES];
101 static const USHORT nCellSpacing;
102 static const sal_Char __FAR_DATA sIndentSource[];
104 ScHTMLGraphList aGraphList;
105 ScHTMLStyle aHTMLStyle;
106 String aBaseURL;
107 String aStreamPath;
108 String aCId; // Content-Id fuer Mail-Export
109 OutputDevice* pAppWin; // fuer Pixelei
110 SvStringsSortDtor* pSrcArr; // fuer CopyLocalFileToINet
111 SvStringsSortDtor* pDestArr;
112 String aNonConvertibleChars; // collect nonconvertible characters
113 rtl_TextEncoding eDestEnc;
114 SCTAB nUsedTables;
115 short nIndent;
116 sal_Char sIndent[nIndentMax+1];
117 BOOL bAll; // ganzes Dokument
118 BOOL bTabHasGraphics;
119 BOOL bTabAlignedLeft;
120 BOOL bCalcAsShown;
121 BOOL bCopyLocalFileToINet;
122 BOOL bTableDataWidth;
123 BOOL bTableDataHeight;
125 const SfxItemSet& PageDefaults( SCTAB nTab );
127 void WriteBody();
128 void WriteHeader();
129 void WriteOverview();
130 void WriteTables();
131 void WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
132 void WriteGraphEntry( ScHTMLGraphEntry* );
133 void WriteImage( String& rLinkName,
134 const Graphic&, const ByteString& rImgOptions,
135 ULONG nXOutFlags = 0 );
136 // nXOutFlags fuer XOutBitmap::WriteGraphic
138 // write to stream if and only if URL fields in edit cell
139 BOOL WriteFieldText( const ScEditCell* pCell );
141 // kopiere ggfs. eine lokale Datei ins Internet
142 BOOL CopyLocalFileToINet( String& rFileNm,
143 const String& rTargetNm, BOOL bFileToFile = FALSE );
144 BOOL HasCId() { return aCId.Len() > 0; }
145 void MakeCIdURL( String& rURL );
147 void PrepareGraphics( ScDrawLayer*, SCTAB nTab,
148 SCCOL nStartCol, SCROW nStartRow,
149 SCCOL nEndCol, SCROW nEndRow );
150 void FillGraphList( const SdrPage*, SCTAB nTab,
151 SCCOL nStartCol, SCROW nStartRow,
152 SCCOL nEndCol, SCROW nEndRow );
154 void BorderToStyle( ByteString& rOut, const char* pBorderName,
155 const SvxBorderLine* pLine, bool& bInsertSemicolon );
157 USHORT GetFontSizeNumber( USHORT nHeight );
158 const char* GetFontSizeCss( USHORT nHeight );
159 USHORT ToPixel( USHORT nTwips );
160 Size MMToPixel( const Size& r100thMMSize );
161 void IncIndent( short nVal );
162 const sal_Char* GetIndentStr() { return sIndent; }
164 public:
165 ScHTMLExport( SvStream&, const String&, ScDocument*, const ScRange&,
166 BOOL bAll, const String& aStreamPath );
167 virtual ~ScHTMLExport();
168 ULONG Write();
169 const String& GetNonConvertibleChars() const
170 { return aNonConvertibleChars; }
173 #endif