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