xref: /aoo41x/main/sfx2/source/bastyp/frmhtmlw.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sfx2.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #ifndef _INETDEF_HXX
32*cdf0e10cSrcweir #include <svl/inetdef.hxx>
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir #include "svtools/htmlkywd.hxx"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir //!(dv) #include <chaos2/cntapi.hxx>
37*cdf0e10cSrcweir #include <rtl/tencinfo.h>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <unotools/configmgr.hxx>
40*cdf0e10cSrcweir #include "svl/urihelper.hxx"
41*cdf0e10cSrcweir #include <tools/datetime.hxx>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #include <sfx2/frmhtmlw.hxx>
44*cdf0e10cSrcweir #include <sfx2/evntconf.hxx>
45*cdf0e10cSrcweir #include <sfx2/frame.hxx>
46*cdf0e10cSrcweir #include <sfx2/app.hxx>
47*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
48*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
49*cdf0e10cSrcweir #include "sfx2/sfxresid.hxx"
50*cdf0e10cSrcweir #include <sfx2/objsh.hxx>
51*cdf0e10cSrcweir #include <sfx2/sfx.hrc>
52*cdf0e10cSrcweir #include "bastyp.hrc"
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir #include <comphelper/string.hxx>
55*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir #include <com/sun/star/script/XTypeConverter.hpp>
58*cdf0e10cSrcweir #include <com/sun/star/document/XDocumentProperties.hpp>
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir // -----------------------------------------------------------------------
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir using namespace ::com::sun::star;
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir static sal_Char __READONLY_DATA sHTML_SC_yes[] =	"YES";
66*cdf0e10cSrcweir static sal_Char __READONLY_DATA sHTML_SC_no[] =		"NO";
67*cdf0e10cSrcweir static sal_Char __READONLY_DATA sHTML_SC_auto[] =	"AUTO";
68*cdf0e10cSrcweir static sal_Char __READONLY_DATA sHTML_MIME_text_html[] =	"text/html; charset=";
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir /* not used anymore?
71*cdf0e10cSrcweir static HTMLOutEvent __FAR_DATA aFrameSetEventTable[] =
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir 	{ sHTML_O_SDonload,		sHTML_O_onload,		SFX_EVENT_OPENDOC	},
74*cdf0e10cSrcweir 	{ sHTML_O_SDonunload,	sHTML_O_onunload,	SFX_EVENT_PREPARECLOSEDOC	},
75*cdf0e10cSrcweir 	{ sHTML_O_SDonfocus,	sHTML_O_onfocus,	SFX_EVENT_ACTIVATEDOC	},
76*cdf0e10cSrcweir 	{ sHTML_O_SDonblur,		sHTML_O_onblur,		SFX_EVENT_DEACTIVATEDOC	},
77*cdf0e10cSrcweir 	{ 0,					0,				  	0					}
78*cdf0e10cSrcweir };
79*cdf0e10cSrcweir */
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir #if defined(UNX)
82*cdf0e10cSrcweir const sal_Char SfxFrameHTMLWriter::sNewLine[] = "\012";
83*cdf0e10cSrcweir #else
84*cdf0e10cSrcweir const sal_Char __FAR_DATA SfxFrameHTMLWriter::sNewLine[] = "\015\012";
85*cdf0e10cSrcweir #endif
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm,
88*cdf0e10cSrcweir 								  const sal_Char *pIndent,
89*cdf0e10cSrcweir 								  const String& rName,
90*cdf0e10cSrcweir 								  const String& rContent, sal_Bool bHTTPEquiv,
91*cdf0e10cSrcweir 							   	  rtl_TextEncoding eDestEnc,
92*cdf0e10cSrcweir 								  String *pNonConvertableChars	)
93*cdf0e10cSrcweir {
94*cdf0e10cSrcweir 	rStrm << sNewLine;
95*cdf0e10cSrcweir 	if( pIndent )
96*cdf0e10cSrcweir 		rStrm << pIndent;
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir 	ByteString sOut( '<' );
99*cdf0e10cSrcweir 	(((sOut += OOO_STRING_SVTOOLS_HTML_meta) += ' ')
100*cdf0e10cSrcweir 		+= (bHTTPEquiv ? OOO_STRING_SVTOOLS_HTML_O_httpequiv : OOO_STRING_SVTOOLS_HTML_O_name))	+= "=\"";
101*cdf0e10cSrcweir 	rStrm << sOut.GetBuffer();
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir 	HTMLOutFuncs::Out_String( rStrm, rName, eDestEnc, pNonConvertableChars );
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 	((sOut = "\" ") += OOO_STRING_SVTOOLS_HTML_O_content) += "=\"";
106*cdf0e10cSrcweir 	rStrm << sOut.GetBuffer();
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 	HTMLOutFuncs::Out_String( rStrm, rContent, eDestEnc, pNonConvertableChars ) << "\">";
109*cdf0e10cSrcweir }
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
112*cdf0e10cSrcweir         const uno::Reference<document::XDocumentProperties> & i_xDocProps,
113*cdf0e10cSrcweir 		const sal_Char *pIndent,
114*cdf0e10cSrcweir         rtl_TextEncoding eDestEnc,
115*cdf0e10cSrcweir 		String *pNonConvertableChars	)
116*cdf0e10cSrcweir {
117*cdf0e10cSrcweir 	const sal_Char *pCharSet =
118*cdf0e10cSrcweir 				rtl_getBestMimeCharsetFromTextEncoding( eDestEnc );
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 	if( pCharSet )
121*cdf0e10cSrcweir 	{
122*cdf0e10cSrcweir 		String aContentType = String::CreateFromAscii( sHTML_MIME_text_html );
123*cdf0e10cSrcweir 		aContentType.AppendAscii( pCharSet );
124*cdf0e10cSrcweir 		OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_content_type, aContentType, sal_True,
125*cdf0e10cSrcweir                  eDestEnc, pNonConvertableChars );
126*cdf0e10cSrcweir 	}
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	// Titel (auch wenn er leer ist)
129*cdf0e10cSrcweir 	rStrm << sNewLine;
130*cdf0e10cSrcweir 	if( pIndent )
131*cdf0e10cSrcweir 		rStrm << pIndent;
132*cdf0e10cSrcweir 	HTMLOutFuncs::Out_AsciiTag( rStrm, OOO_STRING_SVTOOLS_HTML_title );
133*cdf0e10cSrcweir 	if( i_xDocProps.is() )
134*cdf0e10cSrcweir 	{
135*cdf0e10cSrcweir 		const String& rTitle = i_xDocProps->getTitle();
136*cdf0e10cSrcweir 		if( rTitle.Len() )
137*cdf0e10cSrcweir 			HTMLOutFuncs::Out_String( rStrm, rTitle, eDestEnc, pNonConvertableChars );
138*cdf0e10cSrcweir 	}
139*cdf0e10cSrcweir 	HTMLOutFuncs::Out_AsciiTag( rStrm, OOO_STRING_SVTOOLS_HTML_title, sal_False );
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	// Target-Frame
142*cdf0e10cSrcweir 	if( i_xDocProps.is() )
143*cdf0e10cSrcweir 	{
144*cdf0e10cSrcweir 		const String& rTarget = i_xDocProps->getDefaultTarget();
145*cdf0e10cSrcweir 		if( rTarget.Len() )
146*cdf0e10cSrcweir 		{
147*cdf0e10cSrcweir 			rStrm << sNewLine;
148*cdf0e10cSrcweir 			if( pIndent )
149*cdf0e10cSrcweir 				rStrm << pIndent;
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 			ByteString sOut( '<' );
152*cdf0e10cSrcweir 			(((sOut += OOO_STRING_SVTOOLS_HTML_base) += ' ') += OOO_STRING_SVTOOLS_HTML_O_target) += "=\"";
153*cdf0e10cSrcweir 			rStrm << sOut.GetBuffer();
154*cdf0e10cSrcweir 			HTMLOutFuncs::Out_String( rStrm, rTarget, eDestEnc, pNonConvertableChars )
155*cdf0e10cSrcweir 				<< "\">";
156*cdf0e10cSrcweir 		}
157*cdf0e10cSrcweir 	}
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 	// Who we are
160*cdf0e10cSrcweir 	String sGenerator( SfxResId( STR_HTML_GENERATOR ) );
161*cdf0e10cSrcweir 	sGenerator.SearchAndReplaceAscii( "%1", String( DEFINE_CONST_UNICODE( TOOLS_INETDEF_OS ) ) );
162*cdf0e10cSrcweir 	OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_generator, sGenerator, sal_False, eDestEnc, pNonConvertableChars );
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 	if( i_xDocProps.is() )
165*cdf0e10cSrcweir 	{
166*cdf0e10cSrcweir 		// Reload
167*cdf0e10cSrcweir         if( (i_xDocProps->getAutoloadSecs() != 0) ||
168*cdf0e10cSrcweir             !i_xDocProps->getAutoloadURL().equalsAscii("") )
169*cdf0e10cSrcweir 		{
170*cdf0e10cSrcweir 			String sContent = String::CreateFromInt32(
171*cdf0e10cSrcweir 								i_xDocProps->getAutoloadSecs() );
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 			const String &rReloadURL = i_xDocProps->getAutoloadURL();
174*cdf0e10cSrcweir 			if( rReloadURL.Len() )
175*cdf0e10cSrcweir 			{
176*cdf0e10cSrcweir 				sContent.AppendAscii( ";URL=" );
177*cdf0e10cSrcweir                 sContent += String(
178*cdf0e10cSrcweir                     URIHelper::simpleNormalizedMakeRelative(
179*cdf0e10cSrcweir                         rBaseURL, rReloadURL));
180*cdf0e10cSrcweir 			}
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 			OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_refresh, sContent, sal_True,
183*cdf0e10cSrcweir                      eDestEnc, pNonConvertableChars );
184*cdf0e10cSrcweir 		}
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 		// Author
187*cdf0e10cSrcweir 		const String& rAuthor = i_xDocProps->getAuthor();
188*cdf0e10cSrcweir 		if( rAuthor.Len() )
189*cdf0e10cSrcweir 			OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_author, rAuthor, sal_False,
190*cdf0e10cSrcweir                      eDestEnc, pNonConvertableChars );
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 		// created
193*cdf0e10cSrcweir         ::util::DateTime uDT = i_xDocProps->getCreationDate();
194*cdf0e10cSrcweir         Date aD(uDT.Day, uDT.Month, uDT.Year);
195*cdf0e10cSrcweir         Time aT(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds);
196*cdf0e10cSrcweir         String sOut = String::CreateFromInt32(aD.GetDate());
197*cdf0e10cSrcweir         sOut += ';';
198*cdf0e10cSrcweir         sOut += String::CreateFromInt32(aT.GetTime());
199*cdf0e10cSrcweir 		OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_created, sOut, sal_False,
200*cdf0e10cSrcweir                  eDestEnc, pNonConvertableChars );
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 		// changedby
203*cdf0e10cSrcweir 		const String& rChangedBy = i_xDocProps->getModifiedBy();
204*cdf0e10cSrcweir 		if( rChangedBy.Len() )
205*cdf0e10cSrcweir 			OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changedby, rChangedBy, sal_False,
206*cdf0e10cSrcweir                      eDestEnc, pNonConvertableChars );
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 		// changed
209*cdf0e10cSrcweir         uDT = i_xDocProps->getModificationDate();
210*cdf0e10cSrcweir         Date aD2(uDT.Day, uDT.Month, uDT.Year);
211*cdf0e10cSrcweir         Time aT2(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds);
212*cdf0e10cSrcweir         sOut = String::CreateFromInt32(aD2.GetDate());
213*cdf0e10cSrcweir         sOut += ';';
214*cdf0e10cSrcweir         sOut += String::CreateFromInt32(aT2.GetTime());
215*cdf0e10cSrcweir 		OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changed, sOut, sal_False,
216*cdf0e10cSrcweir                  eDestEnc, pNonConvertableChars );
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir 		// Subject
219*cdf0e10cSrcweir 		const String& rTheme = i_xDocProps->getSubject();
220*cdf0e10cSrcweir 		if( rTheme.Len() )
221*cdf0e10cSrcweir 			OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_classification, rTheme, sal_False,
222*cdf0e10cSrcweir                      eDestEnc, pNonConvertableChars );
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 		// Description
225*cdf0e10cSrcweir 		const String& rComment = i_xDocProps->getDescription();
226*cdf0e10cSrcweir 		if( rComment.Len() )
227*cdf0e10cSrcweir 			OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_description, rComment, sal_False,
228*cdf0e10cSrcweir                      eDestEnc, pNonConvertableChars);
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 		// Keywords
231*cdf0e10cSrcweir 		String Keywords = ::comphelper::string::convertCommaSeparated(
232*cdf0e10cSrcweir             i_xDocProps->getKeywords());
233*cdf0e10cSrcweir 		if( Keywords.Len() )
234*cdf0e10cSrcweir 			OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_keywords, Keywords, sal_False,
235*cdf0e10cSrcweir                      eDestEnc, pNonConvertableChars);
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir         uno::Reference < script::XTypeConverter > xConverter(
238*cdf0e10cSrcweir             ::comphelper::getProcessServiceFactory()->createInstance(
239*cdf0e10cSrcweir                 ::rtl::OUString::createFromAscii("com.sun.star.script.Converter")),
240*cdf0e10cSrcweir                 uno::UNO_QUERY_THROW );
241*cdf0e10cSrcweir         uno::Reference<beans::XPropertySet> xUserDefinedProps(
242*cdf0e10cSrcweir             i_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
243*cdf0e10cSrcweir         DBG_ASSERT(xUserDefinedProps.is(), "UserDefinedProperties is null");
244*cdf0e10cSrcweir         uno::Reference<beans::XPropertySetInfo> xPropInfo =
245*cdf0e10cSrcweir             xUserDefinedProps->getPropertySetInfo();
246*cdf0e10cSrcweir         DBG_ASSERT(xPropInfo.is(), "UserDefinedProperties Info is null");
247*cdf0e10cSrcweir         uno::Sequence<beans::Property> props = xPropInfo->getProperties();
248*cdf0e10cSrcweir         for (sal_Int32 i = 0; i < props.getLength(); ++i) {
249*cdf0e10cSrcweir             try {
250*cdf0e10cSrcweir                 ::rtl::OUString name = props[i].Name;
251*cdf0e10cSrcweir                 ::rtl::OUString str;
252*cdf0e10cSrcweir                 uno::Any aStr = xConverter->convertToSimpleType(
253*cdf0e10cSrcweir                         xUserDefinedProps->getPropertyValue(name),
254*cdf0e10cSrcweir                         uno::TypeClass_STRING);
255*cdf0e10cSrcweir                 aStr >>= str;
256*cdf0e10cSrcweir                 String valstr(str);
257*cdf0e10cSrcweir                 valstr.EraseTrailingChars();
258*cdf0e10cSrcweir                 OutMeta( rStrm, pIndent, name, valstr, sal_False,
259*cdf0e10cSrcweir                          eDestEnc, pNonConvertableChars );
260*cdf0e10cSrcweir             } catch (uno::Exception &) {
261*cdf0e10cSrcweir                 // may happen with concurrent modification...
262*cdf0e10cSrcweir                 DBG_WARNING("SfxFrameHTMLWriter::Out_DocInfo: exception");
263*cdf0e10cSrcweir             }
264*cdf0e10cSrcweir         }
265*cdf0e10cSrcweir 	}
266*cdf0e10cSrcweir }
267*cdf0e10cSrcweir /*
268*cdf0e10cSrcweir void SfxFrameHTMLWriter::OutHeader( rtl_TextEncoding eDestEnc )
269*cdf0e10cSrcweir {
270*cdf0e10cSrcweir 	// <HTML>
271*cdf0e10cSrcweir 	// <HEAD>
272*cdf0e10cSrcweir 	// <TITLE>Titel</TITLE>
273*cdf0e10cSrcweir 	// </HEAD>
274*cdf0e10cSrcweir 	HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_html ) << sNewLine;
275*cdf0e10cSrcweir 	HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_head );
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir 	Out_DocInfo( Strm(), &pDoc->GetDocInfo(), "\t", eDestEnc );
278*cdf0e10cSrcweir 	Strm() << sNewLine;
279*cdf0e10cSrcweir 	HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_head, sal_False ) << sNewLine;
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir //!	OutScript();			// Hier fehlen noch die Scripten im Header
282*cdf0e10cSrcweir }
283*cdf0e10cSrcweir */
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir void SfxFrameHTMLWriter::Out_FrameDescriptor(
286*cdf0e10cSrcweir     SvStream& rOut, const String& rBaseURL, const uno::Reference < beans::XPropertySet >& xSet,
287*cdf0e10cSrcweir     rtl_TextEncoding eDestEnc, String *pNonConvertableChars )
288*cdf0e10cSrcweir {
289*cdf0e10cSrcweir     try
290*cdf0e10cSrcweir     {
291*cdf0e10cSrcweir         ByteString sOut;
292*cdf0e10cSrcweir         ::rtl::OUString aStr;
293*cdf0e10cSrcweir         uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameURL") );
294*cdf0e10cSrcweir         if ( (aAny >>= aStr) && aStr.getLength() )
295*cdf0e10cSrcweir         {
296*cdf0e10cSrcweir             String aURL = INetURLObject( aStr ).GetMainURL( INetURLObject::DECODE_TO_IURI );
297*cdf0e10cSrcweir             if( aURL.Len() )
298*cdf0e10cSrcweir             {
299*cdf0e10cSrcweir                 aURL = URIHelper::simpleNormalizedMakeRelative(
300*cdf0e10cSrcweir                     rBaseURL, aURL );
301*cdf0e10cSrcweir                 ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_src) += "=\"";
302*cdf0e10cSrcweir                 rOut << sOut.GetBuffer();
303*cdf0e10cSrcweir                 HTMLOutFuncs::Out_String( rOut, aURL, eDestEnc, pNonConvertableChars );
304*cdf0e10cSrcweir                 sOut = '\"';
305*cdf0e10cSrcweir             }
306*cdf0e10cSrcweir         }
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir         aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameName") );
309*cdf0e10cSrcweir         if ( (aAny >>= aStr) && aStr.getLength() )
310*cdf0e10cSrcweir         {
311*cdf0e10cSrcweir             ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\"";
312*cdf0e10cSrcweir             rOut << sOut.GetBuffer();
313*cdf0e10cSrcweir             HTMLOutFuncs::Out_String( rOut, aStr, eDestEnc, pNonConvertableChars );
314*cdf0e10cSrcweir             sOut = '\"';
315*cdf0e10cSrcweir         }
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir         sal_Int32 nVal = SIZE_NOT_SET;
318*cdf0e10cSrcweir         aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth") );
319*cdf0e10cSrcweir         if ( (aAny >>= nVal) && nVal != SIZE_NOT_SET )
320*cdf0e10cSrcweir             (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_marginwidth) += '=') += ByteString::CreateFromInt32( nVal );
321*cdf0e10cSrcweir         aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight") );
322*cdf0e10cSrcweir         if ( (aAny >>= nVal) && nVal != SIZE_NOT_SET )
323*cdf0e10cSrcweir             (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_marginheight) += '=') += ByteString::CreateFromInt32( nVal );
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir         sal_Bool bVal = sal_True;
326*cdf0e10cSrcweir         aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll") );
327*cdf0e10cSrcweir         if ( (aAny >>= bVal) && !bVal )
328*cdf0e10cSrcweir         {
329*cdf0e10cSrcweir             aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode") );
330*cdf0e10cSrcweir             if ( aAny >>= bVal )
331*cdf0e10cSrcweir             {
332*cdf0e10cSrcweir                 const sal_Char *pStr = bVal ? sHTML_SC_yes : sHTML_SC_no;
333*cdf0e10cSrcweir                 (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_scrolling) += '=') += pStr;
334*cdf0e10cSrcweir             }
335*cdf0e10cSrcweir         }
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir         // frame border (MS+Netscape-Erweiterung)
338*cdf0e10cSrcweir         aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder") );
339*cdf0e10cSrcweir         if ( (aAny >>= bVal) && !bVal )
340*cdf0e10cSrcweir         {
341*cdf0e10cSrcweir             aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder") );
342*cdf0e10cSrcweir             if ( aAny >>= bVal )
343*cdf0e10cSrcweir             {
344*cdf0e10cSrcweir                 const char* pStr = bVal ? sHTML_SC_yes : sHTML_SC_no;
345*cdf0e10cSrcweir                 (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_frameborder) += '=') += pStr;
346*cdf0e10cSrcweir             }
347*cdf0e10cSrcweir         }
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir         // TODO/LATER: currently not supported attributes
350*cdf0e10cSrcweir         // resize
351*cdf0e10cSrcweir         //if( !pFrame->IsResizable() )
352*cdf0e10cSrcweir         //    (sOut += ' ') += sHTML_O_noresize;
353*cdf0e10cSrcweir         //
354*cdf0e10cSrcweir         //if ( pFrame->GetWallpaper() )
355*cdf0e10cSrcweir         //{
356*cdf0e10cSrcweir         //    ((sOut += ' ') += sHTML_O_bordercolor) += '=';
357*cdf0e10cSrcweir         //    rOut << sOut.GetBuffer();
358*cdf0e10cSrcweir         //    HTMLOutFuncs::Out_Color( rOut, pFrame->GetWallpaper()->GetColor(), eDestEnc );
359*cdf0e10cSrcweir         //}
360*cdf0e10cSrcweir         //else
361*cdf0e10cSrcweir             rOut << sOut.GetBuffer();
362*cdf0e10cSrcweir     }
363*cdf0e10cSrcweir     catch ( uno::Exception& )
364*cdf0e10cSrcweir     {
365*cdf0e10cSrcweir     }
366*cdf0e10cSrcweir }
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir String SfxFrameHTMLWriter::CreateURL( SfxFrame* pFrame )
369*cdf0e10cSrcweir {
370*cdf0e10cSrcweir 	String aRet;
371*cdf0e10cSrcweir 	SfxObjectShell* pShell = pFrame->GetCurrentDocument();
372*cdf0e10cSrcweir 	if( !aRet.Len() && pShell )
373*cdf0e10cSrcweir 	{
374*cdf0e10cSrcweir 		aRet = pShell->GetMedium()->GetName();
375*cdf0e10cSrcweir //!(dv)		CntAnchor::ToPresentationURL( aRet );
376*cdf0e10cSrcweir 	}
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir 	return aRet;
379*cdf0e10cSrcweir }
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 
382