Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <com/sun/star/text/HoriOrientation.hpp>
31 : : #include <com/sun/star/text/VertOrientation.hpp>
32 : : #include <com/sun/star/text/RelOrientation.hpp>
33 : : #include <comphelper/string.hxx>
34 : : #include <svx/svxids.hrc>
35 : : #include "hintids.hxx"
36 : : #include <tools/string.hxx>
37 : : #include <svl/urihelper.hxx>
38 : : #include <vcl/svapp.hxx>
39 : : #include <vcl/wrkwin.hxx>
40 : : #include <svtools/htmlkywd.hxx>
41 : : #include <svtools/htmlout.hxx>
42 : : #include <svtools/imap.hxx>
43 : : #include <svtools/imapobj.hxx>
44 : : #include <svtools/htmlcfg.hxx>
45 : : #include <svx/xoutbmp.hxx>
46 : : #include <editeng/boxitem.hxx>
47 : : #include <editeng/lrspitem.hxx>
48 : : #include <editeng/ulspitem.hxx>
49 : : #include <editeng/brshitem.hxx>
50 : :
51 : :
52 : : #include <fmtanchr.hxx>
53 : : #include <fmtornt.hxx>
54 : : #include <fmturl.hxx>
55 : : #include <fmtfsize.hxx>
56 : : #include <fmtclds.hxx>
57 : : #include <fmtcntnt.hxx>
58 : : #include <fmtsrnd.hxx>
59 : : #include <fmtinfmt.hxx>
60 : : #include <txtinet.hxx>
61 : : #include "frmatr.hxx"
62 : : #include <grfatr.hxx>
63 : : #include <flypos.hxx>
64 : : #include <docary.hxx>
65 : : #include <ndgrf.hxx>
66 : :
67 : : #include "doc.hxx"
68 : : #include "ndtxt.hxx"
69 : : #include "pam.hxx"
70 : : #include "swerror.h"
71 : : #include "frmfmt.hxx"
72 : : #include "wrthtml.hxx"
73 : : #include "css1kywd.hxx"
74 : : #include "htmlfly.hxx"
75 : :
76 : : using namespace ::com::sun::star;
77 : :
78 : : ////////////////////////////////////////////////////////////
79 : :
80 : : const sal_uLong HTML_FRMOPTS_IMG_ALL =
81 : : HTML_FRMOPT_ALT |
82 : : HTML_FRMOPT_SIZE |
83 : : HTML_FRMOPT_ANYSIZE |
84 : : HTML_FRMOPT_BORDER |
85 : : HTML_FRMOPT_NAME;
86 : : const sal_uLong HTML_FRMOPTS_IMG_CNTNR =
87 : : HTML_FRMOPTS_IMG_ALL |
88 : : HTML_FRMOPT_ABSSIZE;
89 : : const sal_uLong HTML_FRMOPTS_IMG =
90 : : HTML_FRMOPTS_IMG_ALL |
91 : : HTML_FRMOPT_ALIGN |
92 : : HTML_FRMOPT_SPACE |
93 : : HTML_FRMOPT_BRCLEAR;
94 : : const sal_uLong HTML_FRMOPTS_IMG_CSS1 =
95 : : HTML_FRMOPT_S_ALIGN |
96 : : HTML_FRMOPT_S_SPACE;
97 : :
98 : : const sal_uLong HTML_FRMOPTS_DIV =
99 : : HTML_FRMOPT_ID |
100 : : HTML_FRMOPT_S_ALIGN |
101 : : HTML_FRMOPT_S_SIZE |
102 : : HTML_FRMOPT_ANYSIZE |
103 : : HTML_FRMOPT_ABSSIZE |
104 : : HTML_FRMOPT_S_SPACE |
105 : : HTML_FRMOPT_S_BORDER |
106 : : HTML_FRMOPT_S_BACKGROUND |
107 : : HTML_FRMOPT_BRCLEAR |
108 : : HTML_FRMOPT_DIR;
109 : :
110 : : const sal_uLong HTML_FRMOPTS_MULTICOL =
111 : : HTML_FRMOPT_ID |
112 : : HTML_FRMOPT_WIDTH |
113 : : HTML_FRMOPT_ANYSIZE |
114 : : HTML_FRMOPT_ABSSIZE |
115 : : HTML_FRMOPT_DIR;
116 : : const sal_uLong HTML_FRMOPTS_MULTICOL_CNTNR =
117 : : HTML_FRMOPTS_MULTICOL;
118 : : const sal_uLong HTML_FRMOPTS_MULTICOL_CSS1 =
119 : : HTML_FRMOPT_S_ALIGN |
120 : : HTML_FRMOPT_S_SIZE |
121 : : HTML_FRMOPT_S_SPACE |
122 : : HTML_FRMOPT_S_BORDER|
123 : : HTML_FRMOPT_S_BACKGROUND;
124 : :
125 : : const sal_uLong HTML_FRMOPTS_SPACER =
126 : : HTML_FRMOPT_ALIGN |
127 : : HTML_FRMOPT_SIZE |
128 : : HTML_FRMOPT_ANYSIZE |
129 : : HTML_FRMOPT_BRCLEAR |
130 : : HTML_FRMOPT_MARGINSIZE |
131 : : HTML_FRMOPT_ABSSIZE;
132 : :
133 : : const sal_uLong HTML_FRMOPTS_CNTNR =
134 : : HTML_FRMOPT_S_ALIGN |
135 : : HTML_FRMOPT_S_SPACE |
136 : : HTML_FRMOPT_S_WIDTH |
137 : : HTML_FRMOPT_ANYSIZE |
138 : : HTML_FRMOPT_ABSSIZE |
139 : : HTML_FRMOPT_S_PIXSIZE;
140 : :
141 : :
142 : : static Writer& OutHTML_FrmFmtTableNode( Writer& rWrt, const SwFrmFmt& rFrmFmt );
143 : : static Writer& OutHTML_FrmFmtAsMulticol( Writer& rWrt, const SwFrmFmt& rFmt,
144 : : sal_Bool bInCntnr );
145 : : static Writer& OutHTML_FrmFmtAsSpacer( Writer& rWrt, const SwFrmFmt& rFmt );
146 : : static Writer& OutHTML_FrmFmtAsDivOrSpan( Writer& rWrt,
147 : : const SwFrmFmt& rFrmFmt, sal_Bool bSpan );
148 : : static Writer& OutHTML_FrmFmtAsImage( Writer& rWrt, const SwFrmFmt& rFmt,
149 : : sal_Bool bInCntnr );
150 : :
151 : : static Writer& OutHTML_FrmFmtGrfNode( Writer& rWrt, const SwFrmFmt& rFmt,
152 : : sal_Bool bInCntnr );
153 : :
154 : : static Writer& OutHTML_FrmFmtAsMarquee( Writer& rWrt, const SwFrmFmt& rFrmFmt,
155 : : const SdrObject& rSdrObj );
156 : : //-----------------------------------------------------------------------
157 : :
158 : : extern HTMLOutEvent aAnchorEventTable[];
159 : :
160 : : static HTMLOutEvent aImageEventTable[] =
161 : : {
162 : : { OOO_STRING_SVTOOLS_HTML_O_SDonload, OOO_STRING_SVTOOLS_HTML_O_onload, SVX_EVENT_IMAGE_LOAD },
163 : : { OOO_STRING_SVTOOLS_HTML_O_SDonabort, OOO_STRING_SVTOOLS_HTML_O_onabort, SVX_EVENT_IMAGE_ABORT },
164 : : { OOO_STRING_SVTOOLS_HTML_O_SDonerror, OOO_STRING_SVTOOLS_HTML_O_onerror, SVX_EVENT_IMAGE_ERROR },
165 : : { 0, 0, 0 }
166 : : };
167 : :
168 : : static HTMLOutEvent aIMapEventTable[] =
169 : : {
170 : : { OOO_STRING_SVTOOLS_HTML_O_SDonmouseover, OOO_STRING_SVTOOLS_HTML_O_onmouseover, SFX_EVENT_MOUSEOVER_OBJECT },
171 : : { OOO_STRING_SVTOOLS_HTML_O_SDonmouseout, OOO_STRING_SVTOOLS_HTML_O_onmouseout, SFX_EVENT_MOUSEOUT_OBJECT },
172 : : { 0, 0, 0 }
173 : : };
174 : :
175 : :
176 : :
177 : 0 : sal_uInt16 SwHTMLWriter::GuessFrmType( const SwFrmFmt& rFrmFmt,
178 : : const SdrObject*& rpSdrObj )
179 : : {
180 : : SwHTMLFrmType eType;
181 : :
182 [ # # ]: 0 : if( RES_DRAWFRMFMT == rFrmFmt.Which() )
183 : : {
184 : : // Als Default irgendein Zeichen-Objekt
185 : 0 : eType = HTML_FRMTYPE_DRAW;
186 : :
187 : : const SdrObject *pObj =
188 : 0 : SwHTMLWriter::GetMarqueeTextObj( (const SwDrawFrmFmt &)rFrmFmt );
189 [ # # ]: 0 : if( pObj )
190 : : {
191 : : // Laufschrift
192 : 0 : rpSdrObj = pObj;
193 : 0 : eType = HTML_FRMTYPE_MARQUEE;
194 : : }
195 : : else
196 : : {
197 : 0 : pObj = GetHTMLControl( (const SwDrawFrmFmt &)rFrmFmt );
198 : :
199 [ # # ]: 0 : if( pObj )
200 : : {
201 : : // Form-Control
202 : 0 : rpSdrObj = pObj;
203 : 0 : eType = HTML_FRMTYPE_CONTROL;
204 : : }
205 : : }
206 : : }
207 : : else
208 : : {
209 : : // Als Default ein Textrahmen
210 : 0 : eType = HTML_FRMTYPE_TEXT;
211 : :
212 : 0 : const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt();
213 : 0 : sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex()+1;
214 : 0 : const SwNode* pNd = pDoc->GetNodes()[ nStt ];
215 : :
216 [ # # ]: 0 : if( pNd->IsGrfNode() )
217 : : {
218 : : // Grafik - Node
219 : 0 : eType = HTML_FRMTYPE_GRF;
220 : : }
221 [ # # ]: 0 : else if( pNd->IsOLENode() )
222 : : {
223 : : // Applet, Plugin, Floating-Frame
224 : 0 : eType = (SwHTMLFrmType)GuessOLENodeFrmType( *pNd );
225 : : }
226 : : else
227 : : {
228 [ # # ][ # # ]: 0 : sal_uLong nEnd = pDoc->GetNodes()[nStt-1]->EndOfSectionIndex();
229 : :
230 : : const SfxPoolItem* pItem;
231 : 0 : const SfxItemSet& rItemSet = rFrmFmt.GetAttrSet();
232 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == rItemSet.GetItemState( RES_COL,
[ # # ]
233 [ # # ]: 0 : sal_True, &pItem ) &&
234 [ # # ]: 0 : ((const SwFmtCol *)pItem)->GetNumCols() > 1 )
235 : : {
236 : : // spaltiger Rahmen
237 : 0 : eType = HTML_FRMTYPE_MULTICOL;
238 : : }
239 [ # # ]: 0 : else if( pNd->IsTableNode() )
240 : : {
241 : 0 : const SwTableNode *pTblNd = pNd->GetTableNode();
242 : 0 : sal_uLong nTblEnd = pTblNd->EndOfSectionIndex();
243 : :
244 [ # # ]: 0 : if( nTblEnd+1 == nEnd )
245 : : {
246 : : // Tabelle
247 : 0 : eType = HTML_FRMTYPE_TABLE;
248 : : }
249 [ # # ]: 0 : else if( nTblEnd+2 == nEnd )
250 : : {
251 : : // Tabelle mit Unterschrft
252 : 0 : eType = HTML_FRMTYPE_TABLE_CAP;
253 : : }
254 : : }
255 [ # # ]: 0 : else if( pNd->IsTxtNode() )
256 : : {
257 : 0 : const SwTxtNode *pTxtNd = pNd->GetTxtNode();
258 : :
259 : 0 : sal_Bool bEmpty = sal_False;
260 [ # # ][ # # ]: 0 : if( nStt==nEnd-1 && !pTxtNd->Len() )
[ # # ][ # # ]
261 : : {
262 : : // leerer Rahmen? Nur wenn kein Rahmen am
263 : : // Text- oder Start-Node verankert ist.
264 : 0 : bEmpty = sal_True;
265 [ # # ]: 0 : if( pHTMLPosFlyFrms )
266 : : {
267 [ # # ]: 0 : for( sal_uInt16 i=0; i<pHTMLPosFlyFrms->size(); i++ )
268 : : {
269 [ # # ]: 0 : sal_uLong nIdx = (*pHTMLPosFlyFrms)[i]
270 : 0 : ->GetNdIndex().GetIndex();
271 [ # # ][ # # ]: 0 : bEmpty = (nIdx != nStt) && (nIdx != nStt-1);
272 [ # # ][ # # ]: 0 : if( !bEmpty || nIdx > nStt )
273 : 0 : break;
274 : : }
275 : : }
276 : : }
277 [ # # ]: 0 : if( bEmpty )
278 : : {
279 [ # # ]: 0 : const SvxBrushItem& rBrush = rFrmFmt.GetBackground();
280 : : /// background is not empty, if it has a background graphic
281 : : /// or its background color is not "no fill"/"auto fill".
282 [ # # # # ]: 0 : if( GPOS_NONE != rBrush.GetGraphicPos() ||
[ # # ]
283 [ # # ]: 0 : rBrush.GetColor() != COL_TRANSPARENT )
284 : 0 : bEmpty = sal_False;
285 : : }
286 [ # # ]: 0 : if( bEmpty )
287 : : {
288 : : // leerer Rahmen
289 : 0 : eType = HTML_FRMTYPE_EMPTY;
290 : : }
291 [ # # ][ # # ]: 0 : else if( pDoc->GetNodes()[nStt+1]->IsTableNode() )
[ # # ]
292 : : {
293 : : const SwTableNode *pTblNd =
294 [ # # ][ # # ]: 0 : pDoc->GetNodes()[nStt+1]->GetTableNode();
295 [ # # ]: 0 : if( pTblNd->EndOfSectionIndex()+1 == nEnd )
296 : : {
297 : : // Tabelle mit Ueberschrift
298 : 0 : eType = HTML_FRMTYPE_TABLE_CAP;
299 : : }
300 : : }
301 : : }
302 : : }
303 : : }
304 : :
305 : 0 : return static_cast< sal_uInt16 >(eType);
306 : : }
307 : :
308 : 2 : void SwHTMLWriter::CollectFlyFrms()
309 : : {
310 : : OSL_ENSURE( HTML_CFG_MAX+1 == MAX_BROWSERS,
311 : : "number of browser configurations has changed" );
312 : :
313 [ + - ]: 2 : SwPosFlyFrms aFlyPos;
314 [ - + ][ + - ]: 2 : pDoc->GetAllFlyFmts( aFlyPos, bWriteAll ? 0 : pCurPam, sal_True );
315 : :
316 [ # # ][ + - ]: 2 : for(SwPosFlyFrms::iterator it = aFlyPos.begin(); it != aFlyPos.end(); ++it)
[ - + ]
317 : : {
318 [ # # ]: 0 : const SwFrmFmt& rFrmFmt = (*it)->GetFmt();
319 : 0 : const SdrObject *pSdrObj = 0;
320 : : const SwPosition *pAPos;
321 : : const SwCntntNode *pACNd;
322 [ # # ]: 0 : SwHTMLFrmType eType = (SwHTMLFrmType)GuessFrmType( rFrmFmt, pSdrObj );
323 : :
324 : : sal_uInt8 nMode;
325 [ # # ]: 0 : const SwFmtAnchor& rAnchor = rFrmFmt.GetAnchor();
326 [ # # ]: 0 : sal_Int16 eHoriRel = rFrmFmt.GetHoriOrient().GetRelationOrient();
327 [ # # # # ]: 0 : switch( rAnchor.GetAnchorId() )
328 : : {
329 : : case FLY_AT_PAGE:
330 : : case FLY_AT_FLY:
331 : 0 : nMode = aHTMLOutFrmPageFlyTable[eType][nExportMode];
332 : 0 : break;
333 : :
334 : : case FLY_AT_PARA:
335 : : // Absatz-gebundene Rahmen werden nur dann vor den
336 : : // Absatz geschrieben, wenn der Absatz einen Abstand
337 : : // hat.
338 [ # # ][ # # ]: 0 : if( text::RelOrientation::FRAME == eHoriRel &&
[ # # # # ]
[ # # ]
339 : : (pAPos = rAnchor.GetCntntAnchor()) != 0 &&
340 : 0 : (pACNd = pAPos->nNode.GetNode().GetCntntNode()) != 0 )
341 : : {
342 : : const SvxLRSpaceItem& rLRItem =
343 [ # # ]: 0 : (const SvxLRSpaceItem&)pACNd->GetAttr(RES_LR_SPACE);
344 [ # # ][ # # ]: 0 : if( rLRItem.GetTxtLeft() || rLRItem.GetRight() )
[ # # ]
345 : : {
346 : 0 : nMode = aHTMLOutFrmParaFrameTable[eType][nExportMode];
347 : 0 : break;
348 : : }
349 : : }
350 : 0 : nMode = aHTMLOutFrmParaPrtAreaTable[eType][nExportMode];
351 : 0 : break;
352 : :
353 : : case FLY_AT_CHAR:
354 [ # # ][ # # ]: 0 : if( text::RelOrientation::FRAME == eHoriRel || text::RelOrientation::PRINT_AREA == eHoriRel )
355 : 0 : nMode = aHTMLOutFrmParaPrtAreaTable[eType][nExportMode];
356 : : else
357 : 0 : nMode = aHTMLOutFrmParaOtherTable[eType][nExportMode];
358 : 0 : break;
359 : :
360 : : default:
361 : 0 : nMode = aHTMLOutFrmParaPrtAreaTable[eType][nExportMode];
362 : 0 : break;
363 : : }
364 : :
365 [ # # ]: 0 : if( !pHTMLPosFlyFrms )
366 [ # # ][ # # ]: 0 : pHTMLPosFlyFrms = new SwHTMLPosFlyFrms;
367 : :
368 : : SwHTMLPosFlyFrm *pNew =
369 [ # # ][ # # ]: 0 : new SwHTMLPosFlyFrm( **it, pSdrObj, nMode );
[ # # ]
370 [ # # ]: 0 : pHTMLPosFlyFrms->insert( pNew );
371 : 2 : }
372 : 2 : }
373 : :
374 : 2 : sal_Bool SwHTMLWriter::OutFlyFrm( sal_uLong nNdIdx, xub_StrLen nCntntIdx, sal_uInt8 nPos,
375 : : HTMLOutContext *pContext )
376 : : {
377 : 2 : sal_Bool bFlysLeft = sal_False; // Noch Flys an aktueller Node-Position da?
378 : :
379 : : // OutFlyFrm kan rekursiv aufgerufen werden. Deshalb muss man
380 : : // manchmal wieder von vorne anfangen, nachdem ein Fly ausgegeben
381 : : // wurde.
382 : 2 : sal_Bool bRestart = sal_True;
383 [ - + ][ # # ]: 2 : while( pHTMLPosFlyFrms && bRestart )
[ - + ]
384 : : {
385 : 0 : bFlysLeft = bRestart = sal_False;
386 : :
387 : : // suche nach dem Anfang der FlyFrames
388 : : sal_uInt16 i;
389 : :
390 [ # # # # ]: 0 : for( i = 0; i < pHTMLPosFlyFrms->size() &&
[ # # ]
391 : 0 : (*pHTMLPosFlyFrms)[i]->GetNdIndex().GetIndex() < nNdIdx; i++ )
392 : : ;
393 [ # # ]: 0 : for( ; !bRestart && i < pHTMLPosFlyFrms->size() &&
[ # # # # ]
[ # # ]
394 : 0 : (*pHTMLPosFlyFrms)[i]->GetNdIndex().GetIndex() == nNdIdx; i++ )
395 : : {
396 : 0 : SwHTMLPosFlyFrm *pPosFly = (*pHTMLPosFlyFrms)[i];
397 [ # # ][ # # : 0 : if( ( HTML_POS_ANY == nPos ||
# # # # ]
398 : 0 : pPosFly->GetOutPos() == nPos ) &&
399 : 0 : pPosFly->GetCntntIndex() == nCntntIdx )
400 : : {
401 : : // Erst entfernen ist wichtig, weil in tieferen
402 : : // Rekursionen evtl. weitere Eintraege oder das
403 : : // ganze Array geloscht werden koennte.
404 : 0 : pHTMLPosFlyFrms->erase(i);
405 : 0 : i--;
406 [ # # ]: 0 : if( pHTMLPosFlyFrms->empty() )
407 : : {
408 [ # # ]: 0 : delete pHTMLPosFlyFrms;
409 : 0 : pHTMLPosFlyFrms = 0;
410 : 0 : bRestart = sal_True; // nicht wirklich, nur raus
411 : : // aus der Schleife
412 : : }
413 : :
414 [ # # ]: 0 : if( pContext )
415 : : {
416 : 0 : HTMLOutFuncs::FlushToAscii(Strm(), *pContext );
417 : 0 : pContext = 0; // one time only
418 : : }
419 : :
420 : 0 : OutFrmFmt( pPosFly->GetOutMode(), pPosFly->GetFmt(),
421 : 0 : pPosFly->GetSdrObject() );
422 [ # # ]: 0 : switch( pPosFly->GetOutFn() )
423 : : {
424 : : case HTML_OUT_DIV:
425 : : case HTML_OUT_SPAN:
426 : : case HTML_OUT_MULTICOL:
427 : : case HTML_OUT_TBLNODE:
428 : 0 : bRestart = sal_True; // Hier wird's evtl rekursiv
429 : 0 : break;
430 : : }
431 : 0 : delete pPosFly;
432 : : }
433 : : else
434 : : {
435 : 0 : bFlysLeft = sal_True;
436 : : }
437 : : }
438 : : }
439 : :
440 : 2 : return bFlysLeft;
441 : : }
442 : :
443 : 0 : void SwHTMLWriter::OutFrmFmt( sal_uInt8 nMode, const SwFrmFmt& rFrmFmt,
444 : : const SdrObject *pSdrObject )
445 : : {
446 : 0 : sal_uInt8 nCntnrMode = SwHTMLPosFlyFrm::GetOutCntnr( nMode );
447 : 0 : sal_uInt8 nOutMode = SwHTMLPosFlyFrm::GetOutFn(nMode);
448 : 0 : const sal_Char *pCntnrStr = 0;
449 [ # # ]: 0 : if( HTML_CNTNR_NONE != nCntnrMode )
450 : : {
451 : :
452 [ # # ][ # # ]: 0 : if( bLFPossible && HTML_CNTNR_DIV == nCntnrMode )
453 [ # # ]: 0 : OutNewLine();
454 : :
455 : 0 : rtl::OStringBuffer sOut;
456 : : pCntnrStr = (HTML_CNTNR_DIV == nCntnrMode)
457 : : ? OOO_STRING_SVTOOLS_HTML_division
458 [ # # ]: 0 : : OOO_STRING_SVTOOLS_HTML_span;
459 [ # # ][ # # ]: 0 : sOut.append('<').append(pCntnrStr).append(' ')
[ # # ]
460 [ # # ][ # # ]: 0 : .append(OOO_STRING_SVTOOLS_HTML_O_class).append("=\"")
461 [ # # ][ # # ]: 0 : .append(sCSS1_class_abs_pos).append('\"');
462 [ # # ][ # # ]: 0 : Strm() << sOut.makeStringAndClear().getStr();
463 : :
464 : : // Fuer Nicht-Zeichenobekte eine Breite ausgeben
465 : 0 : sal_uLong nFrmFlags = HTML_FRMOPTS_CNTNR;
466 : :
467 : : // Fuer spaltige Rahmen koennen wir auch noch den Hintergrund ausgeben.
468 [ # # ]: 0 : if( HTML_OUT_MULTICOL == nOutMode )
469 : 0 : nFrmFlags |= HTML_FRMOPT_S_BACKGROUND|HTML_FRMOPT_S_BORDER;
470 : :
471 [ # # ]: 0 : if( IsHTMLMode( HTMLMODE_BORDER_NONE ) )
472 : 0 : nFrmFlags |= HTML_FRMOPT_S_NOBORDER;
473 [ # # ]: 0 : OutCSS1_FrmFmtOptions( rFrmFmt, nFrmFlags, pSdrObject );
474 [ # # ][ # # ]: 0 : Strm() << '>';
475 : :
476 [ # # ]: 0 : if( HTML_CNTNR_DIV == nCntnrMode )
477 : : {
478 : 0 : IncIndentLevel();
479 : 0 : bLFPossible = sal_True;
480 : 0 : }
481 : : }
482 : :
483 [ # # # # : 0 : switch( nOutMode )
# # # # #
# # # ]
484 : : {
485 : : case HTML_OUT_TBLNODE: // OK
486 : : OSL_ENSURE( !pCntnrStr, "Table: Container ist hier nicht vorgesehen" );
487 [ # # ]: 0 : OutHTML_FrmFmtTableNode( *this, rFrmFmt );
488 : 0 : break;
489 : : case HTML_OUT_GRFNODE: // OK
490 [ # # ]: 0 : OutHTML_FrmFmtGrfNode( *this, rFrmFmt, pCntnrStr != 0 );
491 : 0 : break;
492 : : case HTML_OUT_OLENODE: // OK
493 [ # # ]: 0 : OutHTML_FrmFmtOLENode( *this, rFrmFmt, pCntnrStr != 0 );
494 : 0 : break;
495 : : case HTML_OUT_OLEGRF: // OK
496 [ # # ]: 0 : OutHTML_FrmFmtOLENodeGrf( *this, rFrmFmt, pCntnrStr != 0 );
497 : 0 : break;
498 : : case HTML_OUT_DIV:
499 : : case HTML_OUT_SPAN:
500 : : OSL_ENSURE( !pCntnrStr, "Div: Container ist hier nicht vorgesehen" );
501 [ # # ]: 0 : OutHTML_FrmFmtAsDivOrSpan( *this, rFrmFmt, HTML_OUT_SPAN==nOutMode );
502 : 0 : break;
503 : : case HTML_OUT_MULTICOL: // OK
504 [ # # ]: 0 : OutHTML_FrmFmtAsMulticol( *this, rFrmFmt, pCntnrStr != 0 );
505 : 0 : break;
506 : : case HTML_OUT_SPACER: // OK
507 : : OSL_ENSURE( !pCntnrStr, "Spacer: Container ist hier nicht vorgesehen" );
508 [ # # ]: 0 : OutHTML_FrmFmtAsSpacer( *this, rFrmFmt );
509 : 0 : break;
510 : : case HTML_OUT_CONTROL: // OK
511 : : OutHTML_DrawFrmFmtAsControl( *this,
512 : : (const SwDrawFrmFmt &)rFrmFmt, *pSdrObject,
513 [ # # ]: 0 : pCntnrStr != 0 );
514 : 0 : break;
515 : : case HTML_OUT_AMARQUEE:
516 [ # # ]: 0 : OutHTML_FrmFmtAsMarquee( *this, rFrmFmt, *pSdrObject );
517 : 0 : break;
518 : : case HTML_OUT_MARQUEE:
519 : : OSL_ENSURE( !pCntnrStr, "Marquee: Container ist hier nicht vorgesehen" );
520 : : OutHTML_DrawFrmFmtAsMarquee( *this,
521 [ # # ]: 0 : (const SwDrawFrmFmt &)rFrmFmt, *pSdrObject );
522 : 0 : break;
523 : : case HTML_OUT_GRFFRM:
524 [ # # ]: 0 : OutHTML_FrmFmtAsImage( *this, rFrmFmt, pCntnrStr != 0 );
525 : 0 : break;
526 : : }
527 : :
528 [ # # ]: 0 : if( HTML_CNTNR_DIV == nCntnrMode )
529 : : {
530 : 0 : DecIndentLevel();
531 [ # # ]: 0 : if( bLFPossible )
532 [ # # ]: 0 : OutNewLine();
533 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_division, sal_False );
534 : 0 : bLFPossible = sal_True;
535 : : }
536 [ # # ]: 0 : else if( HTML_CNTNR_SPAN == nCntnrMode )
537 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_span, sal_False );
538 : 0 : }
539 : :
540 : :
541 : 0 : rtl::OString SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt,
542 : : const String& rAlternateTxt,
543 : : sal_uInt32 nFrmOpts,
544 : : const rtl::OString &rEndTags )
545 : : {
546 : 0 : rtl::OString sRetEndTags;
547 : 0 : rtl::OStringBuffer sOut;
548 : : const SfxPoolItem* pItem;
549 : 0 : const SfxItemSet& rItemSet = rFrmFmt.GetAttrSet();
550 : :
551 : : // Name
552 [ # # ]: 0 : if( (nFrmOpts & (HTML_FRMOPT_ID|HTML_FRMOPT_NAME)) &&
[ # # # # ]
553 : 0 : rFrmFmt.GetName().Len() )
554 : : {
555 : : const sal_Char *pStr =
556 [ # # ]: 0 : (nFrmOpts & HTML_FRMOPT_ID) ? OOO_STRING_SVTOOLS_HTML_O_id : OOO_STRING_SVTOOLS_HTML_O_name;
557 [ # # ][ # # ]: 0 : sOut.append(' ').append(pStr).
558 [ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM("=\""));
559 [ # # ][ # # ]: 0 : Strm() << sOut.makeStringAndClear().getStr();
560 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_String( Strm(), rFrmFmt.GetName(), eDestEnc, &aNonConvertableCharacters );
561 [ # # ]: 0 : sOut.append('\"');
562 : : }
563 : :
564 : : // Name
565 [ # # ]: 0 : if( nFrmOpts & HTML_FRMOPT_DIR )
566 : : {
567 [ # # ]: 0 : sal_uInt16 nDir = GetHTMLDirection( rItemSet );
568 [ # # ][ # # ]: 0 : Strm() << sOut.makeStringAndClear().getStr();
569 [ # # ]: 0 : OutDirection( nDir );
570 : : }
571 : :
572 : :
573 : : // ALT
574 [ # # ][ # # ]: 0 : if( (nFrmOpts & HTML_FRMOPT_ALT) && rAlternateTxt.Len() )
[ # # ]
575 : : {
576 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_alt).
577 [ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM("=\""));
578 [ # # ][ # # ]: 0 : Strm() << sOut.makeStringAndClear().getStr();
579 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_String( Strm(), rAlternateTxt, eDestEnc, &aNonConvertableCharacters );
580 [ # # ]: 0 : sOut.append('\"');
581 : : }
582 : :
583 : : // ALIGN
584 : 0 : const sal_Char *pStr = 0;
585 [ # # ]: 0 : RndStdIds eAnchorId = rFrmFmt.GetAnchor().GetAnchorId();
586 [ # # ][ # # ]: 0 : if( (nFrmOpts & HTML_FRMOPT_ALIGN) &&
[ # # ]
587 : : ((FLY_AT_PARA == eAnchorId) || (FLY_AT_CHAR == eAnchorId)) )
588 : : {
589 : : // MIB 12.3.98: Ist es nicht schlauer, absatzgebundene
590 : : // Rahmen notfalls links auszurichten als sie
591 : : // zeichengebunden einzufuegen???
592 [ # # ]: 0 : const SwFmtHoriOrient& rHoriOri = rFrmFmt.GetHoriOrient();
593 [ # # # # : 0 : if( !(nFrmOpts & HTML_FRMOPT_S_ALIGN) ||
# # ][ # # ]
594 : 0 : text::RelOrientation::FRAME == rHoriOri.GetRelationOrient() ||
595 : 0 : text::RelOrientation::PRINT_AREA == rHoriOri.GetRelationOrient() )
596 : : {
597 : 0 : pStr = text::HoriOrientation::RIGHT == rHoriOri.GetHoriOrient()
598 : : ? OOO_STRING_SVTOOLS_HTML_AL_right
599 [ # # ]: 0 : : OOO_STRING_SVTOOLS_HTML_AL_left;
600 : : }
601 : : }
602 [ # # ][ # # ]: 0 : if( (nFrmOpts & HTML_FRMOPT_ALIGN) && !pStr &&
[ # # ][ # # ]
[ # # ][ # # ]
603 : : ( (nFrmOpts & HTML_FRMOPT_S_ALIGN) == 0 ||
604 : : (FLY_AS_CHAR == eAnchorId) ) &&
605 [ # # ]: 0 : SFX_ITEM_SET == rItemSet.GetItemState( RES_VERT_ORIENT, sal_True, &pItem ))
606 : : {
607 [ # # # # : 0 : switch( ((SwFmtVertOrient*)pItem)->GetVertOrient() )
# # # # ]
608 : : {
609 : 0 : case text::VertOrientation::LINE_TOP: pStr = OOO_STRING_SVTOOLS_HTML_VA_top; break;
610 : : case text::VertOrientation::CHAR_TOP:
611 : 0 : case text::VertOrientation::BOTTOM: pStr = OOO_STRING_SVTOOLS_HTML_VA_texttop; break; // geht nicht
612 : : case text::VertOrientation::LINE_CENTER:
613 : 0 : case text::VertOrientation::CHAR_CENTER: pStr = OOO_STRING_SVTOOLS_HTML_VA_absmiddle; break; // geht nicht
614 : 0 : case text::VertOrientation::CENTER: pStr = OOO_STRING_SVTOOLS_HTML_VA_middle; break;
615 : : case text::VertOrientation::LINE_BOTTOM:
616 : 0 : case text::VertOrientation::CHAR_BOTTOM: pStr = OOO_STRING_SVTOOLS_HTML_VA_absbottom; break; // geht nicht
617 : 0 : case text::VertOrientation::TOP: pStr = OOO_STRING_SVTOOLS_HTML_VA_bottom; break;
618 : 0 : case text::VertOrientation::NONE: break;
619 : : }
620 : : }
621 [ # # ]: 0 : if( pStr )
622 : : {
623 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).append('=').
[ # # ]
624 [ # # ]: 0 : append(pStr);
625 : : }
626 : :
627 : :
628 : : // HSPACE und VSPACE
629 : 0 : Size aTwipSpc( 0, 0 );
630 [ # # ][ # # ]: 0 : if( (nFrmOpts & (HTML_FRMOPT_SPACE|HTML_FRMOPT_MARGINSIZE)) &&
[ # # ]
631 [ # # ]: 0 : SFX_ITEM_SET == rItemSet.GetItemState( RES_LR_SPACE, sal_True, &pItem ))
632 : : {
633 : 0 : aTwipSpc.Width() =
634 : 0 : ( ((SvxLRSpaceItem*)pItem)->GetLeft() +
635 : 0 : ((SvxLRSpaceItem*)pItem)->GetRight() ) / 2;
636 : 0 : nDfltLeftMargin = nDfltRightMargin = aTwipSpc.Width();
637 : : }
638 [ # # ][ # # ]: 0 : if( (nFrmOpts & (HTML_FRMOPT_SPACE|HTML_FRMOPT_MARGINSIZE)) &&
[ # # ]
639 [ # # ]: 0 : SFX_ITEM_SET == rItemSet.GetItemState( RES_UL_SPACE, sal_True, &pItem ))
640 : : {
641 : 0 : aTwipSpc.Height() =
642 : 0 : ( ((SvxULSpaceItem*)pItem)->GetUpper() +
643 : 0 : ((SvxULSpaceItem*)pItem)->GetLower() ) / 2;
644 : 0 : nDfltTopMargin = nDfltBottomMargin = (sal_uInt16)aTwipSpc.Height();
645 : : }
646 : :
647 [ # # # # : 0 : if( (nFrmOpts & HTML_FRMOPT_SPACE) &&
# # ][ # # ]
[ # # ]
648 : 0 : (aTwipSpc.Width() || aTwipSpc.Height()) &&
649 [ # # ]: 0 : Application::GetDefaultDevice() )
650 : : {
651 : : Size aPixelSpc =
652 : : Application::GetDefaultDevice()->LogicToPixel( aTwipSpc,
653 [ # # ][ # # ]: 0 : MapMode(MAP_TWIP) );
[ # # ][ # # ]
654 [ # # ][ # # ]: 0 : if( !aPixelSpc.Width() && aTwipSpc.Width() )
[ # # ]
655 : 0 : aPixelSpc.Width() = 1;
656 [ # # ][ # # ]: 0 : if( !aPixelSpc.Height() && aTwipSpc.Height() )
[ # # ]
657 : 0 : aPixelSpc.Height() = 1;
658 : :
659 [ # # ]: 0 : if( aPixelSpc.Width() )
660 : : {
661 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_hspace).
662 [ # # ][ # # ]: 0 : append('=').append(static_cast<sal_Int32>(aPixelSpc.Width()));
663 : : }
664 : :
665 [ # # ]: 0 : if( aPixelSpc.Height() )
666 : : {
667 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_vspace).
668 [ # # ][ # # ]: 0 : append('=').append(static_cast<sal_Int32>(aPixelSpc.Height()));
669 : : }
670 : : }
671 : :
672 : : // Der Abstand muss bei der Groesse beruecksichtigt, wenn das entsprechende
673 : : // Flag gesetzt ist.
674 [ # # ]: 0 : if( (nFrmOpts & HTML_FRMOPT_MARGINSIZE) )
675 : : {
676 : 0 : aTwipSpc.Width() *= -2;
677 : 0 : aTwipSpc.Height() *= -2;
678 : : }
679 : : else
680 : : {
681 : 0 : aTwipSpc.Width() = 0;
682 : 0 : aTwipSpc.Height() = 0;
683 : : }
684 : :
685 [ # # ][ # # ]: 0 : if( !(nFrmOpts & HTML_FRMOPT_ABSSIZE) &&
[ # # ]
686 [ # # ]: 0 : SFX_ITEM_SET == rItemSet.GetItemState( RES_BOX, sal_True, &pItem ))
687 : : {
688 : 0 : const SvxBoxItem* pBoxItem = (const SvxBoxItem*)pItem;
689 : :
690 [ # # ]: 0 : aTwipSpc.Width() += pBoxItem->CalcLineSpace( BOX_LINE_LEFT );
691 [ # # ]: 0 : aTwipSpc.Width() += pBoxItem->CalcLineSpace( BOX_LINE_RIGHT );
692 [ # # ]: 0 : aTwipSpc.Height() += pBoxItem->CalcLineSpace( BOX_LINE_TOP );
693 [ # # ]: 0 : aTwipSpc.Height() += pBoxItem->CalcLineSpace( BOX_LINE_BOTTOM );
694 : : }
695 : :
696 : : // WIDTH und/oder HEIGHT
697 : : // ATT_VAR_SIZE/ATT_MIN_SIZE nur ausgeben, wenn ANYSIZE gesezut ist
698 [ # # ][ # # ]: 0 : if( (nFrmOpts & HTML_FRMOPT_SIZE) &&
[ # # # # ]
[ # # ]
699 [ # # ]: 0 : SFX_ITEM_SET == rItemSet.GetItemState( RES_FRM_SIZE, sal_True, &pItem ) &&
700 : : ( (nFrmOpts & HTML_FRMOPT_ANYSIZE) ||
701 : 0 : ATT_FIX_SIZE == ((const SwFmtFrmSize *)pItem)->GetHeightSizeType()) )
702 : : {
703 : 0 : const SwFmtFrmSize *pFSItem = (const SwFmtFrmSize *)pItem;
704 : 0 : sal_uInt8 nPrcWidth = pFSItem->GetWidthPercent();
705 : 0 : sal_uInt8 nPrcHeight = pFSItem->GetHeightPercent();
706 : :
707 : : // Groesse des Objekts Twips ohne Raender
708 : : Size aTwipSz( (nPrcWidth ? 0
709 : 0 : : pFSItem->GetWidth()-aTwipSpc.Width()),
710 : : (nPrcHeight ? 0
711 [ # # ][ # # ]: 0 : : pFSItem->GetHeight()-aTwipSpc.Height()) );
712 : :
713 : : OSL_ENSURE( aTwipSz.Width() >= 0 && aTwipSz.Height() >= 0,
714 : : "Rahmengroesse minus Abstand < 0!!!???" );
715 [ # # ]: 0 : if( aTwipSz.Width() < 0 )
716 : 0 : aTwipSz.Width() = 0;
717 [ # # ]: 0 : if( aTwipSz.Height() < 0 )
718 : 0 : aTwipSz.Height() = 0;
719 : :
720 : 0 : Size aPixelSz( 0, 0 );
721 [ # # ][ # # ]: 0 : if( (aTwipSz.Width() || aTwipSz.Height()) &&
[ # # ][ # # ]
722 [ # # ]: 0 : Application::GetDefaultDevice() )
723 : : {
724 : : aPixelSz =
725 : : Application::GetDefaultDevice()->LogicToPixel( aTwipSz,
726 [ # # ][ # # ]: 0 : MapMode(MAP_TWIP) );
[ # # ][ # # ]
727 [ # # ][ # # ]: 0 : if( !aPixelSz.Width() && aTwipSz.Width() )
[ # # ]
728 : 0 : aPixelSz.Width() = 1;
729 [ # # ][ # # ]: 0 : if( !aPixelSz.Height() && aTwipSz.Height() )
[ # # ]
730 : 0 : aPixelSz.Height() = 1;
731 : : }
732 : :
733 [ # # ][ # # ]: 0 : if( (nFrmOpts & HTML_FRMOPT_WIDTH) &&
[ # # # # ]
[ # # ]
734 : 0 : ((nPrcWidth && nPrcWidth!=255) || aPixelSz.Width()) )
735 : : {
736 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width).
737 [ # # ]: 0 : append('=');
738 [ # # ]: 0 : if( nPrcWidth )
739 [ # # ][ # # ]: 0 : sOut.append(static_cast<sal_Int32>(nPrcWidth)).append('%');
740 : : else
741 [ # # ]: 0 : sOut.append(static_cast<sal_Int32>(aPixelSz.Width()));
742 : : }
743 : :
744 [ # # ][ # # ]: 0 : if( (nFrmOpts & HTML_FRMOPT_HEIGHT) &&
[ # # # # ]
[ # # ]
745 : 0 : ((nPrcHeight && nPrcHeight!=255) || aPixelSz.Height()) )
746 : : {
747 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height).
748 [ # # ]: 0 : append('=');
749 [ # # ]: 0 : if( nPrcHeight )
750 [ # # ][ # # ]: 0 : sOut.append(static_cast<sal_Int32>(nPrcHeight)).append('%');
751 : : else
752 [ # # ]: 0 : sOut.append(static_cast<sal_Int32>(aPixelSz.Height()));
753 : : }
754 : : }
755 : :
756 [ # # ]: 0 : if (sOut.getLength())
757 [ # # ][ # # ]: 0 : Strm() << sOut.makeStringAndClear().getStr();
758 : :
759 : : // Umlauf fuer absatzgeb. Grafiken als <BR CLEAR=...> in den String
760 : : // schreiben
761 [ # # # # : 0 : if( (nFrmOpts & HTML_FRMOPT_BRCLEAR) &&
# # ][ # # ]
[ # # ]
762 [ # # ]: 0 : ((FLY_AT_PARA == rFrmFmt.GetAnchor().GetAnchorId()) ||
763 [ # # ]: 0 : (FLY_AT_CHAR == rFrmFmt.GetAnchor().GetAnchorId())) &&
764 [ # # ]: 0 : SFX_ITEM_SET == rItemSet.GetItemState( RES_SURROUND, sal_True, &pItem ))
765 : : {
766 : 0 : const SwFmtSurround* pSurround = (const SwFmtSurround*)pItem;
767 [ # # ]: 0 : sal_Int16 eHoriOri = rFrmFmt.GetHoriOrient().GetHoriOrient();
768 : 0 : pStr = 0;
769 : 0 : SwSurround eSurround = pSurround->GetSurround();
770 : 0 : sal_Bool bAnchorOnly = pSurround->IsAnchorOnly();
771 [ # # ]: 0 : switch( eHoriOri )
772 : : {
773 : : case text::HoriOrientation::RIGHT:
774 : : {
775 [ # # # ]: 0 : switch( eSurround )
776 : : {
777 : : case SURROUND_NONE:
778 : : case SURROUND_RIGHT:
779 : 0 : pStr = OOO_STRING_SVTOOLS_HTML_AL_right;
780 : 0 : break;
781 : : case SURROUND_LEFT:
782 : : case SURROUND_PARALLEL:
783 [ # # ]: 0 : if( bAnchorOnly )
784 : 0 : bClearRight = sal_True;
785 : 0 : break;
786 : : default:
787 : : ;
788 : : }
789 : : }
790 : 0 : break;
791 : :
792 : : default:
793 : : // If a frame is centered, it gets left aligned. This
794 : : // should be taken into account here, too.
795 : : {
796 [ # # # ]: 0 : switch( eSurround )
797 : : {
798 : : case SURROUND_NONE:
799 : : case SURROUND_LEFT:
800 : 0 : pStr = OOO_STRING_SVTOOLS_HTML_AL_left;
801 : 0 : break;
802 : : case SURROUND_RIGHT:
803 : : case SURROUND_PARALLEL:
804 [ # # ]: 0 : if( bAnchorOnly )
805 : 0 : bClearLeft = sal_True;
806 : 0 : break;
807 : : default:
808 : : ;
809 : : }
810 : : }
811 : 0 : break;
812 : :
813 : : }
814 : :
815 [ # # ]: 0 : if( pStr )
816 : : {
817 [ # # ][ # # ]: 0 : sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_linebreak).
818 [ # # ][ # # ]: 0 : append(' ').append(OOO_STRING_SVTOOLS_HTML_O_clear).
819 [ # # ][ # # ]: 0 : append('=').append(pStr).append('>').append(rEndTags);
[ # # ][ # # ]
820 : 0 : sRetEndTags = sOut.makeStringAndClear();
821 : : }
822 : : }
823 : 0 : return sRetEndTags;
824 : : }
825 : :
826 : :
827 : 0 : Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt,
828 : : const String &rGrfName, const String& rAlternateTxt,
829 : : const Size &rRealSize, sal_uInt32 nFrmOpts,
830 : : const sal_Char *pMarkType,
831 : : const ImageMap *pAltImgMap )
832 : : {
833 : 0 : SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
834 : :
835 : : // ggf. ein noch offenes Attribut voruebergehend beenden
836 [ # # ]: 0 : if( !rHTMLWrt.aINetFmts.empty() )
837 : : {
838 [ # # ]: 0 : SwFmtINetFmt *pINetFmt = rHTMLWrt.aINetFmts.back();
839 [ # # ]: 0 : OutHTML_INetFmt( rWrt, *pINetFmt, sal_False );
840 : : }
841 : :
842 [ # # ]: 0 : String aGrfNm( rGrfName );
843 [ # # ][ # # ]: 0 : if( !HTMLOutFuncs::PrivateURLToInternalImg(aGrfNm) )
844 [ # # ][ # # ]: 0 : aGrfNm = URIHelper::simpleNormalizedMakeRelative( rWrt.GetBaseURL(), aGrfNm);
[ # # ][ # # ]
845 : :
846 : : const SfxPoolItem* pItem;
847 : 0 : const SfxItemSet& rItemSet = rFrmFmt.GetAttrSet();
848 : :
849 : 0 : const SwFmtURL *pURLItem = 0;
850 : :
851 : : // das URL-Attribut nur beruecksichtigen, wenn keine Image-Map
852 : : // uebergeben wurde
853 [ # # ][ # # ]: 0 : if( !pAltImgMap &&
[ # # ]
854 [ # # ]: 0 : SFX_ITEM_SET == rItemSet.GetItemState( RES_URL, sal_True, &pItem ))
855 : : {
856 : 0 : pURLItem = (const SwFmtURL *)pItem;
857 : : }
858 : :
859 : : // Image-Map rausschreiben
860 : 0 : const ImageMap *pIMap = pAltImgMap;
861 [ # # ][ # # ]: 0 : if( !pIMap && pURLItem )
862 : : {
863 : 0 : pIMap = pURLItem->GetMap();
864 : : }
865 : :
866 [ # # ]: 0 : String aIMapName;
867 [ # # ]: 0 : if( pIMap )
868 : : {
869 : : // den Namen eindeutig machen
870 [ # # ]: 0 : aIMapName = pIMap->GetName();
871 [ # # ]: 0 : String aNameBase;
872 [ # # ]: 0 : if( aIMapName.Len() )
873 [ # # ]: 0 : aNameBase = aIMapName;
874 : : else
875 [ # # ]: 0 : aNameBase.AssignAscii( OOO_STRING_SVTOOLS_HTML_map );
876 [ # # ]: 0 : if( !aIMapName.Len() )
877 [ # # ]: 0 : (aIMapName = aNameBase)
878 [ # # ][ # # ]: 0 : += String::CreateFromInt32( rHTMLWrt.nImgMapCnt );
[ # # ]
879 : :
880 : : sal_Bool bFound;
881 [ # # ]: 0 : do
882 : : {
883 : 0 : bFound = sal_False;
884 [ # # ]: 0 : for(size_t i = 0; i < rHTMLWrt.aImgMapNames.size(); ++i)
885 : : {
886 : : // TODO: Unicode: Comparison is case insensitive for ASCII
887 : : // characters only now!
888 [ # # ][ # # ]: 0 : if( aIMapName.EqualsIgnoreCaseAscii(rHTMLWrt.aImgMapNames[i]) )
[ # # ]
889 : : {
890 : 0 : bFound = sal_True;
891 : 0 : break;
892 : : }
893 : : }
894 [ # # ]: 0 : if( bFound )
895 : : {
896 : 0 : rHTMLWrt.nImgMapCnt++;
897 [ # # ]: 0 : (aIMapName = aNameBase)
898 [ # # ][ # # ]: 0 : += String::CreateFromInt32( rHTMLWrt.nImgMapCnt );
[ # # ]
899 : : }
900 : :
901 : : } while( bFound );
902 : :
903 : 0 : sal_Bool bScale = sal_False;
904 [ # # ]: 0 : Fraction aScaleX( 1, 1 );
905 [ # # ]: 0 : Fraction aScaleY( 1, 1 );
906 : :
907 [ # # ]: 0 : const SwFmtFrmSize& rFrmSize = rFrmFmt.GetFrmSize();
908 [ # # ]: 0 : const SvxBoxItem& rBox = rFrmFmt.GetBox();
909 : :
910 [ # # ][ # # ]: 0 : if( !rFrmSize.GetWidthPercent() && rRealSize.Width() )
[ # # ]
911 : : {
912 : 0 : SwTwips nWidth = rFrmSize.GetWidth();
913 [ # # ]: 0 : nWidth -= ( rBox.CalcLineSpace(BOX_LINE_LEFT) +
914 [ # # ]: 0 : rBox.CalcLineSpace(BOX_LINE_RIGHT) );
915 : :
916 : : OSL_ENSURE( nWidth>0, "Gibt es 0 twip breite Grafiken!?" );
917 [ # # ]: 0 : if( nWidth<=0 ) // sollte nicht passieren
918 : 0 : nWidth = 1;
919 : :
920 [ # # ]: 0 : if( rRealSize.Width() != nWidth )
921 : : {
922 [ # # ][ # # ]: 0 : aScaleX = Fraction( nWidth, rRealSize.Width() );
923 : 0 : bScale = sal_True;
924 : : }
925 : : }
926 [ # # ][ # # ]: 0 : if( !rFrmSize.GetHeightPercent() && rRealSize.Height() )
[ # # ]
927 : : {
928 : 0 : SwTwips nHeight = rFrmSize.GetHeight();
929 [ # # ]: 0 : nHeight -= ( rBox.CalcLineSpace(BOX_LINE_TOP) +
930 [ # # ]: 0 : rBox.CalcLineSpace(BOX_LINE_BOTTOM) );
931 : :
932 : : OSL_ENSURE( nHeight>0, "Gibt es 0 twip hohe Grafiken!?" );
933 [ # # ]: 0 : if( nHeight<=0 )
934 : 0 : nHeight = 1;
935 : :
936 [ # # ]: 0 : if( rRealSize.Height() != nHeight )
937 : : {
938 [ # # ][ # # ]: 0 : aScaleY = Fraction( nHeight, rRealSize.Height() );
939 : 0 : bScale = sal_True;
940 : : }
941 : : }
942 : :
943 [ # # ]: 0 : rHTMLWrt.aImgMapNames.push_back(aIMapName);
944 : :
945 : 0 : rtl::OString aIndMap, aIndArea;
946 : 0 : const sal_Char *pLF = 0, *pIndArea = 0, *pIndMap = 0;
947 : : #if defined(UNX)
948 : 0 : sal_Char aLF[2] = "\x00";
949 : : #endif
950 : :
951 [ # # ]: 0 : if( rHTMLWrt.bLFPossible )
952 : : {
953 [ # # ]: 0 : rHTMLWrt.OutNewLine( sal_True );
954 [ # # ]: 0 : aIndMap = rHTMLWrt.GetIndentString();
955 [ # # ]: 0 : aIndArea = rHTMLWrt.GetIndentString(1);
956 : : #if defined(UNX)
957 : 0 : aLF[0] = SwHTMLWriter::sNewLine;
958 : 0 : pLF = aLF;
959 : : #else
960 : : pLF = SwHTMLWriter::sNewLine;
961 : : #endif
962 : 0 : pIndArea = aIndArea.getStr();
963 : 0 : pIndMap = aIndMap.getStr();
964 : : }
965 : :
966 [ # # ]: 0 : if( bScale )
967 : : {
968 [ # # ]: 0 : ImageMap aScaledIMap( *pIMap );
969 [ # # ]: 0 : aScaledIMap.Scale( aScaleX, aScaleY );
970 [ # # ]: 0 : HTMLOutFuncs::Out_ImageMap( rWrt.Strm(), rWrt.GetBaseURL(), aScaledIMap, aIMapName,
971 : : aIMapEventTable,
972 : : rHTMLWrt.bCfgStarBasic,
973 : : pLF, pIndArea, pIndMap,
974 : : rHTMLWrt.eDestEnc,
975 [ # # ][ # # ]: 0 : &rHTMLWrt.aNonConvertableCharacters );
976 : : }
977 : : else
978 : : {
979 [ # # ]: 0 : HTMLOutFuncs::Out_ImageMap( rWrt.Strm(), rWrt.GetBaseURL(), *pIMap, aIMapName,
980 : : aIMapEventTable,
981 : : rHTMLWrt.bCfgStarBasic,
982 : : pLF, pIndArea, pIndMap,
983 : : rHTMLWrt.eDestEnc,
984 [ # # ]: 0 : &rHTMLWrt.aNonConvertableCharacters );
985 [ # # ]: 0 : }
986 : : }
987 : :
988 : : // wenn meoglich vor der Grafik einen Zeilen-Umbruch ausgeben
989 [ # # ]: 0 : if( rHTMLWrt.bLFPossible )
990 [ # # ]: 0 : rHTMLWrt.OutNewLine( sal_True );
991 : :
992 : : // Attribute die ausserhelb der Grafik geschreiben werden muessen sammeln
993 : 0 : rtl::OStringBuffer sOut;
994 : 0 : rtl::OString aEndTags;
995 : :
996 : : // implizite Sprungmarke -> <A NAME=...></A>...<IMG ...>
997 [ # # ][ # # ]: 0 : if( pMarkType && rFrmFmt.GetName().Len() )
[ # # ]
998 [ # # ]: 0 : rHTMLWrt.OutImplicitMark( rFrmFmt.GetName(), pMarkType );
999 : :
1000 : : // URL -> <A>...<IMG ... >...</A>
1001 : 0 : const SvxMacroItem *pMacItem = 0;
1002 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == rItemSet.GetItemState( RES_FRMMACRO, sal_True, &pItem ))
1003 : 0 : pMacItem = (const SvxMacroItem *)pItem;
1004 : :
1005 [ # # ][ # # ]: 0 : if( pURLItem || pMacItem )
1006 : : {
1007 [ # # ]: 0 : String aMapURL;
1008 [ # # ]: 0 : String aName;
1009 [ # # ]: 0 : String aTarget;
1010 [ # # ]: 0 : if( pURLItem )
1011 : : {
1012 [ # # ]: 0 : aMapURL = pURLItem->GetURL();
1013 [ # # ]: 0 : aName = pURLItem->GetName();
1014 [ # # ]: 0 : aTarget = pURLItem->GetTargetFrameName();
1015 : : }
1016 [ # # ][ # # ]: 0 : sal_Bool bEvents = pMacItem && !pMacItem->GetMacroTable().empty();
1017 : :
1018 [ # # ][ # # ]: 0 : if( aMapURL.Len() || aName.Len() || aTarget.Len() || bEvents )
[ # # ][ # # ]
[ # # ]
1019 : : {
1020 [ # # ][ # # ]: 0 : sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_anchor);
1021 : :
1022 : : // Ein HREF nur Ausgaben, wenn es einen Link oder Makros gibt
1023 [ # # ][ # # ]: 0 : if( aMapURL.Len() || bEvents )
[ # # ]
1024 : : {
1025 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_href).
1026 [ # # ]: 0 : append("=\"");
1027 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1028 [ # # ]: 0 : rHTMLWrt.OutHyperlinkHRefValue( aMapURL );
1029 [ # # ]: 0 : sOut.append('\"');
1030 : : }
1031 : :
1032 [ # # ]: 0 : if( aName.Len() )
1033 : : {
1034 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name).
1035 [ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM("=\""));
1036 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1037 [ # # ]: 0 : HTMLOutFuncs::Out_String( rWrt.Strm(), aName,
1038 [ # # ]: 0 : rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
1039 [ # # ]: 0 : sOut.append('\"');
1040 : : }
1041 : :
1042 [ # # ]: 0 : if( aTarget.Len() )
1043 : : {
1044 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_target).
1045 [ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM("=\""));
1046 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1047 [ # # ]: 0 : HTMLOutFuncs::Out_String( rWrt.Strm(), aTarget,
1048 [ # # ]: 0 : rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
1049 [ # # ]: 0 : sOut.append('\"');
1050 : : }
1051 : :
1052 [ # # ]: 0 : if (sOut.getLength())
1053 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1054 : :
1055 [ # # ]: 0 : if( pMacItem )
1056 : : {
1057 : 0 : const SvxMacroTableDtor& rMacTable = pMacItem->GetMacroTable();
1058 [ # # ]: 0 : if( !rMacTable.empty() )
1059 [ # # ]: 0 : HTMLOutFuncs::Out_Events( rWrt.Strm(), rMacTable,
1060 : : aAnchorEventTable,
1061 : : rHTMLWrt.bCfgStarBasic,
1062 : : rHTMLWrt.eDestEnc,
1063 [ # # ]: 0 : &rHTMLWrt.aNonConvertableCharacters );
1064 : : }
1065 : :
1066 [ # # ][ # # ]: 0 : rWrt.Strm() << ">";
1067 [ # # ]: 0 : aEndTags = rtl::OStringBuffer().append("</").
1068 [ # # ]: 0 : append(OOO_STRING_SVTOOLS_HTML_anchor).
1069 [ # # ][ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM(">")).append(aEndTags).
1070 : 0 : makeStringAndClear();
1071 [ # # ][ # # ]: 0 : }
[ # # ]
1072 : : }
1073 : :
1074 : : // Umrandung -> <FONT COLOR = ...>...<IMG ... >...</FONT>
1075 : 0 : sal_uInt16 nBorderWidth = 0;
1076 [ # # ][ # # ]: 0 : if( (nFrmOpts & HTML_FRMOPT_BORDER) &&
[ # # ]
1077 [ # # ]: 0 : SFX_ITEM_SET == rItemSet.GetItemState( RES_BOX, sal_True, &pItem ))
1078 : : {
1079 : 0 : Size aTwipBorder( 0, 0 );
1080 : 0 : const SvxBoxItem* pBoxItem = (const SvxBoxItem*)pItem;
1081 : :
1082 : 0 : const ::editeng::SvxBorderLine *pColBorderLine = 0;
1083 : 0 : const ::editeng::SvxBorderLine *pBorderLine = pBoxItem->GetLeft();
1084 [ # # ]: 0 : if( pBorderLine )
1085 : : {
1086 : 0 : pColBorderLine = pBorderLine;
1087 [ # # ]: 0 : aTwipBorder.Width() += pBorderLine->GetOutWidth();
1088 : : }
1089 : :
1090 : 0 : pBorderLine = pBoxItem->GetRight();
1091 [ # # ]: 0 : if( pBorderLine )
1092 : : {
1093 : 0 : pColBorderLine = pBorderLine;
1094 [ # # ]: 0 : aTwipBorder.Width() += pBorderLine->GetOutWidth();
1095 : : }
1096 : :
1097 : 0 : pBorderLine = pBoxItem->GetTop();
1098 [ # # ]: 0 : if( pBorderLine )
1099 : : {
1100 : 0 : pColBorderLine = pBorderLine;
1101 [ # # ]: 0 : aTwipBorder.Height() += pBorderLine->GetOutWidth();
1102 : : }
1103 : :
1104 : 0 : pBorderLine = pBoxItem->GetBottom();
1105 [ # # ]: 0 : if( pBorderLine )
1106 : : {
1107 : 0 : pColBorderLine = pBorderLine;
1108 [ # # ]: 0 : aTwipBorder.Height() += pBorderLine->GetOutWidth();
1109 : : }
1110 : :
1111 : 0 : aTwipBorder.Width() /= 2;
1112 : 0 : aTwipBorder.Height() /= 2;
1113 : :
1114 [ # # ][ # # ]: 0 : if( (aTwipBorder.Width() || aTwipBorder.Height()) &&
[ # # ][ # # ]
1115 [ # # ]: 0 : Application::GetDefaultDevice() )
1116 : : {
1117 : : Size aPixelBorder =
1118 : : Application::GetDefaultDevice()->LogicToPixel( aTwipBorder,
1119 [ # # ][ # # ]: 0 : MapMode(MAP_TWIP) );
[ # # ][ # # ]
1120 [ # # ][ # # ]: 0 : if( !aPixelBorder.Width() && aTwipBorder.Width() )
[ # # ]
1121 : 0 : aPixelBorder.Width() = 1;
1122 [ # # ][ # # ]: 0 : if( !aPixelBorder.Height() && aTwipBorder.Height() )
[ # # ]
1123 : 0 : aPixelBorder.Height() = 1;
1124 : :
1125 [ # # ]: 0 : if( aPixelBorder.Width() )
1126 : 0 : aPixelBorder.Height() = 0;
1127 : :
1128 : : nBorderWidth =
1129 : 0 : (sal_uInt16)(aPixelBorder.Width() + aPixelBorder.Height());
1130 : : }
1131 : :
1132 [ # # ]: 0 : if( pColBorderLine )
1133 : : {
1134 [ # # ]: 0 : sOut.append('<');
1135 [ # # ][ # # ]: 0 : sOut.append(OOO_STRING_SVTOOLS_HTML_font).append(' ').
1136 [ # # ][ # # ]: 0 : append(OOO_STRING_SVTOOLS_HTML_O_color).append('=');
1137 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1138 [ # # ]: 0 : HTMLOutFuncs::Out_Color( rWrt.Strm(),
1139 [ # # ][ # # ]: 0 : pColBorderLine->GetColor(), rHTMLWrt.eDestEnc ) << '>';
1140 : :
1141 : : aEndTags = rtl::OStringBuffer().
1142 [ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM("</")).
1143 [ # # ]: 0 : append(OOO_STRING_SVTOOLS_HTML_font).
1144 [ # # ][ # # ]: 0 : append('>').append(aEndTags).makeStringAndClear();
1145 : : }
1146 : : }
1147 : :
1148 [ # # ]: 0 : sOut.append('<');
1149 [ # # ][ # # ]: 0 : sOut.append(OOO_STRING_SVTOOLS_HTML_image).append(' ').
1150 [ # # ]: 0 : append(OOO_STRING_SVTOOLS_HTML_O_src).
1151 [ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM("=\""));
1152 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1153 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_String( rWrt.Strm(), aGrfNm, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ) << '\"';
[ # # ]
1154 : :
1155 : : // Events
1156 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == rItemSet.GetItemState( RES_FRMMACRO, sal_True, &pItem ))
1157 : : {
1158 : : const SvxMacroTableDtor& rMacTable =
1159 : 0 : ((const SvxMacroItem *)pItem)->GetMacroTable();
1160 [ # # ]: 0 : if( !rMacTable.empty() )
1161 [ # # ]: 0 : HTMLOutFuncs::Out_Events( rWrt.Strm(), rMacTable, aImageEventTable,
1162 : : rHTMLWrt.bCfgStarBasic, rHTMLWrt.eDestEnc,
1163 [ # # ]: 0 : &rHTMLWrt.aNonConvertableCharacters );
1164 : : }
1165 : :
1166 : : // ALT, ALIGN, WIDTH, HEIGHT, HSPACE, VSPACE
1167 [ # # ]: 0 : aEndTags = rHTMLWrt.OutFrmFmtOptions( rFrmFmt, rAlternateTxt, nFrmOpts, aEndTags );
1168 [ # # ]: 0 : if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) )
1169 [ # # ]: 0 : rHTMLWrt.OutCSS1_FrmFmtOptions( rFrmFmt, nFrmOpts );
1170 : :
1171 : :
1172 [ # # ]: 0 : if( nFrmOpts & HTML_FRMOPT_BORDER )
1173 : : {
1174 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_border).
1175 [ # # ][ # # ]: 0 : append('=').append(static_cast<sal_Int32>(nBorderWidth));
1176 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1177 : : }
1178 : :
1179 [ # # ][ # # ]: 0 : if( pURLItem && pURLItem->IsServerMap() )
[ # # ]
1180 : : {
1181 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_ismap);
1182 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1183 : : }
1184 [ # # ]: 0 : if( aIMapName.Len() )
1185 : : {
1186 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_usemap).
1187 [ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM("=\"#"));
1188 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1189 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_String( rWrt.Strm(), aIMapName, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ) << '\"';
[ # # ]
1190 : : }
1191 : :
1192 [ # # ][ # # ]: 0 : rHTMLWrt.Strm() << '>';
1193 : :
1194 [ # # ]: 0 : if( !aEndTags.isEmpty() )
1195 [ # # ][ # # ]: 0 : rWrt.Strm() << aEndTags.getStr();
1196 : :
1197 [ # # ]: 0 : if( !rHTMLWrt.aINetFmts.empty() )
1198 : : {
1199 : : // es ist noch ein Attribut auf dem Stack, das wieder geoeffnet
1200 : : // werden muss
1201 [ # # ]: 0 : SwFmtINetFmt *pINetFmt = rHTMLWrt.aINetFmts.back();
1202 [ # # ]: 0 : OutHTML_INetFmt( rWrt, *pINetFmt, sal_True );
1203 : : }
1204 : :
1205 [ # # ][ # # ]: 0 : return rHTMLWrt;
1206 : : }
1207 : :
1208 : 0 : Writer& OutHTML_BulletImage( Writer& rWrt,
1209 : : const sal_Char *pTag,
1210 : : const SvxBrushItem* pBrush,
1211 : : String &rGrfName,
1212 : : const Size &rSize,
1213 : : const SwFmtVertOrient* pVertOrient )
1214 : : {
1215 : 0 : SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
1216 : :
1217 : : // Wenn es ein BrushItem gibt, muss die Grafiknoch exportiert werden
1218 : 0 : const String *pLink = 0;
1219 [ # # ]: 0 : if( pBrush )
1220 : : {
1221 : 0 : pLink = pBrush->GetGraphicLink();
1222 : :
1223 : : // embeddete Grafik -> WriteEmbedded schreiben
1224 [ # # ]: 0 : if( !pLink )
1225 : : {
1226 [ # # ]: 0 : const Graphic* pGrf = pBrush->GetGraphic();
1227 [ # # ]: 0 : if( pGrf )
1228 : : {
1229 : : // Grafik als (JPG-)File speichern
1230 [ # # ]: 0 : if( rHTMLWrt.GetOrigFileName() )
1231 [ # # ]: 0 : rGrfName = *rHTMLWrt.GetOrigFileName();
1232 : : sal_uInt16 nErr = XOutBitmap::WriteGraphic( *pGrf, rGrfName,
1233 : : rtl::OUString("JPG"),
1234 : : (XOUTBMP_USE_GIF_IF_SENSIBLE |
1235 [ # # ][ # # ]: 0 : XOUTBMP_USE_NATIVE_IF_POSSIBLE));
[ # # ]
1236 [ # # ]: 0 : if( !nErr )
1237 : : {
1238 : : rGrfName = URIHelper::SmartRel2Abs(
1239 : 0 : INetURLObject( rWrt.GetBaseURL() ), rGrfName,
1240 [ # # ]: 0 : URIHelper::GetMaybeFileHdl() );
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1241 : 0 : pLink = &rGrfName;
1242 : : }
1243 : : else
1244 : : {
1245 : 0 : rHTMLWrt.nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE;
1246 : : }
1247 : : }
1248 : : }
1249 : : else
1250 : : {
1251 [ # # ]: 0 : rGrfName = *pLink;
1252 [ # # ]: 0 : if( rHTMLWrt.bCfgCpyLinkedGrfs )
1253 : : {
1254 [ # # ]: 0 : rHTMLWrt.CopyLocalFileToINet( rGrfName );
1255 : 0 : pLink = &rGrfName;
1256 : : }
1257 : : }
1258 : : }
1259 : : else
1260 : : {
1261 : 0 : pLink = &rGrfName;
1262 : : }
1263 : :
1264 : 0 : rtl::OStringBuffer sOut;
1265 [ # # ]: 0 : if( pTag )
1266 [ # # ][ # # ]: 0 : sOut.append('<').append(pTag);
1267 : :
1268 [ # # ]: 0 : if( pLink )
1269 : : {
1270 [ # # ]: 0 : sOut.append(' ');
1271 [ # # ]: 0 : String s( *pLink );
1272 [ # # ][ # # ]: 0 : if( !HTMLOutFuncs::PrivateURLToInternalImg(s) )
1273 [ # # ][ # # ]: 0 : s = URIHelper::simpleNormalizedMakeRelative( rWrt.GetBaseURL(), s);
[ # # ][ # # ]
1274 [ # # ]: 0 : sOut.append(OOO_STRING_SVTOOLS_HTML_O_src).
1275 [ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM("=\""));
1276 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1277 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_String( rWrt.Strm(), s, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
1278 [ # # ]: 0 : sOut.append('\"');
1279 : :
1280 : : // Groesse des Objekts Twips ohne Raender
1281 : 0 : Size aPixelSz( 0, 0 );
1282 [ # # ][ # # ]: 0 : if( (rSize.Width() || rSize.Height()) && Application::GetDefaultDevice() )
[ # # ][ # # ]
[ # # ]
1283 : : {
1284 : : aPixelSz =
1285 : : Application::GetDefaultDevice()->LogicToPixel( rSize,
1286 [ # # ][ # # ]: 0 : MapMode(MAP_TWIP) );
[ # # ][ # # ]
1287 [ # # ][ # # ]: 0 : if( !aPixelSz.Width() && rSize.Width() )
[ # # ]
1288 : 0 : aPixelSz.Width() = 1;
1289 [ # # ][ # # ]: 0 : if( !aPixelSz.Height() && rSize.Height() )
[ # # ]
1290 : 0 : aPixelSz.Height() = 1;
1291 : : }
1292 : :
1293 [ # # ]: 0 : if( aPixelSz.Width() )
1294 : : {
1295 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width).
1296 [ # # ][ # # ]: 0 : append('=').append(static_cast<sal_Int32>(aPixelSz.Width()));
1297 : : }
1298 : :
1299 [ # # ]: 0 : if( aPixelSz.Height() )
1300 : : {
1301 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height).
1302 [ # # ][ # # ]: 0 : append('=').append(static_cast<sal_Int32>(aPixelSz.Height()));
1303 : : }
1304 : :
1305 [ # # ]: 0 : if( pVertOrient )
1306 : : {
1307 : 0 : const sal_Char *pStr = 0;
1308 [ # # # # : 0 : switch( pVertOrient->GetVertOrient() )
# # # # ]
1309 : : {
1310 : 0 : case text::VertOrientation::LINE_TOP: pStr = OOO_STRING_SVTOOLS_HTML_VA_top; break;
1311 : : case text::VertOrientation::CHAR_TOP:
1312 : 0 : case text::VertOrientation::BOTTOM: pStr = OOO_STRING_SVTOOLS_HTML_VA_texttop; break; // geht nicht
1313 : : case text::VertOrientation::LINE_CENTER:
1314 : 0 : case text::VertOrientation::CHAR_CENTER: pStr = OOO_STRING_SVTOOLS_HTML_VA_absmiddle; break; // geht nicht
1315 : 0 : case text::VertOrientation::CENTER: pStr = OOO_STRING_SVTOOLS_HTML_VA_middle; break;
1316 : : case text::VertOrientation::LINE_BOTTOM:
1317 : 0 : case text::VertOrientation::CHAR_BOTTOM: pStr = OOO_STRING_SVTOOLS_HTML_VA_absbottom; break; // geht nicht
1318 : 0 : case text::VertOrientation::TOP: pStr = OOO_STRING_SVTOOLS_HTML_VA_bottom; break;
1319 : 0 : case text::VertOrientation::NONE: break;
1320 : : }
1321 [ # # ]: 0 : if( pStr )
1322 : : {
1323 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).
1324 [ # # ][ # # ]: 0 : append('=').append(pStr);
1325 : : }
1326 [ # # ]: 0 : }
1327 : : }
1328 : :
1329 [ # # ]: 0 : if (pTag)
1330 [ # # ]: 0 : sOut.append('>');
1331 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1332 : :
1333 : 0 : return rWrt;
1334 : : }
1335 : :
1336 : :
1337 : : //-----------------------------------------------------------------------
1338 : :
1339 : 0 : static Writer& OutHTML_FrmFmtTableNode( Writer& rWrt, const SwFrmFmt& rFrmFmt )
1340 : : {
1341 : 0 : SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
1342 : :
1343 [ # # ]: 0 : const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt();
1344 : 0 : sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex()+1;
1345 [ # # ][ # # ]: 0 : sal_uLong nEnd = rHTMLWrt.pDoc->GetNodes()[nStt-1]->EndOfSectionIndex();
1346 : :
1347 [ # # ]: 0 : String aCaption;
1348 : 0 : sal_Bool bTopCaption = sal_False;
1349 : :
1350 : : // Nicht const, weil GetTable spater mal nicht const ist
1351 [ # # ][ # # ]: 0 : SwNode *pNd = rHTMLWrt.pDoc->GetNodes()[ nStt ];
1352 : 0 : SwTableNode *pTblNd = pNd->GetTableNode();
1353 : 0 : const SwTxtNode *pTxtNd = pNd->GetTxtNode();
1354 [ # # ][ # # ]: 0 : if( !pTblNd && pTxtNd )
1355 : : {
1356 : : // Tabelle mit Ueberschrift
1357 : 0 : bTopCaption = sal_True;
1358 [ # # ][ # # ]: 0 : pTblNd = rHTMLWrt.pDoc->GetNodes()[nStt+1]->GetTableNode();
1359 : : }
1360 : : OSL_ENSURE( pTblNd, "Rahmen enthaelt keine Tabelle" );
1361 [ # # ]: 0 : if( pTblNd )
1362 : : {
1363 : 0 : sal_uLong nTblEnd = pTblNd->EndOfSectionIndex();
1364 : : OSL_ENSURE( nTblEnd == nEnd - 1 ||
1365 : : (nTblEnd == nEnd - 2 && !bTopCaption),
1366 : : "Ungeuelter Rahmen-Inhalt fuer Tabelle" );
1367 : :
1368 [ # # ]: 0 : if( nTblEnd == nEnd - 2 )
1369 [ # # ][ # # ]: 0 : pTxtNd = rHTMLWrt.pDoc->GetNodes()[nTblEnd+1]->GetTxtNode();
1370 : : }
1371 [ # # ]: 0 : if( pTxtNd )
1372 [ # # ]: 0 : aCaption = pTxtNd->GetTxt();
1373 : :
1374 : : {
1375 : 0 : HTMLSaveData aSaveData( rHTMLWrt, pTblNd->GetIndex()+1,
1376 : : pTblNd->EndOfSectionIndex(),
1377 [ # # ]: 0 : sal_True, &rFrmFmt );
1378 : 0 : rHTMLWrt.bOutFlyFrame = sal_True;
1379 : : OutHTML_SwTblNode( rHTMLWrt, *pTblNd, &rFrmFmt, &aCaption,
1380 [ # # ][ # # ]: 0 : bTopCaption );
1381 : : }
1382 : :
1383 [ # # ]: 0 : return rWrt;
1384 : : }
1385 : :
1386 : 0 : static Writer & OutHTML_FrmFmtAsMulticol( Writer& rWrt,
1387 : : const SwFrmFmt& rFrmFmt,
1388 : : sal_Bool bInCntnr )
1389 : : {
1390 : 0 : SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
1391 : :
1392 [ # # ]: 0 : rHTMLWrt.ChangeParaToken( 0 );
1393 : :
1394 : : // Die aktulle <DL> beenden!
1395 [ # # ]: 0 : rHTMLWrt.OutAndSetDefList( 0 );
1396 : :
1397 : : // als Multicol ausgeben
1398 [ # # ]: 0 : if( rHTMLWrt.bLFPossible )
1399 [ # # ]: 0 : rHTMLWrt.OutNewLine();
1400 : :
1401 : 0 : rtl::OStringBuffer sOut;
1402 [ # # ][ # # ]: 0 : sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_multicol);
1403 : :
1404 [ # # ]: 0 : const SwFmtCol& rFmtCol = rFrmFmt.GetCol();
1405 : :
1406 : : // die Anzahl der Spalten als COLS ausgeben
1407 [ # # ]: 0 : sal_uInt16 nCols = rFmtCol.GetNumCols();
1408 [ # # ]: 0 : if( nCols )
1409 : : {
1410 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_cols).
1411 [ # # ][ # # ]: 0 : append('=').append(static_cast<sal_Int32>(nCols));
1412 : : }
1413 : :
1414 : : // die Gutter-Breite (Minimalwert) als GUTTER
1415 [ # # ]: 0 : sal_uInt16 nGutter = rFmtCol.GetGutterWidth( sal_True );
1416 [ # # ]: 0 : if( nGutter!=USHRT_MAX )
1417 : : {
1418 [ # # ][ # # ]: 0 : if( nGutter && Application::GetDefaultDevice() )
[ # # ][ # # ]
1419 : : {
1420 : : nGutter = (sal_uInt16)Application::GetDefaultDevice()
1421 : : ->LogicToPixel( Size(nGutter,0),
1422 [ # # ][ # # ]: 0 : MapMode(MAP_TWIP) ).Width();
[ # # ][ # # ]
1423 : : }
1424 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_gutter).
1425 [ # # ][ # # ]: 0 : append('=').append(static_cast<sal_Int32>(nGutter));
1426 : : }
1427 : :
1428 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1429 : :
1430 : : // WIDTH
1431 : : sal_uLong nFrmFlags = bInCntnr ? HTML_FRMOPTS_MULTICOL_CNTNR
1432 [ # # ]: 0 : : HTML_FRMOPTS_MULTICOL;
1433 [ # # ][ # # ]: 0 : if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bInCntnr )
[ # # ]
1434 : 0 : nFrmFlags |= HTML_FRMOPTS_MULTICOL_CSS1;
1435 [ # # ]: 0 : rHTMLWrt.OutFrmFmtOptions( rFrmFmt, aEmptyStr, nFrmFlags );
1436 [ # # ][ # # ]: 0 : if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bInCntnr )
[ # # ]
1437 [ # # ]: 0 : rHTMLWrt.OutCSS1_FrmFmtOptions( rFrmFmt, nFrmFlags );
1438 : :
1439 [ # # ][ # # ]: 0 : rWrt.Strm() << '>';
1440 : :
1441 : 0 : rHTMLWrt.bLFPossible = sal_True;
1442 : 0 : rHTMLWrt.IncIndentLevel(); // den Inhalt von Multicol einruecken;
1443 : :
1444 [ # # ]: 0 : const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt();
1445 : 0 : sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex();
1446 [ # # ][ # # ]: 0 : const SwStartNode* pSttNd = rWrt.pDoc->GetNodes()[nStt]->GetStartNode();
1447 : : OSL_ENSURE( pSttNd, "Wo ist der Start-Node" );
1448 : :
1449 : : {
1450 : : // in einem Block damit rechtzeitig vor dem Ende der alte Zustand
1451 : : // wieder hergestellt wird.
1452 : : HTMLSaveData aSaveData( rHTMLWrt, nStt+1,
1453 : : pSttNd->EndOfSectionIndex(),
1454 [ # # ]: 0 : sal_True, &rFrmFmt );
1455 : 0 : rHTMLWrt.bOutFlyFrame = sal_True;
1456 [ # # ][ # # ]: 0 : rHTMLWrt.Out_SwDoc( rWrt.pCurPam );
1457 : : }
1458 : :
1459 : 0 : rHTMLWrt.DecIndentLevel(); // den Inhalt von Multicol einruecken;
1460 [ # # ]: 0 : if( rHTMLWrt.bLFPossible )
1461 [ # # ]: 0 : rHTMLWrt.OutNewLine();
1462 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_multicol, sal_False );
1463 : 0 : rHTMLWrt.bLFPossible = sal_True;
1464 : :
1465 : 0 : return rWrt;
1466 : : }
1467 : :
1468 : 0 : static Writer& OutHTML_FrmFmtAsSpacer( Writer& rWrt, const SwFrmFmt& rFrmFmt )
1469 : : {
1470 : 0 : SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
1471 : :
1472 : : // wenn meoglich vor der Grafik einen Zeilen-Umbruch ausgeben
1473 [ # # ]: 0 : if( rHTMLWrt.bLFPossible )
1474 [ # # ]: 0 : rHTMLWrt.OutNewLine( sal_True );
1475 : :
1476 : 0 : rtl::OStringBuffer sOut;
1477 [ # # ][ # # ]: 0 : sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_spacer).append(' ')
[ # # ]
1478 [ # # ][ # # ]: 0 : .append(OOO_STRING_SVTOOLS_HTML_O_type).append('=')
1479 [ # # ]: 0 : .append(OOO_STRING_SVTOOLS_HTML_SPTYPE_block);
1480 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1481 : :
1482 : : // ALIGN, WIDTH, HEIGHT
1483 [ # # ]: 0 : rtl::OString aEndTags = rHTMLWrt.OutFrmFmtOptions( rFrmFmt, aEmptyStr, HTML_FRMOPTS_SPACER );
1484 : :
1485 [ # # ][ # # ]: 0 : rWrt.Strm() << '>';
1486 [ # # ]: 0 : if( !aEndTags.isEmpty() )
1487 [ # # ][ # # ]: 0 : rWrt.Strm() << aEndTags.getStr();
1488 : :
1489 : 0 : return rWrt;
1490 : : }
1491 : :
1492 : 0 : static Writer& OutHTML_FrmFmtAsDivOrSpan( Writer& rWrt,
1493 : : const SwFrmFmt& rFrmFmt, sal_Bool bSpan)
1494 : : {
1495 : 0 : SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
1496 : :
1497 : 0 : const sal_Char *pStr = 0;
1498 [ # # ]: 0 : if( !bSpan )
1499 : : {
1500 [ # # ]: 0 : rHTMLWrt.ChangeParaToken( 0 );
1501 : :
1502 : : // Die aktulle <DL> beenden!
1503 [ # # ]: 0 : rHTMLWrt.OutAndSetDefList( 0 );
1504 : 0 : pStr = OOO_STRING_SVTOOLS_HTML_division;
1505 : : }
1506 : : else
1507 : 0 : pStr = OOO_STRING_SVTOOLS_HTML_span;
1508 : :
1509 : : // als DIV ausgeben
1510 [ # # ]: 0 : if( rHTMLWrt.bLFPossible )
1511 [ # # ]: 0 : rHTMLWrt.OutNewLine();
1512 : :
1513 : 0 : rtl::OStringBuffer sOut;
1514 [ # # ][ # # ]: 0 : sOut.append('<').append(pStr);
1515 : :
1516 [ # # ][ # # ]: 0 : rWrt.Strm() << sOut.makeStringAndClear().getStr();
1517 : 0 : sal_uLong nFrmFlags = HTML_FRMOPTS_DIV;
1518 [ # # ]: 0 : if( rHTMLWrt.IsHTMLMode( HTMLMODE_BORDER_NONE ) )
1519 : 0 : nFrmFlags |= HTML_FRMOPT_S_NOBORDER;
1520 [ # # ]: 0 : rtl::OString aEndTags = rHTMLWrt.OutFrmFmtOptions( rFrmFmt, aEmptyStr, nFrmFlags );
1521 [ # # ]: 0 : rHTMLWrt.OutCSS1_FrmFmtOptions( rFrmFmt, nFrmFlags );
1522 [ # # ][ # # ]: 0 : rWrt.Strm() << '>';
1523 : :
1524 : 0 : rHTMLWrt.IncIndentLevel(); // den Inhalt einruecken
1525 : 0 : rHTMLWrt.bLFPossible = sal_True;
1526 : :
1527 [ # # ]: 0 : const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt();
1528 : 0 : sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex();
1529 : :
1530 : : // Am Start-Node verankerte Rahmen-gebundene Rahmen ausgeben
1531 [ # # ]: 0 : rHTMLWrt.OutFlyFrm( nStt, 0, HTML_POS_ANY );
1532 : :
1533 [ # # ][ # # ]: 0 : const SwStartNode* pSttNd = rWrt.pDoc->GetNodes()[nStt]->GetStartNode();
1534 : : OSL_ENSURE( pSttNd, "Wo ist der Start-Node" );
1535 : :
1536 : : {
1537 : : // in einem Block damit rechtzeitig vor dem Ende der alte Zustand
1538 : : // wieder hergestellt wird.
1539 : : HTMLSaveData aSaveData( rHTMLWrt, nStt+1,
1540 : : pSttNd->EndOfSectionIndex(),
1541 [ # # ]: 0 : sal_True, &rFrmFmt );
1542 : 0 : rHTMLWrt.bOutFlyFrame = sal_True;
1543 [ # # ][ # # ]: 0 : rHTMLWrt.Out_SwDoc( rWrt.pCurPam );
1544 : : }
1545 : :
1546 : 0 : rHTMLWrt.DecIndentLevel(); // den Inhalt von Multicol einruecken;
1547 [ # # ]: 0 : if( rHTMLWrt.bLFPossible )
1548 [ # # ]: 0 : rHTMLWrt.OutNewLine();
1549 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), pStr, sal_False );
1550 : :
1551 [ # # ]: 0 : if( !aEndTags.isEmpty() )
1552 [ # # ][ # # ]: 0 : rWrt.Strm() << aEndTags.getStr();
1553 : :
1554 : 0 : return rWrt;
1555 : : }
1556 : :
1557 : 0 : static Writer & OutHTML_FrmFmtAsImage( Writer& rWrt, const SwFrmFmt& rFrmFmt,
1558 : : sal_Bool /*bInCntnr*/ )
1559 : : {
1560 : 0 : SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
1561 : :
1562 [ # # ]: 0 : ImageMap aIMap;
1563 [ # # ]: 0 : Graphic aGrf( ((SwFrmFmt &)rFrmFmt).MakeGraphic( &aIMap ) );
1564 : :
1565 [ # # ]: 0 : String aGrfNm;
1566 [ # # ]: 0 : if( rHTMLWrt.GetOrigFileName() )
1567 [ # # ]: 0 : aGrfNm = *rHTMLWrt.GetOrigFileName();
1568 [ # # ][ # # ]: 0 : if( aGrf.GetType() == GRAPHIC_NONE ||
[ # # ][ # # ]
1569 : : XOutBitmap::WriteGraphic( aGrf, aGrfNm,
1570 : : rtl::OUString("JPG"),
1571 : : (XOUTBMP_USE_GIF_IF_POSSIBLE|
1572 [ # # ][ # # ]: 0 : XOUTBMP_USE_NATIVE_IF_POSSIBLE) ) != 0 )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # ]
1573 : : {
1574 : : // leer oder fehlerhaft, da ist nichts auszugeben
1575 : 0 : rHTMLWrt.nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE;
1576 : 0 : return rWrt;
1577 : : }
1578 : :
1579 : : aGrfNm = URIHelper::SmartRel2Abs(
1580 : 0 : INetURLObject(rWrt.GetBaseURL()), aGrfNm,
1581 [ # # ]: 0 : URIHelper::GetMaybeFileHdl() );
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1582 : 0 : Size aSz( 0, 0 );
1583 : 0 : OutHTML_Image( rWrt, rFrmFmt, aGrfNm, rFrmFmt.GetName(), aSz,
1584 : : HTML_FRMOPTS_GENIMG, pMarkToFrame,
1585 [ # # ][ # # ]: 0 : aIMap.GetIMapObjectCount() ? &aIMap : 0 );
1586 [ # # ][ # # ]: 0 : return rWrt;
[ # # ]
1587 : : }
1588 : :
1589 : :
1590 : 0 : static Writer& OutHTML_FrmFmtGrfNode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
1591 : : sal_Bool bInCntnr )
1592 : : {
1593 : 0 : SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
1594 : :
1595 [ # # ]: 0 : const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt();
1596 : 0 : sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex()+1;
1597 [ # # ][ # # ]: 0 : SwGrfNode *pGrfNd = rHTMLWrt.pDoc->GetNodes()[ nStt ]->GetGrfNode();
1598 : : OSL_ENSURE( pGrfNd, "Grf-Node erwartet" );
1599 [ # # ]: 0 : if( !pGrfNd )
1600 : 0 : return rWrt;
1601 : :
1602 [ # # ][ # # ]: 0 : const SwMirrorGrf& rMirror = pGrfNd->GetSwAttrSet().GetMirrorGrf();
1603 : :
1604 [ # # ]: 0 : String aGrfNm;
1605 [ # # ][ # # ]: 0 : if( !pGrfNd->IsLinkedFile() || RES_MIRROR_GRAPH_DONT != rMirror.GetValue() )
[ # # ]
1606 : : {
1607 : : // Grafik als File-Referenz speichern (als JPEG-Grafik speichern)
1608 [ # # ]: 0 : if( rHTMLWrt.GetOrigFileName() )
1609 [ # # ]: 0 : aGrfNm = *rHTMLWrt.GetOrigFileName();
1610 [ # # ]: 0 : pGrfNd->SwapIn( sal_True );
1611 : :
1612 : : sal_uLong nFlags = XOUTBMP_USE_GIF_IF_SENSIBLE |
1613 : 0 : XOUTBMP_USE_NATIVE_IF_POSSIBLE;
1614 [ # # # # ]: 0 : switch( rMirror.GetValue() )
1615 : : {
1616 : 0 : case RES_MIRROR_GRAPH_VERT: nFlags = XOUTBMP_MIRROR_HORZ; break;
1617 : 0 : case RES_MIRROR_GRAPH_HOR: nFlags = XOUTBMP_MIRROR_VERT; break;
1618 : : case RES_MIRROR_GRAPH_BOTH:
1619 : 0 : nFlags = XOUTBMP_MIRROR_VERT | XOUTBMP_MIRROR_HORZ;
1620 : 0 : break;
1621 : : }
1622 : :
1623 : 0 : Size aMM100Size;
1624 [ # # ]: 0 : const SwFmtFrmSize& rSize = rFrmFmt.GetFrmSize();
1625 : 0 : aMM100Size = OutputDevice::LogicToLogic( rSize.GetSize(),
1626 [ # # ]: 0 : MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ));
[ # # # # ]
[ # # ][ # # ]
1627 : :
1628 [ # # ]: 0 : sal_uInt16 nErr = XOutBitmap::WriteGraphic( pGrfNd->GetGrf(), aGrfNm,
1629 [ # # ][ # # ]: 0 : rtl::OUString("JPG"), nFlags, &aMM100Size );
[ # # ]
1630 [ # # ]: 0 : if( nErr ) // fehlerhaft, da ist nichts auszugeben
1631 : : {
1632 : 0 : rHTMLWrt.nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE;
1633 : 0 : return rWrt;
1634 : : }
1635 : : aGrfNm = URIHelper::SmartRel2Abs(
1636 : 0 : INetURLObject(rWrt.GetBaseURL()), aGrfNm,
1637 [ # # ]: 0 : URIHelper::GetMaybeFileHdl() );
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1638 : : }
1639 : : else
1640 : : {
1641 [ # # ]: 0 : pGrfNd->GetFileFilterNms( &aGrfNm, 0 );
1642 [ # # ]: 0 : if( rHTMLWrt.bCfgCpyLinkedGrfs )
1643 [ # # ]: 0 : rWrt.CopyLocalFileToINet( aGrfNm );
1644 : : }
1645 : :
1646 [ # # ]: 0 : sal_uLong nFrmFlags = bInCntnr ? HTML_FRMOPTS_IMG_CNTNR : HTML_FRMOPTS_IMG;
1647 [ # # ][ # # ]: 0 : if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bInCntnr )
[ # # ]
1648 : 0 : nFrmFlags |= HTML_FRMOPTS_IMG_CSS1;
1649 : : OutHTML_Image( rWrt, rFrmFmt, aGrfNm, pGrfNd->GetTitle(),
1650 [ # # ][ # # ]: 0 : pGrfNd->GetTwipSize(), nFrmFlags, pMarkToGraphic );
[ # # ][ # # ]
1651 : :
1652 [ # # ]: 0 : return rWrt;
1653 : : }
1654 : :
1655 : :
1656 : 0 : static Writer& OutHTML_FrmFmtAsMarquee( Writer& rWrt, const SwFrmFmt& rFrmFmt,
1657 : : const SdrObject& rSdrObj )
1658 : : {
1659 : 0 : SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
1660 : :
1661 : : // die Edit-Engine-Attribute des Objekts als SW-Attribute holen
1662 : : // und als Hints einsortieren
1663 : 0 : const SfxItemSet& rFmtItemSet = rFrmFmt.GetAttrSet();
1664 : 0 : SfxItemSet aItemSet( *rFmtItemSet.GetPool(), RES_CHRATR_BEGIN,
1665 [ # # ]: 0 : RES_CHRATR_END );
1666 [ # # ]: 0 : SwHTMLWriter::GetEEAttrsFromDrwObj( aItemSet, &rSdrObj, sal_True );
1667 : 0 : sal_Bool bCfgOutStylesOld = rHTMLWrt.bCfgOutStyles;
1668 : 0 : rHTMLWrt.bCfgOutStyles = sal_False;
1669 : 0 : rHTMLWrt.bTxtAttr = sal_True;
1670 : 0 : rHTMLWrt.bTagOn = sal_True;
1671 [ # # ]: 0 : Out_SfxItemSet( aHTMLAttrFnTab, rWrt, aItemSet, sal_False );
1672 : 0 : rHTMLWrt.bTxtAttr = sal_False;
1673 : :
1674 : : OutHTML_DrawFrmFmtAsMarquee( rHTMLWrt,
1675 : : (const SwDrawFrmFmt &)rFrmFmt,
1676 [ # # ]: 0 : rSdrObj );
1677 : 0 : rHTMLWrt.bTxtAttr = sal_True;
1678 : 0 : rHTMLWrt.bTagOn = sal_False;
1679 [ # # ]: 0 : Out_SfxItemSet( aHTMLAttrFnTab, rWrt, aItemSet, sal_False );
1680 : 0 : rHTMLWrt.bTxtAttr = sal_False;
1681 : 0 : rHTMLWrt.bCfgOutStyles = bCfgOutStylesOld;
1682 : :
1683 [ # # ]: 0 : return rWrt;
1684 : : }
1685 : :
1686 : : //-----------------------------------------------------------------------
1687 : :
1688 : 0 : Writer& OutHTML_HeaderFooter( Writer& rWrt, const SwFrmFmt& rFrmFmt,
1689 : : sal_Bool bHeader )
1690 : : {
1691 : 0 : SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
1692 : :
1693 : : // als Multicol ausgeben
1694 [ # # ]: 0 : rHTMLWrt.OutNewLine();
1695 : 0 : rtl::OStringBuffer sOut;
1696 [ # # ][ # # ]: 0 : sOut.append(OOO_STRING_SVTOOLS_HTML_division).append(' ')
1697 [ # # ][ # # ]: 0 : .append(OOO_STRING_SVTOOLS_HTML_O_type).append('=')
1698 [ # # ][ # # ]: 0 : .append(bHeader ? "HEADER" : "FOOTER");
1699 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sOut.makeStringAndClear().getStr() );
1700 : :
1701 : 0 : rHTMLWrt.IncIndentLevel(); // den Inhalt von Multicol einruecken;
1702 : :
1703 : : // Einen Spacer fuer den Absatnd zusammenbasteln. Da durch das
1704 : : // <DL> bzw. </DL> immer einer Absatz-Abstand entsteht, wird der
1705 : : // ggf. abgezogen.
1706 [ # # ]: 0 : const SvxULSpaceItem& rULSpace = rFrmFmt.GetULSpace();
1707 [ # # ]: 0 : sal_uInt16 nSize = bHeader ? rULSpace.GetLower() : rULSpace.GetUpper();
1708 : 0 : rHTMLWrt.nHeaderFooterSpace = nSize;
1709 : :
1710 : 0 : rtl::OString aSpacer;
1711 [ # # ][ # # ]: 0 : if( rHTMLWrt.IsHTMLMode(HTMLMODE_VERT_SPACER) &&
[ # # ][ # # ]
1712 [ # # ]: 0 : nSize > HTML_PARSPACE && Application::GetDefaultDevice() )
1713 : : {
1714 : 0 : nSize -= HTML_PARSPACE;
1715 : : nSize = (sal_Int16)Application::GetDefaultDevice()
1716 [ # # ][ # # ]: 0 : ->LogicToPixel( Size(nSize,0), MapMode(MAP_TWIP) ).Width();
[ # # ][ # # ]
1717 : :
1718 : : aSpacer = rtl::OStringBuffer(OOO_STRING_SVTOOLS_HTML_spacer).
1719 [ # # ][ # # ]: 0 : append(' ').append(OOO_STRING_SVTOOLS_HTML_O_type).
1720 [ # # ][ # # ]: 0 : append('=').append(OOO_STRING_SVTOOLS_HTML_SPTYPE_vertical).
1721 [ # # ][ # # ]: 0 : append(' ').append(OOO_STRING_SVTOOLS_HTML_O_size).
1722 [ # # ][ # # ]: 0 : append('=').append(static_cast<sal_Int32>(nSize)).
1723 : 0 : makeStringAndClear();
1724 : : }
1725 : :
1726 [ # # ]: 0 : const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt();
1727 : 0 : sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex();
1728 [ # # ][ # # ]: 0 : const SwStartNode* pSttNd = rWrt.pDoc->GetNodes()[nStt]->GetStartNode();
1729 : : OSL_ENSURE( pSttNd, "Wo ist der Start-Node" );
1730 : :
1731 [ # # ][ # # ]: 0 : if( !bHeader && !aSpacer.isEmpty() )
[ # # ]
1732 : : {
1733 [ # # ]: 0 : rHTMLWrt.OutNewLine();
1734 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), aSpacer.getStr() );
1735 : : }
1736 : :
1737 : : {
1738 : : // in einem Block damit rechtzeitig vor dem Ende der alte Zustand
1739 : : // wieder hergestellt wird. pFlyFmt braucht hier nicht gestzt zu
1740 : : // werden, denn PageDesc-Attribute koennen hier nicht vorkommen
1741 : : HTMLSaveData aSaveData( rHTMLWrt, nStt+1,
1742 [ # # ]: 0 : pSttNd->EndOfSectionIndex() );
1743 : :
1744 [ # # ]: 0 : if( bHeader )
1745 : 0 : rHTMLWrt.bOutHeader = sal_True;
1746 : : else
1747 : 0 : rHTMLWrt.bOutFooter = sal_True;
1748 : :
1749 [ # # ][ # # ]: 0 : rHTMLWrt.Out_SwDoc( rWrt.pCurPam );
1750 : : }
1751 : :
1752 [ # # ][ # # ]: 0 : if( bHeader && !aSpacer.isEmpty() )
[ # # ]
1753 : : {
1754 [ # # ]: 0 : rHTMLWrt.OutNewLine();
1755 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), aSpacer.getStr() );
1756 : : }
1757 : :
1758 : 0 : rHTMLWrt.DecIndentLevel(); // den Inhalt von Multicol einruecken;
1759 [ # # ]: 0 : rHTMLWrt.OutNewLine();
1760 [ # # ][ # # ]: 0 : HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_division, sal_False );
1761 : :
1762 : 0 : rHTMLWrt.nHeaderFooterSpace = 0;
1763 : :
1764 : 0 : return rWrt;
1765 : : }
1766 : :
1767 : :
1768 : 0 : void SwHTMLWriter::AddLinkTarget( const String& rURL )
1769 : : {
1770 [ # # ][ # # ]: 0 : if( !rURL.Len() || rURL.GetChar(0) != '#' )
[ # # ]
1771 : : return;
1772 : :
1773 : : // There might be a '|' as delimiter (if the link has been inserted
1774 : : // freshly) or a '%7c' or a '%7C' if the document has been saved and
1775 : : // loaded already.
1776 : 0 : xub_StrLen nPos = rURL.Len();
1777 : 0 : sal_Bool bFound = sal_False, bEncoded = sal_False;
1778 [ # # ][ # # ]: 0 : while( !bFound && nPos > 0 )
[ # # ]
1779 : : {
1780 : 0 : sal_Unicode c = rURL.GetChar( --nPos );
1781 [ # # # ]: 0 : switch( c )
1782 : : {
1783 : : case cMarkSeperator:
1784 : 0 : bFound = sal_True;
1785 : 0 : break;
1786 : : case '%':
1787 : 0 : bFound = (rURL.Len() - nPos) >=3 &&
1788 : 0 : rURL.GetChar( nPos+1 ) == '7' &&
1789 [ # # ][ # # ]: 0 : ((c =rURL.GetChar( nPos+2 )) == 'C' || c == 'c');
[ # # # # ]
1790 [ # # ]: 0 : if( bFound )
1791 : 0 : bEncoded = sal_True;
1792 : : }
1793 : : }
1794 [ # # ][ # # ]: 0 : if( !bFound || nPos < 2 ) // mindetsens "#a|..."
1795 : : return;
1796 : :
1797 [ # # ]: 0 : String aURL( rURL.Copy( 1 ) );
1798 : :
1799 : : // nPos-1+1/3 (-1 wg. Erase)
1800 : : String sCmp(comphelper::string::remove(aURL.Copy(bEncoded ? nPos+2 : nPos),
1801 [ # # ][ # # ]: 0 : ' '));
[ # # ][ # # ]
[ # # ]
1802 [ # # ]: 0 : if( !sCmp.Len() )
1803 : : return;
1804 : :
1805 [ # # ]: 0 : sCmp.ToLowerAscii();
1806 : :
1807 [ # # ][ # # ]: 0 : if( sCmp.EqualsAscii( pMarkToRegion ) ||
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1808 [ # # ]: 0 : sCmp.EqualsAscii( pMarkToFrame ) ||
1809 [ # # ]: 0 : sCmp.EqualsAscii( pMarkToGraphic ) ||
1810 [ # # ]: 0 : sCmp.EqualsAscii( pMarkToOLE ) ||
1811 [ # # ]: 0 : sCmp.EqualsAscii( pMarkToTable ) )
1812 : : {
1813 : : // Einfach nur in einem sortierten Array merken
1814 [ # # ]: 0 : if( bEncoded )
1815 : : {
1816 [ # # ]: 0 : aURL.Erase( nPos, 2 );
1817 [ # # ]: 0 : aURL.SetChar( nPos-1, cMarkSeperator );
1818 : : }
1819 [ # # ]: 0 : aImplicitMarks.insert( aURL );
1820 : : }
1821 [ # # ][ # # ]: 0 : else if( sCmp.EqualsAscii( pMarkToOutline ) )
1822 : : {
1823 : : // Hier brauchen wir Position und Name. Deshalb sortieren wir
1824 : : // ein sal_uInt16 und ein String-Array selbst
1825 [ # # ]: 0 : String aOutline( aURL.Copy( 0, nPos-1 ) );
1826 [ # # ]: 0 : SwPosition aPos( *pCurPam->GetPoint() );
1827 [ # # ][ # # ]: 0 : if( pDoc->GotoOutline( aPos, aOutline ) )
1828 : : {
1829 : 0 : sal_uInt32 nIdx = aPos.nNode.GetIndex();
1830 : :
1831 : 0 : sal_uInt32 nIns=0;
1832 [ # # ][ # # ]: 0 : while( nIns < aOutlineMarkPoss.size() &&
[ # # ]
1833 [ # # ]: 0 : aOutlineMarkPoss[nIns] < nIdx )
1834 : 0 : nIns++;
1835 : :
1836 [ # # ][ # # ]: 0 : aOutlineMarkPoss.insert( aOutlineMarkPoss.begin()+nIns, nIdx );
1837 [ # # ]: 0 : if( bEncoded )
1838 : : {
1839 [ # # ]: 0 : aURL.Erase( nPos, 2 );
1840 [ # # ]: 0 : aURL.SetChar( nPos-1, cMarkSeperator );
1841 : : }
1842 [ # # ][ # # ]: 0 : aOutlineMarks.insert( aOutlineMarks.begin()+nIns, new String( aURL ) );
[ # # ][ # # ]
[ # # ]
1843 [ # # ][ # # ]: 0 : }
1844 : : }
1845 [ # # ]: 0 : else if( sCmp.EqualsAscii( pMarkToText ) )
1846 : : {
1847 : : //
1848 [ # # ][ # # ]: 0 : }
[ # # ][ # # ]
1849 : : }
1850 : :
1851 : 2 : void SwHTMLWriter::CollectLinkTargets()
1852 : : {
1853 : : const SwFmtINetFmt* pINetFmt;
1854 : : const SwTxtINetFmt* pTxtAttr;
1855 : : const SwTxtNode* pTxtNd;
1856 : :
1857 : 2 : sal_uInt32 n, nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT );
1858 [ - + ]: 2 : for( n = 0; n < nMaxItems; ++n )
1859 : : {
1860 [ # # ][ # # ]: 0 : if( 0 != (pINetFmt = (SwFmtINetFmt*)pDoc->GetAttrPool().GetItem2(
[ # # # # ]
[ # # ]
1861 : 0 : RES_TXTATR_INETFMT, n ) ) &&
1862 : : 0 != ( pTxtAttr = pINetFmt->GetTxtINetFmt()) &&
1863 : : 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
1864 : 0 : pTxtNd->GetNodes().IsDocNodes() )
1865 : : {
1866 : 0 : AddLinkTarget( pINetFmt->GetValue() );
1867 : : }
1868 : : }
1869 : :
1870 : : const SwFmtURL *pURL;
1871 : 2 : nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_URL );
1872 [ - + ]: 2 : for( n = 0; n < nMaxItems; ++n )
1873 : : {
1874 [ # # ]: 0 : if( 0 != (pURL = (SwFmtURL*)pDoc->GetAttrPool().GetItem2(
1875 : 0 : RES_URL, n ) ) )
1876 : : {
1877 : 0 : AddLinkTarget( pURL->GetURL() );
1878 : 0 : const ImageMap *pIMap = pURL->GetMap();
1879 [ # # ]: 0 : if( pIMap )
1880 : : {
1881 [ # # ]: 0 : for( sal_uInt16 i=0; i<pIMap->GetIMapObjectCount(); i++ )
1882 : : {
1883 : 0 : const IMapObject* pObj = pIMap->GetIMapObject( i );
1884 [ # # ]: 0 : if( pObj )
1885 : : {
1886 : 0 : AddLinkTarget( pObj->GetURL() );
1887 : : }
1888 : : }
1889 : : }
1890 : : }
1891 : : }
1892 : 2 : }
1893 : :
1894 : : //-----------------------------------------------------------------------
1895 : :
1896 : 0 : SwHTMLPosFlyFrm::SwHTMLPosFlyFrm( const SwPosFlyFrm& rPosFly,
1897 : : const SdrObject *pSdrObj,
1898 : : sal_uInt8 nOutMode ) :
1899 : 0 : pFrmFmt( &rPosFly.GetFmt() ),
1900 : : pSdrObject( pSdrObj ),
1901 [ # # ]: 0 : pNdIdx( new SwNodeIndex( rPosFly.GetNdIndex() ) ),
1902 : 0 : nOrdNum( rPosFly.GetOrdNum() ),
1903 : : nCntntIdx( 0 ),
1904 : 0 : nOutputMode( nOutMode )
1905 : : {
1906 : 0 : const SwFmtAnchor& rAnchor = rPosFly.GetFmt().GetAnchor();
1907 [ # # ]: 0 : if ((FLY_AT_CHAR == rAnchor.GetAnchorId()) &&
[ # # # # ]
1908 : 0 : HTML_POS_INSIDE == GetOutPos() )
1909 : : {
1910 : : // Auto-gebundene Rahmen werden ein Zeichen weiter hinten
1911 : : // ausgegeben, weil dann die Positionierung mit Netscape
1912 : : // uebereinstimmt.
1913 : : OSL_ENSURE( rAnchor.GetCntntAnchor(), "Keine Anker-Position?" );
1914 [ # # ]: 0 : if( rAnchor.GetCntntAnchor() )
1915 : : {
1916 : 0 : nCntntIdx = rAnchor.GetCntntAnchor()->nContent.GetIndex();
1917 : 0 : sal_Int16 eHoriRel = rPosFly.GetFmt().GetHoriOrient().
1918 : 0 : GetRelationOrient();
1919 [ # # ][ # # ]: 0 : if( text::RelOrientation::FRAME == eHoriRel || text::RelOrientation::PRINT_AREA == eHoriRel )
1920 : : {
1921 : 0 : const SwCntntNode *pCNd = pNdIdx->GetNode().GetCntntNode();
1922 : : OSL_ENSURE( pCNd, "Kein Content-Node an PaM-Position" );
1923 [ # # ][ # # ]: 0 : if( pCNd && nCntntIdx < pCNd->Len() )
[ # # ]
1924 : 0 : nCntntIdx++;
1925 : : }
1926 : : }
1927 : : }
1928 : 0 : }
1929 : :
1930 : 0 : bool SwHTMLPosFlyFrm::operator<( const SwHTMLPosFlyFrm& rFrm ) const
1931 : : {
1932 [ # # ]: 0 : if( pNdIdx->GetIndex() == rFrm.pNdIdx->GetIndex() )
1933 : : {
1934 [ # # ]: 0 : if( nCntntIdx == rFrm.nCntntIdx )
1935 : : {
1936 [ # # ]: 0 : if( GetOutPos() == rFrm.GetOutPos() )
1937 : 0 : return nOrdNum < rFrm.nOrdNum;
1938 : : else
1939 : 0 : return GetOutPos() < rFrm.GetOutPos();
1940 : : }
1941 : : else
1942 : 0 : return nCntntIdx < rFrm.nCntntIdx;
1943 : : }
1944 : : else
1945 : 0 : return pNdIdx->GetIndex() < rFrm.pNdIdx->GetIndex();
1946 : : }
1947 : :
1948 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|