1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: htmlplug.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #include <com/sun/star/embed/EmbedStates.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include "hintids.hxx"
39 #include <svtools/urihelper.hxx>
40 #define _SVSTDARR_ULONGS
41 #include <svtools/svstdarr.hxx>
42 #include <vcl/svapp.hxx>
43 #include <sfx2/frmhtml.hxx>
44 #include <sfx2/frmhtmlw.hxx>
45 #ifndef _WRKWIN_HXX //autogen
46 #include <vcl/wrkwin.hxx>
48 #include <sot/storage.hxx>
49 #include <svx/xoutbmp.hxx>
50 #include <svx/ulspitem.hxx>
51 #include <svx/lrspitem.hxx>
52 #include <svtools/htmlkywd.hxx>
53 #include <svtools/htmltokn.h>
54 #include <SwAppletImpl.hxx>
55 #include <fmtornt.hxx>
56 #include <fmtfsize.hxx>
57 #include <fmtsrnd.hxx>
58 #include <fmtanchr.hxx>
59 #include <fmtcntnt.hxx>
62 #include <svtools/ownlist.hxx>
68 #include "swtable.hxx"
70 #include "wrthtml.hxx"
71 #include "htmlfly.hxx"
73 #include <com/sun/star/embed/XClassifiedObject.hpp>
74 #include <com/sun/star/embed/EmbedStates.hpp>
75 #include <comphelper/embeddedobjectcontainer.hxx>
76 #include <sot/clsids.hxx>
78 using namespace com::sun::star
;
80 #define HTML_DFLT_EMBED_WIDTH ((MM50*5)/2)
81 #define HTML_DFLT_EMBED_HEIGHT ((MM50*5)/2)
83 #define HTML_DFLT_APPLET_WIDTH ((MM50*5)/2)
84 #define HTML_DFLT_APPLET_HEIGHT ((MM50*5)/2)
88 static char const sHTML_O_Hidden_False
[] = "FALSE";
92 const ULONG HTML_FRMOPTS_EMBED_ALL
=
96 const ULONG HTML_FRMOPTS_EMBED_CNTNR
=
97 HTML_FRMOPTS_EMBED_ALL
|
99 const ULONG HTML_FRMOPTS_EMBED
=
100 HTML_FRMOPTS_EMBED_ALL
|
103 HTML_FRMOPT_BRCLEAR
|
105 const ULONG HTML_FRMOPTS_HIDDEN_EMBED
=
109 const ULONG HTML_FRMOPTS_APPLET_ALL
=
112 const ULONG HTML_FRMOPTS_APPLET_CNTNR
=
113 HTML_FRMOPTS_APPLET_ALL
|
115 const ULONG HTML_FRMOPTS_APPLET
=
116 HTML_FRMOPTS_APPLET_ALL
|
121 const ULONG HTML_FRMOPTS_IFRAME_ALL
=
124 const ULONG HTML_FRMOPTS_IFRAME_CNTNR
=
125 HTML_FRMOPTS_IFRAME_ALL
|
127 const ULONG HTML_FRMOPTS_IFRAME
=
128 HTML_FRMOPTS_IFRAME_ALL
|
134 const ULONG HTML_FRMOPTS_OLE_CSS1
=
135 HTML_FRMOPT_S_ALIGN
|
140 void SwHTMLParser::SetFixSize( const Size
& rPixSize
,
141 const Size
& rTwipDfltSize
,
142 BOOL bPrcWidth
, BOOL bPrcHeight
,
143 SfxItemSet
& /*rCSS1ItemSet*/,
144 SvxCSS1PropertyInfo
& rCSS1PropInfo
,
145 SfxItemSet
& rFlyItemSet
)
147 // absolulte Groessenangaben in Twip umrechnen
148 BYTE nPrcWidth
= 0, nPrcHeight
= 0;
149 Size
aTwipSz( bPrcWidth
|| USHRT_MAX
==rPixSize
.Width() ? 0 : rPixSize
.Width(),
150 bPrcHeight
|| USHRT_MAX
==rPixSize
.Height() ? 0 : rPixSize
.Height() );
151 if( (aTwipSz
.Width() || aTwipSz
.Height()) && Application::GetDefaultDevice() )
154 Application::GetDefaultDevice()->PixelToLogic( aTwipSz
,
158 // die Breite bearbeiten
159 if( SVX_CSS1_LTYPE_PERCENTAGE
== rCSS1PropInfo
.eWidthType
)
161 nPrcWidth
= (BYTE
)rCSS1PropInfo
.nWidth
;
162 aTwipSz
.Width() = rTwipDfltSize
.Width();
164 else if( SVX_CSS1_LTYPE_TWIP
== rCSS1PropInfo
.eWidthType
)
166 aTwipSz
.Width() = rCSS1PropInfo
.nWidth
;
168 else if( bPrcWidth
&& rPixSize
.Width() )
170 nPrcWidth
= (BYTE
)rPixSize
.Width();
171 if( nPrcWidth
> 100 )
174 aTwipSz
.Width() = rTwipDfltSize
.Width();
176 else if( USHRT_MAX
==rPixSize
.Width() )
178 aTwipSz
.Width() = rTwipDfltSize
.Width();
180 if( aTwipSz
.Width() < MINFLY
)
182 aTwipSz
.Width() = MINFLY
;
186 if( SVX_CSS1_LTYPE_PERCENTAGE
== rCSS1PropInfo
.eHeightType
)
188 nPrcHeight
= (BYTE
)rCSS1PropInfo
.nHeight
;
189 aTwipSz
.Height() = rTwipDfltSize
.Height();
191 else if( SVX_CSS1_LTYPE_TWIP
== rCSS1PropInfo
.eHeightType
)
193 aTwipSz
.Height() = rCSS1PropInfo
.nHeight
;
195 else if( bPrcHeight
&& rPixSize
.Height() )
197 nPrcHeight
= (BYTE
)rPixSize
.Height();
198 if( nPrcHeight
> 100 )
201 aTwipSz
.Height() = rTwipDfltSize
.Height();
203 else if( USHRT_MAX
==rPixSize
.Height() )
205 aTwipSz
.Height() = rTwipDfltSize
.Height();
207 if( aTwipSz
.Height() < MINFLY
)
209 aTwipSz
.Height() = MINFLY
;
213 SwFmtFrmSize
aFrmSize( ATT_FIX_SIZE
, aTwipSz
.Width(), aTwipSz
.Height() );
214 aFrmSize
.SetWidthPercent( nPrcWidth
);
215 aFrmSize
.SetHeightPercent( nPrcHeight
);
216 rFlyItemSet
.Put( aFrmSize
);
219 void SwHTMLParser::SetSpace( const Size
& rPixSpace
,
220 SfxItemSet
& rCSS1ItemSet
,
221 SvxCSS1PropertyInfo
& rCSS1PropInfo
,
222 SfxItemSet
& rFlyItemSet
)
224 sal_Int32 nLeftSpace
= 0, nRightSpace
= 0;
225 sal_uInt16 nUpperSpace
= 0, nLowerSpace
= 0;
226 if( (rPixSpace
.Width() || rPixSpace
.Height()) && Application::GetDefaultDevice() )
228 Size
aTwipSpc( rPixSpace
.Width(), rPixSpace
.Height() );
230 Application::GetDefaultDevice()->PixelToLogic( aTwipSpc
,
232 nLeftSpace
= nRightSpace
= aTwipSpc
.Width();
233 nUpperSpace
= nLowerSpace
= (USHORT
)aTwipSpc
.Height();
236 // linken/rechten Rand setzen
237 const SfxPoolItem
*pItem
;
238 if( SFX_ITEM_SET
==rCSS1ItemSet
.GetItemState( RES_LR_SPACE
, TRUE
, &pItem
) )
240 // Ggf. den Erstzeilen-Einzug noch plaetten
241 const SvxLRSpaceItem
*pLRItem
= (const SvxLRSpaceItem
*)pItem
;
242 SvxLRSpaceItem
aLRItem( *pLRItem
);
243 aLRItem
.SetTxtFirstLineOfst( 0 );
244 if( rCSS1PropInfo
.bLeftMargin
)
246 nLeftSpace
= aLRItem
.GetLeft();
247 rCSS1PropInfo
.bLeftMargin
= FALSE
;
249 if( rCSS1PropInfo
.bRightMargin
)
251 nRightSpace
= aLRItem
.GetRight();
252 rCSS1PropInfo
.bRightMargin
= FALSE
;
254 rCSS1ItemSet
.ClearItem( RES_LR_SPACE
);
256 if( nLeftSpace
> 0 || nRightSpace
> 0 )
258 SvxLRSpaceItem
aLRItem( RES_LR_SPACE
);
259 aLRItem
.SetLeft( nLeftSpace
> 0 ? nLeftSpace
: 0 );
260 aLRItem
.SetRight( nRightSpace
> 0 ? nRightSpace
: 0 );
261 rFlyItemSet
.Put( aLRItem
);
264 const SwFmtHoriOrient
& rHoriOri
=
265 (const SwFmtHoriOrient
&)rFlyItemSet
.Get( RES_HORI_ORIENT
);
266 if( text::HoriOrientation::NONE
== rHoriOri
.GetHoriOrient() )
268 SwFmtHoriOrient
aHoriOri( rHoriOri
);
269 aHoriOri
.SetPos( aHoriOri
.GetPos() + nLeftSpace
);
270 rFlyItemSet
.Put( aHoriOri
);
275 // oberen/unteren Rand setzen
276 if( SFX_ITEM_SET
==rCSS1ItemSet
.GetItemState( RES_UL_SPACE
, TRUE
, &pItem
) )
278 // Ggf. den Erstzeilen-Einzug noch plaetten
279 const SvxULSpaceItem
*pULItem
= (const SvxULSpaceItem
*)pItem
;
280 if( rCSS1PropInfo
.bTopMargin
)
282 nUpperSpace
= pULItem
->GetUpper();
283 rCSS1PropInfo
.bTopMargin
= FALSE
;
285 if( rCSS1PropInfo
.bBottomMargin
)
287 nLowerSpace
= pULItem
->GetLower();
288 rCSS1PropInfo
.bBottomMargin
= FALSE
;
290 rCSS1ItemSet
.ClearItem( RES_UL_SPACE
);
292 if( nUpperSpace
|| nLowerSpace
)
294 SvxULSpaceItem
aULItem( RES_UL_SPACE
);
295 aULItem
.SetUpper( nUpperSpace
);
296 aULItem
.SetLower( nLowerSpace
);
297 rFlyItemSet
.Put( aULItem
);
300 const SwFmtVertOrient
& rVertOri
=
301 (const SwFmtVertOrient
&)rFlyItemSet
.Get( RES_VERT_ORIENT
);
302 if( text::VertOrientation::NONE
== rVertOri
.GetVertOrient() )
304 SwFmtVertOrient
aVertOri( rVertOri
);
305 aVertOri
.SetPos( aVertOri
.GetPos() + nUpperSpace
);
306 rFlyItemSet
.Put( aVertOri
);
314 void SwHTMLParser::InsertEmbed()
316 String aURL
, aType
, aName
, aAlt
, aId
, aStyle
, aClass
;
317 Size
aSize( USHRT_MAX
, USHRT_MAX
);
318 Size
aSpace( USHRT_MAX
, USHRT_MAX
);
319 BOOL bPrcWidth
= FALSE
, bPrcHeight
= FALSE
, bHidden
= FALSE
;
320 sal_Int16 eVertOri
= text::VertOrientation::NONE
;
321 sal_Int16 eHoriOri
= text::HoriOrientation::NONE
;
322 SvCommandList aCmdLst
;
323 const HTMLOptions
*pHTMLOptions
= GetOptions();
325 // Die Optionen werden vorwaerts gelesen, weil die Plugins sie in
326 // dieser Reihenfolge erwarten. Trotzdem darf immer nur der erste
327 // Wert einer Option beruecksichtigt werden.
328 USHORT nArrLen
= pHTMLOptions
->Count();
329 for( USHORT i
=0; i
<nArrLen
; i
++ )
331 const HTMLOption
*pOption
= (*pHTMLOptions
)[i
];
332 switch( pOption
->GetToken() )
335 aId
= pOption
->GetString();
338 aStyle
= pOption
->GetString();
341 aClass
= pOption
->GetString();
344 aName
= pOption
->GetString();
348 aURL
= pOption
->GetString();
351 aAlt
= pOption
->GetString();
355 aType
= pOption
->GetString();
358 if( eVertOri
==text::VertOrientation::NONE
&& eHoriOri
==text::HoriOrientation::NONE
)
360 eVertOri
= pOption
->GetEnum( aHTMLImgVAlignTable
, eVertOri
);
361 eHoriOri
= pOption
->GetEnum( aHTMLImgHAlignTable
, eHoriOri
);
365 if( USHRT_MAX
==aSize
.Width() )
367 bPrcWidth
= (pOption
->GetString().Search('%') != STRING_NOTFOUND
);
368 aSize
.Width() = (long)pOption
->GetNumber();
372 if( USHRT_MAX
==aSize
.Height() )
374 bPrcHeight
= (pOption
->GetString().Search('%') != STRING_NOTFOUND
);
375 aSize
.Height() = (long)pOption
->GetNumber();
379 if( USHRT_MAX
==aSpace
.Width() )
380 aSpace
.Width() = (long)pOption
->GetNumber();
383 if( USHRT_MAX
==aSpace
.Height() )
384 aSpace
.Height() = (long)pOption
->GetNumber();
387 if( pOption
->GetTokenString().EqualsIgnoreCaseAscii( OOO_STRING_SW_HTML_O_Hidden
) )
389 !pOption
->GetString().EqualsIgnoreCaseAscii( sHTML_O_Hidden_False
);
393 // Es werden alle Parameter an das Plugin weitergereicht
394 aCmdLst
.Append( pOption
->GetTokenString(), pOption
->GetString() );
397 SfxItemSet
aItemSet( pDoc
->GetAttrPool(), pCSS1Parser
->GetWhichMap() );
398 SvxCSS1PropertyInfo aPropInfo
;
399 if( HasStyleOptions( aStyle
, aId
, aClass
) )
400 ParseStyleOptions( aStyle
, aId
, aClass
, aItemSet
, aPropInfo
);
402 // Die Default-Werte umsetzen (ausser Hoehe/Breite, das macht schon
403 // SetFrmSize() fuer uns)
404 if( eVertOri
==text::VertOrientation::NONE
&& eHoriOri
==text::HoriOrientation::NONE
)
405 eVertOri
= text::VertOrientation::TOP
;
406 if( USHRT_MAX
==aSpace
.Width() )
408 if( USHRT_MAX
==aSpace
.Height() )
412 // Size (0,0) wird in SetFrmSize auf (MINFLY, MINFLY) umgebogen
413 aSize
.Width() = 0; aSize
.Height() = 0;
414 aSpace
.Width() = 0; aSpace
.Height() = 0;
415 bPrcWidth
= bPrcHeight
= FALSE
;
418 // die URL aufbereiten
419 INetURLObject aURLObj
;
420 bool bHasURL
= aURL
.Len() &&
422 URIHelper::SmartRel2Abs(
423 INetURLObject(sBaseURL
), aURL
,
424 URIHelper::GetMaybeFileHdl()) );
426 // #109761# do not insert plugin if it has neither URL nor type
427 bool bHasType
= aType
.Len() != 0;
428 if( !bHasURL
&& !bHasType
)
431 // das Plugin anlegen
432 comphelper::EmbeddedObjectContainer aCnt
;
433 ::rtl::OUString aObjName
;
434 uno::Reference
< embed::XEmbeddedObject
> xObj
= aCnt
.CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID
).GetByteSequence(), aObjName
);
435 if ( svt::EmbeddedObjectRef::TryRunningState( xObj
) )
437 uno::Reference
< beans::XPropertySet
> xSet( xObj
->getComponent(), uno::UNO_QUERY
);
441 xSet
->setPropertyValue( ::rtl::OUString::createFromAscii("PluginURL"),
442 uno::makeAny( ::rtl::OUString( aURL
) ) );
444 xSet
->setPropertyValue( ::rtl::OUString::createFromAscii("PluginMimeType"),
445 uno::makeAny( ::rtl::OUString( aType
) ) );
447 uno::Sequence
< beans::PropertyValue
> aProps
;
448 aCmdLst
.FillSequence( aProps
);
449 xSet
->setPropertyValue( ::rtl::OUString::createFromAscii("PluginCommands"), uno::makeAny( aProps
) );
451 // TODO/LATER: EnableSetModified?!
452 //pPlugin->EnableSetModified( TRUE );
456 SfxItemSet
aFrmSet( pDoc
->GetAttrPool(),
457 RES_FRMATR_BEGIN
, RES_FRMATR_END
-1 );
459 Reader::ResetFrmFmtAttrs( aFrmSet
);
464 SetAnchorAndAdjustment( eVertOri
, eHoriOri
, aItemSet
, aPropInfo
, aFrmSet
);
468 SwFmtAnchor
aAnchor( FLY_AT_CNTNT
);
469 aAnchor
.SetAnchor( pPam
->GetPoint() );
470 aFrmSet
.Put( aAnchor
);
471 aFrmSet
.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT
, text::RelOrientation::FRAME
) );
472 aFrmSet
.Put( SwFmtSurround( SURROUND_THROUGHT
) );
473 aFrmSet
.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP
, text::RelOrientation::PRINT_AREA
) );
476 // und noch die Groesse des Rahmens
477 Size
aDfltSz( HTML_DFLT_EMBED_WIDTH
, HTML_DFLT_EMBED_HEIGHT
);
478 SetFixSize( aSize
, aDfltSz
, bPrcWidth
, bPrcHeight
, aItemSet
, aPropInfo
,
480 SetSpace( aSpace
, aItemSet
, aPropInfo
, aFrmSet
);
482 // und in das Dok einfuegen
484 pDoc
->Insert( *pPam
, ::svt::EmbeddedObjectRef( xObj
, embed::Aspects::MSOLE_CONTENT
), &aFrmSet
, NULL
, NULL
);
486 // Namen am FrmFmt setzen
488 pFlyFmt
->SetName( aName
);
490 // den alternativen Text setzen
491 SwNoTxtNode
*pNoTxtNd
=
492 pDoc
->GetNodes()[ pFlyFmt
->GetCntnt().GetCntntIdx()
493 ->GetIndex()+1 ]->GetNoTxtNode();
494 pNoTxtNd
->SetTitle( aAlt
);
496 // Ggf Frames anlegen und auto-geb. Rahmen registrieren
499 // HIDDEN-Plugins sollen absatzgebunden bleiben. Da RegisterFlyFrm
500 // absatzgebundene Rahmen mit DUrchlauf in am Zeichen gebundene
501 // Rahmen umwandelt, muessen die Frames hier von Hand angelegt werden.
502 RegisterFlyFrm( pFlyFmt
);
509 void SwHTMLParser::NewObject()
511 String aClassID
, aName
, aStandBy
, aId
, aStyle
, aClass
;
512 Size
aSize( USHRT_MAX
, USHRT_MAX
);
514 sal_Int16 eVertOri
= text::VertOrientation::TOP
;
515 sal_Int16 eHoriOri
= text::HoriOrientation::NONE
;
517 sal_Bool bPrcWidth
= sal_False
, bPrcHeight
= sal_False
,
518 bDeclare
= sal_False
;
519 // Eine neue Command-List anlegen
522 pAppletImpl
= new SwApplet_Impl( pDoc
->GetAttrPool(),
523 RES_FRMATR_BEGIN
, RES_FRMATR_END
-1 );
525 const HTMLOptions
*pHTMLOptions
= GetOptions();
526 for( USHORT i
= pHTMLOptions
->Count(); i
; )
528 const HTMLOption
*pOption
= (*pHTMLOptions
)[--i
];
529 switch( pOption
->GetToken() )
532 aId
= pOption
->GetString();
535 aStyle
= pOption
->GetString();
538 aClass
= pOption
->GetString();
544 aClassID
= pOption
->GetString();
546 case HTML_O_CODEBASE
:
552 case HTML_O_CODETYPE
:
558 aStandBy
= pOption
->GetString();
561 bPrcWidth
= (pOption
->GetString().Search('%') != STRING_NOTFOUND
);
562 aSize
.Width() = (long)pOption
->GetNumber();
565 bPrcHeight
= (pOption
->GetString().Search('%') != STRING_NOTFOUND
);
566 aSize
.Height() = (long)pOption
->GetNumber();
569 eVertOri
= pOption
->GetEnum( aHTMLImgVAlignTable
, eVertOri
);
570 eHoriOri
= pOption
->GetEnum( aHTMLImgHAlignTable
, eHoriOri
);
575 aName
= pOption
->GetString();
578 aSpace
.Width() = (long)pOption
->GetNumber();
581 aSpace
.Height() = (long)pOption
->GetNumber();
586 case HTML_O_SDONCLICK
:
588 case HTML_O_SDONMOUSEOVER
:
589 case HTML_O_ONMOUSEOVER
:
590 case HTML_O_SDONMOUSEOUT
:
591 case HTML_O_ONMOUSEOUT
:
594 // Es werden alle Parameter auch an das Applet weitergereicht
595 pAppletImpl
->AppendParam( pOption
->GetTokenString(),
596 pOption
->GetString() );
600 // Objects that are declared only are not evaluated. Moreover, only
601 // Java applets are supported.
602 sal_Bool bIsApplet
= sal_False
;;
604 if( !bDeclare
&& aClassID
.Len() == 42 &&
605 aClassID
.EqualsAscii( "clsid:", 0, 6 ) )
607 aClassID
.Erase( 0, 6 );
609 if( aCID
.MakeId( aClassID
) )
611 SvGlobalName
aJavaCID( 0x8AD9C840UL
, 0x044EU
, 0x11D1U
, 0xB3U
, 0xE9U
,
612 0x00U
, 0x80U
, 0x5FU
, 0x49U
, 0x9DU
, 0x93U
);
614 bIsApplet
= aJavaCID
== aCID
;
625 pAppletImpl
->SetAltText( aStandBy
);
627 SfxItemSet
aItemSet( pDoc
->GetAttrPool(), pCSS1Parser
->GetWhichMap() );
628 SvxCSS1PropertyInfo aPropInfo
;
629 if( HasStyleOptions( aStyle
, aId
, aClass
) )
630 ParseStyleOptions( aStyle
, aId
, aClass
, aItemSet
, aPropInfo
);
632 SfxItemSet
& rFrmSet
= pAppletImpl
->GetItemSet();
634 Reader::ResetFrmFmtAttrs( rFrmSet
);
636 // den Anker und die Ausrichtung setzen
637 SetAnchorAndAdjustment( eVertOri
, eHoriOri
, aItemSet
, aPropInfo
, rFrmSet
);
639 // und noch die Groesse des Rahmens
640 Size
aDfltSz( HTML_DFLT_APPLET_WIDTH
, HTML_DFLT_APPLET_HEIGHT
);
641 SetFixSize( aSize
, aDfltSz
, bPrcWidth
, bPrcHeight
, aItemSet
, aPropInfo
,
643 SetSpace( aSpace
, aItemSet
, aPropInfo
, rFrmSet
);
647 void SwHTMLParser::EndObject()
652 if( pAppletImpl
->CreateApplet( sBaseURL
) )
654 pAppletImpl
->FinishApplet();
656 // und in das Dok einfuegen
659 ::svt::EmbeddedObjectRef( pAppletImpl
->GetApplet(), embed::Aspects::MSOLE_CONTENT
),
660 &pAppletImpl
->GetItemSet(),
664 // den alternativen Namen setzen
665 SwNoTxtNode
*pNoTxtNd
=
666 pDoc
->GetNodes()[ pFlyFmt
->GetCntnt().GetCntntIdx()
667 ->GetIndex()+1 ]->GetNoTxtNode();
668 pNoTxtNd
->SetTitle( pAppletImpl
->GetAltText() );
670 // Ggf Frames anlegen und auto-geb. Rahmen registrieren
671 RegisterFlyFrm( pFlyFmt
);
680 void SwHTMLParser::InsertApplet()
682 String aCodeBase
, aCode
, aName
, aAlt
, aId
, aStyle
, aClass
;
683 Size
aSize( USHRT_MAX
, USHRT_MAX
);
685 BOOL bPrcWidth
= FALSE
, bPrcHeight
= FALSE
, bMayScript
= FALSE
;
686 sal_Int16 eVertOri
= text::VertOrientation::TOP
;
687 sal_Int16 eHoriOri
= text::HoriOrientation::NONE
;
689 // Eine neue Command-List anlegen
692 pAppletImpl
= new SwApplet_Impl( pDoc
->GetAttrPool(), RES_FRMATR_BEGIN
, RES_FRMATR_END
-1 );
694 const HTMLOptions
*pHTMLOptions
= GetOptions();
695 for( USHORT i
= pHTMLOptions
->Count(); i
; )
697 const HTMLOption
*pOption
= (*pHTMLOptions
)[--i
];
698 switch( pOption
->GetToken() )
701 aId
= pOption
->GetString();
704 aStyle
= pOption
->GetString();
707 aClass
= pOption
->GetString();
709 case HTML_O_CODEBASE
:
710 aCodeBase
= pOption
->GetString();
713 aCode
= pOption
->GetString();
716 aName
= pOption
->GetString();
719 aAlt
= pOption
->GetString();
722 eVertOri
= pOption
->GetEnum( aHTMLImgVAlignTable
, eVertOri
);
723 eHoriOri
= pOption
->GetEnum( aHTMLImgHAlignTable
, eHoriOri
);
726 bPrcWidth
= (pOption
->GetString().Search('%') != STRING_NOTFOUND
);
727 aSize
.Width() = (long)pOption
->GetNumber();
730 bPrcHeight
= (pOption
->GetString().Search('%') != STRING_NOTFOUND
);
731 aSize
.Height() = (long)pOption
->GetNumber();
734 aSpace
.Width() = (long)pOption
->GetNumber();
737 aSpace
.Height() = (long)pOption
->GetNumber();
739 case HTML_O_MAYSCRIPT
:
744 // Es werden alle Parameter auch an das Applet weitergereicht
745 pAppletImpl
->AppendParam( pOption
->GetTokenString(),
746 pOption
->GetString() );
756 if ( aCodeBase
.Len() )
757 aCodeBase
= INetURLObject::GetAbsURL( sBaseURL
, aCodeBase
);
758 pAppletImpl
->CreateApplet( aCode
, aName
, bMayScript
, aCodeBase
, sBaseURL
);//, aAlt );
759 pAppletImpl
->SetAltText( aAlt
);
761 SfxItemSet
aItemSet( pDoc
->GetAttrPool(), pCSS1Parser
->GetWhichMap() );
762 SvxCSS1PropertyInfo aPropInfo
;
763 if( HasStyleOptions( aStyle
, aId
, aClass
) )
764 ParseStyleOptions( aStyle
, aId
, aClass
, aItemSet
, aPropInfo
);
766 SfxItemSet
& rFrmSet
= pAppletImpl
->GetItemSet();
768 Reader::ResetFrmFmtAttrs( rFrmSet
);
770 // den Anker und die Ausrichtung setzen
771 SetAnchorAndAdjustment( eVertOri
, eHoriOri
, aItemSet
, aPropInfo
, rFrmSet
);
773 // und noch die Groesse des Rahmens
774 Size
aDfltSz( HTML_DFLT_APPLET_WIDTH
, HTML_DFLT_APPLET_HEIGHT
);
775 SetFixSize( aSize
, aDfltSz
, bPrcWidth
, bPrcHeight
, aItemSet
, aPropInfo
,
777 SetSpace( aSpace
, aItemSet
, aPropInfo
, rFrmSet
);
781 void SwHTMLParser::EndApplet()
787 pAppletImpl
->FinishApplet();
789 // und in das Dok einfuegen
792 ::svt::EmbeddedObjectRef( pAppletImpl
->GetApplet(), embed::Aspects::MSOLE_CONTENT
),
793 &pAppletImpl
->GetItemSet(),
797 // den alternativen Namen setzen
798 SwNoTxtNode
*pNoTxtNd
=
799 pDoc
->GetNodes()[ pFlyFmt
->GetCntnt().GetCntntIdx()
800 ->GetIndex()+1 ]->GetNoTxtNode();
801 pNoTxtNd
->SetTitle( pAppletImpl
->GetAltText() );
803 // Ggf Frames anlegen und auto-geb. Rahmen registrieren
804 RegisterFlyFrm( pFlyFmt
);
811 void SwHTMLParser::InsertParam()
817 String aName
, aValue
;
819 const HTMLOptions
*pHTMLOptions
= GetOptions();
820 for( USHORT i
= pHTMLOptions
->Count(); i
; )
822 const HTMLOption
*pOption
= (*pHTMLOptions
)[--i
];
823 switch( pOption
->GetToken() )
826 aName
= pOption
->GetString();
829 aValue
= pOption
->GetString();
837 pAppletImpl
->AppendParam( aName
, aValue
);
844 void SwHTMLParser::InsertFloatingFrame()
846 String aAlt
, aId
, aStyle
, aClass
;
847 Size
aSize( USHRT_MAX
, USHRT_MAX
);
849 BOOL bPrcWidth
= FALSE
, bPrcHeight
= FALSE
;
850 sal_Int16 eVertOri
= text::VertOrientation::TOP
;
851 sal_Int16 eHoriOri
= text::HoriOrientation::NONE
;
853 const HTMLOptions
*pHTMLOptions
= GetOptions();
855 // Erstmal die Optionen f?r das Writer-Frame-Format holen
856 USHORT nArrLen
= pHTMLOptions
->Count();
857 for ( USHORT i
=0; i
<nArrLen
; i
++ )
859 const HTMLOption
*pOption
= (*pHTMLOptions
)[i
];
860 switch( pOption
->GetToken() )
863 aId
= pOption
->GetString();
866 aStyle
= pOption
->GetString();
869 aClass
= pOption
->GetString();
872 aAlt
= pOption
->GetString();
875 eVertOri
= pOption
->GetEnum( aHTMLImgVAlignTable
, eVertOri
);
876 eHoriOri
= pOption
->GetEnum( aHTMLImgHAlignTable
, eHoriOri
);
879 bPrcWidth
= (pOption
->GetString().Search('%') != STRING_NOTFOUND
);
880 aSize
.Width() = (long)pOption
->GetNumber();
883 bPrcHeight
= (pOption
->GetString().Search('%') != STRING_NOTFOUND
);
884 aSize
.Height() = (long)pOption
->GetNumber();
887 aSpace
.Width() = (long)pOption
->GetNumber();
890 aSpace
.Height() = (long)pOption
->GetNumber();
895 // und jetzt die fuer den SfxFrame
896 SfxFrameDescriptor aFrameDesc
;
898 SfxFrameHTMLParser::ParseFrameOptions( &aFrameDesc
, pHTMLOptions
, sBaseURL
);
900 // den Floating-Frame anlegen
901 comphelper::EmbeddedObjectContainer aCnt
;
902 ::rtl::OUString aObjName
;
903 uno::Reference
< embed::XEmbeddedObject
> xObj
= aCnt
.CreateEmbeddedObject( SvGlobalName( SO3_IFRAME_CLASSID
).GetByteSequence(), aObjName
);
905 //pFrame->EnableSetModified( FALSE );
909 if ( svt::EmbeddedObjectRef::TryRunningState( xObj
) )
911 uno::Reference
< beans::XPropertySet
> xSet( xObj
->getComponent(), uno::UNO_QUERY
);
914 ::rtl::OUString aName
= aFrameDesc
.GetName();
915 ScrollingMode eScroll
= aFrameDesc
.GetScrollingMode();
916 sal_Bool bHasBorder
= aFrameDesc
.HasFrameBorder();
917 Size aMargin
= aFrameDesc
.GetMargin();
919 xSet
->setPropertyValue( ::rtl::OUString::createFromAscii("FrameURL"), uno::makeAny( ::rtl::OUString( aFrameDesc
.GetURL().GetMainURL( INetURLObject::NO_DECODE
) ) ) );
920 xSet
->setPropertyValue( ::rtl::OUString::createFromAscii("FrameName"), uno::makeAny( aName
) );
922 if ( eScroll
== ScrollingAuto
)
923 xSet
->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll"),
924 uno::makeAny( sal_True
) );
926 xSet
->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode"),
927 uno::makeAny( (sal_Bool
) ( eScroll
== ScrollingYes
) ) );
929 //if ( aFrmDescr.IsFrameBorderSet() )
930 xSet
->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder"),
931 uno::makeAny( bHasBorder
) );
933 xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder"),
934 uno::makeAny( sal_True ) );*/
936 xSet
->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth"),
937 uno::makeAny( sal_Int32( aMargin
.Width() ) ) );
939 xSet
->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight"),
940 uno::makeAny( sal_Int32( aMargin
.Height() ) ) );
944 catch ( uno::Exception
& )
948 //pFrame->EnableSetModified( TRUE );
950 SfxItemSet
aItemSet( pDoc
->GetAttrPool(), pCSS1Parser
->GetWhichMap() );
951 SvxCSS1PropertyInfo aPropInfo
;
952 if( HasStyleOptions( aStyle
, aId
, aClass
) )
953 ParseStyleOptions( aStyle
, aId
, aClass
, aItemSet
, aPropInfo
);
956 SfxItemSet
aFrmSet( pDoc
->GetAttrPool(),
957 RES_FRMATR_BEGIN
, RES_FRMATR_END
-1 );
959 Reader::ResetFrmFmtAttrs( aFrmSet
);
961 // den Anker und die Ausrichtung setzen
962 SetAnchorAndAdjustment( eVertOri
, eHoriOri
, aItemSet
, aPropInfo
, aFrmSet
);
964 // und noch die Groesse des Rahmens
965 Size
aDfltSz( HTML_DFLT_APPLET_WIDTH
, HTML_DFLT_APPLET_HEIGHT
);
966 SetFixSize( aSize
, aDfltSz
, bPrcWidth
, bPrcHeight
, aItemSet
, aPropInfo
,
968 SetSpace( aSpace
, aItemSet
, aPropInfo
, aFrmSet
);
970 // und in das Dok einfuegen
972 pDoc
->Insert( *pPam
, ::svt::EmbeddedObjectRef( xObj
, embed::Aspects::MSOLE_CONTENT
), &aFrmSet
, NULL
, NULL
);
974 // den alternativen Namen setzen
975 SwNoTxtNode
*pNoTxtNd
=
976 pDoc
->GetNodes()[ pFlyFmt
->GetCntnt().GetCntntIdx()
977 ->GetIndex()+1 ]->GetNoTxtNode();
978 pNoTxtNd
->SetTitle( aAlt
);
980 // Ggf Frames anlegen und auto-geb. Rahmen registrieren
981 RegisterFlyFrm( pFlyFmt
);
983 bInFloatingFrame
= TRUE
;
989 #define SWHTML_OPTTYPE_IGNORE 0
990 #define SWHTML_OPTTYPE_TAG 1
991 #define SWHTML_OPTTYPE_PARAM 2
994 static USHORT GetOptionType( const String& rName, BOOL bApplet )
996 USHORT nType = bApplet ? SWHTML_OPTTYPE_PARAM : SWHTML_OPTTYPE_TAG;
998 switch( rName.GetChar(0) )
1002 if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_align ) ||
1003 rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_alt ) )
1004 nType = SWHTML_OPTTYPE_IGNORE;
1006 (rName.EqualsIgnoreCaseAscii( sHTML_O_archive ) ||
1007 rName.EqualsIgnoreCaseAscii( sHTML_O_Archives )) )
1008 nType = SWHTML_OPTTYPE_TAG;
1012 if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_class ) ||
1013 (bApplet && (rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_code ) ||
1014 rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_codebase ))) )
1015 nType = SWHTML_OPTTYPE_IGNORE;
1019 if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_height ) ||
1020 rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_hspace ) ||
1021 (!bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SW_HTML_O_Hidden )) )
1022 nType = SWHTML_OPTTYPE_IGNORE;
1026 if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_id ) )
1027 nType = SWHTML_OPTTYPE_IGNORE;
1031 if( bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_mayscript ) )
1032 nType = SWHTML_OPTTYPE_IGNORE;
1036 if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_name ) )
1037 nType = SWHTML_OPTTYPE_IGNORE;
1041 if( bApplet && rName.EqualsIgnoreCaseAscii( sHTML_O_Object ) )
1042 nType = SWHTML_OPTTYPE_TAG;
1046 if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_style ) ||
1047 (!bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_src )) )
1048 nType = SWHTML_OPTTYPE_IGNORE;
1052 if( !bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_type ) )
1053 nType = SWHTML_OPTTYPE_IGNORE;
1057 if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_vspace ) )
1058 nType = SWHTML_OPTTYPE_IGNORE;
1062 if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_width ) )
1063 nType = SWHTML_OPTTYPE_IGNORE;
1071 USHORT
SwHTMLWriter::GuessOLENodeFrmType( const SwNode
& rNode
)
1073 SwOLEObj
& rObj
= ((SwOLENode
*)rNode
.GetOLENode())->GetOLEObj();
1075 SwHTMLFrmType eType
= HTML_FRMTYPE_OLE
;
1077 uno::Reference
< embed::XClassifiedObject
> xClass ( rObj
.GetOleRef(), uno::UNO_QUERY
);
1078 SvGlobalName
aClass( xClass
->getClassID() );
1079 if( aClass
== SvGlobalName( SO3_PLUGIN_CLASSID
) )
1081 eType
= HTML_FRMTYPE_PLUGIN
;
1083 else if( aClass
== SvGlobalName( SO3_IFRAME_CLASSID
) )
1085 eType
= HTML_FRMTYPE_IFRAME
;
1088 else if( aClass
== SvGlobalName( SO3_APPLET_CLASSID
) )
1090 eType
= HTML_FRMTYPE_APPLET
;
1094 return static_cast< USHORT
>(eType
);
1097 Writer
& OutHTML_FrmFmtOLENode( Writer
& rWrt
, const SwFrmFmt
& rFrmFmt
,
1100 SwHTMLWriter
& rHTMLWrt
= (SwHTMLWriter
&)rWrt
;
1102 const SwFmtCntnt
& rFlyCntnt
= rFrmFmt
.GetCntnt();
1103 ULONG nStt
= rFlyCntnt
.GetCntntIdx()->GetIndex()+1;
1104 SwOLENode
*pOLENd
= rHTMLWrt
.pDoc
->GetNodes()[ nStt
]->GetOLENode();
1106 ASSERT( pOLENd
, "OLE-Node erwartet" );
1110 SwOLEObj
&rObj
= pOLENd
->GetOLEObj();
1112 uno::Reference
< embed::XEmbeddedObject
> xObj( rObj
.GetOleRef() );
1113 if ( !svt::EmbeddedObjectRef::TryRunningState( xObj
) )
1116 uno::Reference
< beans::XPropertySet
> xSet( xObj
->getComponent(), uno::UNO_QUERY
);
1117 BOOL bHiddenEmbed
= FALSE
;
1121 DBG_ERROR("Unknown Object" );
1125 ByteString aEndTags
;
1128 // wenn meoglich vor dem "Objekt" einen Zeilen-Umbruch ausgeben
1129 if( rHTMLWrt
.bLFPossible
)
1130 rHTMLWrt
.OutNewLine( TRUE
);
1132 if( rFrmFmt
.GetName().Len() )
1133 rHTMLWrt
.OutImplicitMark( rFrmFmt
.GetName(),
1136 SvGlobalName
aGlobName( xObj
->getClassID() );
1137 ByteString
sOut('<');
1138 if( aGlobName
== SvGlobalName( SO3_PLUGIN_CLASSID
) )
1140 // erstmal das Plug-spezifische
1141 sOut
+= OOO_STRING_SVTOOLS_HTML_embed
;
1143 ::rtl::OUString aStr
;
1145 aAny
= xSet
->getPropertyValue( ::rtl::OUString::createFromAscii("PluginURL" ) );
1146 if( (aAny
>>= aStr
) && aStr
.getLength() )
1148 aURL
= URIHelper::simpleNormalizedMakeRelative( rWrt
.GetBaseURL(),
1154 ((sOut
+= ' ') += OOO_STRING_SVTOOLS_HTML_O_src
) += "=\"";
1155 rWrt
.Strm() << sOut
.GetBuffer();
1156 HTMLOutFuncs::Out_String( rWrt
.Strm(), aURL
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
);
1160 ::rtl::OUString aType
;
1161 aAny
= xSet
->getPropertyValue( ::rtl::OUString::createFromAscii("PluginMimeType" ) );
1162 if( (aAny
>>= aType
) && aType
.getLength() )
1164 ((sOut
+= ' ') += OOO_STRING_SVTOOLS_HTML_O_type
) += "=\"";
1165 rWrt
.Strm() << sOut
.GetBuffer();
1166 HTMLOutFuncs::Out_String( rWrt
.Strm(), aType
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
);
1170 if( FLY_AT_CNTNT
== rFrmFmt
.GetAnchor().GetAnchorId() &&
1171 SURROUND_THROUGHT
== rFrmFmt
.GetSurround().GetSurround() )
1173 // Das Plugin ist HIDDEN
1174 (sOut
+= ' ') += OOO_STRING_SW_HTML_O_Hidden
;
1175 nFrmOpts
= HTML_FRMOPTS_HIDDEN_EMBED
;
1176 bHiddenEmbed
= TRUE
;
1180 nFrmOpts
= bInCntnr
? HTML_FRMOPTS_EMBED_CNTNR
1181 : HTML_FRMOPTS_EMBED
;
1184 else if( aGlobName
== SvGlobalName( SO3_APPLET_CLASSID
) )
1186 // oder das Applet-Spezifische
1188 sOut
+= OOO_STRING_SVTOOLS_HTML_applet
;
1191 ::rtl::OUString aCd
;
1192 aAny
= xSet
->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCodeBase" ) );
1193 if( (aAny
>>= aCd
) && aCd
.getLength() )
1195 String
sCodeBase( URIHelper::simpleNormalizedMakeRelative(rWrt
.GetBaseURL(), aCd
) );
1196 if( sCodeBase
.Len() )
1198 ((sOut
+= ' ') += OOO_STRING_SVTOOLS_HTML_O_codebase
) += "=\"";
1199 rWrt
.Strm() << sOut
.GetBuffer();
1200 HTMLOutFuncs::Out_String( rWrt
.Strm(), sCodeBase
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
);
1206 ::rtl::OUString aClass
;
1207 aAny
= xSet
->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCode" ) );
1209 ((sOut
+= ' ') += OOO_STRING_SVTOOLS_HTML_O_code
) += "=\"";
1210 rWrt
.Strm() << sOut
.GetBuffer();
1211 HTMLOutFuncs::Out_String( rWrt
.Strm(), aClass
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
);
1215 ::rtl::OUString aAppletName
;
1216 aAny
= xSet
->getPropertyValue( ::rtl::OUString::createFromAscii("AppletName" ) );
1217 aAny
>>= aAppletName
;
1218 if( aAppletName
.getLength() )
1220 ((sOut
+= ' ') += OOO_STRING_SVTOOLS_HTML_O_name
) += "=\"";
1221 rWrt
.Strm() << sOut
.GetBuffer();
1222 HTMLOutFuncs::Out_String( rWrt
.Strm(), aAppletName
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
);
1226 sal_Bool bScript
= sal_False
;
1227 aAny
= xSet
->getPropertyValue( ::rtl::OUString::createFromAscii("AppletIsScript" ) );
1230 (sOut
+= ' ') += OOO_STRING_SVTOOLS_HTML_O_mayscript
;
1232 nFrmOpts
= bInCntnr
? HTML_FRMOPTS_APPLET_CNTNR
1233 : HTML_FRMOPTS_APPLET
;
1237 // oder das Flating-Frame spezifische
1239 sOut
+= OOO_STRING_SVTOOLS_HTML_iframe
;
1240 rWrt
.Strm() << sOut
.GetBuffer();
1242 SfxFrameHTMLWriter::Out_FrameDescriptor( rWrt
.Strm(), rWrt
.GetBaseURL(),
1245 &rHTMLWrt
.aNonConvertableCharacters
);
1248 nFrmOpts
= bInCntnr
? HTML_FRMOPTS_IFRAME_CNTNR
1249 : HTML_FRMOPTS_IFRAME
;
1252 rWrt
.Strm() << sOut
.GetBuffer();
1254 // ALT, WIDTH, HEIGHT, HSPACE, VSPACE, ALIGN
1255 if( rHTMLWrt
.IsHTMLMode( HTMLMODE_ABS_POS_FLY
) && !bHiddenEmbed
)
1256 nFrmOpts
|= HTML_FRMOPTS_OLE_CSS1
;
1257 rHTMLWrt
.OutFrmFmtOptions( rFrmFmt
, pOLENd
->GetTitle(),
1258 aEndTags
, nFrmOpts
);
1259 if( rHTMLWrt
.IsHTMLMode( HTMLMODE_ABS_POS_FLY
) && !bHiddenEmbed
)
1260 rHTMLWrt
.OutCSS1_FrmFmtOptions( rFrmFmt
, nFrmOpts
);
1262 if( aGlobName
== SvGlobalName( SO3_APPLET_CLASSID
) )
1264 // fuer Applets die Parameter als eigene Tags ausgeben
1265 // und ein </APPLET> schreiben
1267 uno::Sequence
< beans::PropertyValue
> aProps
;
1268 aAny
= xSet
->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCommands" ) );
1271 SvCommandList aCommands
;
1272 aCommands
.FillFromSequence( aProps
);
1274 ULONG i
= aCommands
.Count();
1277 const SvCommand
& rCommand
= aCommands
[ --i
];
1278 const String
& rName
= rCommand
.GetCommand();
1279 USHORT nType
= SwApplet_Impl::GetOptionType( rName
, TRUE
);
1280 if( SWHTML_OPTTYPE_TAG
== nType
)
1282 const String
& rValue
= rCommand
.GetArgument();
1284 HTMLOutFuncs::Out_String( rWrt
.Strm(), rName
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
);
1285 rWrt
.Strm() << "=\"";
1286 HTMLOutFuncs::Out_String( rWrt
.Strm(), rValue
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
) << '\"';
1288 else if( SWHTML_OPTTYPE_PARAM
== nType
)
1290 aParams
.Insert( i
, aParams
.Count() );
1294 rHTMLWrt
.Strm() << '>';
1296 rHTMLWrt
.IncIndentLevel(); // Inhalt von Applet einruecken
1298 USHORT ii
= aParams
.Count();
1301 const SvCommand
& rCommand
= aCommands
[ aParams
[--ii
] ];
1302 const String
& rName
= rCommand
.GetCommand();
1303 const String
& rValue
= rCommand
.GetArgument();
1304 rHTMLWrt
.OutNewLine();
1305 ((((sOut
= '<') += OOO_STRING_SVTOOLS_HTML_param
) += ' ') += OOO_STRING_SVTOOLS_HTML_O_name
)
1307 rWrt
.Strm() << sOut
.GetBuffer();
1308 HTMLOutFuncs::Out_String( rWrt
.Strm(), rName
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
);
1309 ((sOut
= "\" ") += OOO_STRING_SVTOOLS_HTML_O_value
) += "=\"";
1310 rWrt
.Strm() << sOut
.GetBuffer();
1311 HTMLOutFuncs::Out_String( rWrt
.Strm(), rValue
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
) << "\">";
1314 rHTMLWrt
.DecIndentLevel(); // Inhalt von Applet einruecken
1315 if( aCommands
.Count() )
1316 rHTMLWrt
.OutNewLine();
1317 HTMLOutFuncs::Out_AsciiTag( rWrt
.Strm(), OOO_STRING_SVTOOLS_HTML_applet
, FALSE
);
1320 if( aGlobName
== SvGlobalName( SO3_PLUGIN_CLASSID
) )
1322 // fuer Plugins die Paramater als Optionen schreiben
1324 uno::Sequence
< beans::PropertyValue
> aProps
;
1325 aAny
= xSet
->getPropertyValue( ::rtl::OUString::createFromAscii("PluginCommands" ) );
1328 SvCommandList aCommands
;
1329 aCommands
.FillFromSequence( aProps
);
1330 for( ULONG i
=0; i
<aCommands
.Count(); i
++ )
1332 const SvCommand
& rCommand
= aCommands
[ i
];
1333 const String
& rName
= rCommand
.GetCommand();
1335 if( SwApplet_Impl::GetOptionType( rName
, FALSE
) == SWHTML_OPTTYPE_TAG
)
1337 const String
& rValue
= rCommand
.GetArgument();
1339 HTMLOutFuncs::Out_String( rWrt
.Strm(), rName
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
);
1340 rWrt
.Strm() << "=\"";
1341 HTMLOutFuncs::Out_String( rWrt
.Strm(), rValue
, rHTMLWrt
.eDestEnc
, &rHTMLWrt
.aNonConvertableCharacters
) << '\"';
1344 rHTMLWrt
.Strm() << '>';
1348 // und fuer Floating-Frames einfach noch ein </IFRAME>
1351 rHTMLWrt
.Strm() << '>';
1352 HTMLOutFuncs::Out_AsciiTag( rWrt
.Strm(), OOO_STRING_SVTOOLS_HTML_iframe
, FALSE
);
1355 if( aEndTags
.Len() )
1356 rWrt
.Strm() << aEndTags
.GetBuffer();
1361 Writer
& OutHTML_FrmFmtOLENodeGrf( Writer
& rWrt
, const SwFrmFmt
& rFrmFmt
,
1364 SwHTMLWriter
& rHTMLWrt
= (SwHTMLWriter
&)rWrt
;
1366 const SwFmtCntnt
& rFlyCntnt
= rFrmFmt
.GetCntnt();
1367 ULONG nStt
= rFlyCntnt
.GetCntntIdx()->GetIndex()+1;
1368 SwOLENode
*pOLENd
= rHTMLWrt
.pDoc
->GetNodes()[ nStt
]->GetOLENode();
1370 ASSERT( pOLENd
, "OLE-Node erwartet" );
1374 // Inhalt des Nodes als Grafik speichern
1375 //uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef();
1377 //if( xObj.is() && xRef->GetGDIMetaFile( aPic ).GetActionCount() )
1379 //Graphic aGrf( aPic );
1380 Graphic
aGrf( *pOLENd
->GetGraphic() );
1382 const String
* pTempFileName
= rHTMLWrt
.GetOrigFileName();
1384 aGrfNm
= *pTempFileName
;
1386 USHORT nErr
= XOutBitmap::WriteGraphic( aGrf
, aGrfNm
,
1387 String::CreateFromAscii("JPG"),
1388 (XOUTBMP_USE_GIF_IF_POSSIBLE
|
1389 XOUTBMP_USE_NATIVE_IF_POSSIBLE
) );
1390 if( nErr
) // fehlerhaft, da ist nichts auszugeben
1392 rHTMLWrt
.nWarn
= WARN_SWG_POOR_LOAD
| WARN_SW_WRITE_BASE
;
1395 aGrfNm
= URIHelper::SmartRel2Abs(
1396 INetURLObject(rWrt
.GetBaseURL()), aGrfNm
,
1397 URIHelper::GetMaybeFileHdl() );
1398 ULONG nFlags
= bInCntnr
? HTML_FRMOPTS_GENIMG_CNTNR
1399 : HTML_FRMOPTS_GENIMG
;
1400 OutHTML_Image( rWrt
, rFrmFmt
, aGrfNm
,
1401 pOLENd
->GetTitle(), pOLENd
->GetTwipSize(),
1402 nFlags
, pMarkToOLE
);