1*2ee96f1cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2ee96f1cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2ee96f1cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2ee96f1cSAndrew Rist * distributed with this work for additional information 6*2ee96f1cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2ee96f1cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2ee96f1cSAndrew Rist * "License"); you may not use this file except in compliance 9*2ee96f1cSAndrew Rist * with the License. You may obtain a copy of the License at 10*2ee96f1cSAndrew Rist * 11*2ee96f1cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2ee96f1cSAndrew Rist * 13*2ee96f1cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2ee96f1cSAndrew Rist * software distributed under the License is distributed on an 15*2ee96f1cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2ee96f1cSAndrew Rist * KIND, either express or implied. See the License for the 17*2ee96f1cSAndrew Rist * specific language governing permissions and limitations 18*2ee96f1cSAndrew Rist * under the License. 19*2ee96f1cSAndrew Rist * 20*2ee96f1cSAndrew Rist *************************************************************/ 21*2ee96f1cSAndrew Rist 22*2ee96f1cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_cui.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir // include --------------------------------------------------------------- 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <svtools/langtab.hxx> 30cdf0e10cSrcweir #include <svtools/htmlcfg.hxx> 31cdf0e10cSrcweir #include "opthtml.hxx" 32cdf0e10cSrcweir #include "opthtml.hrc" 33cdf0e10cSrcweir #include <cuires.hrc> 34cdf0e10cSrcweir #include "helpid.hrc" 35cdf0e10cSrcweir #include <dialmgr.hxx> 36cdf0e10cSrcweir 37cdf0e10cSrcweir // Umwandlung der Modi zu den Positionen in der Listbox 38cdf0e10cSrcweir const sal_uInt16 aPosToExportArr[] = 39cdf0e10cSrcweir { 40cdf0e10cSrcweir HTML_CFG_HTML32, 41cdf0e10cSrcweir HTML_CFG_MSIE_40, 42cdf0e10cSrcweir HTML_CFG_NS40, 43cdf0e10cSrcweir HTML_CFG_WRITER 44cdf0e10cSrcweir }; 45cdf0e10cSrcweir 46cdf0e10cSrcweir //#define DEPRECATED_ENTRY 0xFFFF 47cdf0e10cSrcweir 48cdf0e10cSrcweir const sal_uInt16 aExportToPosArr[] = 49cdf0e10cSrcweir { 50cdf0e10cSrcweir 0, //HTML 3.2 51cdf0e10cSrcweir 1, //MS Internet Explorer 4.0 52cdf0e10cSrcweir 3, //StarWriter 53cdf0e10cSrcweir 2 //Netscape Navigator 4.0 54cdf0e10cSrcweir }; 55cdf0e10cSrcweir // ----------------------------------------------------------------------- 56cdf0e10cSrcweir 57cdf0e10cSrcweir OfaHtmlTabPage::OfaHtmlTabPage(Window* pParent, const SfxItemSet& rSet) : 58cdf0e10cSrcweir SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_HTMLOPT ), rSet ), 59cdf0e10cSrcweir aFontSizeGB ( this, CUI_RES( GB_FONTSIZE ) ), 60cdf0e10cSrcweir aSize1FT ( this, CUI_RES( FT_SIZE1 ) ), 61cdf0e10cSrcweir aSize1NF ( this, CUI_RES( NF_SIZE1 ) ), 62cdf0e10cSrcweir aSize2FT ( this, CUI_RES( FT_SIZE2 ) ), 63cdf0e10cSrcweir aSize2NF ( this, CUI_RES( NF_SIZE2 ) ), 64cdf0e10cSrcweir aSize3FT ( this, CUI_RES( FT_SIZE3 ) ), 65cdf0e10cSrcweir aSize3NF ( this, CUI_RES( NF_SIZE3 ) ), 66cdf0e10cSrcweir aSize4FT ( this, CUI_RES( FT_SIZE4 ) ), 67cdf0e10cSrcweir aSize4NF ( this, CUI_RES( NF_SIZE4 ) ), 68cdf0e10cSrcweir aSize5FT ( this, CUI_RES( FT_SIZE5 ) ), 69cdf0e10cSrcweir aSize5NF ( this, CUI_RES( NF_SIZE5 ) ), 70cdf0e10cSrcweir aSize6FT ( this, CUI_RES( FT_SIZE6 ) ), 71cdf0e10cSrcweir aSize6NF ( this, CUI_RES( NF_SIZE6 ) ), 72cdf0e10cSrcweir aSize7FT ( this, CUI_RES( FT_SIZE7 ) ), 73cdf0e10cSrcweir aSize7NF ( this, CUI_RES( NF_SIZE7 ) ), 74cdf0e10cSrcweir aImportGB ( this, CUI_RES( GB_IMPORT ) ), 75cdf0e10cSrcweir aNumbersEnglishUSCB ( this, CUI_RES( CB_NUMBERS_ENGLISH_US ) ), 76cdf0e10cSrcweir aUnknownTagCB ( this, CUI_RES( CB_UNKNOWN_TAGS ) ), 77cdf0e10cSrcweir aIgnoreFontNamesCB( this, CUI_RES( CB_IGNORE_FONTNAMES ) ), 78cdf0e10cSrcweir aExportGB ( this, CUI_RES( GB_EXPORT ) ), 79cdf0e10cSrcweir aExportLB ( this, CUI_RES( LB_EXPORT ) ), 80cdf0e10cSrcweir aStarBasicCB ( this, CUI_RES( CB_STARBASIC ) ), 81cdf0e10cSrcweir aStarBasicWarningCB(this, CUI_RES( CB_STARBASIC_WARNING ) ), 82cdf0e10cSrcweir aPrintExtensionCB( this,CUI_RES(CB_PRINT_EXTENSION )), 83cdf0e10cSrcweir aSaveGrfLocalCB ( this, CUI_RES( CB_LOCAL_GRF ) ), 84cdf0e10cSrcweir aCharSetFT ( this, CUI_RES( FT_CHARSET ) ), 85cdf0e10cSrcweir aCharSetLB ( this, CUI_RES( LB_CHARSET ) ) 86cdf0e10cSrcweir 87cdf0e10cSrcweir { 88cdf0e10cSrcweir FreeResource(); 89cdf0e10cSrcweir 90cdf0e10cSrcweir // replace placeholder with UI string from language list 91cdf0e10cSrcweir String aText( aNumbersEnglishUSCB.GetText()); 92cdf0e10cSrcweir String aPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%ENGLISHUSLOCALE")); 93cdf0e10cSrcweir xub_StrLen nPos; 94cdf0e10cSrcweir if ((nPos = aText.Search( aPlaceholder)) != STRING_NOTFOUND) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir SvtLanguageTable aLangTab; 97cdf0e10cSrcweir const String& rStr = aLangTab.GetString( LANGUAGE_ENGLISH_US); 98cdf0e10cSrcweir if (rStr.Len()) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir aText.Replace( nPos, aPlaceholder.Len(), rStr); 101cdf0e10cSrcweir aNumbersEnglishUSCB.SetText( aText); 102cdf0e10cSrcweir } 103cdf0e10cSrcweir } 104cdf0e10cSrcweir 105cdf0e10cSrcweir aExportLB.SetSelectHdl(LINK(this, OfaHtmlTabPage, ExportHdl_Impl)); 106cdf0e10cSrcweir aStarBasicCB.SetClickHdl(LINK(this, OfaHtmlTabPage, CheckBoxHdl_Impl)); 107cdf0e10cSrcweir 108cdf0e10cSrcweir // initialize the characterset listbox 109cdf0e10cSrcweir aCharSetLB.FillWithMimeAndSelectBest(); 110cdf0e10cSrcweir } 111cdf0e10cSrcweir 112cdf0e10cSrcweir /*-----------------02.09.96 13.47------------------- 113cdf0e10cSrcweir 114cdf0e10cSrcweir --------------------------------------------------*/ 115cdf0e10cSrcweir 116cdf0e10cSrcweir OfaHtmlTabPage::~OfaHtmlTabPage() 117cdf0e10cSrcweir { 118cdf0e10cSrcweir } 119cdf0e10cSrcweir 120cdf0e10cSrcweir /*-----------------02.09.96 13.47------------------- 121cdf0e10cSrcweir 122cdf0e10cSrcweir --------------------------------------------------*/ 123cdf0e10cSrcweir 124cdf0e10cSrcweir SfxTabPage* OfaHtmlTabPage::Create( Window* pParent, 125cdf0e10cSrcweir const SfxItemSet& rAttrSet ) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir return new OfaHtmlTabPage(pParent, rAttrSet); 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir /*-----------------02.09.96 13.47------------------- 131cdf0e10cSrcweir 132cdf0e10cSrcweir --------------------------------------------------*/ 133cdf0e10cSrcweir 134cdf0e10cSrcweir sal_Bool OfaHtmlTabPage::FillItemSet( SfxItemSet& ) 135cdf0e10cSrcweir { 136cdf0e10cSrcweir SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); 137cdf0e10cSrcweir if(aSize1NF.GetSavedValue() != aSize1NF.GetText()) 138cdf0e10cSrcweir pHtmlOpt->SetFontSize(0, (sal_uInt16)aSize1NF.GetValue()); 139cdf0e10cSrcweir if(aSize2NF.GetSavedValue() != aSize2NF.GetText()) 140cdf0e10cSrcweir pHtmlOpt->SetFontSize(1, (sal_uInt16)aSize2NF.GetValue()); 141cdf0e10cSrcweir if(aSize3NF.GetSavedValue() != aSize3NF.GetText()) 142cdf0e10cSrcweir pHtmlOpt->SetFontSize(2, (sal_uInt16)aSize3NF.GetValue()); 143cdf0e10cSrcweir if(aSize4NF.GetSavedValue() != aSize4NF.GetText()) 144cdf0e10cSrcweir pHtmlOpt->SetFontSize(3, (sal_uInt16)aSize4NF.GetValue()); 145cdf0e10cSrcweir if(aSize5NF.GetSavedValue() != aSize5NF.GetText()) 146cdf0e10cSrcweir pHtmlOpt->SetFontSize(4, (sal_uInt16)aSize5NF.GetValue()); 147cdf0e10cSrcweir if(aSize6NF.GetSavedValue() != aSize6NF.GetText()) 148cdf0e10cSrcweir pHtmlOpt->SetFontSize(5, (sal_uInt16)aSize6NF.GetValue()); 149cdf0e10cSrcweir if(aSize7NF.GetSavedValue() != aSize7NF.GetText()) 150cdf0e10cSrcweir pHtmlOpt->SetFontSize(6, (sal_uInt16)aSize7NF.GetValue()); 151cdf0e10cSrcweir 152cdf0e10cSrcweir if(aNumbersEnglishUSCB.IsChecked() != aNumbersEnglishUSCB.GetSavedValue()) 153cdf0e10cSrcweir pHtmlOpt->SetNumbersEnglishUS(aNumbersEnglishUSCB.IsChecked()); 154cdf0e10cSrcweir 155cdf0e10cSrcweir if(aUnknownTagCB.IsChecked() != aUnknownTagCB.GetSavedValue()) 156cdf0e10cSrcweir pHtmlOpt->SetImportUnknown(aUnknownTagCB.IsChecked()); 157cdf0e10cSrcweir 158cdf0e10cSrcweir if(aIgnoreFontNamesCB.IsChecked() != aIgnoreFontNamesCB.GetSavedValue()) 159cdf0e10cSrcweir pHtmlOpt->SetIgnoreFontFamily(aIgnoreFontNamesCB.IsChecked()); 160cdf0e10cSrcweir 161cdf0e10cSrcweir if(aExportLB.GetSelectEntryPos() != aExportLB.GetSavedValue()) 162cdf0e10cSrcweir pHtmlOpt->SetExportMode(aPosToExportArr[aExportLB.GetSelectEntryPos()]); 163cdf0e10cSrcweir 164cdf0e10cSrcweir if(aStarBasicCB.IsChecked() != aStarBasicCB.GetSavedValue()) 165cdf0e10cSrcweir pHtmlOpt->SetStarBasic(aStarBasicCB.IsChecked()); 166cdf0e10cSrcweir 167cdf0e10cSrcweir if(aStarBasicWarningCB.IsChecked() != aStarBasicWarningCB.GetSavedValue()) 168cdf0e10cSrcweir pHtmlOpt->SetStarBasicWarning(aStarBasicWarningCB.IsChecked()); 169cdf0e10cSrcweir 170cdf0e10cSrcweir if(aSaveGrfLocalCB.IsChecked() != aSaveGrfLocalCB.GetSavedValue()) 171cdf0e10cSrcweir pHtmlOpt->SetSaveGraphicsLocal(aSaveGrfLocalCB.IsChecked()); 172cdf0e10cSrcweir 173cdf0e10cSrcweir if(aPrintExtensionCB.IsChecked() != aPrintExtensionCB.GetSavedValue()) 174cdf0e10cSrcweir pHtmlOpt->SetPrintLayoutExtension(aPrintExtensionCB.IsChecked()); 175cdf0e10cSrcweir 176cdf0e10cSrcweir if( aCharSetLB.GetSelectTextEncoding() != pHtmlOpt->GetTextEncoding() ) 177cdf0e10cSrcweir pHtmlOpt->SetTextEncoding( aCharSetLB.GetSelectTextEncoding() ); 178cdf0e10cSrcweir 179cdf0e10cSrcweir return sal_False; 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir /*-----------------02.09.96 13.47------------------- 183cdf0e10cSrcweir 184cdf0e10cSrcweir --------------------------------------------------*/ 185cdf0e10cSrcweir 186cdf0e10cSrcweir void OfaHtmlTabPage::Reset( const SfxItemSet& ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); 189cdf0e10cSrcweir aSize1NF.SetValue(pHtmlOpt->GetFontSize(0)); 190cdf0e10cSrcweir aSize2NF.SetValue(pHtmlOpt->GetFontSize(1)); 191cdf0e10cSrcweir aSize3NF.SetValue(pHtmlOpt->GetFontSize(2)); 192cdf0e10cSrcweir aSize4NF.SetValue(pHtmlOpt->GetFontSize(3)); 193cdf0e10cSrcweir aSize5NF.SetValue(pHtmlOpt->GetFontSize(4)); 194cdf0e10cSrcweir aSize6NF.SetValue(pHtmlOpt->GetFontSize(5)); 195cdf0e10cSrcweir aSize7NF.SetValue(pHtmlOpt->GetFontSize(6)); 196cdf0e10cSrcweir aNumbersEnglishUSCB.Check(pHtmlOpt->IsNumbersEnglishUS()); 197cdf0e10cSrcweir aUnknownTagCB.Check(pHtmlOpt->IsImportUnknown()); 198cdf0e10cSrcweir aIgnoreFontNamesCB.Check(pHtmlOpt->IsIgnoreFontFamily()); 199cdf0e10cSrcweir sal_uInt16 nExport = pHtmlOpt->GetExportMode(); 200cdf0e10cSrcweir if( nExport >= ( sizeof( aExportToPosArr ) / sizeof( sal_uInt16 ) ) ) 201cdf0e10cSrcweir nExport = 4; // default for bad config entry is NS 4.0 202cdf0e10cSrcweir sal_uInt16 nPosArr = aExportToPosArr[ nExport ]; 203cdf0e10cSrcweir // if( nPosArr == DEPRECATED_ENTRY ) 204cdf0e10cSrcweir // nPosArr = aExportToPosArr[ 4 ]; // again: NS 4.0 is default 205cdf0e10cSrcweir aExportLB.SelectEntryPos( nPosArr ); 206cdf0e10cSrcweir aExportLB.SaveValue(); 207cdf0e10cSrcweir 208cdf0e10cSrcweir ExportHdl_Impl(&aExportLB); 209cdf0e10cSrcweir 210cdf0e10cSrcweir aStarBasicCB .Check(pHtmlOpt->IsStarBasic()); 211cdf0e10cSrcweir aStarBasicWarningCB .Check(pHtmlOpt->IsStarBasicWarning()); 212cdf0e10cSrcweir aStarBasicWarningCB.Enable(!aStarBasicCB.IsChecked()); 213cdf0e10cSrcweir aSaveGrfLocalCB.Check(pHtmlOpt->IsSaveGraphicsLocal()); 214cdf0e10cSrcweir aPrintExtensionCB.Check(pHtmlOpt->IsPrintLayoutExtension()); 215cdf0e10cSrcweir 216cdf0e10cSrcweir aPrintExtensionCB.SaveValue(); 217cdf0e10cSrcweir aStarBasicCB .SaveValue(); 218cdf0e10cSrcweir aStarBasicWarningCB .SaveValue(); 219cdf0e10cSrcweir aSaveGrfLocalCB.SaveValue(); 220cdf0e10cSrcweir aSize1NF.SaveValue(); 221cdf0e10cSrcweir aSize2NF.SaveValue(); 222cdf0e10cSrcweir aSize3NF.SaveValue(); 223cdf0e10cSrcweir aSize4NF.SaveValue(); 224cdf0e10cSrcweir aSize5NF.SaveValue(); 225cdf0e10cSrcweir aSize6NF.SaveValue(); 226cdf0e10cSrcweir aSize7NF.SaveValue(); 227cdf0e10cSrcweir aNumbersEnglishUSCB.SaveValue(); 228cdf0e10cSrcweir aUnknownTagCB.SaveValue(); 229cdf0e10cSrcweir aIgnoreFontNamesCB.SaveValue(); 230cdf0e10cSrcweir 231cdf0e10cSrcweir if( !pHtmlOpt->IsDefaultTextEncoding() && 232cdf0e10cSrcweir aCharSetLB.GetSelectTextEncoding() != pHtmlOpt->GetTextEncoding() ) 233cdf0e10cSrcweir aCharSetLB.SelectTextEncoding( pHtmlOpt->GetTextEncoding() ); 234cdf0e10cSrcweir } 235cdf0e10cSrcweir 236cdf0e10cSrcweir /*-----------------16.04.98 16:03------------------- 237cdf0e10cSrcweir 238cdf0e10cSrcweir --------------------------------------------------*/ 239cdf0e10cSrcweir IMPL_LINK(OfaHtmlTabPage, ExportHdl_Impl, ListBox*, pBox) 240cdf0e10cSrcweir { 241cdf0e10cSrcweir sal_uInt16 nExport = aPosToExportArr[ pBox->GetSelectEntryPos() ]; 242cdf0e10cSrcweir switch( nExport ) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir case HTML_CFG_MSIE_40: 245cdf0e10cSrcweir case HTML_CFG_NS40 : 246cdf0e10cSrcweir case HTML_CFG_WRITER : 247cdf0e10cSrcweir aPrintExtensionCB.Enable(sal_True); 248cdf0e10cSrcweir break; 249cdf0e10cSrcweir default: aPrintExtensionCB.Enable(sal_False); 250cdf0e10cSrcweir } 251cdf0e10cSrcweir 252cdf0e10cSrcweir return 0; 253cdf0e10cSrcweir } 254cdf0e10cSrcweir /* -----------------05.02.99 09:17------------------- 255cdf0e10cSrcweir * 256cdf0e10cSrcweir * --------------------------------------------------*/ 257cdf0e10cSrcweir IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, CheckBox*, pBox) 258cdf0e10cSrcweir { 259cdf0e10cSrcweir aStarBasicWarningCB.Enable(!pBox->IsChecked()); 260cdf0e10cSrcweir return 0; 261cdf0e10cSrcweir } 262cdf0e10cSrcweir 263cdf0e10cSrcweir 264