xref: /AOO41X/main/svtools/source/config/htmlcfg.cxx (revision 5900e8ec128faec89519683efce668ccd8cc6084)
1*5900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5900e8ecSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5900e8ecSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5900e8ecSAndrew Rist  * distributed with this work for additional information
6*5900e8ecSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5900e8ecSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5900e8ecSAndrew Rist  * "License"); you may not use this file except in compliance
9*5900e8ecSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*5900e8ecSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*5900e8ecSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5900e8ecSAndrew Rist  * software distributed under the License is distributed on an
15*5900e8ecSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5900e8ecSAndrew Rist  * KIND, either express or implied.  See the License for the
17*5900e8ecSAndrew Rist  * specific language governing permissions and limitations
18*5900e8ecSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*5900e8ecSAndrew Rist  *************************************************************/
21*5900e8ecSAndrew Rist 
22*5900e8ecSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svtools.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svtools/htmlcfg.hxx>
28cdf0e10cSrcweir #include <svtools/parhtml.hxx>
29cdf0e10cSrcweir #include <unotools/syslocale.hxx>
30cdf0e10cSrcweir #include <tools/debug.hxx>
31cdf0e10cSrcweir #include <tools/list.hxx>
32cdf0e10cSrcweir #include <tools/link.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir // -----------------------------------------------------------------------
35cdf0e10cSrcweir #define HTMLCFG_UNKNOWN_TAGS 			0x01
36cdf0e10cSrcweir //#define HTMLCFG_STYLE_SHEETS 			0x02
37cdf0e10cSrcweir //#define HTMLCFG_NETSCAPE3    			0x04
38cdf0e10cSrcweir #define HTMLCFG_STAR_BASIC   			0x08
39cdf0e10cSrcweir #define HTMLCFG_LOCAL_GRF   			0x10
40cdf0e10cSrcweir #define HTMLCFG_PRINT_LAYOUT_EXTENSION 	0x20
41cdf0e10cSrcweir #define HTMLCFG_IGNORE_FONT_FAMILY	 	0x40
42cdf0e10cSrcweir #define HTMLCFG_IS_BASIC_WARNING		0x80
43cdf0e10cSrcweir #define HTMLCFG_NUMBERS_ENGLISH_US      0x100
44cdf0e10cSrcweir 
45cdf0e10cSrcweir using namespace utl;
46cdf0e10cSrcweir using namespace rtl;
47cdf0e10cSrcweir using namespace com::sun::star::uno;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir static SvxHtmlOptions* pOptions = 0;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir DECLARE_LIST( LinkList, Link * )
52cdf0e10cSrcweir 
53cdf0e10cSrcweir #define C2U(cChar) OUString::createFromAscii(cChar)
54cdf0e10cSrcweir /* -----------------------------23.11.00 11:39--------------------------------
55cdf0e10cSrcweir 
56cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
57cdf0e10cSrcweir struct HtmlOptions_Impl
58cdf0e10cSrcweir {
59cdf0e10cSrcweir     LinkList    aList;
60cdf0e10cSrcweir 	sal_Int32 	nFlags;
61cdf0e10cSrcweir 	sal_Int32 	nExportMode;
62cdf0e10cSrcweir 	sal_Int32 	aFontSizeArr[HTML_FONT_COUNT];
63cdf0e10cSrcweir 	sal_Int32 	eEncoding;
64cdf0e10cSrcweir     sal_Bool    bIsEncodingDefault;
65cdf0e10cSrcweir 
HtmlOptions_ImplHtmlOptions_Impl66cdf0e10cSrcweir 	HtmlOptions_Impl() :
67cdf0e10cSrcweir 		nFlags(HTMLCFG_LOCAL_GRF|HTMLCFG_IS_BASIC_WARNING),
68cdf0e10cSrcweir 		nExportMode(HTML_CFG_NS40),
69cdf0e10cSrcweir         eEncoding( gsl_getSystemTextEncoding() ),
70cdf0e10cSrcweir         bIsEncodingDefault(sal_True)
71cdf0e10cSrcweir 	{
72cdf0e10cSrcweir 		aFontSizeArr[0] = HTMLFONTSZ1_DFLT;
73cdf0e10cSrcweir 		aFontSizeArr[1] = HTMLFONTSZ2_DFLT;
74cdf0e10cSrcweir 		aFontSizeArr[2] = HTMLFONTSZ3_DFLT;
75cdf0e10cSrcweir 		aFontSizeArr[3] = HTMLFONTSZ4_DFLT;
76cdf0e10cSrcweir 		aFontSizeArr[4] = HTMLFONTSZ5_DFLT;
77cdf0e10cSrcweir 		aFontSizeArr[5] = HTMLFONTSZ6_DFLT;
78cdf0e10cSrcweir 		aFontSizeArr[6] = HTMLFONTSZ7_DFLT;
79cdf0e10cSrcweir 	}
80cdf0e10cSrcweir };
81cdf0e10cSrcweir 
82cdf0e10cSrcweir /* -----------------------------23.11.00 11:39--------------------------------
83cdf0e10cSrcweir 
84cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
GetPropertyNames()85cdf0e10cSrcweir const Sequence<OUString>& SvxHtmlOptions::GetPropertyNames()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir 	static Sequence<OUString> aNames;
88cdf0e10cSrcweir 	if(!aNames.getLength())
89cdf0e10cSrcweir 	{
90cdf0e10cSrcweir 		static const char* aPropNames[] =
91cdf0e10cSrcweir 		{
92cdf0e10cSrcweir 			"Import/UnknownTag",					//  0
93cdf0e10cSrcweir 			"Import/FontSetting",					//  1
94cdf0e10cSrcweir 			"Import/FontSize/Size_1",				//  2
95cdf0e10cSrcweir 			"Import/FontSize/Size_2",				//  3
96cdf0e10cSrcweir 			"Import/FontSize/Size_3",				//  4
97cdf0e10cSrcweir 			"Import/FontSize/Size_4",				//  5
98cdf0e10cSrcweir 			"Import/FontSize/Size_5",				//  6
99cdf0e10cSrcweir 			"Import/FontSize/Size_6",				//  7
100cdf0e10cSrcweir 			"Import/FontSize/Size_7",				//  8
101cdf0e10cSrcweir 			"Export/Browser",						//  9
102cdf0e10cSrcweir 			"Export/Basic",							//  0
103cdf0e10cSrcweir 			"Export/PrintLayout",					// 11
104cdf0e10cSrcweir 			"Export/LocalGraphic",					// 12
105cdf0e10cSrcweir 			"Export/Warning",    					// 13
106cdf0e10cSrcweir 			"Export/Encoding",  					// 14
107cdf0e10cSrcweir             "Import/NumbersEnglishUS"               // 15
108cdf0e10cSrcweir 		};
109cdf0e10cSrcweir 		const int nCount = sizeof(aPropNames) / sizeof(aPropNames[0]);
110cdf0e10cSrcweir 		aNames.realloc(nCount);
111cdf0e10cSrcweir 		OUString* pNames = aNames.getArray();
112cdf0e10cSrcweir 		for(int i = 0; i < nCount; i++)
113cdf0e10cSrcweir 			pNames[i] = C2U(aPropNames[i]);
114cdf0e10cSrcweir 	}
115cdf0e10cSrcweir 	return aNames;
116cdf0e10cSrcweir }
117cdf0e10cSrcweir // -----------------------------------------------------------------------
SvxHtmlOptions()118cdf0e10cSrcweir SvxHtmlOptions::SvxHtmlOptions() :
119cdf0e10cSrcweir 	ConfigItem(C2U("Office.Common/Filter/HTML"))
120cdf0e10cSrcweir {
121cdf0e10cSrcweir 	pImp = new HtmlOptions_Impl;
122cdf0e10cSrcweir 	Load( GetPropertyNames() );
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir // -----------------------------------------------------------------------
~SvxHtmlOptions()126cdf0e10cSrcweir SvxHtmlOptions::~SvxHtmlOptions()
127cdf0e10cSrcweir {
128cdf0e10cSrcweir 	delete pImp;
129cdf0e10cSrcweir }
130cdf0e10cSrcweir 
Load(const Sequence<OUString> & aNames)131cdf0e10cSrcweir void SvxHtmlOptions::Load( const Sequence< OUString >& aNames )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir 	Sequence<Any> aValues = GetProperties(aNames);
134cdf0e10cSrcweir 	const Any* pValues = aValues.getConstArray();
135cdf0e10cSrcweir 	DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
136cdf0e10cSrcweir 	if(aValues.getLength() == aNames.getLength())
137cdf0e10cSrcweir 	{
138cdf0e10cSrcweir 		pImp->nFlags = 0;
139cdf0e10cSrcweir 		for(int nProp = 0; nProp < aNames.getLength(); nProp++)
140cdf0e10cSrcweir 		{
141cdf0e10cSrcweir 			if(pValues[nProp].hasValue())
142cdf0e10cSrcweir 			{
143cdf0e10cSrcweir 				switch(nProp)
144cdf0e10cSrcweir 				{
145cdf0e10cSrcweir 					case  0:
146cdf0e10cSrcweir 						if(*(sal_Bool*)pValues[nProp].getValue())
147cdf0e10cSrcweir 							pImp->nFlags |= HTMLCFG_UNKNOWN_TAGS;
148cdf0e10cSrcweir 					break;//"Import/UnknownTag",
149cdf0e10cSrcweir 					case  1:
150cdf0e10cSrcweir 						if(*(sal_Bool*)pValues[nProp].getValue())
151cdf0e10cSrcweir 							pImp->nFlags |= HTMLCFG_IGNORE_FONT_FAMILY;
152cdf0e10cSrcweir 					break;//"Import/FontSetting",
153cdf0e10cSrcweir 					case  2: pValues[nProp] >>= pImp->aFontSizeArr[0]; break;//"Import/FontSize/Size_1",
154cdf0e10cSrcweir 					case  3: pValues[nProp] >>= pImp->aFontSizeArr[1]; break;//"Import/FontSize/Size_2",
155cdf0e10cSrcweir 					case  4: pValues[nProp] >>= pImp->aFontSizeArr[2]; break;//"Import/FontSize/Size_3",
156cdf0e10cSrcweir 					case  5: pValues[nProp] >>= pImp->aFontSizeArr[3]; break;//"Import/FontSize/Size_4",
157cdf0e10cSrcweir 					case  6: pValues[nProp] >>= pImp->aFontSizeArr[4]; break;//"Import/FontSize/Size_5",
158cdf0e10cSrcweir 					case  7: pValues[nProp] >>= pImp->aFontSizeArr[5]; break;//"Import/FontSize/Size_6",
159cdf0e10cSrcweir 					case  8: pValues[nProp] >>= pImp->aFontSizeArr[6]; break;//"Import/FontSize/Size_7",
160cdf0e10cSrcweir 					case  9://"Export/Browser",
161cdf0e10cSrcweir 						{
162cdf0e10cSrcweir 							sal_Int32 nExpMode = 0;
163cdf0e10cSrcweir //							pValues[nProp] >>= pImp->nExportMode;
164cdf0e10cSrcweir 							pValues[nProp] >>= nExpMode;
165cdf0e10cSrcweir 							switch( nExpMode )
166cdf0e10cSrcweir 							{
167cdf0e10cSrcweir 								case 0:		nExpMode = HTML_CFG_HTML32;		break;
168cdf0e10cSrcweir 								case 1:		nExpMode = HTML_CFG_MSIE_40;	break;
169cdf0e10cSrcweir //								case 2:		nExpMode = HTML_CFG_NS30;		break;	depricated
170cdf0e10cSrcweir 								case 3:		nExpMode = HTML_CFG_WRITER;		break;
171cdf0e10cSrcweir 								case 4:		nExpMode = HTML_CFG_NS40;		break;
172cdf0e10cSrcweir 								case 5:		nExpMode = HTML_CFG_MSIE_40_OLD;break;
173cdf0e10cSrcweir 								default:	nExpMode = HTML_CFG_NS40;		break;
174cdf0e10cSrcweir 							}
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 							pImp->nExportMode = nExpMode;
177cdf0e10cSrcweir 						}
178cdf0e10cSrcweir 						break;
179cdf0e10cSrcweir 					case 10:
180cdf0e10cSrcweir 						if(*(sal_Bool*)pValues[nProp].getValue())
181cdf0e10cSrcweir 							pImp->nFlags |= HTMLCFG_STAR_BASIC;
182cdf0e10cSrcweir 					break;//"Export/Basic",
183cdf0e10cSrcweir 					case 11:
184cdf0e10cSrcweir 						if(*(sal_Bool*)pValues[nProp].getValue())
185cdf0e10cSrcweir 							pImp->nFlags |= HTMLCFG_PRINT_LAYOUT_EXTENSION;
186cdf0e10cSrcweir 					break;//"Export/PrintLayout",
187cdf0e10cSrcweir 					case 12:
188cdf0e10cSrcweir 						if(*(sal_Bool*)pValues[nProp].getValue())
189cdf0e10cSrcweir 							pImp->nFlags |= HTMLCFG_LOCAL_GRF;
190cdf0e10cSrcweir 					break;//"Export/LocalGraphic",
191cdf0e10cSrcweir 					case 13:
192cdf0e10cSrcweir 						if(*(sal_Bool*)pValues[nProp].getValue())
193cdf0e10cSrcweir 							pImp->nFlags |= HTMLCFG_IS_BASIC_WARNING;
194cdf0e10cSrcweir 					break;//"Export/Warning"
195cdf0e10cSrcweir 
196cdf0e10cSrcweir                     case 14: pValues[nProp] >>= pImp->eEncoding;
197cdf0e10cSrcweir                              pImp->bIsEncodingDefault = sal_False;
198cdf0e10cSrcweir                     break;//"Export/Encoding"
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 					case 15:
201cdf0e10cSrcweir 						if(*(sal_Bool*)pValues[nProp].getValue())
202cdf0e10cSrcweir 							pImp->nFlags |= HTMLCFG_NUMBERS_ENGLISH_US;
203cdf0e10cSrcweir 					break;//"Import/NumbersEnglishUS"
204cdf0e10cSrcweir 				}
205cdf0e10cSrcweir 			}
206cdf0e10cSrcweir 		}
207cdf0e10cSrcweir 	}
208cdf0e10cSrcweir }
209cdf0e10cSrcweir 
210cdf0e10cSrcweir // -----------------------------------------------------------------------
Commit()211cdf0e10cSrcweir void	SvxHtmlOptions::Commit()
212cdf0e10cSrcweir {
213cdf0e10cSrcweir 	const Sequence<OUString>& aNames = GetPropertyNames();
214cdf0e10cSrcweir 
215cdf0e10cSrcweir //	const OUString* pNames = aNames.getConstArray();
216cdf0e10cSrcweir 	Sequence<Any> aValues(aNames.getLength());
217cdf0e10cSrcweir 	Any* pValues = aValues.getArray();
218cdf0e10cSrcweir 
219cdf0e10cSrcweir //	const Type& rType = ::getBooleanCppuType();
220cdf0e10cSrcweir 	for(int nProp = 0; nProp < aNames.getLength(); nProp++)
221cdf0e10cSrcweir 	{
222cdf0e10cSrcweir 		sal_Bool bSet = sal_False;
223cdf0e10cSrcweir 		switch(nProp)
224cdf0e10cSrcweir 		{
225cdf0e10cSrcweir 			case  0: bSet = 0 != (pImp->nFlags & HTMLCFG_UNKNOWN_TAGS);break;//"Import/UnknownTag",
226cdf0e10cSrcweir 			case  1: bSet = 0 != (pImp->nFlags & HTMLCFG_IGNORE_FONT_FAMILY);break;//"Import/FontSetting",
227cdf0e10cSrcweir 			case  2: pValues[nProp] <<= pImp->aFontSizeArr[0];break;//"Import/FontSize/Size_1",
228cdf0e10cSrcweir 			case  3: pValues[nProp] <<= pImp->aFontSizeArr[1];break;//"Import/FontSize/Size_2",
229cdf0e10cSrcweir 			case  4: pValues[nProp] <<= pImp->aFontSizeArr[2];break;//"Import/FontSize/Size_3",
230cdf0e10cSrcweir 			case  5: pValues[nProp] <<= pImp->aFontSizeArr[3];break;//"Import/FontSize/Size_4",
231cdf0e10cSrcweir 			case  6: pValues[nProp] <<= pImp->aFontSizeArr[4];break;//"Import/FontSize/Size_5",
232cdf0e10cSrcweir 			case  7: pValues[nProp] <<= pImp->aFontSizeArr[5];break;//"Import/FontSize/Size_6",
233cdf0e10cSrcweir 			case  8: pValues[nProp] <<= pImp->aFontSizeArr[6];break;//"Import/FontSize/Size_7",
234cdf0e10cSrcweir 			case  9:				//"Export/Browser",
235cdf0e10cSrcweir 				{
236cdf0e10cSrcweir 					sal_Int32 nExpMode = pImp->nExportMode;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 					switch( nExpMode )
239cdf0e10cSrcweir 					{
240cdf0e10cSrcweir 						case HTML_CFG_HTML32:		nExpMode = 0;	break;
241cdf0e10cSrcweir 						case HTML_CFG_MSIE_40:		nExpMode = 1;	break;
242cdf0e10cSrcweir //						case HTML_CFG_NS30:			nExpMode = 2;	break;	depricated
243cdf0e10cSrcweir 						case HTML_CFG_WRITER:		nExpMode = 3;	break;
244cdf0e10cSrcweir 						case HTML_CFG_NS40:			nExpMode = 4;	break;
245cdf0e10cSrcweir 						case HTML_CFG_MSIE_40_OLD:	nExpMode = 5;	break;
246cdf0e10cSrcweir 						default:					nExpMode = 4;	break;	// NS40
247cdf0e10cSrcweir 					}
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 					pValues[nProp] <<= nExpMode;
250cdf0e10cSrcweir 					break;
251cdf0e10cSrcweir 				}
252cdf0e10cSrcweir 			case 10: bSet = 0 != (pImp->nFlags & HTMLCFG_STAR_BASIC);break;//"Export/Basic",
253cdf0e10cSrcweir 			case 11: bSet = 0 != (pImp->nFlags & HTMLCFG_PRINT_LAYOUT_EXTENSION);break;//"Export/PrintLayout",
254cdf0e10cSrcweir 			case 12: bSet = 0 != (pImp->nFlags & HTMLCFG_LOCAL_GRF);break;//"Export/LocalGraphic",
255cdf0e10cSrcweir 			case 13: bSet = 0 != (pImp->nFlags & HTMLCFG_IS_BASIC_WARNING);break;//"Export/Warning"
256cdf0e10cSrcweir             case 14:
257cdf0e10cSrcweir                 if(!pImp->bIsEncodingDefault)
258cdf0e10cSrcweir                     pValues[nProp] <<= pImp->eEncoding;
259cdf0e10cSrcweir                 break;//"Export/Encoding",
260cdf0e10cSrcweir 			case 15: bSet = 0 != (pImp->nFlags & HTMLCFG_NUMBERS_ENGLISH_US);break;//"Import/NumbersEnglishUS"
261cdf0e10cSrcweir 		}
262cdf0e10cSrcweir 		if(nProp < 2 || ( nProp > 9 && nProp < 14 ) || nProp == 15)
263cdf0e10cSrcweir 			pValues[nProp].setValue(&bSet, ::getCppuBooleanType());
264cdf0e10cSrcweir 	}
265cdf0e10cSrcweir 	PutProperties(aNames, aValues);
266cdf0e10cSrcweir }
267cdf0e10cSrcweir 
AddListenerLink(const Link & rLink)268cdf0e10cSrcweir void SvxHtmlOptions::AddListenerLink( const Link& rLink )
269cdf0e10cSrcweir {
270cdf0e10cSrcweir     pImp->aList.Insert( new Link( rLink ) );
271cdf0e10cSrcweir }
272cdf0e10cSrcweir 
RemoveListenerLink(const Link & rLink)273cdf0e10cSrcweir void SvxHtmlOptions::RemoveListenerLink( const Link& rLink )
274cdf0e10cSrcweir {
275cdf0e10cSrcweir     for ( sal_uInt16 n=0; n<pImp->aList.Count(); n++ )
276cdf0e10cSrcweir     {
277cdf0e10cSrcweir         if ( (*pImp->aList.GetObject(n) ) == rLink )
278cdf0e10cSrcweir         {
279cdf0e10cSrcweir             delete pImp->aList.Remove(n);
280cdf0e10cSrcweir             break;
281cdf0e10cSrcweir         }
282cdf0e10cSrcweir     }
283cdf0e10cSrcweir }
284cdf0e10cSrcweir 
CallListeners()285cdf0e10cSrcweir void SvxHtmlOptions::CallListeners()
286cdf0e10cSrcweir {
287cdf0e10cSrcweir     for ( sal_uInt16 n = 0; n < pImp->aList.Count(); ++n )
288cdf0e10cSrcweir         pImp->aList.GetObject(n)->Call( this );
289cdf0e10cSrcweir }
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 
Notify(const com::sun::star::uno::Sequence<rtl::OUString> &)292cdf0e10cSrcweir void SvxHtmlOptions::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
293cdf0e10cSrcweir {
294cdf0e10cSrcweir 	Load( GetPropertyNames() );
295cdf0e10cSrcweir     CallListeners();
296cdf0e10cSrcweir }
297cdf0e10cSrcweir 
298cdf0e10cSrcweir // -----------------------------------------------------------------------
GetFontSize(sal_uInt16 nPos) const299cdf0e10cSrcweir sal_uInt16 	SvxHtmlOptions::GetFontSize(sal_uInt16 nPos) const
300cdf0e10cSrcweir {
301cdf0e10cSrcweir 	if(nPos < HTML_FONT_COUNT)
302cdf0e10cSrcweir 		return (sal_uInt16)pImp->aFontSizeArr[nPos];
303cdf0e10cSrcweir 	return 0;
304cdf0e10cSrcweir }
305cdf0e10cSrcweir // -----------------------------------------------------------------------
SetFontSize(sal_uInt16 nPos,sal_uInt16 nSize)306cdf0e10cSrcweir void SvxHtmlOptions::SetFontSize(sal_uInt16 nPos, sal_uInt16 nSize)
307cdf0e10cSrcweir {
308cdf0e10cSrcweir 	if(nPos < HTML_FONT_COUNT)
309cdf0e10cSrcweir 	{
310cdf0e10cSrcweir 		pImp->aFontSizeArr[nPos] = nSize;
311cdf0e10cSrcweir 		SetModified();
312cdf0e10cSrcweir 	}
313cdf0e10cSrcweir }
314cdf0e10cSrcweir 
315cdf0e10cSrcweir // -----------------------------------------------------------------------
316cdf0e10cSrcweir 
317cdf0e10cSrcweir // -----------------------------------------------------------------------
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 
IsImportUnknown() const320cdf0e10cSrcweir sal_Bool SvxHtmlOptions::IsImportUnknown() const
321cdf0e10cSrcweir {
322cdf0e10cSrcweir 	return 0 != (pImp->nFlags & HTMLCFG_UNKNOWN_TAGS) ;
323cdf0e10cSrcweir }
324cdf0e10cSrcweir 
325cdf0e10cSrcweir // -----------------------------------------------------------------------
326cdf0e10cSrcweir 
327cdf0e10cSrcweir 
SetImportUnknown(sal_Bool bSet)328cdf0e10cSrcweir void SvxHtmlOptions::SetImportUnknown(sal_Bool bSet)
329cdf0e10cSrcweir {
330cdf0e10cSrcweir 	if(bSet)
331cdf0e10cSrcweir 		pImp->nFlags |= HTMLCFG_UNKNOWN_TAGS;
332cdf0e10cSrcweir 	else
333cdf0e10cSrcweir 		pImp->nFlags &= ~HTMLCFG_UNKNOWN_TAGS;
334cdf0e10cSrcweir 	SetModified();
335cdf0e10cSrcweir }
336cdf0e10cSrcweir 
337cdf0e10cSrcweir // -----------------------------------------------------------------------
338cdf0e10cSrcweir 
339cdf0e10cSrcweir 
GetExportMode() const340cdf0e10cSrcweir sal_uInt16 	SvxHtmlOptions::GetExportMode() const
341cdf0e10cSrcweir {
342cdf0e10cSrcweir 	return (sal_uInt16)pImp->nExportMode;
343cdf0e10cSrcweir }
344cdf0e10cSrcweir 
345cdf0e10cSrcweir // -----------------------------------------------------------------------
346cdf0e10cSrcweir 
347cdf0e10cSrcweir 
SetExportMode(sal_uInt16 nSet)348cdf0e10cSrcweir void SvxHtmlOptions::SetExportMode(sal_uInt16 nSet)
349cdf0e10cSrcweir {
350cdf0e10cSrcweir 	if(nSet <= HTML_CFG_MAX )
351cdf0e10cSrcweir 	{
352cdf0e10cSrcweir 		pImp->nExportMode = nSet;
353cdf0e10cSrcweir 		SetModified();
354cdf0e10cSrcweir 		CallListeners();
355cdf0e10cSrcweir 	}
356cdf0e10cSrcweir }
357cdf0e10cSrcweir 
358cdf0e10cSrcweir // -----------------------------------------------------------------------
359cdf0e10cSrcweir 
360cdf0e10cSrcweir 
IsStarBasic() const361cdf0e10cSrcweir sal_Bool SvxHtmlOptions::IsStarBasic() const
362cdf0e10cSrcweir {
363cdf0e10cSrcweir 	return 0 != (pImp->nFlags & HTMLCFG_STAR_BASIC) ;
364cdf0e10cSrcweir }
365cdf0e10cSrcweir 
366cdf0e10cSrcweir // -----------------------------------------------------------------------
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 
SetStarBasic(sal_Bool bSet)369cdf0e10cSrcweir void SvxHtmlOptions::SetStarBasic(sal_Bool bSet)
370cdf0e10cSrcweir {
371cdf0e10cSrcweir 	if(bSet)
372cdf0e10cSrcweir 		pImp->nFlags |=  HTMLCFG_STAR_BASIC;
373cdf0e10cSrcweir 	else
374cdf0e10cSrcweir 		pImp->nFlags &= ~HTMLCFG_STAR_BASIC;
375cdf0e10cSrcweir 	SetModified();
376cdf0e10cSrcweir }
377cdf0e10cSrcweir 
378cdf0e10cSrcweir /*-----------------14.02.97 08.34-------------------
379cdf0e10cSrcweir 
380cdf0e10cSrcweir --------------------------------------------------*/
381cdf0e10cSrcweir 
IsSaveGraphicsLocal() const382cdf0e10cSrcweir sal_Bool SvxHtmlOptions::IsSaveGraphicsLocal() const
383cdf0e10cSrcweir {
384cdf0e10cSrcweir 	return 0 != (pImp->nFlags & HTMLCFG_LOCAL_GRF) ;
385cdf0e10cSrcweir }
386cdf0e10cSrcweir /*-----------------14.02.97 08.34-------------------
387cdf0e10cSrcweir 
388cdf0e10cSrcweir --------------------------------------------------*/
SetSaveGraphicsLocal(sal_Bool bSet)389cdf0e10cSrcweir void SvxHtmlOptions::SetSaveGraphicsLocal(sal_Bool bSet)
390cdf0e10cSrcweir {
391cdf0e10cSrcweir 	if(bSet)
392cdf0e10cSrcweir 		pImp->nFlags |=  HTMLCFG_LOCAL_GRF;
393cdf0e10cSrcweir 	else
394cdf0e10cSrcweir 		pImp->nFlags &= ~HTMLCFG_LOCAL_GRF;
395cdf0e10cSrcweir 	SetModified();
396cdf0e10cSrcweir }
397cdf0e10cSrcweir 
398cdf0e10cSrcweir /*-----------------10/21/97 08:34am-----------------
399cdf0e10cSrcweir 
400cdf0e10cSrcweir --------------------------------------------------*/
401cdf0e10cSrcweir 
IsPrintLayoutExtension() const402cdf0e10cSrcweir sal_Bool 	SvxHtmlOptions::IsPrintLayoutExtension() const
403cdf0e10cSrcweir {
404cdf0e10cSrcweir 	sal_Bool bRet = 0 != (pImp->nFlags & HTMLCFG_PRINT_LAYOUT_EXTENSION);
405cdf0e10cSrcweir 	switch( pImp->nExportMode )
406cdf0e10cSrcweir 	{
407cdf0e10cSrcweir 		case HTML_CFG_MSIE_40:
408cdf0e10cSrcweir 		case HTML_CFG_NS40  :
409cdf0e10cSrcweir 		case HTML_CFG_WRITER :
410cdf0e10cSrcweir 		break;
411cdf0e10cSrcweir 		default:
412cdf0e10cSrcweir 			bRet = sal_False;
413cdf0e10cSrcweir 	}
414cdf0e10cSrcweir 	return bRet;
415cdf0e10cSrcweir }
416cdf0e10cSrcweir /*-----------------10/21/97 08:34am-----------------
417cdf0e10cSrcweir 
418cdf0e10cSrcweir --------------------------------------------------*/
SetPrintLayoutExtension(sal_Bool bSet)419cdf0e10cSrcweir void	SvxHtmlOptions::SetPrintLayoutExtension(sal_Bool bSet)
420cdf0e10cSrcweir {
421cdf0e10cSrcweir 	if(bSet)
422cdf0e10cSrcweir 		pImp->nFlags |=  HTMLCFG_PRINT_LAYOUT_EXTENSION;
423cdf0e10cSrcweir 	else
424cdf0e10cSrcweir 		pImp->nFlags &= ~HTMLCFG_PRINT_LAYOUT_EXTENSION;
425cdf0e10cSrcweir 	SetModified();
426cdf0e10cSrcweir }
427cdf0e10cSrcweir 
428cdf0e10cSrcweir /*-----------------10.07.98 10.02-------------------
429cdf0e10cSrcweir 
430cdf0e10cSrcweir --------------------------------------------------*/
431cdf0e10cSrcweir 
IsIgnoreFontFamily() const432cdf0e10cSrcweir sal_Bool SvxHtmlOptions::IsIgnoreFontFamily() const
433cdf0e10cSrcweir {
434cdf0e10cSrcweir 	return 0 != (pImp->nFlags & HTMLCFG_IGNORE_FONT_FAMILY) ;
435cdf0e10cSrcweir }
436cdf0e10cSrcweir /*-----------------10.07.98 10.02-------------------
437cdf0e10cSrcweir 
438cdf0e10cSrcweir --------------------------------------------------*/
SetIgnoreFontFamily(sal_Bool bSet)439cdf0e10cSrcweir void SvxHtmlOptions::SetIgnoreFontFamily(sal_Bool bSet)
440cdf0e10cSrcweir {
441cdf0e10cSrcweir 	if(bSet)
442cdf0e10cSrcweir 		pImp->nFlags |=  HTMLCFG_IGNORE_FONT_FAMILY;
443cdf0e10cSrcweir 	else
444cdf0e10cSrcweir 		pImp->nFlags &= ~HTMLCFG_IGNORE_FONT_FAMILY;
445cdf0e10cSrcweir 	SetModified();
446cdf0e10cSrcweir }
447cdf0e10cSrcweir /* -----------------05.02.99 09:03-------------------
448cdf0e10cSrcweir  *
449cdf0e10cSrcweir  * --------------------------------------------------*/
IsStarBasicWarning() const450cdf0e10cSrcweir sal_Bool SvxHtmlOptions::IsStarBasicWarning() const
451cdf0e10cSrcweir {
452cdf0e10cSrcweir 	return 0 != (pImp->nFlags & HTMLCFG_IS_BASIC_WARNING) ;
453cdf0e10cSrcweir }
454cdf0e10cSrcweir /* -----------------05.02.99 09:03-------------------
455cdf0e10cSrcweir  *
456cdf0e10cSrcweir  * --------------------------------------------------*/
SetStarBasicWarning(sal_Bool bSet)457cdf0e10cSrcweir void SvxHtmlOptions::SetStarBasicWarning(sal_Bool bSet)
458cdf0e10cSrcweir {
459cdf0e10cSrcweir 	if(bSet)
460cdf0e10cSrcweir 		pImp->nFlags |=  HTMLCFG_IS_BASIC_WARNING;
461cdf0e10cSrcweir 	else
462cdf0e10cSrcweir 		pImp->nFlags &= ~HTMLCFG_IS_BASIC_WARNING;
463cdf0e10cSrcweir 	SetModified();
464cdf0e10cSrcweir }
465cdf0e10cSrcweir 
466cdf0e10cSrcweir /*-----------------19.02.2001 18:40-----------------
467cdf0e10cSrcweir  *
468cdf0e10cSrcweir  * --------------------------------------------------*/
GetTextEncoding() const469cdf0e10cSrcweir rtl_TextEncoding SvxHtmlOptions::GetTextEncoding() const
470cdf0e10cSrcweir {
471cdf0e10cSrcweir     rtl_TextEncoding eRet;
472cdf0e10cSrcweir     if(pImp->bIsEncodingDefault)
473cdf0e10cSrcweir         eRet = SvtSysLocale::GetBestMimeEncoding();
474cdf0e10cSrcweir     else
475cdf0e10cSrcweir         eRet = (rtl_TextEncoding)pImp->eEncoding;
476cdf0e10cSrcweir     return eRet;
477cdf0e10cSrcweir }
478cdf0e10cSrcweir 
479cdf0e10cSrcweir /*-----------------19.02.2001 18:40-----------------
480cdf0e10cSrcweir  *
481cdf0e10cSrcweir  * --------------------------------------------------*/
SetTextEncoding(rtl_TextEncoding eEnc)482cdf0e10cSrcweir void SvxHtmlOptions::SetTextEncoding( rtl_TextEncoding eEnc )
483cdf0e10cSrcweir {
484cdf0e10cSrcweir 	pImp->eEncoding = eEnc;
485cdf0e10cSrcweir     pImp->bIsEncodingDefault = sal_False;
486cdf0e10cSrcweir 	SetModified();
487cdf0e10cSrcweir }
488cdf0e10cSrcweir /* -----------------------------15.08.2001 12:01------------------------------
489cdf0e10cSrcweir 
490cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
IsDefaultTextEncoding() const491cdf0e10cSrcweir sal_Bool SvxHtmlOptions::IsDefaultTextEncoding() const
492cdf0e10cSrcweir {
493cdf0e10cSrcweir     return pImp->bIsEncodingDefault;
494cdf0e10cSrcweir }
495cdf0e10cSrcweir 
Get()496cdf0e10cSrcweir SvxHtmlOptions* SvxHtmlOptions::Get()
497cdf0e10cSrcweir {
498cdf0e10cSrcweir 	if ( !pOptions )
499cdf0e10cSrcweir 		pOptions = new SvxHtmlOptions;
500cdf0e10cSrcweir 	return pOptions;
501cdf0e10cSrcweir }
502cdf0e10cSrcweir 
503cdf0e10cSrcweir 
504cdf0e10cSrcweir /* ---------------------- 2006-06-07T21:02+0200 ---------------------- */
IsNumbersEnglishUS() const505cdf0e10cSrcweir sal_Bool SvxHtmlOptions::IsNumbersEnglishUS() const
506cdf0e10cSrcweir {
507cdf0e10cSrcweir 	return 0 != (pImp->nFlags & HTMLCFG_NUMBERS_ENGLISH_US) ;
508cdf0e10cSrcweir }
509cdf0e10cSrcweir 
510cdf0e10cSrcweir 
511cdf0e10cSrcweir /* ---------------------- 2006-06-07T21:02+0200 ---------------------- */
SetNumbersEnglishUS(sal_Bool bSet)512cdf0e10cSrcweir void SvxHtmlOptions::SetNumbersEnglishUS(sal_Bool bSet)
513cdf0e10cSrcweir {
514cdf0e10cSrcweir 	if(bSet)
515cdf0e10cSrcweir 		pImp->nFlags |=  HTMLCFG_NUMBERS_ENGLISH_US;
516cdf0e10cSrcweir 	else
517cdf0e10cSrcweir 		pImp->nFlags &= ~HTMLCFG_NUMBERS_ENGLISH_US;
518cdf0e10cSrcweir 	SetModified();
519cdf0e10cSrcweir }
520