summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2010-01-12 08:29:31 +0100
committerMathias Bauer <mba@openoffice.org>2010-01-12 08:29:31 +0100
commit5a03ff2c5391d9a25d0bfbb1e4b3f1312df1c70b (patch)
tree6f6a031f32ee21b156ace59e401c2225ef026b26
parentcf1210e40b872191ba433636480293eabc017d95 (diff)
#i107450#: code from svx/source/options moved to other libs
-rw-r--r--svl/inc/svl/asiancfg.hxx72
-rw-r--r--svl/inc/svl/srchcfg.hxx85
-rw-r--r--svl/source/config/asiancfg.cxx294
-rw-r--r--svl/source/config/makefile.mk2
-rw-r--r--svl/source/config/srchcfg.cxx290
-rw-r--r--svtools/inc/svtools/htmlcfg.hxx104
-rw-r--r--svtools/source/config/htmlcfg.cxx496
-rw-r--r--svtools/source/config/makefile.mk1
-rw-r--r--unotools/inc/unotools/syslocale.hxx7
-rw-r--r--unotools/source/misc/syslocale.cxx27
10 files changed, 1378 insertions, 0 deletions
diff --git a/svl/inc/svl/asiancfg.hxx b/svl/inc/svl/asiancfg.hxx
new file mode 100644
index 000000000000..55dfeb06d679
--- /dev/null
+++ b/svl/inc/svl/asiancfg.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: asiancfg.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _SVX_ASIANCFG_HXX
+#define _SVX_ASIANCFG_HXX
+
+#include <unotools/configitem.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <svl/svldllapi.h>
+
+namespace com{namespace sun{namespace star{
+namespace lang{
+ struct Locale;
+}}}}
+//-----------------------------------------------------------------------------
+struct SvxAsianConfig_Impl;
+class SVL_DLLPUBLIC SvxAsianConfig : public utl::ConfigItem
+{
+ SvxAsianConfig_Impl* pImpl;
+
+public:
+ SvxAsianConfig(sal_Bool bEnableNotify = sal_True);
+ virtual ~SvxAsianConfig();
+
+ void Load();
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+
+ sal_Bool IsKerningWesternTextOnly() const;
+ void SetKerningWesternTextOnly(sal_Bool bSet);
+
+ sal_Int16 GetCharDistanceCompression() const;
+ void SetCharDistanceCompression(sal_Int16 nSet);
+
+ com::sun::star::uno::Sequence<com::sun::star::lang::Locale>
+ GetStartEndCharLocales();
+
+ sal_Bool GetStartEndChars( const com::sun::star::lang::Locale& rLocale,
+ rtl::OUString& rStartChars,
+ rtl::OUString& rEndChars );
+ void SetStartEndChars( const com::sun::star::lang::Locale& rLocale,
+ const rtl::OUString* pStartChars,
+ const rtl::OUString* pEndChars );
+};
+
+#endif
diff --git a/svl/inc/svl/srchcfg.hxx b/svl/inc/svl/srchcfg.hxx
new file mode 100644
index 000000000000..8f45843fa5f0
--- /dev/null
+++ b/svl/inc/svl/srchcfg.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: srchcfg.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _SVX_SRCHCFG_HXX
+#define _SVX_SRCHCFG_HXX
+
+#include <unotools/configitem.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <svl/svldllapi.h>
+
+//-----------------------------------------------------------------------------
+struct SvxSearchConfig_Impl;
+struct SvxSearchEngineData
+{
+ rtl::OUString sEngineName;
+
+ rtl::OUString sAndPrefix;
+ rtl::OUString sAndSuffix;
+ rtl::OUString sAndSeparator;
+ sal_Int32 nAndCaseMatch;
+
+ rtl::OUString sOrPrefix;
+ rtl::OUString sOrSuffix;
+ rtl::OUString sOrSeparator;
+ sal_Int32 nOrCaseMatch;
+
+ rtl::OUString sExactPrefix;
+ rtl::OUString sExactSuffix;
+ rtl::OUString sExactSeparator;
+ sal_Int32 nExactCaseMatch;
+
+ SvxSearchEngineData() :
+ nAndCaseMatch(0),
+ nOrCaseMatch(0),
+ nExactCaseMatch(0){}
+
+ sal_Bool operator==(const SvxSearchEngineData& rData);
+};
+class SVL_DLLPUBLIC SvxSearchConfig : public utl::ConfigItem
+{
+ SvxSearchConfig_Impl* pImpl;
+
+public:
+ SvxSearchConfig(sal_Bool bEnableNotify = sal_True);
+ virtual ~SvxSearchConfig();
+
+ void Load();
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+
+ sal_uInt16 Count();
+ const SvxSearchEngineData& GetData(sal_uInt16 nPos);
+ const SvxSearchEngineData* GetData(const rtl::OUString& rEngineName);
+ void SetData(const SvxSearchEngineData& rData);
+ void RemoveData(const rtl::OUString& rEngineName);
+};
+
+#endif
+
diff --git a/svl/source/config/asiancfg.cxx b/svl/source/config/asiancfg.cxx
new file mode 100644
index 000000000000..fb234781bdf8
--- /dev/null
+++ b/svl/source/config/asiancfg.cxx
@@ -0,0 +1,294 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: asiancfg.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svl.hxx"
+
+#include <svl/asiancfg.hxx>
+#include <svl/svarray.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <tools/debug.hxx>
+
+//-----------------------------------------------------------------------------
+using namespace utl;
+using namespace rtl;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+const sal_Char sStartEndCharacters[] = "StartEndCharacters";
+const sal_Char sStartCharacters[] = "StartCharacters";
+const sal_Char sEndCharacters[] = "EndCharacters";
+
+//-----------------------------------------------------------------------------
+struct SvxForbiddenStruct_Impl
+{
+ Locale aLocale;
+ OUString sStartChars;
+ OUString sEndChars;
+};
+//-----------------------------------------------------------------------------
+typedef SvxForbiddenStruct_Impl* SvxForbiddenStruct_ImplPtr;
+SV_DECL_PTRARR_DEL(SvxForbiddenStructArr, SvxForbiddenStruct_ImplPtr, 2, 2)
+SV_IMPL_PTRARR(SvxForbiddenStructArr, SvxForbiddenStruct_ImplPtr);
+//-----------------------------------------------------------------------------
+struct SvxAsianConfig_Impl
+{
+ sal_Bool bKerningWesternTextOnly;
+ sal_Int16 nCharDistanceCompression;
+
+ SvxForbiddenStructArr aForbiddenArr;
+
+ SvxAsianConfig_Impl() :
+ bKerningWesternTextOnly(sal_True),
+ nCharDistanceCompression(0) {}
+};
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence<OUString> lcl_GetPropertyNames()
+{
+ Sequence<OUString> aNames(2);
+ OUString* pNames = aNames.getArray();
+ pNames[0] = C2U("IsKerningWesternTextOnly");
+ pNames[1] = C2U("CompressCharacterDistance");
+ return aNames;;
+}
+// ---------------------------------------------------------------------------
+SvxAsianConfig::SvxAsianConfig(sal_Bool bEnableNotify) :
+ utl::ConfigItem(C2U("Office.Common/AsianLayout")),
+ pImpl(new SvxAsianConfig_Impl)
+{
+ if(bEnableNotify)
+ EnableNotification(lcl_GetPropertyNames());
+ Load();
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxAsianConfig::~SvxAsianConfig()
+{
+ delete pImpl;
+}
+/* -----------------------------17.01.01 09:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxAsianConfig::Load()
+{
+ Sequence<Any> aValues = GetProperties(lcl_GetPropertyNames());
+ const Any* pValues = aValues.getConstArray();
+ if(pValues[0].hasValue())
+ pImpl->bKerningWesternTextOnly = *(sal_Bool*) pValues[0].getValue();
+ pValues[1] >>= pImpl->nCharDistanceCompression;
+
+ pImpl->aForbiddenArr.DeleteAndDestroy(0, pImpl->aForbiddenArr.Count());
+ OUString sPropPrefix(C2U(sStartEndCharacters));
+ Sequence<OUString> aNodes = GetNodeNames(sPropPrefix);
+
+ Sequence<OUString> aPropNames(aNodes.getLength() * 2);
+ OUString* pNames = aPropNames.getArray();
+ sal_Int32 nName = 0;
+ sPropPrefix += C2U("/");
+ sal_Int32 nNode;
+ const OUString* pNodes = aNodes.getConstArray();
+ for(nNode = 0; nNode < aNodes.getLength(); nNode++)
+ {
+ OUString sStart(sPropPrefix);
+ sStart += pNodes[nNode];
+ sStart += C2U("/");
+ pNames[nName] = sStart; pNames[nName++] += C2U("StartCharacters");
+ pNames[nName] = sStart; pNames[nName++] += C2U("EndCharacters");
+ }
+ Sequence<Any> aNodeValues = GetProperties(aPropNames);
+ const Any* pNodeValues = aNodeValues.getConstArray();
+ nName = 0;
+ for(nNode = 0; nNode < aNodes.getLength(); nNode++)
+ {
+ SvxForbiddenStruct_ImplPtr pInsert = new SvxForbiddenStruct_Impl;
+ pInsert->aLocale.Language = pNodes[nNode].copy(0, 2);
+ DBG_ASSERT(pInsert->aLocale.Language.getLength(), "illegal language");
+ pInsert->aLocale.Country = pNodes[nNode].copy(3, 2);
+
+ pNodeValues[nName++] >>= pInsert->sStartChars;
+ pNodeValues[nName++] >>= pInsert->sEndChars;
+ pImpl->aForbiddenArr.Insert(pInsert, pImpl->aForbiddenArr.Count());
+ }
+}
+/* -----------------------------17.01.01 09:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxAsianConfig::Notify( const Sequence<OUString>& )
+{
+ Load();
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxAsianConfig::Commit()
+{
+ Sequence<Any> aValues(2);
+ Any* pValues = aValues.getArray();
+ pValues[0].setValue(&pImpl->bKerningWesternTextOnly, ::getBooleanCppuType());
+ pValues[1] <<= pImpl->nCharDistanceCompression;
+ PutProperties(lcl_GetPropertyNames(), aValues);
+
+
+ OUString sNode(C2U(sStartEndCharacters));
+ if(!pImpl->aForbiddenArr.Count())
+ ClearNodeSet(sNode);
+ else
+ {
+ Sequence<PropertyValue> aSetValues(2 * pImpl->aForbiddenArr.Count());
+ PropertyValue* pSetValues = aSetValues.getArray();
+ sal_Int32 nSetValue = 0;
+ const OUString sStartChars(C2U(sStartCharacters));
+ const OUString sEndChars(C2U(sEndCharacters));
+ for(sal_uInt16 i = 0; i < pImpl->aForbiddenArr.Count(); i++)
+ {
+ OUString sPrefix(sNode);
+ sPrefix += C2U("/");
+ sPrefix += pImpl->aForbiddenArr[i]->aLocale.Language;
+ DBG_ASSERT(pImpl->aForbiddenArr[i]->aLocale.Language.getLength(), "illegal language");
+ sPrefix += C2U("-");
+ sPrefix += pImpl->aForbiddenArr[i]->aLocale.Country;
+ sPrefix += C2U("/");
+ pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sStartChars;
+ pSetValues[nSetValue++].Value <<= pImpl->aForbiddenArr[i]->sStartChars;
+ pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sEndChars;
+ pSetValues[nSetValue++].Value <<= pImpl->aForbiddenArr[i]->sEndChars;
+ }
+ ReplaceSetProperties(sNode, aSetValues);
+ }
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SvxAsianConfig::IsKerningWesternTextOnly() const
+{
+ return pImpl->bKerningWesternTextOnly;
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxAsianConfig::SetKerningWesternTextOnly(sal_Bool bSet)
+{
+ pImpl->bKerningWesternTextOnly = bSet;
+ SetModified();
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int16 SvxAsianConfig::GetCharDistanceCompression() const
+{
+ return pImpl->nCharDistanceCompression;
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxAsianConfig::SetCharDistanceCompression(sal_Int16 nSet)
+{
+ DBG_ASSERT(nSet >= 0 && nSet < 3, "compression value illegal");
+ SetModified();
+ pImpl->nCharDistanceCompression = nSet;
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence<lang::Locale> SvxAsianConfig::GetStartEndCharLocales()
+{
+ Sequence<Locale> aRet(pImpl->aForbiddenArr.Count());
+ Locale* pRet = aRet.getArray();
+ for(sal_uInt16 i = 0; i < pImpl->aForbiddenArr.Count(); i++)
+ {
+ pRet[i] = pImpl->aForbiddenArr[i]->aLocale;
+ }
+ return aRet;
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SvxAsianConfig::GetStartEndChars( const Locale& rLocale,
+ OUString& rStartChars,
+ OUString& rEndChars )
+{
+ for(sal_uInt16 i = 0; i < pImpl->aForbiddenArr.Count(); i++)
+ {
+ if(rLocale.Language == pImpl->aForbiddenArr[i]->aLocale.Language &&
+ rLocale.Country == pImpl->aForbiddenArr[i]->aLocale.Country)
+ {
+ rStartChars = pImpl->aForbiddenArr[i]->sStartChars;
+ rEndChars = pImpl->aForbiddenArr[i]->sEndChars;
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxAsianConfig::SetStartEndChars( const Locale& rLocale,
+ const OUString* pStartChars,
+ const OUString* pEndChars )
+{
+ sal_Bool bFound = sal_False;
+ for(sal_uInt16 i = 0; i < pImpl->aForbiddenArr.Count(); i++)
+ {
+ if(rLocale.Language == pImpl->aForbiddenArr[i]->aLocale.Language &&
+ rLocale.Country == pImpl->aForbiddenArr[i]->aLocale.Country)
+ {
+ if(pStartChars && pEndChars)
+ {
+ pImpl->aForbiddenArr[i]->sStartChars = *pStartChars;
+ pImpl->aForbiddenArr[i]->sEndChars = *pEndChars;
+ }
+ else
+ pImpl->aForbiddenArr.DeleteAndDestroy(i, 1);
+ bFound = sal_True;
+ }
+ }
+ if(!bFound && pStartChars && pEndChars)
+ {
+ SvxForbiddenStruct_ImplPtr pInsert = new SvxForbiddenStruct_Impl;
+ pInsert->aLocale = rLocale;
+ pInsert->sStartChars = *pStartChars;
+ pInsert->sEndChars = *pEndChars;
+ pImpl->aForbiddenArr.Insert(pInsert, pImpl->aForbiddenArr.Count());
+ }
+#ifdef DBG_UTIL
+ else if(!bFound)
+ DBG_ERROR("attempt to clear unavailable data");
+#endif
+ SetModified();
+}
diff --git a/svl/source/config/makefile.mk b/svl/source/config/makefile.mk
index 82c4ae12828f..fd35bf093d27 100644
--- a/svl/source/config/makefile.mk
+++ b/svl/source/config/makefile.mk
@@ -43,8 +43,10 @@ ENABLE_EXCEPTIONS := TRUE
# --- Files --------------------------------------------------------
SLOFILES= \
+ $(SLO)$/asiancfg.obj \
$(SLO)$/cjkoptions.obj \
$(SLO)$/ctloptions.obj \
+ $(SLO)$/srchcfg.obj \
$(SLO)$/itemholder2.obj \
$(SLO)$/languageoptions.obj
diff --git a/svl/source/config/srchcfg.cxx b/svl/source/config/srchcfg.cxx
new file mode 100644
index 000000000000..b3473dae98af
--- /dev/null
+++ b/svl/source/config/srchcfg.cxx
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: srchcfg.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svl.hxx"
+
+#include <svl/srchcfg.hxx>
+#include <svl/svarray.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <tools/debug.hxx>
+#include <unotools/configpathes.hxx>
+
+//-----------------------------------------------------------------------------
+using namespace utl;
+using namespace rtl;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+//-----------------------------------------------------------------------------
+typedef SvxSearchEngineData* SvxSearchEngineDataPtr;
+SV_DECL_PTRARR_DEL(SvxSearchEngineArr, SvxSearchEngineDataPtr, 2, 2)
+SV_IMPL_PTRARR(SvxSearchEngineArr, SvxSearchEngineDataPtr);
+//-----------------------------------------------------------------------------
+struct SvxSearchConfig_Impl
+{
+ SvxSearchEngineArr aEngineArr;
+};
+/* -----------------------------19.03.01 14:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SvxSearchEngineData::operator==(const SvxSearchEngineData& rData)
+{
+ return sEngineName == rData.sEngineName &&
+ sAndPrefix == rData.sAndPrefix &&
+ sAndSuffix == rData.sAndSuffix &&
+ sAndSeparator == rData.sAndSeparator &&
+ nAndCaseMatch == rData.nAndCaseMatch &&
+ sOrPrefix == rData.sOrPrefix &&
+ sOrSuffix == rData.sOrSuffix &&
+ sOrSeparator == rData.sOrSeparator &&
+ nOrCaseMatch == rData.nOrCaseMatch &&
+ sExactPrefix == rData.sExactPrefix &&
+ sExactSuffix == rData.sExactSuffix &&
+ sExactSeparator == rData.sExactSeparator &&
+ nExactCaseMatch == rData.nExactCaseMatch;
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const Sequence<OUString>& lcl_GetSearchPropertyNames_Impl()
+{
+ static Sequence<OUString> aNames;
+ if(!aNames.getLength())
+ {
+ aNames.realloc(12);
+ OUString* pNames = aNames.getArray();
+ pNames[0] = C2U("And/ooInetPrefix");
+ pNames[1] = C2U("And/ooInetSuffix");
+ pNames[2] = C2U("And/ooInetSeparator");
+ pNames[3] = C2U("And/ooInetCaseMatch");
+ pNames[4] = C2U("Or/ooInetPrefix");
+ pNames[5] = C2U("Or/ooInetSuffix");
+ pNames[6] = C2U("Or/ooInetSeparator");
+ pNames[7] = C2U("Or/ooInetCaseMatch");
+ pNames[8] = C2U("Exact/ooInetPrefix");
+ pNames[9] = C2U("Exact/ooInetSuffix");
+ pNames[10] = C2U("Exact/ooInetSeparator");
+ pNames[11] = C2U("Exact/ooInetCaseMatch");
+ }
+ return aNames;
+}
+// ---------------------------------------------------------------------------
+SvxSearchConfig::SvxSearchConfig(sal_Bool bEnableNotify) :
+ utl::ConfigItem(C2U("Inet/SearchEngines"), CONFIG_MODE_DELAYED_UPDATE),
+ pImpl(new SvxSearchConfig_Impl)
+{
+ if(bEnableNotify)
+ {
+ //request notifications from the node
+ Sequence<OUString> aEnable(1);
+ EnableNotification(aEnable);
+ }
+ Load();
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxSearchConfig::~SvxSearchConfig()
+{
+ delete pImpl;
+}
+/* -----------------------------17.01.01 09:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxSearchConfig::Load()
+{
+ pImpl->aEngineArr.DeleteAndDestroy(0, pImpl->aEngineArr.Count());
+ Sequence<OUString> aNodeNames = GetNodeNames(OUString());
+ const OUString* pNodeNames = aNodeNames.getConstArray();
+ for(sal_Int32 nNode = 0; nNode < aNodeNames.getLength(); nNode++)
+ {
+ SvxSearchEngineDataPtr pNew = new SvxSearchEngineData;
+ pNew->sEngineName = pNodeNames[nNode];
+ const Sequence<OUString>& rPropNames = lcl_GetSearchPropertyNames_Impl();
+ const OUString* pPropNames = rPropNames.getConstArray();
+ Sequence<OUString> aPropertyNames(rPropNames.getLength());
+ OUString* pPropertyNames = aPropertyNames.getArray();
+ const OUString sSlash(C2U("/"));
+ sal_Int32 nProp;
+ for(nProp = 0; nProp < rPropNames.getLength(); nProp++)
+ {
+ pPropertyNames[nProp] = wrapConfigurationElementName(pNodeNames[nNode]);
+ pPropertyNames[nProp] += sSlash;
+ pPropertyNames[nProp] += pPropNames[nProp];
+ }
+ Sequence<Any> aValues = GetProperties(aPropertyNames);
+ const Any* pValues = aValues.getConstArray();
+ for(nProp = 0; nProp < rPropNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0 : pValues[nProp] >>= pNew->sAndPrefix; break;
+ case 1 : pValues[nProp] >>= pNew->sAndSuffix; break;
+ case 2 : pValues[nProp] >>= pNew->sAndSeparator; break;
+ case 3 : pValues[nProp] >>= pNew->nAndCaseMatch; break;
+
+ case 4 : pValues[nProp] >>= pNew->sOrPrefix; break;
+ case 5 : pValues[nProp] >>= pNew->sOrSuffix; break;
+ case 6 : pValues[nProp] >>= pNew->sOrSeparator; break;
+ case 7 : pValues[nProp] >>= pNew->nOrCaseMatch; break;
+
+ case 8 : pValues[nProp] >>= pNew->sExactPrefix; break;
+ case 9 : pValues[nProp] >>= pNew->sExactSuffix; break;
+ case 10: pValues[nProp] >>= pNew->sExactSeparator; break;
+ case 11: pValues[nProp] >>= pNew->nExactCaseMatch; break;
+ }
+ }
+ pImpl->aEngineArr.Insert(pNew, pImpl->aEngineArr.Count());
+ }
+}
+/* -----------------------------17.01.01 09:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxSearchConfig::Notify( const Sequence<OUString>& )
+{
+ Load();
+}
+/* -----------------------------16.01.01 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxSearchConfig::Commit()
+{
+ OUString sNode;
+ if(!pImpl->aEngineArr.Count())
+ ClearNodeSet(sNode);
+ else
+ {
+ Sequence<PropertyValue> aSetValues(12 * pImpl->aEngineArr.Count());
+ PropertyValue* pSetValues = aSetValues.getArray();
+
+ const Sequence<OUString>& rPropNames = lcl_GetSearchPropertyNames_Impl();
+ const OUString* pPropNames = rPropNames.getConstArray();
+ const OUString sSlash(C2U("/"));
+ for(sal_uInt16 i = 0; i < pImpl->aEngineArr.Count(); i++)
+ {
+ SvxSearchEngineDataPtr pSave = pImpl->aEngineArr[i];
+ for(sal_Int16 nProp = 0; nProp < rPropNames.getLength(); nProp++)
+ {
+ OUString sTmpName = sSlash;
+ sTmpName += wrapConfigurationElementName(pSave->sEngineName);
+ sTmpName += sSlash;
+ sTmpName += pPropNames[nProp];
+ pSetValues[nProp].Name = sTmpName;
+ switch(nProp)
+ {
+ case 0 : pSetValues[nProp].Value <<= pSave->sAndPrefix; break;
+ case 1 : pSetValues[nProp].Value <<= pSave->sAndSuffix; break;
+ case 2 : pSetValues[nProp].Value <<= pSave->sAndSeparator; break;
+ case 3 : pSetValues[nProp].Value <<= pSave->nAndCaseMatch; break;
+
+ case 4 : pSetValues[nProp].Value <<= pSave->sOrPrefix; break;
+ case 5 : pSetValues[nProp].Value <<= pSave->sOrSuffix; break;
+ case 6 : pSetValues[nProp].Value <<= pSave->sOrSeparator; break;
+ case 7 : pSetValues[nProp].Value <<= pSave->nOrCaseMatch; break;
+
+ case 8 : pSetValues[nProp].Value <<= pSave->sExactPrefix; break;
+ case 9 : pSetValues[nProp].Value <<= pSave->sExactSuffix; break;
+ case 10: pSetValues[nProp].Value <<= pSave->sExactSeparator; break;
+ case 11: pSetValues[nProp].Value <<= pSave->nExactCaseMatch; break;
+ }
+ }
+ pSetValues+= 12;
+ }
+ ReplaceSetProperties(sNode, aSetValues);
+ }
+}
+/* -----------------------------19.03.01 10:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_uInt16 SvxSearchConfig::Count()
+{
+ return pImpl->aEngineArr.Count();
+}
+/* -----------------------------19.03.01 10:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SvxSearchEngineData& SvxSearchConfig::GetData(sal_uInt16 nPos)
+{
+ DBG_ASSERT(nPos < pImpl->aEngineArr.Count(), "wrong array index");
+ return *pImpl->aEngineArr[nPos];
+}
+/* -----------------------------19.03.01 10:38--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SvxSearchEngineData* SvxSearchConfig::GetData(const rtl::OUString& rEngineName)
+{
+ for(sal_uInt16 nPos = 0; nPos < pImpl->aEngineArr.Count(); nPos++)
+ {
+ if(pImpl->aEngineArr[nPos]->sEngineName == rEngineName)
+ return pImpl->aEngineArr[nPos];
+ }
+ return 0;
+}
+/* -----------------------------19.03.01 10:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxSearchConfig::SetData(const SvxSearchEngineData& rData)
+{
+ for(sal_uInt16 nPos = 0; nPos < pImpl->aEngineArr.Count(); nPos++)
+ {
+ if(pImpl->aEngineArr[nPos]->sEngineName == rData.sEngineName)
+ {
+ if((*pImpl->aEngineArr[nPos]) == rData)
+ return;
+ pImpl->aEngineArr.DeleteAndDestroy(nPos, 1);
+ break;
+ }
+ }
+ SvxSearchEngineDataPtr pInsert = new SvxSearchEngineData(rData);
+ pImpl->aEngineArr.Insert(pInsert, pImpl->aEngineArr.Count());
+ SetModified();
+}
+/* -----------------------------19.03.01 10:38--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxSearchConfig::RemoveData(const rtl::OUString& rEngineName)
+{
+ for(sal_uInt16 nPos = 0; nPos < pImpl->aEngineArr.Count(); nPos++)
+ {
+ if(pImpl->aEngineArr[nPos]->sEngineName == rEngineName)
+ {
+ pImpl->aEngineArr.DeleteAndDestroy(nPos, 1);
+ SetModified();
+ return ;
+ }
+ }
+}
+
diff --git a/svtools/inc/svtools/htmlcfg.hxx b/svtools/inc/svtools/htmlcfg.hxx
new file mode 100644
index 000000000000..90a1d79175c0
--- /dev/null
+++ b/svtools/inc/svtools/htmlcfg.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: htmlcfg.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _SVX_HTMLCFG_HXX
+#define _SVX_HTMLCFG_HXX
+
+// -----------------------------------------------------------------------
+
+#include <tools/solar.h>
+#include <unotools/configitem.hxx>
+#include <svtools/svtdllapi.h>
+
+#define HTML_FONT_COUNT 7
+
+// !!!be aware!!!: the following defines are _not_ used as values in the configuration file
+// this is because of compatibility reasons
+#define HTML_CFG_HTML32 0 // Html 3.2
+#define HTML_CFG_MSIE_40 1 // Internet Explorer 4.0
+#define HTML_CFG_MSIE HTML_CFG_MSIE_40
+#define HTML_CFG_WRITER 2 // Writer
+#define HTML_CFG_NS40 3 // Netscape 4.0
+#define HTML_CFG_MSIE_40_OLD 4 // Internet Explorer 4.0 - alter Wert
+
+#define HTML_CFG_MAX HTML_CFG_NS40
+
+struct HtmlOptions_Impl;
+// -----------------------------------------------------------------------
+
+class SVT_DLLPUBLIC SvxHtmlOptions : public utl::ConfigItem
+{
+ HtmlOptions_Impl*pImp;
+ const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
+
+public:
+ SvxHtmlOptions();
+ ~SvxHtmlOptions();
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
+
+ USHORT GetFontSize(USHORT nPos) const;
+ void SetFontSize(USHORT nPos, USHORT nSize);
+
+ BOOL IsImportUnknown() const;
+ void SetImportUnknown(BOOL bSet);
+
+ USHORT GetExportMode() const;
+ void SetExportMode(USHORT nSet);
+
+ BOOL IsStarBasic() const;
+ void SetStarBasic(BOOL bSet);
+
+ BOOL IsStarBasicWarning() const;
+ void SetStarBasicWarning(BOOL bSet);
+
+ BOOL IsSaveGraphicsLocal() const;
+ void SetSaveGraphicsLocal(BOOL bSet);
+
+ BOOL IsPrintLayoutExtension() const;
+ void SetPrintLayoutExtension(BOOL bSet);
+
+ BOOL IsIgnoreFontFamily() const;
+ void SetIgnoreFontFamily(BOOL bSet);
+
+ sal_Bool IsDefaultTextEncoding() const;
+ rtl_TextEncoding GetTextEncoding() const;
+ void SetTextEncoding( rtl_TextEncoding );
+ static SvxHtmlOptions* Get();
+
+ BOOL IsNumbersEnglishUS() const;
+ void SetNumbersEnglishUS(BOOL bSet);
+};
+
+#endif
+
+
+
+
diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx
new file mode 100644
index 000000000000..3b343dc7fadd
--- /dev/null
+++ b/svtools/source/config/htmlcfg.cxx
@@ -0,0 +1,496 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: htmlcfg.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <svtools/htmlcfg.hxx>
+#include <svtools/parhtml.hxx>
+//#include <sfx2/bindings.hxx>
+//#include <sfx2/viewfrm.hxx>
+//#include <svx/svxids.hrc>
+#include <unotools/syslocale.hxx>
+#include <tools/debug.hxx>
+
+// -----------------------------------------------------------------------
+#define HTMLCFG_UNKNOWN_TAGS 0x01
+//#define HTMLCFG_STYLE_SHEETS 0x02
+//#define HTMLCFG_NETSCAPE3 0x04
+#define HTMLCFG_STAR_BASIC 0x08
+#define HTMLCFG_LOCAL_GRF 0x10
+#define HTMLCFG_PRINT_LAYOUT_EXTENSION 0x20
+#define HTMLCFG_IGNORE_FONT_FAMILY 0x40
+#define HTMLCFG_IS_BASIC_WARNING 0x80
+#define HTMLCFG_NUMBERS_ENGLISH_US 0x100
+
+using namespace utl;
+using namespace rtl;
+using namespace com::sun::star::uno;
+
+static SvxHtmlOptions* pOptions = 0;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+/* -----------------------------23.11.00 11:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+struct HtmlOptions_Impl
+{
+ sal_Int32 nFlags;
+ sal_Int32 nExportMode;
+ sal_Int32 aFontSizeArr[HTML_FONT_COUNT];
+ sal_Int32 eEncoding;
+ sal_Bool bIsEncodingDefault;
+
+ HtmlOptions_Impl() :
+ nFlags(HTMLCFG_LOCAL_GRF|HTMLCFG_IS_BASIC_WARNING),
+ nExportMode(HTML_CFG_NS40),
+ eEncoding( gsl_getSystemTextEncoding() ),
+ bIsEncodingDefault(sal_True)
+ {
+ aFontSizeArr[0] = HTMLFONTSZ1_DFLT;
+ aFontSizeArr[1] = HTMLFONTSZ2_DFLT;
+ aFontSizeArr[2] = HTMLFONTSZ3_DFLT;
+ aFontSizeArr[3] = HTMLFONTSZ4_DFLT;
+ aFontSizeArr[4] = HTMLFONTSZ5_DFLT;
+ aFontSizeArr[5] = HTMLFONTSZ6_DFLT;
+ aFontSizeArr[6] = HTMLFONTSZ7_DFLT;
+ }
+};
+
+/* -----------------------------23.11.00 11:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const Sequence<OUString>& SvxHtmlOptions::GetPropertyNames()
+{
+ static Sequence<OUString> aNames;
+ if(!aNames.getLength())
+ {
+ static const char* aPropNames[] =
+ {
+ "Import/UnknownTag", // 0
+ "Import/FontSetting", // 1
+ "Import/FontSize/Size_1", // 2
+ "Import/FontSize/Size_2", // 3
+ "Import/FontSize/Size_3", // 4
+ "Import/FontSize/Size_4", // 5
+ "Import/FontSize/Size_5", // 6
+ "Import/FontSize/Size_6", // 7
+ "Import/FontSize/Size_7", // 8
+ "Export/Browser", // 9
+ "Export/Basic", // 0
+ "Export/PrintLayout", // 11
+ "Export/LocalGraphic", // 12
+ "Export/Warning", // 13
+ "Export/Encoding", // 14
+ "Import/NumbersEnglishUS" // 15
+ };
+ const int nCount = sizeof(aPropNames) / sizeof(aPropNames[0]);
+ aNames.realloc(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = C2U(aPropNames[i]);
+ }
+ return aNames;
+}
+// -----------------------------------------------------------------------
+SvxHtmlOptions::SvxHtmlOptions() :
+ ConfigItem(C2U("Office.Common/Filter/HTML"))
+{
+ pImp = new HtmlOptions_Impl;
+ const Sequence<OUString>& aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ pImp->nFlags = 0;
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ switch(nProp)
+ {
+ case 0:
+ if(*(sal_Bool*)pValues[nProp].getValue())
+ pImp->nFlags |= HTMLCFG_UNKNOWN_TAGS;
+ break;//"Import/UnknownTag",
+ case 1:
+ if(*(sal_Bool*)pValues[nProp].getValue())
+ pImp->nFlags |= HTMLCFG_IGNORE_FONT_FAMILY;
+ break;//"Import/FontSetting",
+ case 2: pValues[nProp] >>= pImp->aFontSizeArr[0]; break;//"Import/FontSize/Size_1",
+ case 3: pValues[nProp] >>= pImp->aFontSizeArr[1]; break;//"Import/FontSize/Size_2",
+ case 4: pValues[nProp] >>= pImp->aFontSizeArr[2]; break;//"Import/FontSize/Size_3",
+ case 5: pValues[nProp] >>= pImp->aFontSizeArr[3]; break;//"Import/FontSize/Size_4",
+ case 6: pValues[nProp] >>= pImp->aFontSizeArr[4]; break;//"Import/FontSize/Size_5",
+ case 7: pValues[nProp] >>= pImp->aFontSizeArr[5]; break;//"Import/FontSize/Size_6",
+ case 8: pValues[nProp] >>= pImp->aFontSizeArr[6]; break;//"Import/FontSize/Size_7",
+ case 9://"Export/Browser",
+ {
+ sal_Int32 nExpMode = 0;
+// pValues[nProp] >>= pImp->nExportMode;
+ pValues[nProp] >>= nExpMode;
+ switch( nExpMode )
+ {
+ case 0: nExpMode = HTML_CFG_HTML32; break;
+ case 1: nExpMode = HTML_CFG_MSIE_40; break;
+// case 2: nExpMode = HTML_CFG_NS30; break; depricated
+ case 3: nExpMode = HTML_CFG_WRITER; break;
+ case 4: nExpMode = HTML_CFG_NS40; break;
+ case 5: nExpMode = HTML_CFG_MSIE_40_OLD;break;
+ default: nExpMode = HTML_CFG_NS40; break;
+ }
+
+ pImp->nExportMode = nExpMode;
+ }
+ break;
+ case 10:
+ if(*(sal_Bool*)pValues[nProp].getValue())
+ pImp->nFlags |= HTMLCFG_STAR_BASIC;
+ break;//"Export/Basic",
+ case 11:
+ if(*(sal_Bool*)pValues[nProp].getValue())
+ pImp->nFlags |= HTMLCFG_PRINT_LAYOUT_EXTENSION;
+ break;//"Export/PrintLayout",
+ case 12:
+ if(*(sal_Bool*)pValues[nProp].getValue())
+ pImp->nFlags |= HTMLCFG_LOCAL_GRF;
+ break;//"Export/LocalGraphic",
+ case 13:
+ if(*(sal_Bool*)pValues[nProp].getValue())
+ pImp->nFlags |= HTMLCFG_IS_BASIC_WARNING;
+ break;//"Export/Warning"
+
+ case 14: pValues[nProp] >>= pImp->eEncoding;
+ pImp->bIsEncodingDefault = sal_False;
+ break;//"Export/Encoding"
+
+ case 15:
+ if(*(sal_Bool*)pValues[nProp].getValue())
+ pImp->nFlags |= HTMLCFG_NUMBERS_ENGLISH_US;
+ break;//"Import/NumbersEnglishUS"
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+SvxHtmlOptions::~SvxHtmlOptions()
+{
+ delete pImp;
+}
+// -----------------------------------------------------------------------
+void SvxHtmlOptions::Commit()
+{
+ const Sequence<OUString>& aNames = GetPropertyNames();
+
+// const OUString* pNames = aNames.getConstArray();
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+// const Type& rType = ::getBooleanCppuType();
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ sal_Bool bSet = sal_False;
+ switch(nProp)
+ {
+ case 0: bSet = 0 != (pImp->nFlags & HTMLCFG_UNKNOWN_TAGS);break;//"Import/UnknownTag",
+ case 1: bSet = 0 != (pImp->nFlags & HTMLCFG_IGNORE_FONT_FAMILY);break;//"Import/FontSetting",
+ case 2: pValues[nProp] <<= pImp->aFontSizeArr[0];break;//"Import/FontSize/Size_1",
+ case 3: pValues[nProp] <<= pImp->aFontSizeArr[1];break;//"Import/FontSize/Size_2",
+ case 4: pValues[nProp] <<= pImp->aFontSizeArr[2];break;//"Import/FontSize/Size_3",
+ case 5: pValues[nProp] <<= pImp->aFontSizeArr[3];break;//"Import/FontSize/Size_4",
+ case 6: pValues[nProp] <<= pImp->aFontSizeArr[4];break;//"Import/FontSize/Size_5",
+ case 7: pValues[nProp] <<= pImp->aFontSizeArr[5];break;//"Import/FontSize/Size_6",
+ case 8: pValues[nProp] <<= pImp->aFontSizeArr[6];break;//"Import/FontSize/Size_7",
+ case 9: //"Export/Browser",
+ {
+ sal_Int32 nExpMode = pImp->nExportMode;
+
+ switch( nExpMode )
+ {
+ case HTML_CFG_HTML32: nExpMode = 0; break;
+ case HTML_CFG_MSIE_40: nExpMode = 1; break;
+// case HTML_CFG_NS30: nExpMode = 2; break; depricated
+ case HTML_CFG_WRITER: nExpMode = 3; break;
+ case HTML_CFG_NS40: nExpMode = 4; break;
+ case HTML_CFG_MSIE_40_OLD: nExpMode = 5; break;
+ default: nExpMode = 4; break; // NS40
+ }
+
+ pValues[nProp] <<= nExpMode;
+ break;
+ }
+ case 10: bSet = 0 != (pImp->nFlags & HTMLCFG_STAR_BASIC);break;//"Export/Basic",
+ case 11: bSet = 0 != (pImp->nFlags & HTMLCFG_PRINT_LAYOUT_EXTENSION);break;//"Export/PrintLayout",
+ case 12: bSet = 0 != (pImp->nFlags & HTMLCFG_LOCAL_GRF);break;//"Export/LocalGraphic",
+ case 13: bSet = 0 != (pImp->nFlags & HTMLCFG_IS_BASIC_WARNING);break;//"Export/Warning"
+ case 14:
+ if(!pImp->bIsEncodingDefault)
+ pValues[nProp] <<= pImp->eEncoding;
+ break;//"Export/Encoding",
+ case 15: bSet = 0 != (pImp->nFlags & HTMLCFG_NUMBERS_ENGLISH_US);break;//"Import/NumbersEnglishUS"
+ }
+ if(nProp < 2 || ( nProp > 9 && nProp < 14 ) || nProp == 15)
+ pValues[nProp].setValue(&bSet, ::getCppuBooleanType());
+ }
+ PutProperties(aNames, aValues);
+}
+
+void SvxHtmlOptions::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
+// -----------------------------------------------------------------------
+USHORT SvxHtmlOptions::GetFontSize(USHORT nPos) const
+{
+ if(nPos < HTML_FONT_COUNT)
+ return (USHORT)pImp->aFontSizeArr[nPos];
+ return 0;
+}
+// -----------------------------------------------------------------------
+void SvxHtmlOptions::SetFontSize(USHORT nPos, USHORT nSize)
+{
+ if(nPos < HTML_FONT_COUNT)
+ {
+ pImp->aFontSizeArr[nPos] = nSize;
+ SetModified();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+
+BOOL SvxHtmlOptions::IsImportUnknown() const
+{
+ return 0 != (pImp->nFlags & HTMLCFG_UNKNOWN_TAGS) ;
+}
+
+// -----------------------------------------------------------------------
+
+
+void SvxHtmlOptions::SetImportUnknown(BOOL bSet)
+{
+ if(bSet)
+ pImp->nFlags |= HTMLCFG_UNKNOWN_TAGS;
+ else
+ pImp->nFlags &= ~HTMLCFG_UNKNOWN_TAGS;
+ SetModified();
+}
+
+// -----------------------------------------------------------------------
+
+
+USHORT SvxHtmlOptions::GetExportMode() const
+{
+ return (USHORT)pImp->nExportMode;
+}
+
+// -----------------------------------------------------------------------
+
+
+void SvxHtmlOptions::SetExportMode(USHORT nSet)
+{
+ if(nSet <= HTML_CFG_MAX )
+ {
+ pImp->nExportMode = nSet;
+ SetModified();
+ // Invalidierung, falls blinkender Text erlaubt/verboten wurde
+/* SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if(pViewFrame)
+ pViewFrame->GetBindings().Invalidate(SID_DRAW_TEXT_MARQUEE); */
+ }
+}
+
+// -----------------------------------------------------------------------
+
+
+BOOL SvxHtmlOptions::IsStarBasic() const
+{
+ return 0 != (pImp->nFlags & HTMLCFG_STAR_BASIC) ;
+}
+
+// -----------------------------------------------------------------------
+
+
+void SvxHtmlOptions::SetStarBasic(BOOL bSet)
+{
+ if(bSet)
+ pImp->nFlags |= HTMLCFG_STAR_BASIC;
+ else
+ pImp->nFlags &= ~HTMLCFG_STAR_BASIC;
+ SetModified();
+}
+
+/*-----------------14.02.97 08.34-------------------
+
+--------------------------------------------------*/
+
+BOOL SvxHtmlOptions::IsSaveGraphicsLocal() const
+{
+ return 0 != (pImp->nFlags & HTMLCFG_LOCAL_GRF) ;
+}
+/*-----------------14.02.97 08.34-------------------
+
+--------------------------------------------------*/
+void SvxHtmlOptions::SetSaveGraphicsLocal(BOOL bSet)
+{
+ if(bSet)
+ pImp->nFlags |= HTMLCFG_LOCAL_GRF;
+ else
+ pImp->nFlags &= ~HTMLCFG_LOCAL_GRF;
+ SetModified();
+}
+
+/*-----------------10/21/97 08:34am-----------------
+
+--------------------------------------------------*/
+
+BOOL SvxHtmlOptions::IsPrintLayoutExtension() const
+{
+ BOOL bRet = 0 != (pImp->nFlags & HTMLCFG_PRINT_LAYOUT_EXTENSION);
+ switch( pImp->nExportMode )
+ {
+ case HTML_CFG_MSIE_40:
+ case HTML_CFG_NS40 :
+ case HTML_CFG_WRITER :
+ break;
+ default:
+ bRet = FALSE;
+ }
+ return bRet;
+}
+/*-----------------10/21/97 08:34am-----------------
+
+--------------------------------------------------*/
+void SvxHtmlOptions::SetPrintLayoutExtension(BOOL bSet)
+{
+ if(bSet)
+ pImp->nFlags |= HTMLCFG_PRINT_LAYOUT_EXTENSION;
+ else
+ pImp->nFlags &= ~HTMLCFG_PRINT_LAYOUT_EXTENSION;
+ SetModified();
+}
+
+/*-----------------10.07.98 10.02-------------------
+
+--------------------------------------------------*/
+
+BOOL SvxHtmlOptions::IsIgnoreFontFamily() const
+{
+ return 0 != (pImp->nFlags & HTMLCFG_IGNORE_FONT_FAMILY) ;
+}
+/*-----------------10.07.98 10.02-------------------
+
+--------------------------------------------------*/
+void SvxHtmlOptions::SetIgnoreFontFamily(BOOL bSet)
+{
+ if(bSet)
+ pImp->nFlags |= HTMLCFG_IGNORE_FONT_FAMILY;
+ else
+ pImp->nFlags &= ~HTMLCFG_IGNORE_FONT_FAMILY;
+ SetModified();
+}
+/* -----------------05.02.99 09:03-------------------
+ *
+ * --------------------------------------------------*/
+BOOL SvxHtmlOptions::IsStarBasicWarning() const
+{
+ return 0 != (pImp->nFlags & HTMLCFG_IS_BASIC_WARNING) ;
+}
+/* -----------------05.02.99 09:03-------------------
+ *
+ * --------------------------------------------------*/
+void SvxHtmlOptions::SetStarBasicWarning(BOOL bSet)
+{
+ if(bSet)
+ pImp->nFlags |= HTMLCFG_IS_BASIC_WARNING;
+ else
+ pImp->nFlags &= ~HTMLCFG_IS_BASIC_WARNING;
+ SetModified();
+}
+
+/*-----------------19.02.2001 18:40-----------------
+ *
+ * --------------------------------------------------*/
+rtl_TextEncoding SvxHtmlOptions::GetTextEncoding() const
+{
+ rtl_TextEncoding eRet;
+ if(pImp->bIsEncodingDefault)
+ eRet = SvtSysLocale::GetBestMimeEncoding();
+ else
+ eRet = (rtl_TextEncoding)pImp->eEncoding;
+ return eRet;
+}
+
+/*-----------------19.02.2001 18:40-----------------
+ *
+ * --------------------------------------------------*/
+void SvxHtmlOptions::SetTextEncoding( rtl_TextEncoding eEnc )
+{
+ pImp->eEncoding = eEnc;
+ pImp->bIsEncodingDefault = sal_False;
+ SetModified();
+}
+/* -----------------------------15.08.2001 12:01------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SvxHtmlOptions::IsDefaultTextEncoding() const
+{
+ return pImp->bIsEncodingDefault;
+}
+
+SvxHtmlOptions* SvxHtmlOptions::Get()
+{
+ if ( !pOptions )
+ pOptions = new SvxHtmlOptions;
+ return pOptions;
+}
+
+
+/* ---------------------- 2006-06-07T21:02+0200 ---------------------- */
+BOOL SvxHtmlOptions::IsNumbersEnglishUS() const
+{
+ return 0 != (pImp->nFlags & HTMLCFG_NUMBERS_ENGLISH_US) ;
+}
+
+
+/* ---------------------- 2006-06-07T21:02+0200 ---------------------- */
+void SvxHtmlOptions::SetNumbersEnglishUS(BOOL bSet)
+{
+ if(bSet)
+ pImp->nFlags |= HTMLCFG_NUMBERS_ENGLISH_US;
+ else
+ pImp->nFlags &= ~HTMLCFG_NUMBERS_ENGLISH_US;
+ SetModified();
+}
diff --git a/svtools/source/config/makefile.mk b/svtools/source/config/makefile.mk
index 9de32bd9e43d..2e24490bd9e1 100644
--- a/svtools/source/config/makefile.mk
+++ b/svtools/source/config/makefile.mk
@@ -49,6 +49,7 @@ SLOFILES= \
$(SLO)$/extcolorcfg.obj \
$(SLO)$/fontsubstconfig.obj \
$(SLO)$/helpopt.obj \
+ $(SLO)$/htmlcfg.obj \
$(SLO)$/itemholder2.obj \
$(SLO)$/menuoptions.obj \
$(SLO)$/miscopt.obj \
diff --git a/unotools/inc/unotools/syslocale.hxx b/unotools/inc/unotools/syslocale.hxx
index adce66b7e84a..5b7834832689 100644
--- a/unotools/inc/unotools/syslocale.hxx
+++ b/unotools/inc/unotools/syslocale.hxx
@@ -36,6 +36,7 @@
#include <unotools/charclass.hxx>
#include <sal/types.h>
#include <i18npool/lang.h>
+#include <rtl/textenc.h>
class SvtSysLocale_Impl;
class SvtSysLocaleOptions;
@@ -79,6 +80,12 @@ public:
LanguageType GetLanguage() const;
com::sun::star::lang::Locale GetUILocale() const;
LanguageType GetUILanguage() const;
+
+ /** Get the best MIME encoding matching the system locale, or if that isn't
+ determinable one that matches the UI locale, or UTF8 if everything else
+ fails.
+ */
+ static rtl_TextEncoding GetBestMimeEncoding();
};
#endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX
diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx
index 8e9d75c6ce0c..9b131f2a76cc 100644
--- a/unotools/source/misc/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -39,6 +39,9 @@
#include <unotools/localedatawrapper.hxx>
#include <comphelper/processfactory.hxx>
#include <i18npool/mslangid.hxx>
+#include <rtl/tencinfo.h>
+#include <rtl/locale.h>
+#include <osl/nlsupport.h>
using namespace osl;
using namespace com::sun::star;
@@ -187,4 +190,28 @@ LanguageType SvtSysLocale::GetUILanguage() const
return pImpl->aSysLocaleOptions.GetRealUILanguage();
}
+//------------------------------------------------------------------------
+
+// static
+rtl_TextEncoding SvtSysLocale::GetBestMimeEncoding()
+{
+ const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding(
+ gsl_getSystemTextEncoding() );
+ if ( !pCharSet )
+ {
+ // If the system locale is unknown to us, e.g. LC_ALL=xx, match the UI
+ // language if possible.
+ ::com::sun::star::lang::Locale aLocale( SvtSysLocale().GetUILocale() );
+ rtl_Locale * pLocale = rtl_locale_register( aLocale.Language.getStr(),
+ aLocale.Country.getStr(), aLocale.Variant.getStr() );
+ rtl_TextEncoding nEnc = osl_getTextEncodingFromLocale( pLocale );
+ pCharSet = rtl_getBestMimeCharsetFromTextEncoding( nEnc );
+ }
+ rtl_TextEncoding nRet;
+ if ( pCharSet )
+ nRet = rtl_getTextEncodingFromMimeCharset( pCharSet );
+ else
+ nRet = RTL_TEXTENCODING_UTF8;
+ return nRet;
+}