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