Files
libreoffice/cui/source/options/opthtml.cxx

217 lines
7.8 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: clarify Option->Language UI option Patch contributed by Herbert Duerr http://svn.apache.org/viewvc?view=revision&revision=1173991 cws mba34issues01: #i117712#: fix several resource errors introduced by IAccessible2 implementation Patch contributed by Mathias Bauer http://svn.apache.org/viewvc?view=revision&revision=1173991 cws mba34issues01: #i117709#: add missing string resource Patch contributed by Mathias Bauer http://svn.apache.org/viewvc?view=revision&revision=1172348 cws mba34issues01: #i117716#: fix missing resources my removing unused code Patch contributed by Mathias Bauer http://svn.apache.org/viewvc?view=revision&revision=1172345 re-add Crystal, Tango, Oxygen icon theme listings. correct method signature Patch contributed by Jean-Louis 'Hans' Fuchs http://svn.apache.org/viewvc?view=revision&revision=1306725 i#119063 - correct serf integration Patch contributed by Oliver-Rainer Wittmann http://svn.apache.org/viewvc?view=revision&revision=1300521 i#119036 - adapt serf integration -- use transfer-encoding 'chunked' on HTTPS -- switch transfer-encoding between 'chunked' and none on 413 HTTP status code -- refactoring -- improve user experience of certification dialog - only shown once Patch contributed by Oliver-Rainer Wittmann http://svn.apache.org/viewvc?view=revision&revision=1299727 118569: Use whole certification chain for verification. Patch contributed by Andre Fischer http://svn.apache.org/viewvc?view=revision&revision=1295493 serf integration: improve credential input handling Patch contributed by Oliver-Rainer Wittmann http://svn.apache.org/viewvc?view=revision&revision=1294557 warning-free ucb/source/ucp/webdav Patch contributed by Pavel Janik http://svn.apache.org/viewvc?view=revision&revision=1294086 some refactoring to PROPPATCH and PROPFIND requests Patch contributed by Oliver-Rainer Wittmann http://svn.apache.org/viewvc?view=revision&revision=1293281 i#118569: Replace neon with serf Patch contributed by Oliver-Rainer Wittmann http://svn.apache.org/viewvc?view=revision&revision=1292832 http://svn.apache.org/viewvc?view=revision&revision=1292794 remove OS/2 conditionals for now. re-enable webdav unit tests.
2012-10-04 11:25:41 +01:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2009-10-31 00:36:06 +01:00
#include <svtools/langtab.hxx>
2010-01-13 22:25:07 +01:00
#include <svtools/htmlcfg.hxx>
2009-10-31 00:36:06 +01:00
#include "opthtml.hxx"
#include <cuires.hrc>
2009-10-31 00:36:06 +01:00
#include "helpid.hrc"
#include <dialmgr.hxx>
2010-12-03 13:59:47 +00:00
#include <sal/macros.h>
2009-10-31 00:36:06 +01:00
// modus convertion to the positions in the listbox
const sal_uInt16 aPosToExportArr[] =
2009-10-31 00:36:06 +01:00
{
HTML_CFG_MSIE,
2009-10-31 00:36:06 +01:00
HTML_CFG_NS40,
HTML_CFG_WRITER
};
const sal_uInt16 aExportToPosArr[] =
2009-10-31 00:36:06 +01:00
{
2011-08-20 12:48:24 +03: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-31 00:36:06 +01:00
};
// -----------------------------------------------------------------------
OfaHtmlTabPage::OfaHtmlTabPage(Window* pParent, const SfxItemSet& rSet) :
SfxTabPage( pParent, "OptHtmlPage" , "cui/ui/opthtmlpage.ui", rSet )
2009-10-31 00:36:06 +01:00
{
get(aSize1NF,"size1");
get(aSize2NF,"size2");
get(aSize3NF,"size3");
get(aSize4NF,"size4");
get(aSize5NF,"size5");
get(aSize6NF,"size6");
get(aSize7NF,"size7");
get(aNumbersEnglishUSCB,"numbersenglishus");
get(aUnknownTagCB,"unknowntag");
get(aIgnoreFontNamesCB,"ignorefontnames");
get(aExportLB,"export");
get(aStarBasicCB,"starbasic");
get(aStarBasicWarningCB,"starbasicwarning");
get(aPrintExtensionCB,"printextension");
get(aSaveGrfLocalCB,"savegrflocal");
get(aCharSetLB,"charset");
2009-10-31 00:36:06 +01:00
// replace placeholder with UI string from language list
/*String aText( aNumbersEnglishUSCB->GetText());
2009-10-31 00:36:06 +01:00
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);
2009-10-31 00:36:06 +01:00
}
}*/
2009-10-31 00:36:06 +01:00
aExportLB->SetSelectHdl(LINK(this, OfaHtmlTabPage, ExportHdl_Impl));
aStarBasicCB->SetClickHdl(LINK(this, OfaHtmlTabPage, CheckBoxHdl_Impl));
2009-10-31 00:36:06 +01:00
// initialize the characterset listbox
aCharSetLB->FillWithMimeAndSelectBest();
2009-10-31 00:36:06 +01:00
}
OfaHtmlTabPage::~OfaHtmlTabPage()
{
}
SfxTabPage* OfaHtmlTabPage::Create( Window* pParent,
const SfxItemSet& rAttrSet )
{
return new OfaHtmlTabPage(pParent, rAttrSet);
}
sal_Bool OfaHtmlTabPage::FillItemSet( SfxItemSet& )
2009-10-31 00:36:06 +01:00
{
SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
if(aSize1NF->GetSavedValue() != aSize1NF->GetText())
rHtmlOpt.SetFontSize(0, (sal_uInt16)aSize1NF->GetValue());
if(aSize2NF->GetSavedValue() != aSize2NF->GetText())
rHtmlOpt.SetFontSize(1, (sal_uInt16)aSize2NF->GetValue());
if(aSize3NF->GetSavedValue() != aSize3NF->GetText())
rHtmlOpt.SetFontSize(2, (sal_uInt16)aSize3NF->GetValue());
if(aSize4NF->GetSavedValue() != aSize4NF->GetText())
rHtmlOpt.SetFontSize(3, (sal_uInt16)aSize4NF->GetValue());
if(aSize5NF->GetSavedValue() != aSize5NF->GetText())
rHtmlOpt.SetFontSize(4, (sal_uInt16)aSize5NF->GetValue());
if(aSize6NF->GetSavedValue() != aSize6NF->GetText())
rHtmlOpt.SetFontSize(5, (sal_uInt16)aSize6NF->GetValue());
if(aSize7NF->GetSavedValue() != aSize7NF->GetText())
rHtmlOpt.SetFontSize(6, (sal_uInt16)aSize7NF->GetValue());
2009-10-31 00:36:06 +01:00
if(aNumbersEnglishUSCB->IsChecked() != aNumbersEnglishUSCB->GetSavedValue())
rHtmlOpt.SetNumbersEnglishUS(aNumbersEnglishUSCB->IsChecked());
2009-10-31 00:36:06 +01:00
if(aUnknownTagCB->IsChecked() != aUnknownTagCB->GetSavedValue())
rHtmlOpt.SetImportUnknown(aUnknownTagCB->IsChecked());
2009-10-31 00:36:06 +01:00
if(aIgnoreFontNamesCB->IsChecked() != aIgnoreFontNamesCB->GetSavedValue())
rHtmlOpt.SetIgnoreFontFamily(aIgnoreFontNamesCB->IsChecked());
2009-10-31 00:36:06 +01:00
if(aExportLB->GetSelectEntryPos() != aExportLB->GetSavedValue())
rHtmlOpt.SetExportMode(aPosToExportArr[aExportLB->GetSelectEntryPos()]);
2009-10-31 00:36:06 +01:00
if(aStarBasicCB->IsChecked() != aStarBasicCB->GetSavedValue())
rHtmlOpt.SetStarBasic(aStarBasicCB->IsChecked());
2009-10-31 00:36:06 +01:00
if(aStarBasicWarningCB->IsChecked() != aStarBasicWarningCB->GetSavedValue())
rHtmlOpt.SetStarBasicWarning(aStarBasicWarningCB->IsChecked());
2009-10-31 00:36:06 +01:00
if(aSaveGrfLocalCB->IsChecked() != aSaveGrfLocalCB->GetSavedValue())
rHtmlOpt.SetSaveGraphicsLocal(aSaveGrfLocalCB->IsChecked());
2009-10-31 00:36:06 +01:00
if(aPrintExtensionCB->IsChecked() != aPrintExtensionCB->GetSavedValue())
rHtmlOpt.SetPrintLayoutExtension(aPrintExtensionCB->IsChecked());
2009-10-31 00:36:06 +01:00
if( aCharSetLB->GetSelectTextEncoding() != rHtmlOpt.GetTextEncoding() )
rHtmlOpt.SetTextEncoding( aCharSetLB->GetSelectTextEncoding() );
2009-10-31 00:36:06 +01:00
return sal_False;
2009-10-31 00:36:06 +01:00
}
void OfaHtmlTabPage::Reset( const SfxItemSet& )
{
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 13:59:47 +00:00
if( nExport >= SAL_N_ELEMENTS( aExportToPosArr ) )
2011-08-20 12:48:24 +03:00
nExport = 3; // default for bad config entry is NS 4.0
sal_uInt16 nPosArr = aExportToPosArr[ nExport ];
aExportLB->SelectEntryPos( nPosArr );
aExportLB->SaveValue();
ExportHdl_Impl(aExportLB);
aStarBasicCB->Check(rHtmlOpt.IsStarBasic());
aStarBasicWarningCB->Check(rHtmlOpt.IsStarBasicWarning());
aStarBasicWarningCB->Enable(!aStarBasicCB->IsChecked());
aSaveGrfLocalCB->Check(rHtmlOpt.IsSaveGraphicsLocal());
aPrintExtensionCB->Check(rHtmlOpt.IsPrintLayoutExtension());
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();
2009-10-31 00:36:06 +01:00
if( !rHtmlOpt.IsDefaultTextEncoding() &&
aCharSetLB->GetSelectTextEncoding() != rHtmlOpt.GetTextEncoding() )
aCharSetLB->SelectTextEncoding( rHtmlOpt.GetTextEncoding() );
2009-10-31 00:36:06 +01:00
}
IMPL_LINK(OfaHtmlTabPage, ExportHdl_Impl, ListBox*, pBox)
{
sal_uInt16 nExport = aPosToExportArr[ pBox->GetSelectEntryPos() ];
2009-10-31 00:36:06 +01:00
switch( nExport )
{
case HTML_CFG_MSIE:
2009-10-31 00:36:06 +01:00
case HTML_CFG_NS40 :
case HTML_CFG_WRITER :
aPrintExtensionCB->Enable(sal_True);
2009-10-31 00:36:06 +01:00
break;
default: aPrintExtensionCB->Enable(sal_False);
2009-10-31 00:36:06 +01:00
}
return 0;
}
2009-10-31 00:36:06 +01:00
IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, CheckBox*, pBox)
{
aStarBasicWarningCB->Enable(!pBox->IsChecked());
2009-10-31 00:36:06 +01:00
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */