use officecfg for default options
Change-Id: I5241c21fa097c104f1131db61787191d019a5de4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119485 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
5e93753ca6
commit
6bb901a128
@@ -62,7 +62,6 @@ using namespace svx;
|
|||||||
|
|
||||||
struct OptPath_Impl
|
struct OptPath_Impl
|
||||||
{
|
{
|
||||||
SvtDefaultOptions m_aDefOpt;
|
|
||||||
OUString m_sMultiPathDlg;
|
OUString m_sMultiPathDlg;
|
||||||
Reference< css::util::XPathSettings > m_xPathSettings;
|
Reference< css::util::XPathSettings > m_xPathSettings;
|
||||||
|
|
||||||
@@ -351,7 +350,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, StandardHdl_Impl, weld::Button&, void)
|
|||||||
{
|
{
|
||||||
m_xPathBox->selected_foreach([this](weld::TreeIter& rEntry){
|
m_xPathBox->selected_foreach([this](weld::TreeIter& rEntry){
|
||||||
PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(rEntry).toInt64());
|
PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(rEntry).toInt64());
|
||||||
OUString aOldPath = pImpl->m_aDefOpt.GetDefaultPath( pPathImpl->nRealId );
|
OUString aOldPath = SvtDefaultOptions::GetDefaultPath( pPathImpl->nRealId );
|
||||||
|
|
||||||
if ( !aOldPath.isEmpty() )
|
if ( !aOldPath.isEmpty() )
|
||||||
{
|
{
|
||||||
|
@@ -16,29 +16,15 @@
|
|||||||
* except in compliance with the License. You may obtain a copy of
|
* except in compliance with the License. You may obtain a copy of
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
#ifndef INCLUDED_UNOTOOLS_DEFAULTOPTIONS_HXX
|
#pragma once
|
||||||
#define INCLUDED_UNOTOOLS_DEFAULTOPTIONS_HXX
|
|
||||||
|
|
||||||
#include <unotools/unotoolsdllapi.h>
|
#include <unotools/unotoolsdllapi.h>
|
||||||
#include <rtl/ustring.hxx>
|
#include <rtl/ustring.hxx>
|
||||||
#include <unotools/options.hxx>
|
|
||||||
#include <unotools/pathoptions.hxx>
|
#include <unotools/pathoptions.hxx>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
class SvtDefaultOptions_Impl;
|
namespace SvtDefaultOptions
|
||||||
|
|
||||||
class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtDefaultOptions final : public utl::detail::Options
|
|
||||||
{
|
{
|
||||||
private:
|
UNOTOOLS_DLLPUBLIC OUString GetDefaultPath(SvtPathOptions::Paths nId);
|
||||||
std::shared_ptr<SvtDefaultOptions_Impl> pImpl;
|
|
||||||
|
|
||||||
public:
|
|
||||||
SvtDefaultOptions();
|
|
||||||
virtual ~SvtDefaultOptions() override;
|
|
||||||
|
|
||||||
OUString GetDefaultPath(SvtPathOptions::Paths nId) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDED_UNOTOOLS_DEFAULTOPTIONS_HXX
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -39,8 +39,6 @@ enum class EItem
|
|||||||
Compatibility ,
|
Compatibility ,
|
||||||
CTLOptions , // 2
|
CTLOptions , // 2
|
||||||
|
|
||||||
DefaultOptions ,
|
|
||||||
|
|
||||||
EventConfig ,
|
EventConfig ,
|
||||||
|
|
||||||
HistoryOptions ,
|
HistoryOptions ,
|
||||||
|
@@ -23,335 +23,100 @@
|
|||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
#include <unotools/defaultoptions.hxx>
|
#include <unotools/defaultoptions.hxx>
|
||||||
#include <unotools/pathoptions.hxx>
|
#include <unotools/pathoptions.hxx>
|
||||||
#include <unotools/configitem.hxx>
|
|
||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
#include <com/sun/star/uno/Any.hxx>
|
#include <com/sun/star/uno/Any.hxx>
|
||||||
#include <com/sun/star/uno/Sequence.hxx>
|
#include <com/sun/star/uno/Sequence.hxx>
|
||||||
#include <osl/mutex.hxx>
|
|
||||||
|
|
||||||
#include <rtl/instance.hxx>
|
|
||||||
#include <rtl/ustrbuf.hxx>
|
#include <rtl/ustrbuf.hxx>
|
||||||
|
#include <officecfg/Office/Common.hxx>
|
||||||
|
|
||||||
#include "itemholder1.hxx"
|
namespace SvtDefaultOptions
|
||||||
|
|
||||||
using namespace osl;
|
|
||||||
using namespace utl;
|
|
||||||
using namespace com::sun::star::uno;
|
|
||||||
|
|
||||||
#define DEFAULTPATH_ADDIN 0
|
|
||||||
#define DEFAULTPATH_AUTOCORRECT 1
|
|
||||||
#define DEFAULTPATH_AUTOTEXT 2
|
|
||||||
#define DEFAULTPATH_BACKUP 3
|
|
||||||
#define DEFAULTPATH_BASIC 4
|
|
||||||
#define DEFAULTPATH_BITMAP 5
|
|
||||||
#define DEFAULTPATH_CONFIG 6
|
|
||||||
#define DEFAULTPATH_DICTIONARY 7
|
|
||||||
#define DEFAULTPATH_FAVORITES 8
|
|
||||||
#define DEFAULTPATH_FILTER 9
|
|
||||||
#define DEFAULTPATH_GALLERY 10
|
|
||||||
#define DEFAULTPATH_GRAPHIC 11
|
|
||||||
#define DEFAULTPATH_HELP 12
|
|
||||||
#define DEFAULTPATH_LINGUISTIC 13
|
|
||||||
#define DEFAULTPATH_MODULE 14
|
|
||||||
#define DEFAULTPATH_PALETTE 15
|
|
||||||
#define DEFAULTPATH_PLUGIN 16
|
|
||||||
#define DEFAULTPATH_TEMP 17
|
|
||||||
#define DEFAULTPATH_TEMPLATE 18
|
|
||||||
#define DEFAULTPATH_USERCONFIG 19
|
|
||||||
#define DEFAULTPATH_WORK 20
|
|
||||||
#define DEFAULTPATH_CLASSIFICATION 21
|
|
||||||
#define DEFAULTPATH_USERDICTIONARY 22
|
|
||||||
|
|
||||||
// class SvtDefaultOptions_Impl ------------------------------------------
|
|
||||||
|
|
||||||
class SvtDefaultOptions_Impl : public utl::ConfigItem
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
OUString m_aAddinPath;
|
|
||||||
OUString m_aAutoCorrectPath;
|
|
||||||
OUString m_aAutoTextPath;
|
|
||||||
OUString m_aBackupPath;
|
|
||||||
OUString m_aBasicPath;
|
|
||||||
OUString m_aBitmapPath;
|
|
||||||
OUString m_aConfigPath;
|
|
||||||
OUString m_aDictionaryPath;
|
|
||||||
OUString m_aFavoritesPath;
|
|
||||||
OUString m_aFilterPath;
|
|
||||||
OUString m_aGalleryPath;
|
|
||||||
OUString m_aGraphicPath;
|
|
||||||
OUString m_aHelpPath;
|
|
||||||
OUString m_aLinguisticPath;
|
|
||||||
OUString m_aModulePath;
|
|
||||||
OUString m_aPalettePath;
|
|
||||||
OUString m_aPluginPath;
|
|
||||||
OUString m_aTempPath;
|
|
||||||
OUString m_aTemplatePath;
|
|
||||||
OUString m_aUserConfigPath;
|
|
||||||
OUString m_aWorkPath;
|
|
||||||
OUString m_aClassificationPath;
|
|
||||||
|
|
||||||
SvtDefaultOptions_Impl();
|
OUString GetDefaultPath( SvtPathOptions::Paths nId )
|
||||||
virtual ~SvtDefaultOptions_Impl() override;
|
|
||||||
|
|
||||||
OUString GetDefaultPath( SvtPathOptions::Paths nId ) const;
|
|
||||||
virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual void ImplCommit() final override;
|
|
||||||
};
|
|
||||||
|
|
||||||
// global ----------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
std::weak_ptr<SvtDefaultOptions_Impl> g_pOptions;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef OUString SvtDefaultOptions_Impl::*PathStrPtr;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
struct PathToDefaultMapping_Impl
|
|
||||||
{
|
{
|
||||||
SvtPathOptions::Paths _ePath;
|
SvtPathOptions aPathOpt;
|
||||||
PathStrPtr _pDefaultPath;
|
auto seqToPath = [&aPathOpt] (const css::uno::Sequence<OUString> & rSeq)
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
PathToDefaultMapping_Impl const PathMap_Impl[] =
|
|
||||||
{
|
|
||||||
{ SvtPathOptions::Paths::AddIn, &SvtDefaultOptions_Impl::m_aAddinPath },
|
|
||||||
{ SvtPathOptions::Paths::AutoCorrect, &SvtDefaultOptions_Impl::m_aAutoCorrectPath },
|
|
||||||
{ SvtPathOptions::Paths::AutoText, &SvtDefaultOptions_Impl::m_aAutoTextPath },
|
|
||||||
{ SvtPathOptions::Paths::Backup, &SvtDefaultOptions_Impl::m_aBackupPath },
|
|
||||||
{ SvtPathOptions::Paths::Basic, &SvtDefaultOptions_Impl::m_aBasicPath },
|
|
||||||
{ SvtPathOptions::Paths::Bitmap, &SvtDefaultOptions_Impl::m_aBitmapPath },
|
|
||||||
{ SvtPathOptions::Paths::Config, &SvtDefaultOptions_Impl::m_aConfigPath },
|
|
||||||
{ SvtPathOptions::Paths::Dictionary, &SvtDefaultOptions_Impl::m_aDictionaryPath },
|
|
||||||
{ SvtPathOptions::Paths::Favorites, &SvtDefaultOptions_Impl::m_aFavoritesPath },
|
|
||||||
{ SvtPathOptions::Paths::Filter, &SvtDefaultOptions_Impl::m_aFilterPath },
|
|
||||||
{ SvtPathOptions::Paths::Gallery, &SvtDefaultOptions_Impl::m_aGalleryPath },
|
|
||||||
{ SvtPathOptions::Paths::Graphic, &SvtDefaultOptions_Impl::m_aGraphicPath },
|
|
||||||
{ SvtPathOptions::Paths::Help, &SvtDefaultOptions_Impl::m_aHelpPath },
|
|
||||||
{ SvtPathOptions::Paths::Linguistic, &SvtDefaultOptions_Impl::m_aLinguisticPath },
|
|
||||||
{ SvtPathOptions::Paths::Module, &SvtDefaultOptions_Impl::m_aModulePath },
|
|
||||||
{ SvtPathOptions::Paths::Palette, &SvtDefaultOptions_Impl::m_aPalettePath },
|
|
||||||
{ SvtPathOptions::Paths::Plugin, &SvtDefaultOptions_Impl::m_aPluginPath },
|
|
||||||
{ SvtPathOptions::Paths::Temp, &SvtDefaultOptions_Impl::m_aTempPath },
|
|
||||||
{ SvtPathOptions::Paths::Template, &SvtDefaultOptions_Impl::m_aTemplatePath },
|
|
||||||
{ SvtPathOptions::Paths::UserConfig, &SvtDefaultOptions_Impl::m_aUserConfigPath },
|
|
||||||
{ SvtPathOptions::Paths::Work, &SvtDefaultOptions_Impl::m_aWorkPath },
|
|
||||||
{ SvtPathOptions::Paths::Classification, &SvtDefaultOptions_Impl::m_aClassificationPath }
|
|
||||||
};
|
|
||||||
|
|
||||||
// functions -------------------------------------------------------------
|
|
||||||
|
|
||||||
static Sequence< OUString > GetDefaultPropertyNames()
|
|
||||||
{
|
|
||||||
static const char* aPropNames[] =
|
|
||||||
{
|
|
||||||
"Addin", // PATH_ADDIN
|
|
||||||
"AutoCorrect", // PATH_AUTOCORRECT
|
|
||||||
"AutoText", // PATH_AUTOTEXT
|
|
||||||
"Backup", // PATH_BACKUP
|
|
||||||
"Basic", // PATH_BASIC
|
|
||||||
"Bitmap", // PATH_BITMAP
|
|
||||||
"Config", // PATH_CONFIG
|
|
||||||
"Dictionary", // PATH_DICTIONARY
|
|
||||||
"Favorite", // PATH_FAVORITES
|
|
||||||
"Filter", // PATH_FILTER
|
|
||||||
"Gallery", // PATH_GALLERY
|
|
||||||
"Graphic", // PATH_GRAPHIC
|
|
||||||
"Help", // PATH_HELP
|
|
||||||
"Linguistic", // PATH_LINGUISTIC
|
|
||||||
"Module", // PATH_MODULE
|
|
||||||
"Palette", // PATH_PALETTE
|
|
||||||
"Plugin", // PATH_PLUGIN
|
|
||||||
"Temp", // PATH_TEMP
|
|
||||||
"Template", // PATH_TEMPLATE
|
|
||||||
"UserConfig", // PATH_USERCONFIG
|
|
||||||
"Work", // PATH_WORK
|
|
||||||
"Classification" // PATH_CLASSIFICATION
|
|
||||||
};
|
|
||||||
|
|
||||||
const int nCount = SAL_N_ELEMENTS( aPropNames );
|
|
||||||
Sequence< OUString > aNames( nCount );
|
|
||||||
OUString* pNames = aNames.getArray();
|
|
||||||
for ( int i = 0; i < nCount; i++ )
|
|
||||||
pNames[i] = OUString::createFromAscii( aPropNames[i] );
|
|
||||||
|
|
||||||
return aNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SvtDefaultOptions_Impl::Notify( const Sequence< OUString >& )
|
|
||||||
{
|
|
||||||
// no notification, will never be changed
|
|
||||||
}
|
|
||||||
|
|
||||||
void SvtDefaultOptions_Impl::ImplCommit()
|
|
||||||
{
|
|
||||||
// will never be changed
|
|
||||||
}
|
|
||||||
|
|
||||||
// class SvtDefaultOptions_Impl ------------------------------------------
|
|
||||||
|
|
||||||
OUString SvtDefaultOptions_Impl::GetDefaultPath( SvtPathOptions::Paths nId ) const
|
|
||||||
{
|
|
||||||
OUString aRet;
|
|
||||||
sal_uInt16 nIdx = 0;
|
|
||||||
|
|
||||||
while ( PathMap_Impl[nIdx]._ePath <= SvtPathOptions::Paths::Classification )
|
|
||||||
{
|
|
||||||
if ( nId == PathMap_Impl[nIdx]._ePath && PathMap_Impl[nIdx]._pDefaultPath )
|
|
||||||
{
|
{
|
||||||
aRet = this->*(PathMap_Impl[nIdx]._pDefaultPath);
|
// single paths
|
||||||
if ( nId == SvtPathOptions::Paths::AddIn ||
|
sal_Int32 nCount = rSeq.getLength();
|
||||||
nId == SvtPathOptions::Paths::Filter ||
|
OUStringBuffer aFullPathBuf(nCount * 40);
|
||||||
nId == SvtPathOptions::Paths::Help ||
|
for ( sal_Int32 nPosition = 0; nPosition < nCount; ++nPosition )
|
||||||
nId == SvtPathOptions::Paths::Module ||
|
|
||||||
nId == SvtPathOptions::Paths::Plugin )
|
|
||||||
{
|
{
|
||||||
OUString aTmp;
|
aFullPathBuf.append(aPathOpt.SubstituteVariable( rSeq[ nPosition ] ));
|
||||||
osl::FileBase::getFileURLFromSystemPath( aRet, aTmp );
|
if ( nPosition < nCount-1 )
|
||||||
aRet = aTmp;
|
aFullPathBuf.append(";");
|
||||||
}
|
}
|
||||||
|
return aFullPathBuf.makeStringAndClear();
|
||||||
|
};
|
||||||
|
|
||||||
break;
|
OUString aRet;
|
||||||
}
|
switch (nId)
|
||||||
++nIdx;
|
{
|
||||||
|
case SvtPathOptions::Paths::AddIn:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Addin::get()); break;
|
||||||
|
case SvtPathOptions::Paths::AutoCorrect:
|
||||||
|
aRet = seqToPath(officecfg::Office::Common::Path::Default::AutoCorrect::get()); break;
|
||||||
|
case SvtPathOptions::Paths::AutoText:
|
||||||
|
aRet = seqToPath(officecfg::Office::Common::Path::Default::AutoText::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Backup:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Backup::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Basic:
|
||||||
|
aRet = seqToPath(officecfg::Office::Common::Path::Default::Basic::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Bitmap:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Bitmap::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Config:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Config::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Dictionary:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Dictionary::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Favorites:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Favorite::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Filter:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Filter::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Gallery:
|
||||||
|
aRet = seqToPath(officecfg::Office::Common::Path::Default::Gallery::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Graphic:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Graphic::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Help:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Help::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Linguistic:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Linguistic::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Module:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Module::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Palette:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Palette::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Plugin:
|
||||||
|
aRet = seqToPath(officecfg::Office::Common::Path::Default::Plugin::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Temp:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Temp::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Template:
|
||||||
|
aRet = seqToPath(officecfg::Office::Common::Path::Default::Template::get()); break;
|
||||||
|
case SvtPathOptions::Paths::UserConfig:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::UserConfig::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Work:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Work::get()); break;
|
||||||
|
case SvtPathOptions::Paths::Classification:
|
||||||
|
aRet = aPathOpt.SubstituteVariable(officecfg::Office::Common::Path::Default::Classification::get()); break;
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( nId == SvtPathOptions::Paths::AddIn ||
|
||||||
|
nId == SvtPathOptions::Paths::Filter ||
|
||||||
|
nId == SvtPathOptions::Paths::Help ||
|
||||||
|
nId == SvtPathOptions::Paths::Module ||
|
||||||
|
nId == SvtPathOptions::Paths::Plugin )
|
||||||
|
{
|
||||||
|
OUString aTmp;
|
||||||
|
osl::FileBase::getFileURLFromSystemPath( aRet, aTmp );
|
||||||
|
aRet = aTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aRet;
|
return aRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( "Office.Common/Path/Default" )
|
} // namespace
|
||||||
{
|
|
||||||
Sequence< OUString > aNames = GetDefaultPropertyNames();
|
|
||||||
Sequence< Any > aValues = GetProperties( aNames );
|
|
||||||
EnableNotification( aNames );
|
|
||||||
const Any* pValues = aValues.getConstArray();
|
|
||||||
DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
|
|
||||||
if ( aValues.getLength() != aNames.getLength() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
SvtPathOptions aPathOpt;
|
|
||||||
OUString aTempStr;
|
|
||||||
OUStringBuffer aFullPathBuf;
|
|
||||||
|
|
||||||
for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
|
|
||||||
{
|
|
||||||
if ( pValues[nProp].hasValue() )
|
|
||||||
{
|
|
||||||
switch ( pValues[nProp].getValueTypeClass() )
|
|
||||||
{
|
|
||||||
case css::uno::TypeClass_STRING :
|
|
||||||
{
|
|
||||||
// multi paths
|
|
||||||
if ( pValues[nProp] >>= aTempStr )
|
|
||||||
aFullPathBuf = aPathOpt.SubstituteVariable( aTempStr );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SAL_WARN( "unotools.config", "any operator >>= failed" );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case css::uno::TypeClass_SEQUENCE :
|
|
||||||
{
|
|
||||||
// single paths
|
|
||||||
aFullPathBuf.setLength(0);
|
|
||||||
Sequence < OUString > aList;
|
|
||||||
if ( pValues[nProp] >>= aList )
|
|
||||||
{
|
|
||||||
sal_Int32 nCount = aList.getLength();
|
|
||||||
for ( sal_Int32 nPosition = 0; nPosition < nCount; ++nPosition )
|
|
||||||
{
|
|
||||||
aFullPathBuf.append(aPathOpt.SubstituteVariable( aList[ nPosition ] ));
|
|
||||||
if ( nPosition < nCount-1 )
|
|
||||||
aFullPathBuf.append(";");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SAL_WARN( "unotools.config", "any operator >>= failed" );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
SAL_WARN( "unotools.config", "Wrong any type" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto aFullPath = aFullPathBuf.makeStringAndClear();
|
|
||||||
switch ( nProp )
|
|
||||||
{
|
|
||||||
case DEFAULTPATH_ADDIN: m_aAddinPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_AUTOCORRECT: m_aAutoCorrectPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_AUTOTEXT: m_aAutoTextPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_BACKUP: m_aBackupPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_BASIC: m_aBasicPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_BITMAP: m_aBitmapPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_CONFIG: m_aConfigPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_DICTIONARY: m_aDictionaryPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_FAVORITES: m_aFavoritesPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_FILTER: m_aFilterPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_GALLERY: m_aGalleryPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_GRAPHIC: m_aGraphicPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_HELP: m_aHelpPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_LINGUISTIC: m_aLinguisticPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_MODULE: m_aModulePath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_PALETTE: m_aPalettePath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_PLUGIN: m_aPluginPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_TEMP: m_aTempPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_TEMPLATE: m_aTemplatePath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_USERCONFIG: m_aUserConfigPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_WORK: m_aWorkPath = aFullPath; break;
|
|
||||||
case DEFAULTPATH_CLASSIFICATION: m_aClassificationPath = aFullPath;break;
|
|
||||||
case DEFAULTPATH_USERDICTIONARY: break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
SAL_WARN( "unotools.config", "invalid index to load a default path" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SvtDefaultOptions_Impl::~SvtDefaultOptions_Impl()
|
|
||||||
{
|
|
||||||
if ( IsModified() )
|
|
||||||
Commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// class SvtDefaultOptions -----------------------------------------------
|
|
||||||
namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; }
|
|
||||||
|
|
||||||
SvtDefaultOptions::SvtDefaultOptions()
|
|
||||||
{
|
|
||||||
// Global access, must be guarded (multithreading)
|
|
||||||
::osl::MutexGuard aGuard( lclMutex::get() );
|
|
||||||
pImpl = g_pOptions.lock();
|
|
||||||
if ( !pImpl )
|
|
||||||
{
|
|
||||||
pImpl = std::make_shared<SvtDefaultOptions_Impl>();
|
|
||||||
g_pOptions = pImpl;
|
|
||||||
ItemHolder1::holdConfigItem(EItem::DefaultOptions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SvtDefaultOptions::~SvtDefaultOptions()
|
|
||||||
{
|
|
||||||
// Global access, must be guarded (multithreading)
|
|
||||||
::osl::MutexGuard aGuard( lclMutex::get() );
|
|
||||||
pImpl.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
OUString SvtDefaultOptions::GetDefaultPath( SvtPathOptions::Paths nId ) const
|
|
||||||
{
|
|
||||||
return pImpl->GetDefaultPath( nId );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -125,10 +125,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
|
|||||||
rItem.pItem.reset( new SvtCompatibilityOptions() );
|
rItem.pItem.reset( new SvtCompatibilityOptions() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EItem::DefaultOptions :
|
|
||||||
rItem.pItem.reset( new SvtDefaultOptions() );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EItem::EventConfig :
|
case EItem::EventConfig :
|
||||||
//rItem.pItem.reset( new GlobalEventConfig() );
|
//rItem.pItem.reset( new GlobalEventConfig() );
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user