2010-10-12 08:57:08 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2009-10-30 18:36:06 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2009-10-30 18:36:06 -05:00
|
|
|
*
|
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
|
|
*
|
|
|
|
* This file is part of OpenOffice.org.
|
|
|
|
*
|
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include <svtools/langtab.hxx>
|
2010-01-13 15:25:07 -06:00
|
|
|
#include <svtools/htmlcfg.hxx>
|
2009-10-30 18:36:06 -05:00
|
|
|
#include "opthtml.hxx"
|
|
|
|
#include "opthtml.hrc"
|
2009-11-02 13:49:14 -06:00
|
|
|
#include <cuires.hrc>
|
2009-10-30 18:36:06 -05:00
|
|
|
#include "helpid.hrc"
|
2009-11-02 13:49:14 -06:00
|
|
|
#include <dialmgr.hxx>
|
2010-12-03 07:59:47 -06:00
|
|
|
#include <sal/macros.h>
|
2009-10-30 18:36:06 -05:00
|
|
|
|
2012-04-15 10:50:21 -05:00
|
|
|
// modus convertion to the positions in the listbox
|
2011-01-14 05:41:27 -06:00
|
|
|
const sal_uInt16 aPosToExportArr[] =
|
2009-10-30 18:36:06 -05:00
|
|
|
{
|
2011-08-13 05:40:46 -05:00
|
|
|
HTML_CFG_MSIE,
|
2009-10-30 18:36:06 -05:00
|
|
|
HTML_CFG_NS40,
|
|
|
|
HTML_CFG_WRITER
|
|
|
|
};
|
|
|
|
|
2011-01-14 05:41:27 -06:00
|
|
|
const sal_uInt16 aExportToPosArr[] =
|
2009-10-30 18:36:06 -05:00
|
|
|
{
|
2011-08-20 04:48:24 -05:00
|
|
|
1, //HTML 3.2 (removed, map to Netscape Navigator 4.0)
|
|
|
|
0, //MS Internet Explorer 4.0
|
|
|
|
2, //StarWriter
|
|
|
|
1 //Netscape Navigator 4.0
|
2009-10-30 18:36:06 -05:00
|
|
|
};
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
OfaHtmlTabPage::OfaHtmlTabPage(Window* pParent, const SfxItemSet& rSet) :
|
2009-11-02 13:49:14 -06:00
|
|
|
SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_HTMLOPT ), rSet ),
|
|
|
|
aFontSizeGB ( this, CUI_RES( GB_FONTSIZE ) ),
|
|
|
|
aSize1FT ( this, CUI_RES( FT_SIZE1 ) ),
|
|
|
|
aSize1NF ( this, CUI_RES( NF_SIZE1 ) ),
|
|
|
|
aSize2FT ( this, CUI_RES( FT_SIZE2 ) ),
|
|
|
|
aSize2NF ( this, CUI_RES( NF_SIZE2 ) ),
|
|
|
|
aSize3FT ( this, CUI_RES( FT_SIZE3 ) ),
|
|
|
|
aSize3NF ( this, CUI_RES( NF_SIZE3 ) ),
|
|
|
|
aSize4FT ( this, CUI_RES( FT_SIZE4 ) ),
|
|
|
|
aSize4NF ( this, CUI_RES( NF_SIZE4 ) ),
|
|
|
|
aSize5FT ( this, CUI_RES( FT_SIZE5 ) ),
|
|
|
|
aSize5NF ( this, CUI_RES( NF_SIZE5 ) ),
|
|
|
|
aSize6FT ( this, CUI_RES( FT_SIZE6 ) ),
|
|
|
|
aSize6NF ( this, CUI_RES( NF_SIZE6 ) ),
|
|
|
|
aSize7FT ( this, CUI_RES( FT_SIZE7 ) ),
|
|
|
|
aSize7NF ( this, CUI_RES( NF_SIZE7 ) ),
|
|
|
|
aImportGB ( this, CUI_RES( GB_IMPORT ) ),
|
|
|
|
aNumbersEnglishUSCB ( this, CUI_RES( CB_NUMBERS_ENGLISH_US ) ),
|
|
|
|
aUnknownTagCB ( this, CUI_RES( CB_UNKNOWN_TAGS ) ),
|
|
|
|
aIgnoreFontNamesCB( this, CUI_RES( CB_IGNORE_FONTNAMES ) ),
|
|
|
|
aExportGB ( this, CUI_RES( GB_EXPORT ) ),
|
|
|
|
aExportLB ( this, CUI_RES( LB_EXPORT ) ),
|
|
|
|
aStarBasicCB ( this, CUI_RES( CB_STARBASIC ) ),
|
|
|
|
aStarBasicWarningCB(this, CUI_RES( CB_STARBASIC_WARNING ) ),
|
|
|
|
aPrintExtensionCB( this,CUI_RES(CB_PRINT_EXTENSION )),
|
|
|
|
aSaveGrfLocalCB ( this, CUI_RES( CB_LOCAL_GRF ) ),
|
|
|
|
aCharSetFT ( this, CUI_RES( FT_CHARSET ) ),
|
|
|
|
aCharSetLB ( this, CUI_RES( LB_CHARSET ) )
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
FreeResource();
|
|
|
|
|
|
|
|
// replace placeholder with UI string from language list
|
|
|
|
String aText( aNumbersEnglishUSCB.GetText());
|
|
|
|
String aPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%ENGLISHUSLOCALE"));
|
|
|
|
xub_StrLen nPos;
|
|
|
|
if ((nPos = aText.Search( aPlaceholder)) != STRING_NOTFOUND)
|
|
|
|
{
|
|
|
|
SvtLanguageTable aLangTab;
|
|
|
|
const String& rStr = aLangTab.GetString( LANGUAGE_ENGLISH_US);
|
|
|
|
if (rStr.Len())
|
|
|
|
{
|
|
|
|
aText.Replace( nPos, aPlaceholder.Len(), rStr);
|
|
|
|
aNumbersEnglishUSCB.SetText( aText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aExportLB.SetSelectHdl(LINK(this, OfaHtmlTabPage, ExportHdl_Impl));
|
|
|
|
aStarBasicCB.SetClickHdl(LINK(this, OfaHtmlTabPage, CheckBoxHdl_Impl));
|
|
|
|
|
|
|
|
// initialize the characterset listbox
|
|
|
|
aCharSetLB.FillWithMimeAndSelectBest();
|
|
|
|
}
|
|
|
|
|
|
|
|
OfaHtmlTabPage::~OfaHtmlTabPage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxTabPage* OfaHtmlTabPage::Create( Window* pParent,
|
|
|
|
const SfxItemSet& rAttrSet )
|
|
|
|
{
|
|
|
|
return new OfaHtmlTabPage(pParent, rAttrSet);
|
|
|
|
}
|
|
|
|
|
2011-01-14 05:41:27 -06:00
|
|
|
sal_Bool OfaHtmlTabPage::FillItemSet( SfxItemSet& )
|
2009-10-30 18:36:06 -05:00
|
|
|
{
|
2011-08-21 18:12:16 -05:00
|
|
|
SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
|
2009-10-30 18:36:06 -05:00
|
|
|
if(aSize1NF.GetSavedValue() != aSize1NF.GetText())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetFontSize(0, (sal_uInt16)aSize1NF.GetValue());
|
2009-10-30 18:36:06 -05:00
|
|
|
if(aSize2NF.GetSavedValue() != aSize2NF.GetText())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetFontSize(1, (sal_uInt16)aSize2NF.GetValue());
|
2009-10-30 18:36:06 -05:00
|
|
|
if(aSize3NF.GetSavedValue() != aSize3NF.GetText())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetFontSize(2, (sal_uInt16)aSize3NF.GetValue());
|
2009-10-30 18:36:06 -05:00
|
|
|
if(aSize4NF.GetSavedValue() != aSize4NF.GetText())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetFontSize(3, (sal_uInt16)aSize4NF.GetValue());
|
2009-10-30 18:36:06 -05:00
|
|
|
if(aSize5NF.GetSavedValue() != aSize5NF.GetText())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetFontSize(4, (sal_uInt16)aSize5NF.GetValue());
|
2009-10-30 18:36:06 -05:00
|
|
|
if(aSize6NF.GetSavedValue() != aSize6NF.GetText())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetFontSize(5, (sal_uInt16)aSize6NF.GetValue());
|
2009-10-30 18:36:06 -05:00
|
|
|
if(aSize7NF.GetSavedValue() != aSize7NF.GetText())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetFontSize(6, (sal_uInt16)aSize7NF.GetValue());
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
if(aNumbersEnglishUSCB.IsChecked() != aNumbersEnglishUSCB.GetSavedValue())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetNumbersEnglishUS(aNumbersEnglishUSCB.IsChecked());
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
if(aUnknownTagCB.IsChecked() != aUnknownTagCB.GetSavedValue())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetImportUnknown(aUnknownTagCB.IsChecked());
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
if(aIgnoreFontNamesCB.IsChecked() != aIgnoreFontNamesCB.GetSavedValue())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetIgnoreFontFamily(aIgnoreFontNamesCB.IsChecked());
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
if(aExportLB.GetSelectEntryPos() != aExportLB.GetSavedValue())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetExportMode(aPosToExportArr[aExportLB.GetSelectEntryPos()]);
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
if(aStarBasicCB.IsChecked() != aStarBasicCB.GetSavedValue())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetStarBasic(aStarBasicCB.IsChecked());
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
if(aStarBasicWarningCB.IsChecked() != aStarBasicWarningCB.GetSavedValue())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetStarBasicWarning(aStarBasicWarningCB.IsChecked());
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
if(aSaveGrfLocalCB.IsChecked() != aSaveGrfLocalCB.GetSavedValue())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetSaveGraphicsLocal(aSaveGrfLocalCB.IsChecked());
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
if(aPrintExtensionCB.IsChecked() != aPrintExtensionCB.GetSavedValue())
|
2011-08-21 18:12:16 -05:00
|
|
|
rHtmlOpt.SetPrintLayoutExtension(aPrintExtensionCB.IsChecked());
|
2009-10-30 18:36:06 -05:00
|
|
|
|
2011-08-21 18:12:16 -05:00
|
|
|
if( aCharSetLB.GetSelectTextEncoding() != rHtmlOpt.GetTextEncoding() )
|
|
|
|
rHtmlOpt.SetTextEncoding( aCharSetLB.GetSelectTextEncoding() );
|
2009-10-30 18:36:06 -05:00
|
|
|
|
2011-01-14 05:41:27 -06:00
|
|
|
return sal_False;
|
2009-10-30 18:36:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void OfaHtmlTabPage::Reset( const SfxItemSet& )
|
|
|
|
{
|
2011-08-21 18:12:16 -05:00
|
|
|
SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
|
|
|
|
aSize1NF.SetValue(rHtmlOpt.GetFontSize(0));
|
|
|
|
aSize2NF.SetValue(rHtmlOpt.GetFontSize(1));
|
|
|
|
aSize3NF.SetValue(rHtmlOpt.GetFontSize(2));
|
|
|
|
aSize4NF.SetValue(rHtmlOpt.GetFontSize(3));
|
|
|
|
aSize5NF.SetValue(rHtmlOpt.GetFontSize(4));
|
|
|
|
aSize6NF.SetValue(rHtmlOpt.GetFontSize(5));
|
|
|
|
aSize7NF.SetValue(rHtmlOpt.GetFontSize(6));
|
|
|
|
aNumbersEnglishUSCB.Check(rHtmlOpt.IsNumbersEnglishUS());
|
|
|
|
aUnknownTagCB.Check(rHtmlOpt.IsImportUnknown());
|
|
|
|
aIgnoreFontNamesCB.Check(rHtmlOpt.IsIgnoreFontFamily());
|
|
|
|
sal_uInt16 nExport = rHtmlOpt.GetExportMode();
|
2010-12-03 07:59:47 -06:00
|
|
|
if( nExport >= SAL_N_ELEMENTS( aExportToPosArr ) )
|
2011-08-20 04:48:24 -05:00
|
|
|
nExport = 3; // default for bad config entry is NS 4.0
|
2011-01-14 05:41:27 -06:00
|
|
|
sal_uInt16 nPosArr = aExportToPosArr[ nExport ];
|
2009-10-30 18:36:06 -05:00
|
|
|
aExportLB.SelectEntryPos( nPosArr );
|
|
|
|
aExportLB.SaveValue();
|
|
|
|
|
|
|
|
ExportHdl_Impl(&aExportLB);
|
|
|
|
|
2011-08-21 18:12:16 -05:00
|
|
|
aStarBasicCB .Check(rHtmlOpt.IsStarBasic());
|
|
|
|
aStarBasicWarningCB .Check(rHtmlOpt.IsStarBasicWarning());
|
2009-10-30 18:36:06 -05:00
|
|
|
aStarBasicWarningCB.Enable(!aStarBasicCB.IsChecked());
|
2011-08-21 18:12:16 -05:00
|
|
|
aSaveGrfLocalCB.Check(rHtmlOpt.IsSaveGraphicsLocal());
|
|
|
|
aPrintExtensionCB.Check(rHtmlOpt.IsPrintLayoutExtension());
|
2009-10-30 18:36:06 -05:00
|
|
|
|
|
|
|
aPrintExtensionCB.SaveValue();
|
|
|
|
aStarBasicCB .SaveValue();
|
|
|
|
aStarBasicWarningCB .SaveValue();
|
|
|
|
aSaveGrfLocalCB.SaveValue();
|
|
|
|
aSize1NF.SaveValue();
|
|
|
|
aSize2NF.SaveValue();
|
|
|
|
aSize3NF.SaveValue();
|
|
|
|
aSize4NF.SaveValue();
|
|
|
|
aSize5NF.SaveValue();
|
|
|
|
aSize6NF.SaveValue();
|
|
|
|
aSize7NF.SaveValue();
|
|
|
|
aNumbersEnglishUSCB.SaveValue();
|
|
|
|
aUnknownTagCB.SaveValue();
|
|
|
|
aIgnoreFontNamesCB.SaveValue();
|
|
|
|
|
2011-08-21 18:12:16 -05:00
|
|
|
if( !rHtmlOpt.IsDefaultTextEncoding() &&
|
|
|
|
aCharSetLB.GetSelectTextEncoding() != rHtmlOpt.GetTextEncoding() )
|
|
|
|
aCharSetLB.SelectTextEncoding( rHtmlOpt.GetTextEncoding() );
|
2009-10-30 18:36:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK(OfaHtmlTabPage, ExportHdl_Impl, ListBox*, pBox)
|
|
|
|
{
|
2011-01-14 05:41:27 -06:00
|
|
|
sal_uInt16 nExport = aPosToExportArr[ pBox->GetSelectEntryPos() ];
|
2009-10-30 18:36:06 -05:00
|
|
|
switch( nExport )
|
|
|
|
{
|
2011-08-13 05:40:46 -05:00
|
|
|
case HTML_CFG_MSIE:
|
2009-10-30 18:36:06 -05:00
|
|
|
case HTML_CFG_NS40 :
|
|
|
|
case HTML_CFG_WRITER :
|
2011-01-14 05:41:27 -06:00
|
|
|
aPrintExtensionCB.Enable(sal_True);
|
2009-10-30 18:36:06 -05:00
|
|
|
break;
|
2011-01-14 05:41:27 -06:00
|
|
|
default: aPrintExtensionCB.Enable(sal_False);
|
2009-10-30 18:36:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2010-11-07 17:31:55 -06:00
|
|
|
|
2009-10-30 18:36:06 -05:00
|
|
|
IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, CheckBox*, pBox)
|
|
|
|
{
|
|
|
|
aStarBasicWarningCB.Enable(!pBox->IsChecked());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-12 08:57:08 -05:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|