xref: /aoo41x/main/sw/source/filter/html/htmldraw.cxx (revision 5222b95b)
1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5efeef26fSAndrew Rist  * distributed with this work for additional information
6efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10efeef26fSAndrew Rist  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist  *
13efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17efeef26fSAndrew Rist  * specific language governing permissions and limitations
18efeef26fSAndrew Rist  * under the License.
19efeef26fSAndrew Rist  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "hintids.hxx"
29cdf0e10cSrcweir #include <vcl/svapp.hxx>
30cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
31cdf0e10cSrcweir #include <svx/svdmodel.hxx>
32cdf0e10cSrcweir #include <svx/svdpage.hxx>
33cdf0e10cSrcweir #include <svx/svdobj.hxx>
34cdf0e10cSrcweir #include <svx/svdotext.hxx>
35cdf0e10cSrcweir #include <editeng/eeitem.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #ifndef _OUTLINER_HXX //autogen
38cdf0e10cSrcweir #define _EEITEMID_HXX
39cdf0e10cSrcweir #include <editeng/outliner.hxx>
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #include <svx/xfillit.hxx>
42cdf0e10cSrcweir #include <editeng/colritem.hxx>
43cdf0e10cSrcweir #include <editeng/brshitem.hxx>
44cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
45cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
46cdf0e10cSrcweir #include <svl/itemiter.hxx>
47cdf0e10cSrcweir #include <svl/whiter.hxx>
48cdf0e10cSrcweir #include <svtools/htmlout.hxx>
49cdf0e10cSrcweir #include <svtools/htmltokn.h>
50cdf0e10cSrcweir #include <svtools/htmlkywd.hxx>
51cdf0e10cSrcweir #include <svx/svdpool.hxx>
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 
54cdf0e10cSrcweir #include "charatr.hxx"
55cdf0e10cSrcweir #include <frmfmt.hxx>
56cdf0e10cSrcweir #include <fmtanchr.hxx>
57cdf0e10cSrcweir #include <fmtsrnd.hxx>
58cdf0e10cSrcweir #include "ndtxt.hxx"
59cdf0e10cSrcweir #include "doc.hxx"
60cdf0e10cSrcweir #include "dcontact.hxx"
61cdf0e10cSrcweir #include "poolfmt.hxx"
62cdf0e10cSrcweir #include "swcss1.hxx"
63cdf0e10cSrcweir #include "swhtml.hxx"
64cdf0e10cSrcweir #include "wrthtml.hxx"
65cdf0e10cSrcweir 
66cdf0e10cSrcweir using namespace ::com::sun::star;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
69cdf0e10cSrcweir const sal_uInt32 HTML_FRMOPTS_MARQUEE 	=
70cdf0e10cSrcweir 	HTML_FRMOPT_ALIGN |
71cdf0e10cSrcweir 	HTML_FRMOPT_SPACE;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir const sal_uInt32 HTML_FRMOPTS_MARQUEE_CSS1 	=
74cdf0e10cSrcweir 	HTML_FRMOPT_S_ALIGN |
75cdf0e10cSrcweir 	HTML_FRMOPT_S_SPACE;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir static HTMLOptionEnum __FAR_DATA aHTMLMarqBehaviorTable[] =
78cdf0e10cSrcweir {
79cdf0e10cSrcweir 	{ OOO_STRING_SVTOOLS_HTML_BEHAV_scroll,		SDRTEXTANI_SCROLL		},
80cdf0e10cSrcweir 	{ OOO_STRING_SVTOOLS_HTML_BEHAV_alternate,	SDRTEXTANI_ALTERNATE	},
81cdf0e10cSrcweir 	{ OOO_STRING_SVTOOLS_HTML_BEHAV_slide,		SDRTEXTANI_SLIDE		},
82cdf0e10cSrcweir 	{ 0,						0						}
83cdf0e10cSrcweir };
84cdf0e10cSrcweir 
85cdf0e10cSrcweir static HTMLOptionEnum __FAR_DATA aHTMLMarqDirectionTable[] =
86cdf0e10cSrcweir {
87cdf0e10cSrcweir 	{ OOO_STRING_SVTOOLS_HTML_AL_left,			SDRTEXTANI_LEFT			},
88cdf0e10cSrcweir 	{ OOO_STRING_SVTOOLS_HTML_AL_right,			SDRTEXTANI_RIGHT		},
89cdf0e10cSrcweir 	{ 0,						0						}
90cdf0e10cSrcweir };
91cdf0e10cSrcweir 
92cdf0e10cSrcweir /*  */
InsertDrawObject(SdrObject * pNewDrawObj,const Size & rPixSpace,sal_Int16 eVertOri,sal_Int16 eHoriOri,SfxItemSet & rCSS1ItemSet,SvxCSS1PropertyInfo & rCSS1PropInfo,sal_Bool bHidden)93cdf0e10cSrcweir void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj,
94cdf0e10cSrcweir 									 const Size& rPixSpace,
95cdf0e10cSrcweir                                      sal_Int16 eVertOri,
96cdf0e10cSrcweir                                      sal_Int16 eHoriOri,
97cdf0e10cSrcweir 									 SfxItemSet& rCSS1ItemSet,
98cdf0e10cSrcweir 									 SvxCSS1PropertyInfo& rCSS1PropInfo,
99cdf0e10cSrcweir 									 sal_Bool bHidden )
100cdf0e10cSrcweir {
101cdf0e10cSrcweir     // always on top of text.
102cdf0e10cSrcweir     // OD 02.07.2003 #108784# but in invisible layer. <ConnectToLayout> will
103cdf0e10cSrcweir     // move the object to the visible layer.
104cdf0e10cSrcweir     pNewDrawObj->SetLayer( pDoc->GetInvisibleHeavenId() );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	SfxItemSet aFrmSet( pDoc->GetAttrPool(),
107cdf0e10cSrcweir 						RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
108cdf0e10cSrcweir 	if( !IsNewDoc() )
109cdf0e10cSrcweir 		Reader::ResetFrmFmtAttrs( aFrmSet );
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	sal_uInt16 nLeftSpace = 0, nRightSpace = 0, nUpperSpace = 0, nLowerSpace = 0;
112cdf0e10cSrcweir 	if( (rPixSpace.Width() || rPixSpace.Height()) && Application::GetDefaultDevice() )
113cdf0e10cSrcweir 	{
114cdf0e10cSrcweir 		Size aTwipSpc( rPixSpace.Width(), rPixSpace.Height() );
115cdf0e10cSrcweir 		aTwipSpc =
116cdf0e10cSrcweir 			Application::GetDefaultDevice()->PixelToLogic( aTwipSpc,
117cdf0e10cSrcweir 												MapMode(MAP_TWIP) );
118cdf0e10cSrcweir 		nLeftSpace = nRightSpace = (sal_uInt16)aTwipSpc.Width();
119cdf0e10cSrcweir 		nUpperSpace = nLowerSpace = (sal_uInt16)aTwipSpc.Height();
120cdf0e10cSrcweir 	}
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	// linken/rechten Rand setzen
123cdf0e10cSrcweir 	const SfxPoolItem *pItem;
124cdf0e10cSrcweir 	if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_LR_SPACE, sal_True, &pItem ) )
125cdf0e10cSrcweir 	{
126cdf0e10cSrcweir 		// Ggf. den Erstzeilen-Einzug noch plaetten
127cdf0e10cSrcweir 		const SvxLRSpaceItem *pLRItem = (const SvxLRSpaceItem *)pItem;
128cdf0e10cSrcweir 		SvxLRSpaceItem aLRItem( *pLRItem );
129cdf0e10cSrcweir 		aLRItem.SetTxtFirstLineOfst( 0 );
130cdf0e10cSrcweir 		if( rCSS1PropInfo.bLeftMargin )
131cdf0e10cSrcweir 		{
132cdf0e10cSrcweir             nLeftSpace = static_cast< sal_uInt16 >(aLRItem.GetLeft());
133cdf0e10cSrcweir 			rCSS1PropInfo.bLeftMargin = sal_False;
134cdf0e10cSrcweir 		}
135cdf0e10cSrcweir 		if( rCSS1PropInfo.bRightMargin )
136cdf0e10cSrcweir 		{
137cdf0e10cSrcweir             nRightSpace = static_cast< sal_uInt16 >(aLRItem.GetRight());
138cdf0e10cSrcweir 			rCSS1PropInfo.bRightMargin = sal_False;
139cdf0e10cSrcweir 		}
140cdf0e10cSrcweir 		rCSS1ItemSet.ClearItem( RES_LR_SPACE );
141cdf0e10cSrcweir 	}
142cdf0e10cSrcweir 	if( nLeftSpace || nRightSpace )
143cdf0e10cSrcweir 	{
144cdf0e10cSrcweir         SvxLRSpaceItem aLRItem( RES_LR_SPACE );
145cdf0e10cSrcweir 		aLRItem.SetLeft( nLeftSpace );
146cdf0e10cSrcweir 		aLRItem.SetRight( nRightSpace );
147cdf0e10cSrcweir 		aFrmSet.Put( aLRItem );
148cdf0e10cSrcweir 	}
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	// oberen/unteren Rand setzen
151cdf0e10cSrcweir 	if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_UL_SPACE, sal_True, &pItem ) )
152cdf0e10cSrcweir 	{
153cdf0e10cSrcweir 		// Ggf. den Erstzeilen-Einzug noch plaetten
154cdf0e10cSrcweir 		const SvxULSpaceItem *pULItem = (const SvxULSpaceItem *)pItem;
155cdf0e10cSrcweir 		if( rCSS1PropInfo.bTopMargin )
156cdf0e10cSrcweir 		{
157cdf0e10cSrcweir 			nUpperSpace = pULItem->GetUpper();
158cdf0e10cSrcweir 			rCSS1PropInfo.bTopMargin = sal_False;
159cdf0e10cSrcweir 		}
160cdf0e10cSrcweir 		if( rCSS1PropInfo.bBottomMargin )
161cdf0e10cSrcweir 		{
162cdf0e10cSrcweir 			nLowerSpace = pULItem->GetLower();
163cdf0e10cSrcweir 			rCSS1PropInfo.bBottomMargin = sal_False;
164cdf0e10cSrcweir 		}
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 		rCSS1ItemSet.ClearItem( RES_UL_SPACE );
167cdf0e10cSrcweir 	}
168cdf0e10cSrcweir 	if( nUpperSpace || nLowerSpace )
169cdf0e10cSrcweir 	{
170cdf0e10cSrcweir         SvxULSpaceItem aULItem( RES_UL_SPACE );
171cdf0e10cSrcweir 		aULItem.SetUpper( nUpperSpace );
172cdf0e10cSrcweir 		aULItem.SetLower( nLowerSpace );
173cdf0e10cSrcweir 		aFrmSet.Put( aULItem );
174cdf0e10cSrcweir 	}
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     SwFmtAnchor aAnchor( FLY_AS_CHAR );
177cdf0e10cSrcweir 	if( SVX_CSS1_POS_ABSOLUTE == rCSS1PropInfo.ePosition &&
178cdf0e10cSrcweir 		SVX_CSS1_LTYPE_TWIP == rCSS1PropInfo.eLeftType &&
179cdf0e10cSrcweir 		SVX_CSS1_LTYPE_TWIP	== rCSS1PropInfo.eTopType )
180cdf0e10cSrcweir 	{
181cdf0e10cSrcweir 		const SwStartNode *pFlySttNd =
182cdf0e10cSrcweir             pPam->GetPoint()->nNode.GetNode().FindFlyStartNode();
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 		if( pFlySttNd )
185cdf0e10cSrcweir 		{
186cdf0e10cSrcweir 			aAnchor.SetType( FLY_AT_FLY );
187cdf0e10cSrcweir 			SwPosition aPos( *pFlySttNd );
188cdf0e10cSrcweir 			aAnchor.SetAnchor( &aPos );
189cdf0e10cSrcweir 		}
190cdf0e10cSrcweir 		else
191cdf0e10cSrcweir         {
192cdf0e10cSrcweir             aAnchor.SetType( FLY_AT_PAGE );
193cdf0e10cSrcweir         }
194cdf0e10cSrcweir         // OD 2004-04-13 #i26791# - direct positioning for <SwDoc::Insert(..)>
195cdf0e10cSrcweir         pNewDrawObj->SetRelativePos( Point(rCSS1PropInfo.nLeft + nLeftSpace,
196cdf0e10cSrcweir 										   rCSS1PropInfo.nTop + nUpperSpace) );
197cdf0e10cSrcweir 		aFrmSet.Put( SwFmtSurround(SURROUND_THROUGHT) );
198cdf0e10cSrcweir 	}
199cdf0e10cSrcweir 	else if( SVX_ADJUST_LEFT == rCSS1PropInfo.eFloat ||
200cdf0e10cSrcweir              text::HoriOrientation::LEFT == eHoriOri )
201cdf0e10cSrcweir     {
202cdf0e10cSrcweir         aAnchor.SetType( FLY_AT_PARA );
203cdf0e10cSrcweir 		aFrmSet.Put( SwFmtSurround(bHidden ? SURROUND_THROUGHT
204cdf0e10cSrcweir 											 : SURROUND_RIGHT) );
205cdf0e10cSrcweir         // OD 2004-04-13 #i26791# - direct positioning for <SwDoc::Insert(..)>
206cdf0e10cSrcweir 		pNewDrawObj->SetRelativePos( Point(nLeftSpace, nUpperSpace) );
207cdf0e10cSrcweir 	}
208cdf0e10cSrcweir     else if( text::VertOrientation::NONE != eVertOri )
209cdf0e10cSrcweir 	{
210cdf0e10cSrcweir 		aFrmSet.Put( SwFmtVertOrient( 0, eVertOri ) );
211cdf0e10cSrcweir 	}
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     if (FLY_AT_PAGE == aAnchor.GetAnchorId())
214cdf0e10cSrcweir     {
215cdf0e10cSrcweir 		aAnchor.SetPageNum( 1 );
216cdf0e10cSrcweir     }
217cdf0e10cSrcweir 	else if( FLY_AT_FLY != aAnchor.GetAnchorId() )
218cdf0e10cSrcweir     {
219cdf0e10cSrcweir 		aAnchor.SetAnchor( pPam->GetPoint() );
220cdf0e10cSrcweir     }
221cdf0e10cSrcweir 	aFrmSet.Put( aAnchor );
222cdf0e10cSrcweir 
223*5222b95bSOliver-Rainer Wittmann 	pDoc->InsertDrawObj( *pPam, *pNewDrawObj, aFrmSet );
224cdf0e10cSrcweir }
225cdf0e10cSrcweir 
226cdf0e10cSrcweir /*  */
227cdf0e10cSrcweir 
PutEEPoolItem(SfxItemSet & rEEItemSet,const SfxPoolItem & rSwItem)228cdf0e10cSrcweir static void PutEEPoolItem( SfxItemSet &rEEItemSet,
229cdf0e10cSrcweir 						   const SfxPoolItem& rSwItem )
230cdf0e10cSrcweir {
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	sal_uInt16 nEEWhich = 0;
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 	switch( rSwItem.Which() )
235cdf0e10cSrcweir 	{
236cdf0e10cSrcweir 	case RES_CHRATR_COLOR:			nEEWhich = EE_CHAR_COLOR; break;
237cdf0e10cSrcweir 	case RES_CHRATR_CROSSEDOUT:		nEEWhich = EE_CHAR_STRIKEOUT; break;
238cdf0e10cSrcweir 	case RES_CHRATR_ESCAPEMENT:		nEEWhich = EE_CHAR_ESCAPEMENT; break;
239cdf0e10cSrcweir 	case RES_CHRATR_FONT:			nEEWhich = EE_CHAR_FONTINFO; break;
240cdf0e10cSrcweir 	case RES_CHRATR_CJK_FONT:		nEEWhich = EE_CHAR_FONTINFO_CJK; break;
241cdf0e10cSrcweir 	case RES_CHRATR_CTL_FONT:		nEEWhich = EE_CHAR_FONTINFO_CTL; break;
242cdf0e10cSrcweir 	case RES_CHRATR_FONTSIZE:		nEEWhich = EE_CHAR_FONTHEIGHT; break;
243cdf0e10cSrcweir 	case RES_CHRATR_CJK_FONTSIZE:	nEEWhich = EE_CHAR_FONTHEIGHT_CJK; break;
244cdf0e10cSrcweir 	case RES_CHRATR_CTL_FONTSIZE:	nEEWhich = EE_CHAR_FONTHEIGHT_CTL; break;
245cdf0e10cSrcweir 	case RES_CHRATR_KERNING: 		nEEWhich = EE_CHAR_KERNING; break;
246cdf0e10cSrcweir 	case RES_CHRATR_POSTURE: 		nEEWhich = EE_CHAR_ITALIC; break;
247cdf0e10cSrcweir 	case RES_CHRATR_CJK_POSTURE: 	nEEWhich = EE_CHAR_ITALIC_CJK; break;
248cdf0e10cSrcweir 	case RES_CHRATR_CTL_POSTURE: 	nEEWhich = EE_CHAR_ITALIC_CTL; break;
249cdf0e10cSrcweir 	case RES_CHRATR_UNDERLINE:		nEEWhich = EE_CHAR_UNDERLINE; break;
250cdf0e10cSrcweir 	case RES_CHRATR_WEIGHT:   		nEEWhich = EE_CHAR_WEIGHT; break;
251cdf0e10cSrcweir 	case RES_CHRATR_CJK_WEIGHT:   	nEEWhich = EE_CHAR_WEIGHT_CJK; break;
252cdf0e10cSrcweir 	case RES_CHRATR_CTL_WEIGHT:   	nEEWhich = EE_CHAR_WEIGHT_CTL; break;
253cdf0e10cSrcweir 	case RES_BACKGROUND:
254cdf0e10cSrcweir 	case RES_CHRATR_BACKGROUND:
255cdf0e10cSrcweir 		{
256cdf0e10cSrcweir 			const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rSwItem;
257cdf0e10cSrcweir 			rEEItemSet.Put( XFillStyleItem(XFILL_SOLID) );
258cdf0e10cSrcweir 			rEEItemSet.Put( XFillColorItem(aEmptyStr,
259cdf0e10cSrcweir 							rBrushItem.GetColor()) );
260cdf0e10cSrcweir 		}
261cdf0e10cSrcweir 		break;
262cdf0e10cSrcweir 	}
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	if( nEEWhich )
265cdf0e10cSrcweir 	{
266cdf0e10cSrcweir 		SfxPoolItem *pEEItem = rSwItem.Clone();
267cdf0e10cSrcweir 		pEEItem->SetWhich( nEEWhich );
268cdf0e10cSrcweir 		rEEItemSet.Put( *pEEItem );
269cdf0e10cSrcweir 		delete pEEItem;
270cdf0e10cSrcweir 	}
271cdf0e10cSrcweir }
272cdf0e10cSrcweir 
NewMarquee(HTMLTable * pCurTable)273cdf0e10cSrcweir void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
274cdf0e10cSrcweir {
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 	ASSERT( !pMarquee, "Marquee in Marquee???" );
277cdf0e10cSrcweir 	aContents.Erase();
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 	String aId, aStyle, aClass;
280cdf0e10cSrcweir 
281cdf0e10cSrcweir 	long nWidth=0, nHeight=0;
282cdf0e10cSrcweir 	sal_Bool bPrcWidth = sal_False, bDirection = sal_False, bBGColor = sal_False;
283cdf0e10cSrcweir 	Size aSpace( 0, 0 );
284cdf0e10cSrcweir     sal_Int16 eVertOri = text::VertOrientation::TOP;
285cdf0e10cSrcweir     sal_Int16 eHoriOri = text::HoriOrientation::NONE;
286cdf0e10cSrcweir 	SdrTextAniKind eAniKind = SDRTEXTANI_SCROLL;
287cdf0e10cSrcweir 	SdrTextAniDirection eAniDir = SDRTEXTANI_LEFT;
288cdf0e10cSrcweir 	sal_uInt16 nCount = 0, nDelay = 60;
289cdf0e10cSrcweir 	sal_Int16 nAmount = -6;
290cdf0e10cSrcweir 	Color aBGColor;
291cdf0e10cSrcweir 
292cdf0e10cSrcweir 	const HTMLOptions *pHTMLOptions = GetOptions();
293cdf0e10cSrcweir 	sal_uInt16 nArrLen = pHTMLOptions->Count();
294cdf0e10cSrcweir 	for ( sal_uInt16 i=0; i<nArrLen; i++ )
295cdf0e10cSrcweir 	{
296cdf0e10cSrcweir 		const HTMLOption *pOption = (*pHTMLOptions)[i];
297cdf0e10cSrcweir 		switch( pOption->GetToken() )
298cdf0e10cSrcweir 		{
299cdf0e10cSrcweir 			case HTML_O_ID:
300cdf0e10cSrcweir 				aId = pOption->GetString();
301cdf0e10cSrcweir 				break;
302cdf0e10cSrcweir 			case HTML_O_STYLE:
303cdf0e10cSrcweir 				aStyle = pOption->GetString();
304cdf0e10cSrcweir 				break;
305cdf0e10cSrcweir 			case HTML_O_CLASS:
306cdf0e10cSrcweir 				aClass = pOption->GetString();
307cdf0e10cSrcweir 				break;
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 			case HTML_O_BEHAVIOR:
310cdf0e10cSrcweir 				eAniKind =
311cdf0e10cSrcweir 					(SdrTextAniKind)pOption->GetEnum( aHTMLMarqBehaviorTable,
312cdf0e10cSrcweir                                                       static_cast< sal_uInt16 >(eAniKind) );
313cdf0e10cSrcweir 				break;
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 			case HTML_O_BGCOLOR:
316cdf0e10cSrcweir 				pOption->GetColor( aBGColor );
317cdf0e10cSrcweir 				bBGColor = sal_True;
318cdf0e10cSrcweir 				break;
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 			case HTML_O_DIRECTION:
321cdf0e10cSrcweir 				eAniDir =
322cdf0e10cSrcweir 					(SdrTextAniDirection)pOption->GetEnum( aHTMLMarqDirectionTable,
323cdf0e10cSrcweir                                                       static_cast< sal_uInt16 >(eAniDir) );
324cdf0e10cSrcweir 				bDirection = sal_True;
325cdf0e10cSrcweir 				break;
326cdf0e10cSrcweir 
327cdf0e10cSrcweir 			case HTML_O_LOOP:
328cdf0e10cSrcweir 				if( pOption->GetString().
329cdf0e10cSrcweir 						EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_LOOP_infinite) )
330cdf0e10cSrcweir 				{
331cdf0e10cSrcweir 					nCount = 0;
332cdf0e10cSrcweir 				}
333cdf0e10cSrcweir 				else
334cdf0e10cSrcweir 				{
335cdf0e10cSrcweir 					sal_uInt32 nLoop = pOption->GetSNumber();
336cdf0e10cSrcweir 					nCount = (sal_uInt16)(nLoop>0 ? nLoop : 0 );
337cdf0e10cSrcweir 				}
338cdf0e10cSrcweir 				break;
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 			case HTML_O_SCROLLAMOUNT:
341cdf0e10cSrcweir 				nAmount = -((sal_Int16)pOption->GetNumber());
342cdf0e10cSrcweir 				break;
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 			case HTML_O_SCROLLDELAY:
345cdf0e10cSrcweir 				nDelay = (sal_uInt16)pOption->GetNumber();
346cdf0e10cSrcweir 				break;
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 			case HTML_O_WIDTH:
349cdf0e10cSrcweir 				// erstmal nur als Pixelwerte merken!
350cdf0e10cSrcweir 				nWidth = pOption->GetNumber();
351cdf0e10cSrcweir 				bPrcWidth = pOption->GetString().Search('%') != STRING_NOTFOUND;
352cdf0e10cSrcweir 				if( bPrcWidth && nWidth>100 )
353cdf0e10cSrcweir 					nWidth = 100;
354cdf0e10cSrcweir 				break;
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 			case HTML_O_HEIGHT:
357cdf0e10cSrcweir 				// erstmal nur als Pixelwerte merken!
358cdf0e10cSrcweir 				nHeight = pOption->GetNumber();
359cdf0e10cSrcweir 				if( pOption->GetString().Search('%') != STRING_NOTFOUND )
360cdf0e10cSrcweir 					nHeight = 0;
361cdf0e10cSrcweir 				break;
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 			case HTML_O_HSPACE:
364cdf0e10cSrcweir 				// erstmal nur als Pixelwerte merken!
365cdf0e10cSrcweir 				aSpace.Height() = pOption->GetNumber();
366cdf0e10cSrcweir 				break;
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 			case HTML_O_VSPACE:
369cdf0e10cSrcweir 				// erstmal nur als Pixelwerte merken!
370cdf0e10cSrcweir 				aSpace.Width() = pOption->GetNumber();
371cdf0e10cSrcweir 				break;
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 			case HTML_O_ALIGN:
374cdf0e10cSrcweir 				eVertOri =
375cdf0e10cSrcweir                     pOption->GetEnum( aHTMLImgVAlignTable,
376cdf0e10cSrcweir                                                     text::VertOrientation::TOP );
377cdf0e10cSrcweir 				eHoriOri =
378cdf0e10cSrcweir                     pOption->GetEnum( aHTMLImgHAlignTable,
379cdf0e10cSrcweir                                                     text::HoriOrientation::NONE );
380cdf0e10cSrcweir 				break;
381cdf0e10cSrcweir 		}
382cdf0e10cSrcweir 	}
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 	// Ein DrawTxtobj anlegen
385cdf0e10cSrcweir     // --> OD 2005-08-08 #i52858# - method name changed
386cdf0e10cSrcweir     SdrModel* pModel = pDoc->GetOrCreateDrawModel();
387cdf0e10cSrcweir     // <--
388cdf0e10cSrcweir 	SdrPage* pPg = pModel->GetPage( 0 );
389cdf0e10cSrcweir 	pMarquee = SdrObjFactory::MakeNewObject( SdrInventor,
390cdf0e10cSrcweir 											 OBJ_TEXT, pPg, pModel );
391cdf0e10cSrcweir 	if( !pMarquee )
392cdf0e10cSrcweir 		return;
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 	pPg->InsertObject( pMarquee );
395cdf0e10cSrcweir 
396cdf0e10cSrcweir 	if( aId.Len() )
397cdf0e10cSrcweir 		InsertBookmark( aId );
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 	// (Nur) Alternate leueft per Default von links nach rechts
400cdf0e10cSrcweir 	if( SDRTEXTANI_ALTERNATE==eAniKind && !bDirection )
401cdf0e10cSrcweir 		eAniDir = SDRTEXTANI_RIGHT;
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 	// die fuer das Scrollen benoetigten Attribute umsetzen
404cdf0e10cSrcweir 	sal_uInt16 aWhichMap[7] =	{ XATTR_FILL_FIRST,	  XATTR_FILL_LAST,
405cdf0e10cSrcweir 							  SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
406cdf0e10cSrcweir 							  EE_CHAR_START,	  EE_CHAR_END,
407cdf0e10cSrcweir 							  0	};
408cdf0e10cSrcweir 	SfxItemSet aItemSet( pModel->GetItemPool(), aWhichMap );
409cdf0e10cSrcweir 	aItemSet.Put( SdrTextAutoGrowWidthItem( sal_False ) );
410cdf0e10cSrcweir 	aItemSet.Put( SdrTextAutoGrowHeightItem( sal_True ) );
411cdf0e10cSrcweir 	aItemSet.Put( SdrTextAniKindItem( eAniKind ) );
412cdf0e10cSrcweir 	aItemSet.Put( SdrTextAniDirectionItem( eAniDir ) );
413cdf0e10cSrcweir 	aItemSet.Put( SdrTextAniCountItem( nCount ) );
414cdf0e10cSrcweir 	aItemSet.Put( SdrTextAniDelayItem( nDelay ) );
415cdf0e10cSrcweir 	aItemSet.Put( SdrTextAniAmountItem( nAmount ) );
416cdf0e10cSrcweir 	if( SDRTEXTANI_ALTERNATE==eAniKind )
417cdf0e10cSrcweir 	{
418cdf0e10cSrcweir 		// (Nur) Alternate startet und stoppt per default Inside
419cdf0e10cSrcweir 		aItemSet.Put( SdrTextAniStartInsideItem(sal_True) );
420cdf0e10cSrcweir 		aItemSet.Put( SdrTextAniStopInsideItem(sal_True) );
421cdf0e10cSrcweir 		if( SDRTEXTANI_LEFT==eAniDir )
422cdf0e10cSrcweir 			aItemSet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) );
423cdf0e10cSrcweir 	}
424cdf0e10cSrcweir 
425cdf0e10cSrcweir 	// die Default-Farbe (aus der Standard-Vorlage) setzen, damit ueberhaupt
426cdf0e10cSrcweir 	// eine sinnvolle Farbe gesetzt ist.
427cdf0e10cSrcweir 	const Color& rDfltColor =
428cdf0e10cSrcweir 		pCSS1Parser->GetTxtCollFromPool( RES_POOLCOLL_STANDARD )
429cdf0e10cSrcweir 			->GetColor().GetValue();
430cdf0e10cSrcweir 	aItemSet.Put( SvxColorItem( rDfltColor, EE_CHAR_COLOR ) );
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 	// Die Attribute der aktuellen Absatzvorlage setzen
433cdf0e10cSrcweir 	sal_uInt16 nWhichIds[] =
434cdf0e10cSrcweir 	{
435cdf0e10cSrcweir 		RES_CHRATR_COLOR,   RES_CHRATR_CROSSEDOUT, RES_CHRATR_ESCAPEMENT,
436cdf0e10cSrcweir 		RES_CHRATR_FONT,    RES_CHRATR_FONTSIZE,   RES_CHRATR_KERNING,
437cdf0e10cSrcweir 		RES_CHRATR_POSTURE, RES_CHRATR_UNDERLINE,  RES_CHRATR_WEIGHT,
438cdf0e10cSrcweir 		RES_CHRATR_BACKGROUND,
439cdf0e10cSrcweir 		RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONTSIZE,
440cdf0e10cSrcweir 		RES_CHRATR_CJK_POSTURE, RES_CHRATR_CJK_WEIGHT,
441cdf0e10cSrcweir 		RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONTSIZE,
442cdf0e10cSrcweir 		RES_CHRATR_CTL_POSTURE, RES_CHRATR_CTL_WEIGHT,
443cdf0e10cSrcweir 		0
444cdf0e10cSrcweir 	};
445cdf0e10cSrcweir     SwTxtNode const*const pTxtNd =
446cdf0e10cSrcweir         pPam->GetPoint()->nNode.GetNode().GetTxtNode();
447cdf0e10cSrcweir 	if( pTxtNd )
448cdf0e10cSrcweir 	{
449cdf0e10cSrcweir 		const SfxItemSet& rItemSet = pTxtNd->GetAnyFmtColl().GetAttrSet();
450cdf0e10cSrcweir 		const SfxPoolItem *pItem;
451cdf0e10cSrcweir 		for( sal_uInt16 i=0; nWhichIds[i]; i++ )
452cdf0e10cSrcweir 		{
453cdf0e10cSrcweir 			if( SFX_ITEM_SET == rItemSet.GetItemState( nWhichIds[i], sal_True, &pItem ) )
454cdf0e10cSrcweir 				PutEEPoolItem( aItemSet, *pItem );
455cdf0e10cSrcweir 		}
456cdf0e10cSrcweir 	}
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 	// die Attribute der Umgebung am Draw-Objekt setzen
459cdf0e10cSrcweir 	_HTMLAttr** pTbl = (_HTMLAttr**)&aAttrTab;
460cdf0e10cSrcweir 	for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* );
461cdf0e10cSrcweir 		 nCnt--; ++pTbl )
462cdf0e10cSrcweir 	{
463cdf0e10cSrcweir 		_HTMLAttr *pAttr = *pTbl;
464cdf0e10cSrcweir 		if( pAttr )
465cdf0e10cSrcweir 			PutEEPoolItem( aItemSet, pAttr->GetItem() );
466cdf0e10cSrcweir 	}
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 	if( bBGColor )
469cdf0e10cSrcweir 	{
470cdf0e10cSrcweir 		aItemSet.Put( XFillStyleItem(XFILL_SOLID) );
471cdf0e10cSrcweir 		aItemSet.Put( XFillColorItem(aEmptyStr, aBGColor) );
472cdf0e10cSrcweir 	}
473cdf0e10cSrcweir 
474cdf0e10cSrcweir 	// Styles parsen (funktioniert hier nur fuer Attribute, die auch
475cdf0e10cSrcweir 	// am Zeichen-Objekt gesetzt werden koennen)
476cdf0e10cSrcweir 	SfxItemSet aStyleItemSet( pDoc->GetAttrPool(),
477cdf0e10cSrcweir 							  pCSS1Parser->GetWhichMap() );
478cdf0e10cSrcweir 	SvxCSS1PropertyInfo aPropInfo;
479cdf0e10cSrcweir 	if( HasStyleOptions( aStyle, aId, aClass )  &&
480cdf0e10cSrcweir 		ParseStyleOptions( aStyle, aId, aClass, aStyleItemSet, aPropInfo ) )
481cdf0e10cSrcweir 	{
482cdf0e10cSrcweir 		SfxItemIter aIter( aStyleItemSet );
483cdf0e10cSrcweir 
484cdf0e10cSrcweir 		const SfxPoolItem *pItem = aIter.FirstItem();
485cdf0e10cSrcweir 		while( pItem )
486cdf0e10cSrcweir 		{
487cdf0e10cSrcweir 			PutEEPoolItem( aItemSet, *pItem );
488cdf0e10cSrcweir 			pItem = aIter.NextItem();
489cdf0e10cSrcweir 		}
490cdf0e10cSrcweir 	}
491cdf0e10cSrcweir 
492cdf0e10cSrcweir 	// jetzt noch die Groesse setzen
493cdf0e10cSrcweir 	Size aTwipSz( bPrcWidth ? 0 : nWidth, nHeight );
494cdf0e10cSrcweir 	if( (aTwipSz.Width() || aTwipSz.Height()) && Application::GetDefaultDevice() )
495cdf0e10cSrcweir 	{
496cdf0e10cSrcweir 		aTwipSz = Application::GetDefaultDevice()
497cdf0e10cSrcweir 					->PixelToLogic( aTwipSz, MapMode( MAP_TWIP ) );
498cdf0e10cSrcweir 	}
499cdf0e10cSrcweir 
500cdf0e10cSrcweir 	if( SVX_CSS1_LTYPE_TWIP== aPropInfo.eWidthType )
501cdf0e10cSrcweir 	{
502cdf0e10cSrcweir 		aTwipSz.Width() = aPropInfo.nWidth;
503cdf0e10cSrcweir 		nWidth = 1; // != 0;
504cdf0e10cSrcweir 		bPrcWidth = sal_False;
505cdf0e10cSrcweir 	}
506cdf0e10cSrcweir 	if( SVX_CSS1_LTYPE_TWIP== aPropInfo.eHeightType )
507cdf0e10cSrcweir 		aTwipSz.Height() = aPropInfo.nHeight;
508cdf0e10cSrcweir 
509cdf0e10cSrcweir 	bFixMarqueeWidth = sal_False;
510cdf0e10cSrcweir 	if( !nWidth || bPrcWidth )
511cdf0e10cSrcweir 	{
512cdf0e10cSrcweir 		if( pTable )
513cdf0e10cSrcweir 		{
514cdf0e10cSrcweir 			if( !pCurTable )
515cdf0e10cSrcweir 			{
516cdf0e10cSrcweir 				// Die Laufschrift steht in einer Tabelle, aber nicht
517cdf0e10cSrcweir 				// in einer Zelle. Da jetzt keine vernuenftige Zuordung
518cdf0e10cSrcweir 				// zu einer Zelle moeglich ist, passen wir hir die
519cdf0e10cSrcweir 				// Breite dem Inhalt der Laufschrift an.
520cdf0e10cSrcweir 				bFixMarqueeWidth = sal_True;
521cdf0e10cSrcweir 			}
522cdf0e10cSrcweir 			else if( !nWidth )
523cdf0e10cSrcweir 			{
524cdf0e10cSrcweir 				// Da wir wissen, in welcher Zelle die Laufschrift ist,
525cdf0e10cSrcweir 				// koennen wir die Breite auch anpassen. Keine Breitenangabe
526cdf0e10cSrcweir 				// wird wie 100% behandelt.
527cdf0e10cSrcweir 				nWidth = 100;
528cdf0e10cSrcweir 				bPrcWidth = sal_True;
529cdf0e10cSrcweir 			}
530cdf0e10cSrcweir 			aTwipSz.Width() = MINLAY;
531cdf0e10cSrcweir 		}
532cdf0e10cSrcweir 		else
533cdf0e10cSrcweir 		{
534cdf0e10cSrcweir 			long nBrowseWidth = GetCurrentBrowseWidth();
535cdf0e10cSrcweir 			aTwipSz.Width() = !nWidth ? nBrowseWidth
536cdf0e10cSrcweir 									  : (nWidth*nBrowseWidth) / 100;
537cdf0e10cSrcweir 		}
538cdf0e10cSrcweir 	}
539cdf0e10cSrcweir 
540cdf0e10cSrcweir 	// Die Hoehe ist nur eine Mindest-Hoehe
541cdf0e10cSrcweir 	if( aTwipSz.Height() < MINFLY )
542cdf0e10cSrcweir 		aTwipSz.Height() = MINFLY;
543cdf0e10cSrcweir 	aItemSet.Put( SdrTextMinFrameHeightItem( aTwipSz.Height() ) );
544cdf0e10cSrcweir 
545cdf0e10cSrcweir 	pMarquee->SetMergedItemSetAndBroadcast(aItemSet);
546cdf0e10cSrcweir 
547cdf0e10cSrcweir 	if( aTwipSz.Width() < MINFLY )
548cdf0e10cSrcweir 		aTwipSz.Width() = MINFLY;
549cdf0e10cSrcweir 	pMarquee->SetLogicRect( Rectangle( 0, 0, aTwipSz.Width(), aTwipSz.Height() ) );
550cdf0e10cSrcweir 
551cdf0e10cSrcweir 	// und das Objekt in das Dok einfuegen
552cdf0e10cSrcweir 	InsertDrawObject( pMarquee, aSpace, eVertOri, eHoriOri, aStyleItemSet,
553cdf0e10cSrcweir 					  aPropInfo	);
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 	// Das Zeichen-Objekt der Tabelle bekanntmachen. Ist ein bisserl
556cdf0e10cSrcweir 	// umstaendlich, weil noch ueber den Parser gegangen wird, obwohl die
557cdf0e10cSrcweir 	// Tabelle bekannt ist, aber anderenfalls muesste man die Tabelle
558cdf0e10cSrcweir 	// oeffentlich machen, und das ist auch nicht schoen. Das globale
559cdf0e10cSrcweir 	// pTable kann uebrigens auch nicht verwendet werden, denn die
560cdf0e10cSrcweir 	// Laufschrift kann sich auch mal in einer Sub-Tabelle befinden.
561cdf0e10cSrcweir 	if( pCurTable && bPrcWidth)
562cdf0e10cSrcweir 		RegisterDrawObjectToTable( pCurTable, pMarquee, (sal_uInt8)nWidth );
563cdf0e10cSrcweir }
564cdf0e10cSrcweir 
EndMarquee()565cdf0e10cSrcweir void SwHTMLParser::EndMarquee()
566cdf0e10cSrcweir {
567cdf0e10cSrcweir 	ASSERT( pMarquee && OBJ_TEXT==pMarquee->GetObjIdentifier(),
568cdf0e10cSrcweir 			"kein Marquee oder falscher Typ" );
569cdf0e10cSrcweir 
570cdf0e10cSrcweir 	if( bFixMarqueeWidth )
571cdf0e10cSrcweir 	{
572cdf0e10cSrcweir 		// Da es keine fixe Hoehe gibt, das Text-Objekt erstmal breiter
573cdf0e10cSrcweir 		// als den Text machen, damit nicht umgebrochen wird.
574cdf0e10cSrcweir 		const Rectangle& rOldRect = pMarquee->GetLogicRect();
575cdf0e10cSrcweir 		pMarquee->SetLogicRect( Rectangle( rOldRect.TopLeft(),
576cdf0e10cSrcweir 										   Size( USHRT_MAX, 240 ) ) );
577cdf0e10cSrcweir 	}
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 	// den gesammelten Text einfuegen
580cdf0e10cSrcweir 	((SdrTextObj*)pMarquee)->SetText( aContents );
581cdf0e10cSrcweir 	pMarquee->SetMergedItemSetAndBroadcast( pMarquee->GetMergedItemSet() );
582cdf0e10cSrcweir 
583cdf0e10cSrcweir 	if( bFixMarqueeWidth )
584cdf0e10cSrcweir 	{
585cdf0e10cSrcweir 		// die Groesse dem Text anpassen.
586cdf0e10cSrcweir 		((SdrTextObj*)pMarquee)->FitFrameToTextSize();
587cdf0e10cSrcweir 	}
588cdf0e10cSrcweir 
589cdf0e10cSrcweir 	aContents.Erase();
590cdf0e10cSrcweir 	pMarquee = 0;
591cdf0e10cSrcweir }
592cdf0e10cSrcweir 
InsertMarqueeText()593cdf0e10cSrcweir void SwHTMLParser::InsertMarqueeText()
594cdf0e10cSrcweir {
595cdf0e10cSrcweir 	ASSERT( pMarquee && OBJ_TEXT==pMarquee->GetObjIdentifier(),
596cdf0e10cSrcweir 			"kein Marquee oder falscher Typ" );
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 	// das akteulle Textstueck an den Text anhaengen
599cdf0e10cSrcweir 	aContents += aToken;
600cdf0e10cSrcweir }
601cdf0e10cSrcweir 
ResizeDrawObject(SdrObject * pObj,SwTwips nWidth)602cdf0e10cSrcweir void SwHTMLParser::ResizeDrawObject( SdrObject* pObj, SwTwips nWidth )
603cdf0e10cSrcweir {
604cdf0e10cSrcweir 	ASSERT( OBJ_TEXT==pObj->GetObjIdentifier(),
605cdf0e10cSrcweir 			"kein Marquee oder falscher Typ" );
606cdf0e10cSrcweir 
607cdf0e10cSrcweir 	if( OBJ_TEXT!=pObj->GetObjIdentifier() )
608cdf0e10cSrcweir 		return;
609cdf0e10cSrcweir 
610cdf0e10cSrcweir 	// die alte Groesse
611cdf0e10cSrcweir 	const Rectangle& rOldRect = pObj->GetLogicRect();
612cdf0e10cSrcweir 	Size aNewSz( nWidth, rOldRect.GetSize().Height() );
613cdf0e10cSrcweir 	pObj->SetLogicRect( Rectangle( rOldRect.TopLeft(), aNewSz ) );
614cdf0e10cSrcweir }
615cdf0e10cSrcweir 
616cdf0e10cSrcweir /*  */
617cdf0e10cSrcweir 
GetMarqueeTextObj(const SwDrawFrmFmt & rFmt)618cdf0e10cSrcweir const SdrObject *SwHTMLWriter::GetMarqueeTextObj( const SwDrawFrmFmt& rFmt )
619cdf0e10cSrcweir {
620cdf0e10cSrcweir 	const SdrObject* pObj = rFmt.FindSdrObject();
621cdf0e10cSrcweir 	return (pObj && ::IsMarqueeTextObj( *pObj )) ? pObj : 0;
622cdf0e10cSrcweir }
623cdf0e10cSrcweir 
GetEEAttrsFromDrwObj(SfxItemSet & rItemSet,const SdrObject * pObj,sal_Bool bSetDefaults)624cdf0e10cSrcweir void SwHTMLWriter::GetEEAttrsFromDrwObj( SfxItemSet& rItemSet,
625cdf0e10cSrcweir 										 const SdrObject *pObj,
626cdf0e10cSrcweir 										 sal_Bool bSetDefaults )
627cdf0e10cSrcweir {
628cdf0e10cSrcweir     // die Edit script::Engine-Attribute aus dem Objekt holen
629cdf0e10cSrcweir 	SfxItemSet rObjItemSet = pObj->GetMergedItemSet();
630cdf0e10cSrcweir 
631cdf0e10cSrcweir     // ueber die Edit script::Engine-Attribute iterieren und die Attribute
632cdf0e10cSrcweir 	// in SW-Attrs wandeln bzw. default setzen
633cdf0e10cSrcweir 	SfxWhichIter aIter( rObjItemSet );
634cdf0e10cSrcweir 	sal_uInt16 nEEWhich = aIter.FirstWhich();
635cdf0e10cSrcweir 	while( nEEWhich )
636cdf0e10cSrcweir 	{
637cdf0e10cSrcweir 		const SfxPoolItem *pEEItem;
638cdf0e10cSrcweir 		sal_Bool bSet = SFX_ITEM_SET == rObjItemSet.GetItemState( nEEWhich, sal_False,
639cdf0e10cSrcweir 															  &pEEItem );
640cdf0e10cSrcweir 
641cdf0e10cSrcweir 		if( bSet || bSetDefaults )
642cdf0e10cSrcweir 		{
643cdf0e10cSrcweir 			sal_uInt16 nSwWhich = 0;
644cdf0e10cSrcweir 			switch( nEEWhich )
645cdf0e10cSrcweir 			{
646cdf0e10cSrcweir 			case EE_CHAR_COLOR:			nSwWhich = RES_CHRATR_COLOR;		break;
647cdf0e10cSrcweir 			case EE_CHAR_STRIKEOUT: 	nSwWhich = RES_CHRATR_CROSSEDOUT;	break;
648cdf0e10cSrcweir 			case EE_CHAR_ESCAPEMENT:	nSwWhich = RES_CHRATR_ESCAPEMENT;	break;
649cdf0e10cSrcweir 			case EE_CHAR_FONTINFO: 		nSwWhich = RES_CHRATR_FONT;		    break;
650cdf0e10cSrcweir 			case EE_CHAR_FONTINFO_CJK: 	nSwWhich = RES_CHRATR_CJK_FONT;	    break;
651cdf0e10cSrcweir 			case EE_CHAR_FONTINFO_CTL: 	nSwWhich = RES_CHRATR_CTL_FONT;		break;
652cdf0e10cSrcweir 			case EE_CHAR_FONTHEIGHT:	nSwWhich = RES_CHRATR_FONTSIZE;	    break;
653cdf0e10cSrcweir 			case EE_CHAR_FONTHEIGHT_CJK:nSwWhich = RES_CHRATR_CJK_FONTSIZE; break;
654cdf0e10cSrcweir 			case EE_CHAR_FONTHEIGHT_CTL:nSwWhich = RES_CHRATR_CTL_FONTSIZE; break;
655cdf0e10cSrcweir 			case EE_CHAR_KERNING: 		nSwWhich = RES_CHRATR_KERNING; 	    break;
656cdf0e10cSrcweir 			case EE_CHAR_ITALIC: 		nSwWhich = RES_CHRATR_POSTURE; 	    break;
657cdf0e10cSrcweir 			case EE_CHAR_ITALIC_CJK:	nSwWhich = RES_CHRATR_CJK_POSTURE;  break;
658cdf0e10cSrcweir 			case EE_CHAR_ITALIC_CTL:	nSwWhich = RES_CHRATR_CTL_POSTURE;  break;
659cdf0e10cSrcweir 			case EE_CHAR_UNDERLINE: 	nSwWhich = RES_CHRATR_UNDERLINE;	break;
660cdf0e10cSrcweir 			case EE_CHAR_WEIGHT: 		nSwWhich = RES_CHRATR_WEIGHT;   	break;
661cdf0e10cSrcweir 			case EE_CHAR_WEIGHT_CJK: 	nSwWhich = RES_CHRATR_CJK_WEIGHT;  	break;
662cdf0e10cSrcweir 			case EE_CHAR_WEIGHT_CTL: 	nSwWhich = RES_CHRATR_CTL_WEIGHT;  	break;
663cdf0e10cSrcweir 			}
664cdf0e10cSrcweir 
665cdf0e10cSrcweir 			if( nSwWhich )
666cdf0e10cSrcweir 			{
667cdf0e10cSrcweir 				// wenn das Item nicht gesetzt ist nehmen wir ggf. das
668cdf0e10cSrcweir 				// Default-Item
669cdf0e10cSrcweir 				if( !bSet )
670cdf0e10cSrcweir 					pEEItem = &rObjItemSet.GetPool()->GetDefaultItem(nEEWhich);
671cdf0e10cSrcweir 
672cdf0e10cSrcweir 				// jetzt Clonen wir das Item mit der Which-Id des Writers
673cdf0e10cSrcweir 				SfxPoolItem *pSwItem = pEEItem->Clone();
674cdf0e10cSrcweir 				pSwItem->SetWhich( nSwWhich );
675cdf0e10cSrcweir 				rItemSet.Put( *pSwItem );
676cdf0e10cSrcweir 				delete pSwItem;
677cdf0e10cSrcweir 			}
678cdf0e10cSrcweir 		}
679cdf0e10cSrcweir 
680cdf0e10cSrcweir 		nEEWhich = aIter.NextWhich();
681cdf0e10cSrcweir 	}
682cdf0e10cSrcweir }
683cdf0e10cSrcweir 
684cdf0e10cSrcweir 
OutHTML_DrawFrmFmtAsMarquee(Writer & rWrt,const SwDrawFrmFmt & rFmt,const SdrObject & rSdrObject)685cdf0e10cSrcweir Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt,
686cdf0e10cSrcweir 									 const SwDrawFrmFmt& rFmt,
687cdf0e10cSrcweir 									 const SdrObject& rSdrObject )
688cdf0e10cSrcweir {
689cdf0e10cSrcweir 	SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
690cdf0e10cSrcweir 
691cdf0e10cSrcweir 	ASSERT( rWrt.pDoc->GetDrawModel(), "Da gibt's ein Draw-Obj ohne ein Draw-Model zu haben?" );
692cdf0e10cSrcweir 	const SdrTextObj *pTextObj = (const SdrTextObj *)&rSdrObject;
693cdf0e10cSrcweir 
694cdf0e10cSrcweir 	// Gibt es ueberhaupt auszugebenden Text
695cdf0e10cSrcweir 	const OutlinerParaObject *pOutlinerParaObj =
696cdf0e10cSrcweir 		pTextObj->GetOutlinerParaObject();
697cdf0e10cSrcweir 	if( !pOutlinerParaObj )
698cdf0e10cSrcweir 		return rWrt;
699cdf0e10cSrcweir 
700cdf0e10cSrcweir 	ByteString sOut( '<' );
701cdf0e10cSrcweir 	sOut += OOO_STRING_SVTOOLS_HTML_marquee;
702cdf0e10cSrcweir 
703cdf0e10cSrcweir 	// Die Attribute des Objektd holen
704cdf0e10cSrcweir 	const SfxItemSet& rItemSet = pTextObj->GetMergedItemSet();
705cdf0e10cSrcweir 
706cdf0e10cSrcweir 	// BEHAVIOUR
707cdf0e10cSrcweir 	SdrTextAniKind eAniKind = pTextObj->GetTextAniKind();
708cdf0e10cSrcweir 	ASSERT( SDRTEXTANI_SCROLL==eAniKind ||
709cdf0e10cSrcweir 			SDRTEXTANI_ALTERNATE==eAniKind ||
710cdf0e10cSrcweir 			SDRTEXTANI_SLIDE==eAniKind,
711cdf0e10cSrcweir 			"Text-Draw-Objekt nicht fuer Marquee geeignet" )
712cdf0e10cSrcweir 
713cdf0e10cSrcweir 	const sal_Char *pStr = 0;
714cdf0e10cSrcweir 	switch( eAniKind )
715cdf0e10cSrcweir 	{
716cdf0e10cSrcweir 	case SDRTEXTANI_SCROLL:		pStr = OOO_STRING_SVTOOLS_HTML_BEHAV_scroll;		break;
717cdf0e10cSrcweir 	case SDRTEXTANI_SLIDE:		pStr = OOO_STRING_SVTOOLS_HTML_BEHAV_slide;		break;
718cdf0e10cSrcweir 	case SDRTEXTANI_ALTERNATE:	pStr = OOO_STRING_SVTOOLS_HTML_BEHAV_alternate;	break;
719cdf0e10cSrcweir 	default:
720cdf0e10cSrcweir 		;
721cdf0e10cSrcweir 	}
722cdf0e10cSrcweir 
723cdf0e10cSrcweir 	if( pStr )
724cdf0e10cSrcweir 		(((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_behavior) += '=') += pStr;
725cdf0e10cSrcweir 
726cdf0e10cSrcweir 	// DIRECTION
727cdf0e10cSrcweir 	pStr = 0;
728cdf0e10cSrcweir 	SdrTextAniDirection eAniDir = pTextObj->GetTextAniDirection();
729cdf0e10cSrcweir 	switch( eAniDir )
730cdf0e10cSrcweir 	{
731cdf0e10cSrcweir 	case SDRTEXTANI_LEFT:		pStr = OOO_STRING_SVTOOLS_HTML_AL_left;		break;
732cdf0e10cSrcweir 	case SDRTEXTANI_RIGHT:		pStr = OOO_STRING_SVTOOLS_HTML_AL_right;		break;
733cdf0e10cSrcweir 	default:
734cdf0e10cSrcweir 		;
735cdf0e10cSrcweir 	}
736cdf0e10cSrcweir 
737cdf0e10cSrcweir 	if( pStr )
738cdf0e10cSrcweir 		(((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_direction) += '=') += pStr;
739cdf0e10cSrcweir 
740cdf0e10cSrcweir 	// LOOP
741cdf0e10cSrcweir 	sal_Int32 nCount =
742cdf0e10cSrcweir 		((const SdrTextAniCountItem&)rItemSet.Get( SDRATTR_TEXT_ANICOUNT ))
743cdf0e10cSrcweir 											 .GetValue();
744cdf0e10cSrcweir 	if( 0==nCount )
745cdf0e10cSrcweir 		nCount = SDRTEXTANI_SLIDE==eAniKind ? 1 : -1;
746cdf0e10cSrcweir 	(((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_loop) += '=')
747cdf0e10cSrcweir 		+= ByteString::CreateFromInt32( nCount );
748cdf0e10cSrcweir 
749cdf0e10cSrcweir 	// SCROLLDELAY
750cdf0e10cSrcweir 	sal_uInt16 nDelay =
751cdf0e10cSrcweir 		((const SdrTextAniDelayItem&)rItemSet.Get( SDRATTR_TEXT_ANIDELAY ))
752cdf0e10cSrcweir 											.GetValue();
753cdf0e10cSrcweir 	(((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_scrolldelay) += '=')
754cdf0e10cSrcweir 		+= ByteString::CreateFromInt32( nDelay );
755cdf0e10cSrcweir 
756cdf0e10cSrcweir 	// SCROLLAMOUNT
757cdf0e10cSrcweir 	sal_Int16 nAmount =
758cdf0e10cSrcweir 		((const SdrTextAniAmountItem&)rItemSet.Get( SDRATTR_TEXT_ANIAMOUNT ))
759cdf0e10cSrcweir 											 .GetValue();
760cdf0e10cSrcweir 	if( nAmount < 0 )
761cdf0e10cSrcweir 	{
762cdf0e10cSrcweir 		nAmount = -nAmount;
763cdf0e10cSrcweir 	}
764cdf0e10cSrcweir 	else if( nAmount && Application::GetDefaultDevice() )
765cdf0e10cSrcweir 	{
766cdf0e10cSrcweir 		nAmount = (sal_uInt16)(Application::GetDefaultDevice()
767cdf0e10cSrcweir 							->LogicToPixel( Size(nAmount,0),
768cdf0e10cSrcweir 											MapMode(MAP_TWIP) ).Width());
769cdf0e10cSrcweir 	}
770cdf0e10cSrcweir 	if( nAmount )
771cdf0e10cSrcweir 		(((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_scrollamount) += '=')
772cdf0e10cSrcweir 			+= ByteString::CreateFromInt32( nAmount );
773cdf0e10cSrcweir 
774cdf0e10cSrcweir 	Size aTwipSz( pTextObj->GetLogicRect().GetSize() );
775cdf0e10cSrcweir 	if( pTextObj->IsAutoGrowWidth() )
776cdf0e10cSrcweir 		aTwipSz.Width() = 0;
777cdf0e10cSrcweir 	// Die Hoehe ist bei MS eine Mindesthoehe, also geben wir auch die
778cdf0e10cSrcweir 	// Mindestheoehe aus, wenn es sie gibt. Da eine Mindesthoehe MINFLY
779cdf0e10cSrcweir 	// mit hoher Wahrscheinlichkeit vom Import kommt, wird sie nicht mit
780cdf0e10cSrcweir 	// ausgegeben. Falsch machen kann man da nichst, denn jeder Font ist
781cdf0e10cSrcweir 	// hoeher.
782cdf0e10cSrcweir 	if( pTextObj->IsAutoGrowHeight() )
783cdf0e10cSrcweir 	{
784cdf0e10cSrcweir 		aTwipSz.Height() = pTextObj->GetMinTextFrameHeight();
785cdf0e10cSrcweir 		if( MINFLY==aTwipSz.Height() )
786cdf0e10cSrcweir 			aTwipSz.Height() = 0;
787cdf0e10cSrcweir 	}
788cdf0e10cSrcweir 
789cdf0e10cSrcweir 	if( (aTwipSz.Width() || aTwipSz.Height()) &&
790cdf0e10cSrcweir 		Application::GetDefaultDevice() )
791cdf0e10cSrcweir 	{
792cdf0e10cSrcweir 		Size aPixelSz =
793cdf0e10cSrcweir 			Application::GetDefaultDevice()->LogicToPixel( aTwipSz,
794cdf0e10cSrcweir 												MapMode(MAP_TWIP) );
795cdf0e10cSrcweir 		if( !aPixelSz.Width() && aTwipSz.Width() )
796cdf0e10cSrcweir 			aPixelSz.Width() = 1;
797cdf0e10cSrcweir 		if( !aPixelSz.Height() && aTwipSz.Height() )
798cdf0e10cSrcweir 			aPixelSz.Height() = 1;
799cdf0e10cSrcweir 
800cdf0e10cSrcweir 		if( aPixelSz.Width() )
801cdf0e10cSrcweir 			(((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_width) += '=')
802cdf0e10cSrcweir 				+= ByteString::CreateFromInt32( aPixelSz.Width() );
803cdf0e10cSrcweir 
804cdf0e10cSrcweir 		if( aPixelSz.Height() )
805cdf0e10cSrcweir 			(((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_height) += '=')
806cdf0e10cSrcweir 				+= ByteString::CreateFromInt32( aPixelSz.Height() );
807cdf0e10cSrcweir 	}
808cdf0e10cSrcweir 
809cdf0e10cSrcweir 	// BGCOLOR
810cdf0e10cSrcweir 	XFillStyle eFillStyle =
811cdf0e10cSrcweir 		((const XFillStyleItem&)rItemSet.Get(XATTR_FILLSTYLE)).GetValue();
812cdf0e10cSrcweir 	if( XFILL_SOLID==eFillStyle )
813cdf0e10cSrcweir 	{
814cdf0e10cSrcweir 		const Color& rFillColor =
815cdf0e10cSrcweir 			((const XFillColorItem&)rItemSet.Get(XATTR_FILLCOLOR)).GetColorValue();
816cdf0e10cSrcweir 
817cdf0e10cSrcweir 		((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_bgcolor) += '=';
818cdf0e10cSrcweir 		rWrt.Strm() << sOut.GetBuffer();
819cdf0e10cSrcweir 		HTMLOutFuncs::Out_Color( rWrt.Strm(), rFillColor, rHTMLWrt.eDestEnc );
820cdf0e10cSrcweir 		sOut.Erase();
821cdf0e10cSrcweir 	}
822cdf0e10cSrcweir 
823cdf0e10cSrcweir 	if( sOut.Len() )
824cdf0e10cSrcweir 		rWrt.Strm() << sOut.GetBuffer();
825cdf0e10cSrcweir 
826cdf0e10cSrcweir 	// und nun noch ALIGN, HSPACE und VSPACE
827cdf0e10cSrcweir 	ByteString aEndTags;
828cdf0e10cSrcweir 	sal_uInt32 nFrmFlags = HTML_FRMOPTS_MARQUEE;
829cdf0e10cSrcweir 	if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_DRAW ) )
830cdf0e10cSrcweir 		nFrmFlags |= HTML_FRMOPTS_MARQUEE_CSS1;
831cdf0e10cSrcweir 	rHTMLWrt.OutFrmFmtOptions( rFmt, aEmptyStr, aEndTags, nFrmFlags );
832cdf0e10cSrcweir 	if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_DRAW ) )
833cdf0e10cSrcweir 		rHTMLWrt.OutCSS1_FrmFmtOptions( rFmt, nFrmFlags, &rSdrObject );
834cdf0e10cSrcweir 
835cdf0e10cSrcweir 
836cdf0e10cSrcweir 	rWrt.Strm() << '>';
837cdf0e10cSrcweir 
838cdf0e10cSrcweir 	// Was jetzt kommt ist das Gegenstueck zu SdrTextObjectt::SetText()
839cdf0e10cSrcweir 	Outliner aOutliner(0, OUTLINERMODE_TEXTOBJECT);
840cdf0e10cSrcweir 	aOutliner.SetUpdateMode( sal_False );
841cdf0e10cSrcweir 	aOutliner.SetText( *pOutlinerParaObj );
842cdf0e10cSrcweir 	String aText( aOutliner.GetText( aOutliner.GetParagraph(0),
843cdf0e10cSrcweir 									 aOutliner.GetParagraphCount() ) );
844cdf0e10cSrcweir 	HTMLOutFuncs::Out_String( rWrt.Strm(), aText,
845cdf0e10cSrcweir 						  	  rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
846cdf0e10cSrcweir 
847cdf0e10cSrcweir 	HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_marquee, sal_False );
848cdf0e10cSrcweir 
849cdf0e10cSrcweir 	if( aEndTags.Len() )
850cdf0e10cSrcweir 		rWrt.Strm() << aEndTags.GetBuffer();
851cdf0e10cSrcweir 
852cdf0e10cSrcweir 	return rWrt;
853cdf0e10cSrcweir }
854cdf0e10cSrcweir 
855cdf0e10cSrcweir 
856