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