for testing allow disabling configmgr for time critical paths

Change-Id: I08021f18d53e1748927f8847649994f95252bbc2
Reviewed-on: https://gerrit.libreoffice.org/17844
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 910b487..ea3a5f9 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1294,18 +1294,24 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v
                                LanguageType eLang = pImpEditEngine->GetLanguage( EditPaM( aStart.GetNode(), aStart.GetIndex()+1));
                                LanguageTag aLanguageTag( eLang);

                                if (!pImpEditEngine->xLocaleDataWrapper.isInitialized())
                                    pImpEditEngine->xLocaleDataWrapper.init( SvtSysLocale().GetLocaleData().getComponentContext(), aLanguageTag);
                                else
                                    pImpEditEngine->xLocaleDataWrapper.changeLocale( aLanguageTag);
                                if (!pImpEditEngine->pLocaleDataWrapper)
                                    pImpEditEngine->pLocaleDataWrapper = new OnDemandLocaleDataWrapper;

                                if (!pImpEditEngine->xTransliterationWrapper.isInitialized())
                                    pImpEditEngine->xTransliterationWrapper.init( SvtSysLocale().GetLocaleData().getComponentContext(), eLang, i18n::TransliterationModules_IGNORE_CASE);
                                if (!pImpEditEngine->pLocaleDataWrapper->isInitialized())
                                    pImpEditEngine->pLocaleDataWrapper->init( SvtSysLocale().GetLocaleData().getComponentContext(), aLanguageTag);
                                else
                                    pImpEditEngine->xTransliterationWrapper.changeLocale( eLang);
                                    pImpEditEngine->pLocaleDataWrapper->changeLocale( aLanguageTag);

                                const ::utl::TransliterationWrapper* pTransliteration = pImpEditEngine->xTransliterationWrapper.get();
                                Sequence< i18n::CalendarItem2 > xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarDays();
                                if (!pImpEditEngine->pTransliterationWrapper)
                                    pImpEditEngine->pTransliterationWrapper = new OnDemandTransliterationWrapper;

                                if (!pImpEditEngine->pTransliterationWrapper->isInitialized())
                                    pImpEditEngine->pTransliterationWrapper->init( SvtSysLocale().GetLocaleData().getComponentContext(), eLang, i18n::TransliterationModules_IGNORE_CASE);
                                else
                                    pImpEditEngine->pTransliterationWrapper->changeLocale( eLang);

                                const ::utl::TransliterationWrapper* pTransliteration = pImpEditEngine->pTransliterationWrapper->get();
                                Sequence< i18n::CalendarItem2 > xItem = pImpEditEngine->pLocaleDataWrapper->get()->getDefaultCalendarDays();
                                sal_Int32 nCount = xItem.getLength();
                                const i18n::CalendarItem2* pArr = xItem.getArray();
                                for( sal_Int32 n = 0; n <= nCount; ++n )
@@ -1320,7 +1326,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v

                                if ( aComplete.isEmpty() )
                                {
                                    xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarMonths();
                                    xItem = pImpEditEngine->pLocaleDataWrapper->get()->getDefaultCalendarMonths();
                                    sal_Int32 nMonthCount = xItem.getLength();
                                    const i18n::CalendarItem2* pMonthArr = xItem.getArray();
                                    for( sal_Int32 n = 0; n <= nMonthCount; ++n )
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 793a85e..5ce5524 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -464,8 +464,8 @@ private:

    LanguageType        eDefLanguage;

    OnDemandLocaleDataWrapper       xLocaleDataWrapper;
    OnDemandTransliterationWrapper  xTransliterationWrapper;
    OnDemandLocaleDataWrapper*       pLocaleDataWrapper;
    OnDemandTransliterationWrapper*  pTransliterationWrapper;

    // For Formatting / Update ....
    boost::ptr_vector<DeletedNodeInfo> aDeletedNodes;
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 8269dae..9dec70e 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -129,6 +129,8 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
    nStretchY           = 100;

    eDefLanguage        = LANGUAGE_DONTKNOW;
    pLocaleDataWrapper  = 0;
    pTransliterationWrapper = 0;
    maBackgroundColor   = COL_AUTO;

    nAsianCompressionMode = text::CharacterCompressionType::NONE;
@@ -182,6 +184,8 @@ ImpEditEngine::~ImpEditEngine()
    delete pCTLOptions;
    if ( bOwnerOfRefDev )
        pRefDev.disposeAndClear();
    delete pLocaleDataWrapper;
    delete pTransliterationWrapper;
    delete pSpellInfo;
}

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 99ad41e..b44355f 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <comphelper/processfactory.hxx>
#include <tools/mapunit.hxx>
#include <unotools/configmgr.hxx>

#include <editeng/unonrule.hxx>

@@ -99,8 +100,10 @@ SvxNumberType::~SvxNumberType()

OUString SvxNumberType::GetNumStr( sal_uLong nNo ) const
{
    const LanguageTag& rLang = Application::GetSettings().GetLanguageTag();
    return GetNumStr( nNo, rLang.getLocale() );
    LanguageTag aLang = utl::ConfigManager::IsAvoidConfig() ?
        LanguageTag("en-US") :
        Application::GetSettings().GetLanguageTag();
    return GetNumStr( nNo, aLang.getLocale() );
}

OUString SvxNumberType::GetNumStr( sal_uLong nNo, const css::lang::Locale& rLocale ) const
diff --git a/i18nutil/Library_i18nutil.mk b/i18nutil/Library_i18nutil.mk
index 1c5837c..4dcfbdd 100644
--- a/i18nutil/Library_i18nutil.mk
+++ b/i18nutil/Library_i18nutil.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_Library_add_defs,i18nutil,\
))

$(eval $(call gb_Library_use_libraries,i18nutil,\
	utl \
	i18nlangtag \
	comphelper \
	cppu \
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx
index 73993bf..c61bac6 100644
--- a/i18nutil/source/utility/paper.cxx
+++ b/i18nutil/source/utility/paper.cxx
@@ -30,6 +30,7 @@

#include <utility>
#include <cstdlib>
#include <unotools/configmgr.hxx>

#ifdef UNX
#include <stdio.h>
@@ -207,6 +208,9 @@ long PaperInfo::sloppyFitPageDimension(long nDimension)

PaperInfo PaperInfo::getSystemDefaultPaper()
{
    if (utl::ConfigManager::IsAvoidConfig())
        return PaperInfo(PAPER_A4);

    OUString aLocaleStr = officecfg::Setup::L10N::ooSetupSystemLocale::get();

#ifdef UNX
diff --git a/include/unotools/configmgr.hxx b/include/unotools/configmgr.hxx
index 14a5abf..7c174f6 100644
--- a/include/unotools/configmgr.hxx
+++ b/include/unotools/configmgr.hxx
@@ -73,6 +73,12 @@ public:

    SAL_DLLPRIVATE void registerConfigItem(utl::ConfigItem * item);

    // Avoid using the config layer and rely on defaults
    // which is only useful for special test tool targets
    // where start-up speed is of the essence
    static bool IsAvoidConfig();
    static void EnableAvoidConfig();

private:

    ConfigManager(const ConfigManager&) SAL_DELETED_FUNCTION;
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index 607a561..5bfac57 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -28,7 +28,7 @@
#include "itemdel.hxx"
#include <svtools/asynclink.hxx>
#include <basic/sbx.hxx>

#include <unotools/configmgr.hxx>
#include <sfx2/app.hxx>
#include <sfx2/shell.hxx>
#include <sfx2/bindings.hxx>
@@ -223,9 +223,11 @@ void SfxShell::SetUndoManager( ::svl::IUndoManager *pNewUndoMgr )
    // a supported scenario (/me thinks it is not), then we would need to notify all such clients instances.

    pUndoMgr = pNewUndoMgr;
    if ( pUndoMgr )
    if (pUndoMgr && !utl::ConfigManager::IsAvoidConfig())
    {
        pUndoMgr->SetMaxUndoActionCount(
            officecfg::Office::Common::Undo::Steps::get());
    }
}

SfxRepeatTarget* SfxShell::GetRepeatTarget() const
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index e97cb75..e39ee4c 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -28,6 +28,7 @@
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/localfilehelper.hxx>
#include <unotools/tempfile.hxx>
#include <unotools/configmgr.hxx>
#include <vcl/svapp.hxx>
#include <vcl/cvtgrf.hxx>
#include <vcl/metaact.hxx>
@@ -184,14 +185,25 @@ void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const OSt
            {
                if( !mpGlobalMgr )
                {
                    mpGlobalMgr = new GraphicManager(
                        (officecfg::Office::Common::Cache::GraphicManager::
                         TotalCacheSize::get()),
                        (officecfg::Office::Common::Cache::GraphicManager::
                         ObjectCacheSize::get()));
                    mpGlobalMgr->SetCacheTimeout(
                        officecfg::Office::Common::Cache::GraphicManager::
                        ObjectReleaseTime::get());
                    if (!utl::ConfigManager::IsAvoidConfig())
                    {
                        mpGlobalMgr = new GraphicManager(
                            (officecfg::Office::Common::Cache::GraphicManager::
                             TotalCacheSize::get()),
                            (officecfg::Office::Common::Cache::GraphicManager::
                             ObjectCacheSize::get()));
                        mpGlobalMgr->SetCacheTimeout(
                            officecfg::Office::Common::Cache::GraphicManager::
                            ObjectReleaseTime::get());
                    }
                    else
                    {
                        mpGlobalMgr = new GraphicManager(
                            20000,
                            20000);
                        mpGlobalMgr->SetCacheTimeout(
                            20000);
                    }
                }

                mpMgr = mpGlobalMgr;
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 76e75f8..c18754d 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -45,9 +45,11 @@
#include <svx/xflgrit.hxx>
#include <svx/svdoole2.hxx>
#include <svl/itempool.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/localedatawrapper.hxx>
#include <i18nlangtag/lang.h>
#include <unotools/syslocale.hxx>
#include <unotools/configmgr.hxx>
#include <svx/xflbckit.hxx>
#include <svx/extrusionbar.hxx>
#include <svx/fontworkbar.hxx>
@@ -74,9 +76,11 @@ SdrGlobalData::SdrGlobalData() :
    pResMgr(NULL),
    nExchangeFormat(0)
{

    svx::ExtrusionBar::RegisterInterface();
    svx::FontworkBar::RegisterInterface();
    if (!utl::ConfigManager::IsAvoidConfig())
    {
        svx::ExtrusionBar::RegisterInterface();
        svx::FontworkBar::RegisterInterface();
    }
}

const SvtSysLocale*         SdrGlobalData::GetSysLocale()
@@ -104,7 +108,10 @@ SdrGlobalData & GetSdrGlobalData() {

OLEObjCache::OLEObjCache()
{
    nSize = officecfg::Office::Common::Cache::DrawingEngine::OLE_Objects::get();
    if (!utl::ConfigManager::IsAvoidConfig())
        nSize = officecfg::Office::Common::Cache::DrawingEngine::OLE_Objects::get();
    else
        nSize = 100;
    pTimer = new AutoTimer();
    Link<Timer *, void> aLink = LINK(this, OLEObjCache, UnloadCheckHdl);

diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 8baffe4..ff9004e 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/embed/ElementModes.hpp>

#include <unotools/ucbstreamhelper.hxx>
#include <unotools/configmgr.hxx>

#include <svl/whiter.hxx>
#include <svx/xit.hxx>
@@ -174,9 +175,12 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe

    mbDisableTextEditUsesCommonUndoManager = false;

    mnCharCompressType =
        officecfg::Office::Common::AsianLayout::CompressCharacterDistance::
        get();
    if (!utl::ConfigManager::IsAvoidConfig())
        mnCharCompressType =
            officecfg::Office::Common::AsianLayout::CompressCharacterDistance::
            get();
    else
        mnCharCompressType = 0;

#ifdef OSL_LITENDIAN
    nStreamNumberFormat=SvStreamEndian::LITTLE;
@@ -714,7 +718,11 @@ void SdrModel::SetTextDefaults( SfxItemPool* pItemPool, sal_uIntPtr nDefTextHgt 
    SvxFontItem aSvxFontItem( EE_CHAR_FONTINFO) ;
    SvxFontItem aSvxFontItemCJK(EE_CHAR_FONTINFO_CJK);
    SvxFontItem aSvxFontItemCTL(EE_CHAR_FONTINFO_CTL);
    sal_uInt16 nLanguage(Application::GetSettings().GetLanguageTag().getLanguageType());
    sal_uInt16 nLanguage;
    if (!utl::ConfigManager::IsAvoidConfig())
        nLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
    else
        nLanguage = LANGUAGE_ENGLISH_US;

    // get DEFAULTFONT_LATIN_TEXT and set at pool as dynamic default
    vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::LATIN_TEXT, nLanguage, GetDefaultFontFlags::OnlyOne, 0));
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 1d3962a..9e78587 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -123,6 +123,7 @@
#include <tools/globname.hxx>
#include <tox.hxx>
#include <unotools/charclass.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/collatorwrapper.hxx>
#include <unotools/syslocale.hxx>
#include <unotools/transliterationwrapper.hxx>
@@ -740,9 +741,16 @@ void _InitCore()

    pGlobalOLEExcludeList = new std::vector<SvGlobalName*>;

    const SvxSwAutoFormatFlags& rAFlags = SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags();
    SwDoc::mpACmpltWords = new SwAutoCompleteWord( rAFlags.nAutoCmpltListLen,
    if (!utl::ConfigManager::IsAvoidConfig())
    {
        const SvxSwAutoFormatFlags& rAFlags = SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags();
        SwDoc::mpACmpltWords = new SwAutoCompleteWord( rAFlags.nAutoCmpltListLen,
                                            rAFlags.nAutoCmpltWordLen );
    }
    else
    {
        SwDoc::mpACmpltWords = new SwAutoCompleteWord( 0, 0 );
    }
}

void _FinitCore()
@@ -855,7 +863,9 @@ void SwCalendarWrapper::LoadDefaultCalendar( sal_uInt16 eLang )

LanguageType GetAppLanguage()
{
    return Application::GetSettings().GetLanguageTag().getLanguageType();
    if (!utl::ConfigManager::IsAvoidConfig())
        return Application::GetSettings().GetLanguageTag().getLanguageType();
    return LANGUAGE_ENGLISH_US;
}

const LanguageTag& GetAppLanguageTag()
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 6970d1f..e9cb58a 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -26,6 +26,7 @@
#include <editeng/forbiddencharacterstable.hxx>
#include <svx/svdmodel.hxx>
#include <unotools/compatibility.hxx>
#include <unotools/configmgr.hxx>
#include <drawdoc.hxx>
#include <swmodule.hxx>
#include <linkenum.hxx>
@@ -92,19 +93,36 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
    // Note: Any non-hidden compatibility flag should obtain its default
    // by asking SvtCompatibilityOptions, see below.

    const SvtCompatibilityOptions aOptions;
    mbParaSpaceMax                      = aOptions.IsAddSpacing();
    mbParaSpaceMaxAtPages               = aOptions.IsAddSpacingAtPages();
    mbTabCompat                         = !aOptions.IsUseOurTabStops();
    mbUseVirtualDevice                  = !aOptions.IsUsePrtDevice();
    mbAddExternalLeading                = !aOptions.IsNoExtLeading();
    mbOldLineSpacing                    = aOptions.IsUseLineSpacing();
    mbAddParaSpacingToTableCells        = aOptions.IsAddTableSpacing();
    mbUseFormerObjectPos                = aOptions.IsUseObjectPositioning();
    mbUseFormerTextWrapping             = aOptions.IsUseOurTextWrapping();
    mbConsiderWrapOnObjPos              = aOptions.IsConsiderWrappingStyle();
    if (!utl::ConfigManager::IsAvoidConfig())
    {
        const SvtCompatibilityOptions aOptions;
        mbParaSpaceMax                      = aOptions.IsAddSpacing();
        mbParaSpaceMaxAtPages               = aOptions.IsAddSpacingAtPages();
        mbTabCompat                         = !aOptions.IsUseOurTabStops();
        mbUseVirtualDevice                  = !aOptions.IsUsePrtDevice();
        mbAddExternalLeading                = !aOptions.IsNoExtLeading();
        mbOldLineSpacing                    = aOptions.IsUseLineSpacing();
        mbAddParaSpacingToTableCells        = aOptions.IsAddTableSpacing();
        mbUseFormerObjectPos                = aOptions.IsUseObjectPositioning();
        mbUseFormerTextWrapping             = aOptions.IsUseOurTextWrapping();
        mbConsiderWrapOnObjPos              = aOptions.IsConsiderWrappingStyle();

    mbDoNotJustifyLinesWithManualBreak      = !aOptions.IsExpandWordSpace();
        mbDoNotJustifyLinesWithManualBreak      = !aOptions.IsExpandWordSpace();
    }
    else
    {
        mbParaSpaceMax                      = false;
        mbParaSpaceMaxAtPages               = false;
        mbTabCompat                         = true;
        mbUseVirtualDevice                  = true;
        mbAddExternalLeading                = true;
        mbOldLineSpacing                    = false;
        mbAddParaSpacingToTableCells        = false;
        mbUseFormerObjectPos                = false;
        mbUseFormerTextWrapping             = false;
        mbConsiderWrapOnObjPos              = false;
        mbDoNotJustifyLinesWithManualBreak  = true;
    }

    // COMPATIBILITY FLAGS END

diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 240d2ea..8663fda 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -56,6 +56,7 @@
#include <SwUndoPageDesc.hxx>
#include <pagedeschint.hxx>
#include <tgrditem.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/syslocale.hxx>

#include <boost/scoped_ptr.hpp>
@@ -92,7 +93,7 @@ static void lcl_DefaultPageFormat( sal_uInt16 nPoolFormatId,
        nMinRight = nMinTop = nMinBottom = GetMetricVal( CM_1 );
        nMinLeft = nMinRight * 2;
    }
    else if( MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() )
    else if (!utl::ConfigManager::IsAvoidConfig() && MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() )
    {
        nMinTop = nMinBottom = nMinLeft = nMinRight = 1134; // 2 centimetres
    }
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index be310a1..3fd8614 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -37,6 +37,7 @@
#include <SwStyleNameMapper.hxx>

// Needed to load default bullet list configuration
#include <unotools/configmgr.hxx>
#include <unotools/configitem.hxx>

#include <numrule.hxx>
@@ -1412,6 +1413,9 @@ namespace numfunc

    SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
    {
        if (utl::ConfigManager::IsAvoidConfig())
            return SvxNumberFormat::LABEL_ALIGNMENT;

        SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode;
        SvtSaveOptions aSaveOptions;
        switch ( aSaveOptions.GetODFDefaultVersion() )
diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx
index 10130c2..3f8bd09 100644
--- a/sw/source/core/draw/drawdoc.cxx
+++ b/sw/source/core/draw/drawdoc.cxx
@@ -19,6 +19,7 @@

#include <svx/svxids.hrc>
#include <tools/stream.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/pathoptions.hxx>
#include <sot/storage.hxx>
#include <svl/intitem.hxx>
@@ -45,6 +46,8 @@ using namespace com::sun::star;

const OUString GetPalettePath()
{
    if (utl::ConfigManager::IsAvoidConfig())
        return OUString();
    SvtPathOptions aPathOpt;
    return aPathOpt.GetPalettePath();
}
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index de7796e..8037523 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -29,6 +29,7 @@
#include <hintids.hxx>
#include <tools/urlobj.hxx>
#include <unotools/tempfile.hxx>
#include <unotools/configmgr.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/msgbox.hxx>
#include <svl/lckbitem.hxx>
@@ -1213,6 +1214,8 @@ void SwDocShell::FillClass( SvGlobalName * pClassName,

void SwDocShell::SetModified( bool bSet )
{
    if (utl::ConfigManager::IsAvoidConfig())
        return;
    SfxObjectShell::SetModified( bSet );
    if( IsEnableSetModified())
    {
diff --git a/sw/source/uibase/app/docshdrw.cxx b/sw/source/uibase/app/docshdrw.cxx
index 00e7c2d..6262140 100644
--- a/sw/source/uibase/app/docshdrw.cxx
+++ b/sw/source/uibase/app/docshdrw.cxx
@@ -24,7 +24,7 @@
#include <svx/svdmodel.hxx>
#include <svx/svdoutl.hxx>
#include <svx/xtable.hxx>

#include <unotools/configmgr.hxx>
#include <docsh.hxx>
#include <doc.hxx>
#include <drawdoc.hxx>
@@ -68,7 +68,7 @@ void InitDrawModelAndDocShell(SwDocShell* pSwDocShell, SwDrawModel* pSwDrawDocum
                    {
                        pSwDocShell->PutItem(SvxColorListItem(xColorList, SID_COLOR_TABLE));
                    }
                    else
                    else if (!utl::ConfigManager::IsAvoidConfig())
                    {
                        // there wasn't one, get the standard and set to the
                        // docshell and then to the drawdocument
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
index bb46aa7..08f2f71 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -176,7 +176,10 @@ ConfigItem::ConfigItem(const OUString &rSubTree, ConfigItemMode nSetMode ) :
    m_bEnableInternalNotification(false),
    m_nInValueChange(0)
{
    if(nSetMode & ConfigItemMode::ReleaseTree)
    if (utl::ConfigManager::IsAvoidConfig())
        return;

    if (nSetMode & ConfigItemMode::ReleaseTree)
        ConfigManager::getConfigManager().addConfigItem(*this);
    else
        m_xHierarchyAccess = ConfigManager::getConfigManager().addConfigItem(*this);
@@ -1110,11 +1113,11 @@ void    ConfigItem::ClearModified()
    m_bIsModified = false;
}



Reference< XHierarchicalNameAccess> ConfigItem::GetTree()
{
    Reference< XHierarchicalNameAccess> xRet;
    if (utl::ConfigManager::IsAvoidConfig())
        return xRet;
    if(!m_xHierarchyAccess.is())
        xRet = ConfigManager::acquireTree(*this);
    else
diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx
index bf74b53..91a77ef 100644
--- a/unotools/source/config/configmgr.cxx
+++ b/unotools/source/config/configmgr.cxx
@@ -204,4 +204,16 @@ void utl::ConfigManager::doStoreConfigItems() {
    }
}

static bool bIsAvoidConfig = false;

bool utl::ConfigManager::IsAvoidConfig()
{
    return bIsAvoidConfig;
}

void utl::ConfigManager::EnableAvoidConfig()
{
    bIsAvoidConfig = true;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index ccea2c5..fd6f073 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -567,9 +567,18 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
        }
    }

    bAutoSave = officecfg::Office::Recovery::AutoSave::Enabled::get();
    nAutoSaveTime = officecfg::Office::Recovery::AutoSave::TimeIntervall::get();
    bUserAutoSave = officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get();
    if (!utl::ConfigManager::IsAvoidConfig())
    {
        bAutoSave = officecfg::Office::Recovery::AutoSave::Enabled::get();
        nAutoSaveTime = officecfg::Office::Recovery::AutoSave::TimeIntervall::get();
        bUserAutoSave = officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get();
    }
    else
    {
        bAutoSave = false;
        nAutoSaveTime = 0;
        bUserAutoSave = false;
    }
}

SvtSaveOptions_Impl::~SvtSaveOptions_Impl()
diff --git a/unotools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx
index 95282f0..ef336153 100644
--- a/unotools/source/config/viewoptions.cxx
+++ b/unotools/source/config/viewoptions.cxx
@@ -149,6 +149,9 @@ SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const OUString& sList )
        ,   m_nWriteCount( 0     )
        #endif
{
    if (utl::ConfigManager::IsAvoidConfig())
        return;

    try
    {
        m_xRoot = css::uno::Reference< css::container::XNameAccess >(
diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx
index 1790520..117d5d8 100644
--- a/unotools/source/misc/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>

#include <sal/log.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/syslocale.hxx>
#include <unotools/syslocaleoptions.hxx>
#include <comphelper/processfactory.hxx>
@@ -54,7 +55,13 @@ private:

SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL)
{
    pLocaleData = new LocaleDataWrapper( aSysLocaleOptions.GetRealLanguageTag() );
    if (utl::ConfigManager::IsAvoidConfig())
    {
        pLocaleData = NULL;
        return;
    }

    pLocaleData = new LocaleDataWrapper(aSysLocaleOptions.GetRealLanguageTag());
    setDateAcceptancePatternsConfig();

    // listen for further changes
@@ -114,6 +121,9 @@ void SvtSysLocale_Impl::setDateAcceptancePatternsConfig()

SvtSysLocale::SvtSysLocale()
{
    if (utl::ConfigManager::IsAvoidConfig())
        return;

    MutexGuard aGuard( GetMutex() );
    if ( !pImpl )
        pImpl = new SvtSysLocale_Impl;