2010-10-12 15:57:08 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-10-04 11:25:41 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
2009-10-31 00:36:06 +01:00
|
|
|
*
|
2012-10-04 11:25:41 +01:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2009-10-31 00:36:06 +01:00
|
|
|
*
|
2012-10-04 11:25:41 +01:00
|
|
|
* This file incorporates work covered by the following license notice:
|
2009-10-31 00:36:06 +01:00
|
|
|
*
|
2012-10-04 11:25:41 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2017-04-14 08:42:15 +10:00
|
|
|
#include <memory>
|
2014-10-21 23:21:37 +03:00
|
|
|
#include <config_features.h>
|
|
|
|
|
2017-06-11 20:56:30 +01:00
|
|
|
#include <svx/dialogs.hrc>
|
|
|
|
|
2017-10-23 22:43:01 +02:00
|
|
|
#include <strings.hrc>
|
|
|
|
#include <treeopt.hrc>
|
|
|
|
#include <helpids.h>
|
2011-12-16 19:50:33 -05:00
|
|
|
|
|
|
|
#include "cfgchart.hxx"
|
|
|
|
#include "connpoolconfig.hxx"
|
|
|
|
#include "connpooloptions.hxx"
|
2017-10-23 22:43:01 +02:00
|
|
|
#include <cuioptgenrl.hxx>
|
|
|
|
#include <cuitabarea.hxx>
|
|
|
|
#include <dbregister.hxx>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include "dbregisterednamesconfig.hxx"
|
2017-10-23 22:43:01 +02:00
|
|
|
#include <dialmgr.hxx>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include "fontsubs.hxx"
|
2013-06-24 21:50:23 +03:00
|
|
|
#include "optaboutconfig.hxx"
|
2011-12-16 19:50:33 -05:00
|
|
|
#include "optaccessibility.hxx"
|
2017-10-23 22:43:01 +02:00
|
|
|
#include <optasian.hxx>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include "optchart.hxx"
|
|
|
|
#include "optcolor.hxx"
|
|
|
|
#include "optctl.hxx"
|
|
|
|
#include "optfltr.hxx"
|
|
|
|
#include "optgdlg.hxx"
|
|
|
|
#include "opthtml.hxx"
|
|
|
|
#include "optinet2.hxx"
|
|
|
|
#include "optjava.hxx"
|
|
|
|
#include "optjsearch.hxx"
|
2017-10-23 22:43:01 +02:00
|
|
|
#include <optlingu.hxx>
|
2014-11-27 11:53:42 +02:00
|
|
|
#if HAVE_FEATURE_OPENCL
|
2014-11-26 22:30:33 +02:00
|
|
|
#include "optopencl.hxx"
|
2014-11-27 11:53:42 +02:00
|
|
|
#endif
|
2017-10-23 22:43:01 +02:00
|
|
|
#include <optpath.hxx>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include "optsave.hxx"
|
|
|
|
#include "optupdt.hxx"
|
2012-11-29 13:05:39 +01:00
|
|
|
#include "personalization.hxx"
|
2017-10-23 22:43:01 +02:00
|
|
|
#include <treeopt.hxx>
|
2013-08-12 13:53:09 +02:00
|
|
|
#include "optbasic.hxx"
|
2011-12-16 19:50:33 -05:00
|
|
|
|
|
|
|
#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
|
2013-01-31 10:31:47 +02:00
|
|
|
#include <com/sun/star/awt/ContainerWindowProvider.hpp>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include <com/sun/star/awt/XControl.hpp>
|
|
|
|
#include <com/sun/star/awt/PosSize.hpp>
|
2012-12-14 12:58:00 +02:00
|
|
|
#include <com/sun/star/frame/Desktop.hpp>
|
2012-09-04 14:56:48 +02:00
|
|
|
#include <com/sun/star/frame/ModuleManager.hpp>
|
2017-02-06 17:08:38 +01:00
|
|
|
#include <com/sun/star/frame/UnknownModuleException.hpp>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
|
2013-05-13 10:43:34 +02:00
|
|
|
#include <com/sun/star/linguistic2/LinguProperties.hpp>
|
2013-05-13 13:51:44 +02:00
|
|
|
#include <com/sun/star/setup/UpdateCheck.hpp>
|
2013-09-13 01:01:52 +05:30
|
|
|
#include <comphelper/getexpandeduri.hxx>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include <comphelper/processfactory.hxx>
|
2013-03-26 10:18:14 +01:00
|
|
|
#include <editeng/langitem.hxx>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include <editeng/optitems.hxx>
|
|
|
|
#include <editeng/unolingu.hxx>
|
2009-10-31 00:36:06 +01:00
|
|
|
#include <linguistic/misc.hxx>
|
2017-06-14 09:35:26 +02:00
|
|
|
#include <o3tl/make_unique.hxx>
|
2012-07-25 19:06:42 +02:00
|
|
|
#include <officecfg/Office/OptionsDialog.hxx>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include <osl/module.hxx>
|
|
|
|
#include <osl/process.h>
|
|
|
|
#include <rtl/bootstrap.hxx>
|
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
#include <sfx2/module.hxx>
|
|
|
|
#include <sfx2/printopt.hxx>
|
|
|
|
#include <sfx2/shell.hxx>
|
|
|
|
#include <sfx2/tplpitem.hxx>
|
|
|
|
#include <sfx2/viewsh.hxx>
|
|
|
|
#include <svl/languageoptions.hxx>
|
2009-10-31 00:36:06 +01:00
|
|
|
#include <svtools/helpopt.hxx>
|
2016-11-26 19:41:35 +01:00
|
|
|
#include <svtools/miscopt.hxx>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include <svx/drawitem.hxx>
|
|
|
|
#include <svx/xtable.hxx>
|
|
|
|
#include <svx/xpool.hxx>
|
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#include <unotools/linguprops.hxx>
|
|
|
|
#include <unotools/misccfg.hxx>
|
2009-10-31 00:36:06 +01:00
|
|
|
#include <unotools/moduleoptions.hxx>
|
|
|
|
#include <unotools/optionsdlg.hxx>
|
2011-12-16 19:50:33 -05:00
|
|
|
#include <unotools/viewoptions.hxx>
|
|
|
|
#include <vcl/help.hxx>
|
2013-03-05 14:42:07 +00:00
|
|
|
#include <vcl/layout.hxx>
|
2009-10-31 00:36:06 +01:00
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#include <vcl/waitobj.hxx>
|
2014-01-02 23:52:37 +01:00
|
|
|
#include <vcl/settings.hxx>
|
2017-10-23 22:43:01 +02:00
|
|
|
#include <svtools/treelistentry.hxx>
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2010-04-13 17:55:14 +02:00
|
|
|
#ifdef LINUX
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif
|
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::frame;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::linguistic2;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::util;
|
|
|
|
|
2015-11-10 10:13:27 +01:00
|
|
|
LastPageSaver* OfaTreeOptionsDialog::pLastPageSaver = nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
// some stuff for easier changes for SvtViewOptions
|
2016-11-25 16:31:10 +01:00
|
|
|
static char const VIEWOPT_DATANAME[] = "page data";
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2013-09-26 08:30:52 +02:00
|
|
|
static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const OUString& rData )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-05-19 17:18:38 +02:00
|
|
|
rOpt.SetUserItem( VIEWOPT_DATANAME, Any( rData ) );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2013-09-26 08:30:52 +02:00
|
|
|
static inline OUString GetViewOptUserItem( const SvtViewOptions& rOpt )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) );
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aUserData;
|
2009-10-31 00:36:06 +01:00
|
|
|
aAny >>= aUserData;
|
|
|
|
|
2013-09-26 08:30:52 +02:00
|
|
|
return aUserData;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct ModuleToGroupNameMap_Impl
|
|
|
|
{
|
|
|
|
const char* m_pModule;
|
2013-09-08 17:34:06 +01:00
|
|
|
OUString m_sGroupName;
|
|
|
|
sal_uInt16 m_nNodeId;
|
2009-10-31 00:36:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static ModuleToGroupNameMap_Impl ModuleMap[] =
|
|
|
|
{
|
2013-09-08 17:34:06 +01:00
|
|
|
{ "ProductName", OUString(), SID_GENERAL_OPTIONS },
|
|
|
|
{ "LanguageSettings", OUString(), SID_LANGUAGE_OPTIONS },
|
|
|
|
{ "Internet", OUString(), SID_INET_DLG },
|
|
|
|
{ "LoadSave", OUString(), SID_FILTER_DLG },
|
|
|
|
{ "Writer", OUString(), SID_SW_EDITOPTIONS },
|
|
|
|
{ "WriterWeb", OUString(), SID_SW_ONLINEOPTIONS },
|
|
|
|
{ "Math", OUString(), SID_SM_EDITOPTIONS },
|
|
|
|
{ "Calc", OUString(), SID_SC_EDITOPTIONS },
|
|
|
|
{ "Impress", OUString(), SID_SD_EDITOPTIONS },
|
|
|
|
{ "Draw", OUString(), SID_SD_GRAPHIC_OPTIONS },
|
|
|
|
{ "Charts", OUString(), SID_SCH_EDITOPTIONS },
|
|
|
|
{ "Base", OUString(), SID_SB_STARBASEOPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2015-11-10 10:13:27 +01:00
|
|
|
{ nullptr, OUString(), 0xFFFF }
|
2009-10-31 00:36:06 +01:00
|
|
|
};
|
|
|
|
|
2013-09-26 08:30:52 +02:00
|
|
|
static void setGroupName( const OUString& rModule, const OUString& rGroupName )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nIndex = 0;
|
2009-10-31 00:36:06 +01:00
|
|
|
while ( ModuleMap[ nIndex ].m_pModule )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sTemp =
|
|
|
|
OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule );
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( sTemp == rModule )
|
|
|
|
{
|
|
|
|
ModuleMap[ nIndex ].m_sGroupName = rGroupName;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++nIndex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-26 08:30:52 +02:00
|
|
|
static OUString getGroupName( const OUString& rModule, bool bForced )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2013-09-26 08:30:52 +02:00
|
|
|
OUString sGroupName;
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nIndex = 0;
|
2009-10-31 00:36:06 +01:00
|
|
|
while ( ModuleMap[ nIndex ].m_pModule )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sTemp =
|
|
|
|
OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule );
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( sTemp == rModule )
|
|
|
|
{
|
|
|
|
sGroupName = ModuleMap[ nIndex ].m_sGroupName;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++nIndex;
|
|
|
|
}
|
|
|
|
|
2013-09-26 08:30:52 +02:00
|
|
|
if ( sGroupName.isEmpty() && bForced )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-10-05 10:07:15 +02:00
|
|
|
if ( rModule == "Writer" )
|
2017-06-11 20:56:30 +01:00
|
|
|
sGroupName = CuiResId(SID_SW_EDITOPTIONS_RES[0].first);
|
2012-10-05 10:07:15 +02:00
|
|
|
else if ( rModule == "WriterWeb" )
|
2017-06-11 20:56:30 +01:00
|
|
|
sGroupName = CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first);
|
2012-10-05 10:07:15 +02:00
|
|
|
else if ( rModule == "Calc" )
|
2017-06-11 20:56:30 +01:00
|
|
|
sGroupName = CuiResId(SID_SC_EDITOPTIONS_RES[0].first);
|
2012-10-05 10:07:15 +02:00
|
|
|
else if ( rModule == "Impress" )
|
2017-06-11 20:56:30 +01:00
|
|
|
sGroupName = CuiResId(SID_SD_EDITOPTIONS_RES[0].first);
|
2012-10-05 10:07:15 +02:00
|
|
|
else if ( rModule == "Draw" )
|
2017-06-11 20:56:30 +01:00
|
|
|
sGroupName = CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first);
|
2012-10-05 10:07:15 +02:00
|
|
|
else if ( rModule == "Math" )
|
2017-06-11 20:56:30 +01:00
|
|
|
sGroupName = CuiResId(SID_SM_EDITOPTIONS_RES[0].first);
|
2012-10-05 10:07:15 +02:00
|
|
|
else if ( rModule == "Base" )
|
2017-06-11 20:56:30 +01:00
|
|
|
sGroupName = CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
return sGroupName;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void deleteGroupNames()
|
|
|
|
{
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nIndex = 0;
|
2009-10-31 00:36:06 +01:00
|
|
|
while ( ModuleMap[ nIndex ].m_pModule )
|
2014-11-12 14:24:10 +05:30
|
|
|
ModuleMap[ nIndex++ ].m_sGroupName.clear();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
static sal_uInt16 getGroupNodeId( const OUString& rModule )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nNodeId = 0xFFFF, nIndex = 0;
|
2009-10-31 00:36:06 +01:00
|
|
|
while ( ModuleMap[ nIndex ].m_pModule )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sTemp =
|
|
|
|
OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule );
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( sTemp == rModule )
|
|
|
|
{
|
|
|
|
nNodeId = ModuleMap[ nIndex ].m_nNodeId;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++nIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nNodeId;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MailMergeCfg_Impl : public utl::ConfigItem
|
|
|
|
{
|
2015-03-11 16:14:47 +01:00
|
|
|
private:
|
2009-10-31 00:36:06 +01:00
|
|
|
friend class SvxEMailTabPage;
|
|
|
|
// variables
|
2014-04-16 11:39:08 +02:00
|
|
|
bool bIsEmailSupported;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void ImplCommit() override;
|
2015-03-11 16:14:47 +01:00
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
public:
|
|
|
|
MailMergeCfg_Impl();
|
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void Notify( const css::uno::Sequence< OUString >& _rPropertyNames) override;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2014-04-16 11:39:08 +02:00
|
|
|
bool IsEmailSupported() const {return bIsEmailSupported;}
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
MailMergeCfg_Impl::MailMergeCfg_Impl() :
|
2012-10-05 10:07:15 +02:00
|
|
|
utl::ConfigItem("Office.Writer/MailMergeWizard"),
|
2014-04-16 11:39:08 +02:00
|
|
|
bIsEmailSupported(false)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-11-15 12:17:19 +02:00
|
|
|
Sequence<OUString> aNames { "EMailSupported" };
|
2009-10-31 00:36:06 +01:00
|
|
|
const Sequence< Any > aValues = GetProperties(aNames);
|
|
|
|
const Any* pValues = aValues.getConstArray();
|
|
|
|
if(aValues.getLength() && pValues[0].hasValue())
|
|
|
|
pValues[0] >>= bIsEmailSupported;
|
|
|
|
}
|
|
|
|
|
2015-03-11 16:14:47 +01:00
|
|
|
void MailMergeCfg_Impl::ImplCommit()
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-07-28 14:18:40 +02:00
|
|
|
void MailMergeCfg_Impl::Notify( const css::uno::Sequence< OUString >& )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
//typedef SfxTabPage* (*FNCreateTabPage)( vcl::Window *pParent, const SfxItemSet &rAttrSet );
|
2015-04-17 13:51:33 +01:00
|
|
|
VclPtr<SfxTabPage> CreateGeneralTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-11-10 10:13:27 +01:00
|
|
|
CreateTabPage fnCreate = nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
switch(nId)
|
|
|
|
{
|
|
|
|
case RID_SFXPAGE_SAVE: fnCreate = &SvxSaveTabPage::Create; break;
|
|
|
|
case RID_SFXPAGE_PATH: fnCreate = &SvxPathTabPage::Create; break;
|
|
|
|
case RID_SFXPAGE_GENERAL: fnCreate = &SvxGeneralTabPage::Create; break;
|
|
|
|
case RID_SFXPAGE_PRINTOPTIONS: fnCreate = &SfxCommonPrintOptionsTabPage::Create; break;
|
|
|
|
case OFA_TP_LANGUAGES: fnCreate = &OfaLanguagesTabPage::Create; break;
|
|
|
|
case RID_SFXPAGE_LINGU: fnCreate = &SvxLinguTabPage::Create; break;
|
|
|
|
case OFA_TP_VIEW: fnCreate = &OfaViewTabPage::Create; break;
|
|
|
|
case OFA_TP_MISC: fnCreate = &OfaMiscTabPage::Create; break;
|
|
|
|
case RID_SVXPAGE_ASIAN_LAYOUT: fnCreate = &SvxAsianLayoutPage::Create; break;
|
|
|
|
case RID_SVX_FONT_SUBSTITUTION: fnCreate = &SvxFontSubstTabPage::Create; break;
|
|
|
|
case RID_SVXPAGE_INET_PROXY: fnCreate = &SvxProxyTabPage::Create; break;
|
|
|
|
case RID_SVXPAGE_INET_SECURITY: fnCreate = &SvxSecurityTabPage::Create; break;
|
|
|
|
case RID_SVXPAGE_INET_MAIL: fnCreate = &SvxEMailTabPage::Create; break;
|
2012-11-29 13:05:39 +01:00
|
|
|
case RID_SVXPAGE_PERSONALIZATION: fnCreate = &SvxPersonalizationTabPage::Create; break;
|
2009-10-31 00:36:06 +01:00
|
|
|
case RID_SVXPAGE_COLORCONFIG: fnCreate = &SvxColorOptionsTabPage::Create; break;
|
|
|
|
case RID_OFAPAGE_HTMLOPT: fnCreate = &OfaHtmlTabPage::Create; break;
|
|
|
|
case SID_OPTFILTER_MSOFFICE: fnCreate = &OfaMSFilterTabPage::Create; break;
|
|
|
|
case RID_OFAPAGE_MSFILTEROPT2: fnCreate = &OfaMSFilterTabPage2::Create; break;
|
|
|
|
case RID_SVXPAGE_JSEARCH_OPTIONS: fnCreate = &SvxJSearchOptionsPage::Create ; break;
|
|
|
|
case SID_SB_CONNECTIONPOOLING: fnCreate = &::offapp::ConnectionPoolOptionsPage::Create; break;
|
2015-04-30 07:15:55 +03:00
|
|
|
case SID_SB_DBREGISTEROPTIONS: fnCreate = &svx::DbRegistrationOptionsPage::Create; break;
|
2009-10-31 00:36:06 +01:00
|
|
|
case RID_SVXPAGE_ACCESSIBILITYCONFIG: fnCreate = &SvxAccessibilityOptionsTabPage::Create; break;
|
|
|
|
case RID_SVXPAGE_OPTIONS_CTL: fnCreate = &SvxCTLOptionsPage::Create ; break;
|
|
|
|
case RID_SVXPAGE_OPTIONS_JAVA: fnCreate = &SvxJavaOptionsPage::Create ; break;
|
2014-11-27 11:53:42 +02:00
|
|
|
#if HAVE_FEATURE_OPENCL
|
2014-11-26 22:30:33 +02:00
|
|
|
case RID_SVXPAGE_OPENCL: fnCreate = &SvxOpenCLTabPage::Create ; break;
|
2014-11-27 11:53:42 +02:00
|
|
|
#endif
|
2009-10-31 00:36:06 +01:00
|
|
|
case RID_SVXPAGE_ONLINEUPDATE: fnCreate = &SvxOnlineUpdateTabPage::Create; break;
|
|
|
|
case RID_OPTPAGE_CHART_DEFCOLORS: fnCreate = &SvxDefaultColorOptPage::Create; break;
|
2014-10-21 23:21:37 +03:00
|
|
|
#if HAVE_FEATURE_SCRIPTING
|
2013-08-12 13:53:09 +02:00
|
|
|
case RID_SVXPAGE_BASICIDE_OPTIONS: fnCreate = &SvxBasicIDEOptionsPage::Create; break;
|
2013-09-03 10:54:49 +03:00
|
|
|
#endif
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2015-04-17 13:51:33 +01:00
|
|
|
VclPtr<SfxTabPage> pRet = fnCreate ? (*fnCreate)( pParent, &rSet ) : nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct OptionsMapping_Impl
|
|
|
|
{
|
|
|
|
const char* m_pGroupName;
|
|
|
|
const char* m_pPageName;
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 m_nPageId;
|
2009-10-31 00:36:06 +01:00
|
|
|
};
|
|
|
|
|
2010-12-12 09:17:59 +01:00
|
|
|
static OptionsMapping_Impl const OptionsMap_Impl[] =
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
// GROUP PAGE PAGE-ID
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "ProductName", nullptr, SID_GENERAL_OPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "ProductName", "UserData", RID_SFXPAGE_GENERAL },
|
|
|
|
{ "ProductName", "General", OFA_TP_MISC },
|
|
|
|
{ "ProductName", "View", OFA_TP_VIEW },
|
|
|
|
{ "ProductName", "Print", RID_SFXPAGE_PRINTOPTIONS },
|
|
|
|
{ "ProductName", "Paths", RID_SFXPAGE_PATH },
|
|
|
|
{ "ProductName", "Fonts", RID_SVX_FONT_SUBSTITUTION },
|
|
|
|
{ "ProductName", "Security", RID_SVXPAGE_INET_SECURITY },
|
2012-11-29 13:05:39 +01:00
|
|
|
{ "ProductName", "Personalization", RID_SVXPAGE_PERSONALIZATION },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "ProductName", "Appearance", RID_SVXPAGE_COLORCONFIG },
|
|
|
|
{ "ProductName", "Accessibility", RID_SVXPAGE_ACCESSIBILITYCONFIG },
|
|
|
|
{ "ProductName", "Java", RID_SVXPAGE_OPTIONS_JAVA },
|
2013-08-12 13:53:09 +02:00
|
|
|
{ "ProductName", "BasicIDEOptions", RID_SVXPAGE_BASICIDE_OPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "ProductName", "OnlineUpdate", RID_SVXPAGE_ONLINEUPDATE },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "LanguageSettings", nullptr, SID_LANGUAGE_OPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "LanguageSettings", "Languages", OFA_TP_LANGUAGES },
|
|
|
|
{ "LanguageSettings", "WritingAids", RID_SFXPAGE_LINGU },
|
|
|
|
{ "LanguageSettings", "SearchingInJapanese", RID_SVXPAGE_JSEARCH_OPTIONS },
|
|
|
|
{ "LanguageSettings", "AsianLayout", RID_SVXPAGE_ASIAN_LAYOUT },
|
|
|
|
{ "LanguageSettings", "ComplexTextLayout", RID_SVXPAGE_OPTIONS_CTL },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "Internet", nullptr, SID_INET_DLG },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Internet", "Proxy", RID_SVXPAGE_INET_PROXY },
|
|
|
|
{ "Internet", "Email", RID_SVXPAGE_INET_MAIL },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "LoadSave", nullptr, SID_FILTER_DLG },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "LoadSave", "General", RID_SFXPAGE_SAVE },
|
|
|
|
{ "LoadSave", "VBAProperties", SID_OPTFILTER_MSOFFICE },
|
|
|
|
{ "LoadSave", "MicrosoftOffice", RID_OFAPAGE_MSFILTEROPT2 },
|
|
|
|
{ "LoadSave", "HTMLCompatibility", RID_OFAPAGE_HTMLOPT },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "Writer", nullptr, SID_SW_EDITOPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Writer", "General", RID_SW_TP_OPTLOAD_PAGE },
|
|
|
|
{ "Writer", "View", RID_SW_TP_CONTENT_OPT },
|
|
|
|
{ "Writer", "FormattingAids", RID_SW_TP_OPTSHDWCRSR },
|
|
|
|
{ "Writer", "Grid", RID_SVXPAGE_GRID },
|
2012-01-27 10:32:23 +01:00
|
|
|
{ "Writer", "BasicFontsWestern", RID_SW_TP_STD_FONT },
|
|
|
|
{ "Writer", "BasicFontsAsian", RID_SW_TP_STD_FONT_CJK },
|
|
|
|
{ "Writer", "BasicFontsCTL", RID_SW_TP_STD_FONT_CTL },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Writer", "Print", RID_SW_TP_OPTPRINT_PAGE },
|
|
|
|
{ "Writer", "Table", RID_SW_TP_OPTTABLE_PAGE },
|
|
|
|
{ "Writer", "Changes", RID_SW_TP_REDLINE_OPT },
|
2011-12-22 17:27:32 +01:00
|
|
|
{ "Writer", "Comparison", RID_SW_TP_COMPARISON_OPT },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Writer", "Compatibility", RID_SW_TP_OPTCOMPATIBILITY_PAGE },
|
|
|
|
{ "Writer", "AutoCaption", RID_SW_TP_OPTCAPTION_PAGE },
|
|
|
|
{ "Writer", "MailMerge", RID_SW_TP_MAILCONFIG },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "WriterWeb", nullptr, SID_SW_ONLINEOPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "WriterWeb", "View", RID_SW_TP_HTML_CONTENT_OPT },
|
|
|
|
{ "WriterWeb", "FormattingAids", RID_SW_TP_HTML_OPTSHDWCRSR },
|
|
|
|
{ "WriterWeb", "Grid", RID_SW_TP_HTML_OPTGRID_PAGE },
|
|
|
|
{ "WriterWeb", "Print", RID_SW_TP_HTML_OPTPRINT_PAGE },
|
|
|
|
{ "WriterWeb", "Table", RID_SW_TP_HTML_OPTTABLE_PAGE },
|
|
|
|
{ "WriterWeb", "Background", RID_SW_TP_BACKGROUND },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "Math", nullptr, SID_SM_EDITOPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Math", "Settings", SID_SM_TP_PRINTOPTIONS },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "Calc", nullptr, SID_SC_EDITOPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Calc", "General", SID_SC_TP_LAYOUT },
|
|
|
|
{ "Calc", "View", SID_SC_TP_CONTENT },
|
|
|
|
{ "Calc", "Calculate", SID_SC_TP_CALC },
|
2010-09-15 21:26:26 +02:00
|
|
|
{ "Calc", "Formula", SID_SC_TP_FORMULA },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Calc", "SortLists", SID_SC_TP_USERLISTS },
|
|
|
|
{ "Calc", "Changes", SID_SC_TP_CHANGES },
|
2010-10-11 18:06:02 -04:00
|
|
|
{ "Calc", "Compatibility", SID_SC_TP_COMPATIBILITY },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Calc", "Grid", SID_SC_TP_GRID },
|
|
|
|
{ "Calc", "Print", RID_SC_TP_PRINT },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "Impress", nullptr, SID_SD_EDITOPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Impress", "General", SID_SI_TP_MISC },
|
|
|
|
{ "Impress", "View", SID_SI_TP_CONTENTS },
|
|
|
|
{ "Impress", "Grid", SID_SI_TP_SNAP },
|
|
|
|
{ "Impress", "Print", SID_SI_TP_PRINT },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "Draw", nullptr, SID_SD_GRAPHIC_OPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Draw", "General", SID_SD_TP_MISC },
|
|
|
|
{ "Draw", "View", SID_SD_TP_CONTENTS },
|
|
|
|
{ "Draw", "Grid", SID_SD_TP_SNAP },
|
|
|
|
{ "Draw", "Print", SID_SD_TP_PRINT },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "Charts", nullptr, SID_SCH_EDITOPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Charts", "DefaultColors", RID_OPTPAGE_CHART_DEFCOLORS },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ "Base", nullptr, SID_SB_STARBASEOPTIONS },
|
2009-10-31 00:36:06 +01:00
|
|
|
{ "Base", "Connections", SID_SB_CONNECTIONPOOLING },
|
|
|
|
{ "Base", "Databases", SID_SB_DBREGISTEROPTIONS },
|
2017-06-11 20:56:30 +01:00
|
|
|
{ nullptr, nullptr, 0 }
|
2009-10-31 00:36:06 +01:00
|
|
|
};
|
|
|
|
|
2014-04-16 11:39:08 +02:00
|
|
|
static bool lcl_getStringFromID( sal_uInt16 _nPageId, OUString& _rGroupName, OUString& _rPageName )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-04-16 11:39:08 +02:00
|
|
|
bool bRet = false;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nIdx = 0;
|
2015-11-10 10:13:27 +01:00
|
|
|
while ( OptionsMap_Impl[nIdx].m_pGroupName != nullptr )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
if ( _nPageId == OptionsMap_Impl[nIdx].m_nPageId )
|
|
|
|
{
|
2014-04-16 11:39:08 +02:00
|
|
|
bRet = true;
|
2013-09-26 08:30:52 +02:00
|
|
|
_rGroupName = OUString::createFromAscii( OptionsMap_Impl[nIdx].m_pGroupName );
|
2015-11-10 10:13:27 +01:00
|
|
|
if ( OptionsMap_Impl[nIdx].m_pPageName != nullptr )
|
2013-09-26 08:30:52 +02:00
|
|
|
_rPageName = OUString::createFromAscii( OptionsMap_Impl[nIdx].m_pPageName );
|
2009-10-31 00:36:06 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
++nIdx;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2014-04-16 11:39:08 +02:00
|
|
|
static bool lcl_isOptionHidden( sal_uInt16 _nPageId, const SvtOptionsDialogOptions& _rOptOptions )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-04-16 11:39:08 +02:00
|
|
|
bool bIsHidden = false;
|
2013-09-26 08:30:52 +02:00
|
|
|
OUString sGroupName, sPageName;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( lcl_getStringFromID( _nPageId, sGroupName, sPageName ) )
|
|
|
|
{
|
2013-09-26 08:30:52 +02:00
|
|
|
if ( sPageName.isEmpty() )
|
2009-10-31 00:36:06 +01:00
|
|
|
bIsHidden = _rOptOptions.IsGroupHidden( sGroupName );
|
|
|
|
else
|
|
|
|
bIsHidden = _rOptOptions.IsPageHidden( sPageName, sGroupName );
|
|
|
|
}
|
|
|
|
return bIsHidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct OptionsPageInfo
|
|
|
|
{
|
2015-03-20 15:00:03 +00:00
|
|
|
ScopedVclPtr<SfxTabPage> m_pPage;
|
2009-10-31 00:36:06 +01:00
|
|
|
sal_uInt16 m_nPageId;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_sPageURL;
|
|
|
|
OUString m_sEventHdl;
|
2015-03-09 14:29:30 +02:00
|
|
|
VclPtr<ExtensionsTabPage> m_pExtPage;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2015-11-10 10:13:27 +01:00
|
|
|
explicit OptionsPageInfo( sal_uInt16 nId ) : m_pPage( nullptr ), m_nPageId( nId ), m_pExtPage( nullptr ) {}
|
2009-10-31 00:36:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct OptionsGroupInfo
|
|
|
|
{
|
2017-06-14 09:35:26 +02:00
|
|
|
std::unique_ptr<SfxItemSet> m_pInItemSet;
|
|
|
|
std::unique_ptr<SfxItemSet> m_pOutItemSet;
|
2009-10-31 00:36:06 +01:00
|
|
|
SfxShell* m_pShell; // used to create the page
|
|
|
|
SfxModule* m_pModule; // used to create the ItemSet
|
|
|
|
sal_uInt16 m_nDialogId; // Id of the former dialog
|
2014-04-16 11:39:08 +02:00
|
|
|
bool m_bLoadError; // load fails?
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_sPageURL;
|
2015-03-09 14:29:30 +02:00
|
|
|
VclPtr<ExtensionsTabPage> m_pExtPage;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
OptionsGroupInfo( SfxShell* pSh, SfxModule* pMod, sal_uInt16 nId ) :
|
2017-06-14 09:35:26 +02:00
|
|
|
m_pShell( pSh ),
|
2014-04-16 11:39:08 +02:00
|
|
|
m_pModule( pMod ), m_nDialogId( nId ), m_bLoadError( false ),
|
2015-11-10 10:13:27 +01:00
|
|
|
m_sPageURL( OUString() ), m_pExtPage( nullptr ) {}
|
2009-10-31 00:36:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#define INI_LIST() \
|
2015-11-10 10:13:27 +01:00
|
|
|
pCurrentPageEntry ( nullptr ),\
|
2009-10-31 00:36:06 +01:00
|
|
|
sTitle ( GetText() ),\
|
2017-05-18 21:14:00 +01:00
|
|
|
sNotLoadedError ( CuiResId( RID_SVXSTR_LOAD_ERROR ) ),\
|
2014-04-16 11:39:08 +02:00
|
|
|
bForgetSelection ( false ),\
|
2009-10-31 00:36:06 +01:00
|
|
|
bIsFromExtensionManager( false ), \
|
|
|
|
bIsForSetDocumentLanguage( false )
|
|
|
|
|
2014-07-15 13:08:40 +02:00
|
|
|
void OfaTreeOptionsDialog::InitWidgets()
|
|
|
|
{
|
|
|
|
get(pOkPB, "ok");
|
|
|
|
get(pBackPB, "revert");
|
|
|
|
get(pTreeLB, "pages");
|
|
|
|
get(pTabBox, "box");
|
2016-09-20 16:41:39 +02:00
|
|
|
Size aSize(pTabBox->LogicToPixel(Size(278, 259), MapUnit::MapAppFont));
|
2014-07-15 13:08:40 +02:00
|
|
|
pTabBox->set_width_request(aSize.Width());
|
|
|
|
pTabBox->set_height_request(aSize.Height() - get_action_area()->get_preferred_size().Height());
|
2015-01-15 11:27:40 +00:00
|
|
|
pTreeLB->set_width_request(pTreeLB->approximate_char_width() * 25);
|
2014-07-15 13:08:40 +02:00
|
|
|
pTreeLB->set_height_request(pTabBox->get_height_request());
|
|
|
|
}
|
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
// Ctor() with Frame -----------------------------------------------------
|
|
|
|
OfaTreeOptionsDialog::OfaTreeOptionsDialog(
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pParent,
|
2009-10-31 00:36:06 +01:00
|
|
|
const Reference< XFrame >& _xFrame,
|
|
|
|
bool bActivateLastSelection ) :
|
|
|
|
|
2014-07-15 13:08:40 +02:00
|
|
|
SfxModalDialog( pParent, "OptionsDialog", "cui/ui/optionsdialog.ui" ),
|
2009-10-31 00:36:06 +01:00
|
|
|
INI_LIST()
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
InitWidgets();
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
InitTreeAndHandler();
|
|
|
|
Initialize( _xFrame );
|
2013-04-07 12:06:47 +02:00
|
|
|
LoadExtensionOptions( OUString() );
|
2009-10-31 00:36:06 +01:00
|
|
|
if (bActivateLastSelection)
|
|
|
|
ActivateLastSelection();
|
2011-01-20 12:21:31 +01:00
|
|
|
|
2014-07-15 13:08:40 +02:00
|
|
|
pTreeLB->SetAccessibleName(GetDisplayText());
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Ctor() with ExtensionId -----------------------------------------------
|
2014-09-23 11:20:40 +02:00
|
|
|
OfaTreeOptionsDialog::OfaTreeOptionsDialog( vcl::Window* pParent, const OUString& rExtensionId ) :
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2014-07-15 13:08:40 +02:00
|
|
|
SfxModalDialog( pParent, "OptionsDialog", "cui/ui/optionsdialog.ui" ),
|
2009-10-31 00:36:06 +01:00
|
|
|
INI_LIST()
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
InitWidgets();
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2011-12-16 17:29:07 -02:00
|
|
|
bIsFromExtensionManager = ( !rExtensionId.isEmpty() );
|
2009-10-31 00:36:06 +01:00
|
|
|
InitTreeAndHandler();
|
|
|
|
LoadExtensionOptions( rExtensionId );
|
|
|
|
ActivateLastSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
|
2015-01-15 15:47:39 +02:00
|
|
|
{
|
2015-03-10 09:07:06 +02:00
|
|
|
disposeOnce();
|
2015-01-15 15:47:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OfaTreeOptionsDialog::dispose()
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-11-10 10:13:27 +01:00
|
|
|
pCurrentPageEntry = nullptr;
|
|
|
|
SvTreeListEntry* pEntry = pTreeLB ? pTreeLB->First() : nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
// first children
|
|
|
|
while(pEntry)
|
|
|
|
{
|
|
|
|
// if Child (has parent), then OptionsPageInfo
|
2014-07-15 13:08:40 +02:00
|
|
|
if(pTreeLB->GetParent(pEntry))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsPageInfo *pPageInfo = static_cast<OptionsPageInfo *>(pEntry->GetUserData());
|
2009-10-31 00:36:06 +01:00
|
|
|
if(pPageInfo->m_pPage)
|
|
|
|
{
|
|
|
|
pPageInfo->m_pPage->FillUserData();
|
2013-09-26 08:30:52 +02:00
|
|
|
OUString aPageData(pPageInfo->m_pPage->GetUserData());
|
|
|
|
if ( !aPageData.isEmpty() )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-03-29 08:43:55 +02:00
|
|
|
SvtViewOptions aTabPageOpt( EViewType::TabPage, OUString::number( pPageInfo->m_nPageId) );
|
2009-10-31 00:36:06 +01:00
|
|
|
SetViewOptUserItem( aTabPageOpt, aPageData );
|
|
|
|
}
|
2015-04-10 10:44:13 +01:00
|
|
|
pPageInfo->m_pPage.disposeAndClear();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pPageInfo->m_nPageId == RID_SFXPAGE_LINGU)
|
|
|
|
{
|
|
|
|
// write personal dictionaries
|
2016-07-10 22:08:12 +02:00
|
|
|
Reference< XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() );
|
2009-10-31 00:36:06 +01:00
|
|
|
if (xDicList.is())
|
|
|
|
{
|
|
|
|
linguistic::SaveDictionaries( xDicList );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-10 10:44:13 +01:00
|
|
|
pPageInfo->m_pExtPage.disposeAndClear();
|
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
delete pPageInfo;
|
|
|
|
}
|
2014-07-15 13:08:40 +02:00
|
|
|
pEntry = pTreeLB->Next(pEntry);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// and parents
|
2015-11-10 10:13:27 +01:00
|
|
|
pEntry = pTreeLB ? pTreeLB->First() : nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
while(pEntry)
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
if(!pTreeLB->GetParent(pEntry))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo*>(pEntry->GetUserData());
|
2015-03-09 14:29:30 +02:00
|
|
|
if ( pGroupInfo )
|
2015-04-10 10:44:13 +01:00
|
|
|
pGroupInfo->m_pExtPage.disposeAndClear();
|
2009-10-31 00:36:06 +01:00
|
|
|
delete pGroupInfo;
|
|
|
|
}
|
2014-07-15 13:08:40 +02:00
|
|
|
pEntry = pTreeLB->Next(pEntry);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
deleteGroupNames();
|
2015-03-09 14:29:30 +02:00
|
|
|
pOkPB.clear();
|
|
|
|
pBackPB.clear();
|
|
|
|
pTreeLB.clear();
|
|
|
|
pTabBox.clear();
|
2015-01-15 15:47:39 +02:00
|
|
|
SfxModalDialog::dispose();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage(
|
2013-09-26 08:30:52 +02:00
|
|
|
sal_uInt16 nId, const OUString& rPageName, sal_uInt16 nGroup )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
OptionsPageInfo* pPageInfo = new OptionsPageInfo( nId );
|
2015-11-10 10:13:27 +01:00
|
|
|
SvTreeListEntry* pParent = pTreeLB->GetEntry( nullptr, nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
DBG_ASSERT( pParent, "OfaTreeOptionsDialog::AddTabPage(): no group found" );
|
2014-07-15 13:08:40 +02:00
|
|
|
SvTreeListEntry* pEntry = pTreeLB->InsertEntry( rPageName, pParent );
|
2009-10-31 00:36:06 +01:00
|
|
|
pEntry->SetUserData( pPageInfo );
|
|
|
|
return pPageInfo;
|
|
|
|
}
|
|
|
|
|
2012-04-15 17:50:21 +02:00
|
|
|
// the ItemSet* is passed on to the dialog's ownership
|
2013-09-26 08:30:52 +02:00
|
|
|
sal_uInt16 OfaTreeOptionsDialog::AddGroup(const OUString& rGroupName,
|
2009-10-31 00:36:06 +01:00
|
|
|
SfxShell* pCreateShell,
|
|
|
|
SfxModule* pCreateModule,
|
|
|
|
sal_uInt16 nDialogId )
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
SvTreeListEntry* pEntry = pTreeLB->InsertEntry(rGroupName);
|
2009-10-31 00:36:06 +01:00
|
|
|
OptionsGroupInfo* pInfo =
|
|
|
|
new OptionsGroupInfo( pCreateShell, pCreateModule, nDialogId );
|
|
|
|
pEntry->SetUserData(pInfo);
|
|
|
|
sal_uInt16 nRet = 0;
|
2014-07-15 13:08:40 +02:00
|
|
|
pEntry = pTreeLB->First();
|
2009-10-31 00:36:06 +01:00
|
|
|
while(pEntry)
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
if(!pTreeLB->GetParent(pEntry))
|
2009-10-31 00:36:06 +01:00
|
|
|
nRet++;
|
2014-07-15 13:08:40 +02:00
|
|
|
pEntry = pTreeLB->Next(pEntry);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
return nRet - 1;
|
|
|
|
}
|
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
IMPL_LINK_NOARG(OfaTreeOptionsDialog, ShowPageHdl_Impl, SvTreeListBox*, void)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2011-12-20 13:12:34 +00:00
|
|
|
SelectHdl_Impl();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
2010-11-08 00:31:55 +01:00
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
IMPL_LINK_NOARG(OfaTreeOptionsDialog, BackHdl_Impl, Button*, void)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
if ( pCurrentPageEntry && pTreeLB->GetParent( pCurrentPageEntry ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsPageInfo* pPageInfo = static_cast<OptionsPageInfo*>(pCurrentPageEntry->GetUserData());
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( pPageInfo->m_pPage )
|
|
|
|
{
|
|
|
|
OptionsGroupInfo* pGroupInfo =
|
2015-03-28 19:00:29 +01:00
|
|
|
static_cast<OptionsGroupInfo*>(pTreeLB->GetParent( pCurrentPageEntry )->GetUserData());
|
2017-06-14 09:35:26 +02:00
|
|
|
pPageInfo->m_pPage->Reset( pGroupInfo->m_pInItemSet.get() );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
else if ( pPageInfo->m_pExtPage )
|
|
|
|
pPageInfo->m_pExtPage->ResetPage();
|
|
|
|
}
|
|
|
|
}
|
2010-11-08 00:31:55 +01:00
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
IMPL_LINK_NOARG(OfaTreeOptionsDialog, OKHdl_Impl, Button*, void)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
pTreeLB->EndSelection();
|
|
|
|
if ( pCurrentPageEntry && pTreeLB->GetParent( pCurrentPageEntry ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsPageInfo* pPageInfo = static_cast<OptionsPageInfo *>(pCurrentPageEntry->GetUserData());
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( pPageInfo->m_pPage )
|
|
|
|
{
|
|
|
|
OptionsGroupInfo* pGroupInfo =
|
2015-03-28 19:00:29 +01:00
|
|
|
static_cast<OptionsGroupInfo *>(pTreeLB->GetParent(pCurrentPageEntry)->GetUserData());
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId
|
|
|
|
&& pPageInfo->m_pPage->HasExchangeSupport() )
|
|
|
|
{
|
2017-06-14 09:35:26 +02:00
|
|
|
DeactivateRC nLeave = pPageInfo->m_pPage->DeactivatePage(pGroupInfo->m_pOutItemSet.get());
|
2016-06-05 15:15:56 +02:00
|
|
|
if ( nLeave == DeactivateRC::KeepPage )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-04-15 17:50:21 +02:00
|
|
|
// the page mustn't be left
|
2014-07-15 13:08:40 +02:00
|
|
|
pTreeLB->Select(pCurrentPageEntry);
|
2015-08-19 09:11:34 +02:00
|
|
|
return;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pPageInfo->m_pPage->Hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-15 13:08:40 +02:00
|
|
|
SvTreeListEntry* pEntry = pTreeLB->First();
|
2009-10-31 00:36:06 +01:00
|
|
|
while ( pEntry )
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
if ( pTreeLB->GetParent( pEntry ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsPageInfo* pPageInfo = static_cast<OptionsPageInfo *>(pEntry->GetUserData());
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( pPageInfo->m_pPage && !pPageInfo->m_pPage->HasExchangeSupport() )
|
|
|
|
{
|
|
|
|
OptionsGroupInfo* pGroupInfo =
|
2015-03-28 19:00:29 +01:00
|
|
|
static_cast<OptionsGroupInfo*>(pTreeLB->GetParent(pEntry)->GetUserData());
|
2017-06-14 09:35:26 +02:00
|
|
|
pPageInfo->m_pPage->FillItemSet(pGroupInfo->m_pOutItemSet.get());
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( pPageInfo->m_pExtPage )
|
|
|
|
{
|
|
|
|
pPageInfo->m_pExtPage->DeactivatePage();
|
|
|
|
pPageInfo->m_pExtPage->SavePage();
|
|
|
|
}
|
|
|
|
}
|
2014-07-15 13:08:40 +02:00
|
|
|
pEntry = pTreeLB->Next(pEntry);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
EndDialog(RET_OK);
|
|
|
|
}
|
|
|
|
|
2012-04-15 17:50:21 +02:00
|
|
|
// an opened group shall be completely visible
|
2016-10-05 07:56:12 +02:00
|
|
|
IMPL_STATIC_LINK(
|
2015-09-07 09:35:04 +02:00
|
|
|
OfaTreeOptionsDialog, ExpandedHdl_Impl, SvTreeListBox*, pBox, void )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
pBox->Update();
|
|
|
|
pBox->InitStartEntry();
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = pBox->GetHdlEntry();
|
2009-10-31 00:36:06 +01:00
|
|
|
if(pEntry && pBox->IsExpanded(pEntry))
|
|
|
|
{
|
|
|
|
sal_uInt32 nChildCount = pBox->GetChildCount( pEntry );
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pNext = pEntry;
|
2009-10-31 00:36:06 +01:00
|
|
|
for(sal_uInt32 i = 0; i < nChildCount;i++)
|
|
|
|
{
|
|
|
|
pNext = pBox->GetNextEntryInView(pNext);
|
|
|
|
if(!pNext)
|
|
|
|
{
|
|
|
|
pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Size aSz(pBox->GetOutputSizePixel());
|
|
|
|
int nHeight = pBox->GetEntryHeight();
|
|
|
|
Point aPos(pBox->GetEntryPosition(pNext));
|
|
|
|
if(aPos.Y()+nHeight > aSz.Height())
|
|
|
|
{
|
|
|
|
pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OfaTreeOptionsDialog::ApplyItemSets()
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
SvTreeListEntry* pEntry = pTreeLB->First();
|
2009-10-31 00:36:06 +01:00
|
|
|
while(pEntry)
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
if(!pTreeLB->GetParent(pEntry))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo *>(pEntry->GetUserData());
|
2009-10-31 00:36:06 +01:00
|
|
|
if(pGroupInfo->m_pOutItemSet)
|
|
|
|
{
|
|
|
|
if(pGroupInfo->m_pShell)
|
|
|
|
pGroupInfo->m_pShell->ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet);
|
|
|
|
else
|
|
|
|
ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet);
|
|
|
|
}
|
|
|
|
}
|
2014-07-15 13:08:40 +02:00
|
|
|
pEntry = pTreeLB->Next(pEntry);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OfaTreeOptionsDialog::InitTreeAndHandler()
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
pTreeLB->SetNodeDefaultImages();
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2014-07-15 13:08:40 +02:00
|
|
|
pTreeLB->SetHelpId( HID_OFADLG_TREELISTBOX );
|
|
|
|
pTreeLB->SetStyle( pTreeLB->GetStyle()|WB_HASBUTTONS | WB_HASBUTTONSATROOT |
|
2009-10-31 00:36:06 +01:00
|
|
|
WB_HASLINES | WB_HASLINESATROOT |
|
2017-08-21 09:31:14 +02:00
|
|
|
WB_CLIPCHILDREN | WB_HSCROLL );
|
|
|
|
pTreeLB->SetForceMakeVisible(true);
|
|
|
|
pTreeLB->SetQuickSearch(true);
|
2014-07-15 13:08:40 +02:00
|
|
|
pTreeLB->SetSpaceBetweenEntries( 0 );
|
2016-05-29 17:12:52 +02:00
|
|
|
pTreeLB->SetSelectionMode( SelectionMode::Single );
|
2015-08-12 15:09:44 +02:00
|
|
|
pTreeLB->SetSublistOpenWithLeftRight();
|
2014-07-15 13:08:40 +02:00
|
|
|
pTreeLB->SetExpandedHdl( LINK( this, OfaTreeOptionsDialog, ExpandedHdl_Impl ) );
|
|
|
|
pTreeLB->SetSelectHdl( LINK( this, OfaTreeOptionsDialog, ShowPageHdl_Impl ) );
|
|
|
|
pBackPB->SetClickHdl( LINK( this, OfaTreeOptionsDialog, BackHdl_Impl ) );
|
|
|
|
pOkPB->SetClickHdl( LINK( this, OfaTreeOptionsDialog, OKHdl_Impl ) );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void OfaTreeOptionsDialog::ActivatePage( sal_uInt16 nResId )
|
|
|
|
{
|
|
|
|
bIsForSetDocumentLanguage = false;
|
|
|
|
if ( nResId == OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE )
|
|
|
|
{
|
|
|
|
bIsForSetDocumentLanguage = true;
|
|
|
|
nResId = OFA_TP_LANGUAGES;
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" );
|
|
|
|
if ( !pLastPageSaver )
|
|
|
|
pLastPageSaver = new LastPageSaver;
|
2014-04-16 11:39:08 +02:00
|
|
|
bForgetSelection = true;
|
2009-10-31 00:36:06 +01:00
|
|
|
sal_uInt16 nTemp = pLastPageSaver->m_nLastPageId;
|
|
|
|
pLastPageSaver->m_nLastPageId = nResId;
|
|
|
|
ActivateLastSelection();
|
|
|
|
pLastPageSaver->m_nLastPageId = nTemp;
|
|
|
|
}
|
|
|
|
|
2013-09-26 08:30:52 +02:00
|
|
|
void OfaTreeOptionsDialog::ActivatePage( const OUString& rPageURL )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" );
|
|
|
|
if ( !pLastPageSaver )
|
|
|
|
pLastPageSaver = new LastPageSaver;
|
2014-04-16 11:39:08 +02:00
|
|
|
bForgetSelection = true;
|
2009-10-31 00:36:06 +01:00
|
|
|
pLastPageSaver->m_nLastPageId = 0;
|
|
|
|
pLastPageSaver->m_sLastPageURL_Tools = rPageURL;
|
|
|
|
ActivateLastSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OfaTreeOptionsDialog::ActivateLastSelection()
|
|
|
|
{
|
2015-11-10 10:13:27 +01:00
|
|
|
SvTreeListEntry* pEntry = nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( pLastPageSaver )
|
|
|
|
{
|
2013-09-26 08:30:52 +02:00
|
|
|
OUString sLastURL = bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr
|
2009-10-31 00:36:06 +01:00
|
|
|
: pLastPageSaver->m_sLastPageURL_Tools;
|
2013-09-26 08:30:52 +02:00
|
|
|
if ( sLastURL.isEmpty() )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
sLastURL = !bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr
|
|
|
|
: pLastPageSaver->m_sLastPageURL_Tools;
|
|
|
|
}
|
|
|
|
|
2015-04-02 18:32:36 +02:00
|
|
|
bool bMustExpand = ( INetURLObject( sLastURL ).GetProtocol() == INetProtocol::File );
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2014-07-15 13:08:40 +02:00
|
|
|
SvTreeListEntry* pTemp = pTreeLB->First();
|
2009-10-31 00:36:06 +01:00
|
|
|
while( !pEntry && pTemp )
|
|
|
|
{
|
|
|
|
// restore only selection of a leaf
|
2014-07-15 13:08:40 +02:00
|
|
|
if ( pTreeLB->GetParent( pTemp ) && pTemp->GetUserData() )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsPageInfo* pPageInfo = static_cast<OptionsPageInfo*>(pTemp->GetUserData());
|
2013-09-08 20:55:11 +02:00
|
|
|
OUString sPageURL = pPageInfo->m_sPageURL;
|
2014-12-03 20:29:58 +01:00
|
|
|
if ( bMustExpand )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2013-09-13 01:01:52 +05:30
|
|
|
sPageURL = comphelper::getExpandedUri(
|
|
|
|
comphelper::getProcessComponentContext(), sPageURL);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( ( !bIsFromExtensionManager
|
|
|
|
&& pPageInfo->m_nPageId && pPageInfo->m_nPageId == pLastPageSaver->m_nLastPageId )
|
|
|
|
|| ( !pPageInfo->m_nPageId && sLastURL == sPageURL ) )
|
|
|
|
pEntry = pTemp;
|
|
|
|
}
|
2014-07-15 13:08:40 +02:00
|
|
|
pTemp = pTreeLB->Next(pTemp);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !pEntry )
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
pEntry = pTreeLB->First();
|
|
|
|
pEntry = pTreeLB->Next(pEntry);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2014-03-21 15:48:11 +00:00
|
|
|
if ( !pEntry )
|
|
|
|
return;
|
|
|
|
|
2014-07-15 13:08:40 +02:00
|
|
|
SvTreeListEntry* pParent = pTreeLB->GetParent(pEntry);
|
|
|
|
pTreeLB->Expand(pParent);
|
|
|
|
pTreeLB->MakeVisible(pParent);
|
|
|
|
pTreeLB->MakeVisible(pEntry);
|
|
|
|
pTreeLB->Select(pEntry);
|
|
|
|
pTreeLB->GrabFocus();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2016-11-24 22:40:33 +01:00
|
|
|
bool OfaTreeOptionsDialog::EventNotify( NotifyEvent& rNEvt )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-11-26 14:53:25 +00:00
|
|
|
if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
|
2014-08-23 22:22:32 +03:00
|
|
|
const vcl::KeyCode aKeyCode = pKEvt->GetKeyCode();
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
if( aKeyCode.GetCode() == KEY_PAGEUP ||
|
|
|
|
aKeyCode.GetCode() == KEY_PAGEDOWN)
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
SvTreeListEntry* pCurEntry = pTreeLB->FirstSelected();
|
2015-11-10 10:13:27 +01:00
|
|
|
SvTreeListEntry* pTemp = nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
if(aKeyCode.GetCode() == KEY_PAGEDOWN)
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
pTemp = pTreeLB->Next( pCurEntry ) ;
|
|
|
|
if(pTemp && !pTreeLB->GetParent(pTemp))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
pTemp = pTreeLB->Next( pTemp ) ;
|
|
|
|
pTreeLB->Select(pTemp);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
pTemp = pTreeLB->Prev( pCurEntry ) ;
|
|
|
|
if(pTemp && !pTreeLB->GetParent(pTemp))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
pTemp = pTreeLB->Prev( pTemp ) ;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(pTemp)
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
if(!pTreeLB->IsExpanded(pTreeLB->GetParent(pTemp)))
|
|
|
|
pTreeLB->Expand(pTreeLB->GetParent(pTemp));
|
|
|
|
pTreeLB->MakeVisible(pTemp);
|
|
|
|
pTreeLB->Select(pTemp);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-11-24 22:40:33 +01:00
|
|
|
return SfxModalDialog::EventNotify(rNEvt);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2011-12-20 13:12:34 +00:00
|
|
|
void OfaTreeOptionsDialog::SelectHdl_Impl()
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
SvTreeListBox* pBox = pTreeLB;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2011-12-16 18:37:03 -05:00
|
|
|
if(pCurrentPageEntry == pBox->GetCurEntry())
|
|
|
|
{
|
|
|
|
pBox->EndSelection();
|
2011-12-20 13:12:34 +00:00
|
|
|
return;
|
2011-12-16 18:37:03 -05:00
|
|
|
}
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = pBox->GetCurEntry();
|
|
|
|
SvTreeListEntry* pParent = pBox->GetParent(pEntry);
|
2011-12-16 00:14:03 -05:00
|
|
|
|
|
|
|
// If the user has selected a category, automatically switch to a suitable
|
|
|
|
// default sub-page instead.
|
|
|
|
if (!pParent)
|
|
|
|
{
|
2011-12-16 18:37:03 -05:00
|
|
|
pBox->EndSelection();
|
2011-12-20 13:12:34 +00:00
|
|
|
return;
|
2011-12-16 00:14:03 -05:00
|
|
|
}
|
|
|
|
|
2011-12-16 18:37:03 -05:00
|
|
|
pBox->EndSelection();
|
|
|
|
|
2015-11-10 10:13:27 +01:00
|
|
|
TabPage* pOldPage = nullptr;
|
|
|
|
TabPage* pNewPage = nullptr;
|
2014-07-15 13:08:40 +02:00
|
|
|
OptionsPageInfo* pOptPageInfo = ( pCurrentPageEntry && pTreeLB->GetParent( pCurrentPageEntry ) )
|
2015-11-10 10:13:27 +01:00
|
|
|
? static_cast<OptionsPageInfo*>(pCurrentPageEntry->GetUserData()) : nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
if ( pOptPageInfo && pOptPageInfo->m_pPage && pOptPageInfo->m_pPage->IsVisible() )
|
|
|
|
{
|
|
|
|
pOldPage = pOptPageInfo->m_pPage;
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo*>(pTreeLB->GetParent(pCurrentPageEntry)->GetUserData());
|
2016-06-05 15:15:56 +02:00
|
|
|
DeactivateRC nLeave = DeactivateRC::LeavePage;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( RID_SVXPAGE_COLOR != pOptPageInfo->m_nPageId && pOptPageInfo->m_pPage->HasExchangeSupport() )
|
2017-06-14 09:35:26 +02:00
|
|
|
nLeave = pOptPageInfo->m_pPage->DeactivatePage( pGroupInfo->m_pOutItemSet.get() );
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2016-06-05 15:15:56 +02:00
|
|
|
if ( nLeave == DeactivateRC::KeepPage )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
// we cannot leave this page
|
|
|
|
pBox->Select( pCurrentPageEntry );
|
2011-12-20 13:12:34 +00:00
|
|
|
return;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pOptPageInfo->m_pPage->Hide();
|
|
|
|
}
|
|
|
|
else if ( pOptPageInfo && pOptPageInfo->m_pExtPage )
|
|
|
|
{
|
|
|
|
pOptPageInfo->m_pExtPage->Hide();
|
|
|
|
pOptPageInfo->m_pExtPage->DeactivatePage();
|
|
|
|
}
|
2014-07-15 13:08:40 +02:00
|
|
|
else if ( pCurrentPageEntry && !pTreeLB->GetParent( pCurrentPageEntry ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo*>(pCurrentPageEntry->GetUserData());
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( pGroupInfo && pGroupInfo->m_pExtPage )
|
|
|
|
{
|
|
|
|
pGroupInfo->m_pExtPage->Hide();
|
|
|
|
pGroupInfo->m_pExtPage->DeactivatePage();
|
|
|
|
}
|
|
|
|
}
|
2011-12-16 00:59:10 -05:00
|
|
|
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsPageInfo *pPageInfo = static_cast<OptionsPageInfo *>(pEntry->GetUserData());
|
|
|
|
OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo *>(pParent->GetUserData());
|
2011-12-16 00:59:10 -05:00
|
|
|
if(!pPageInfo->m_pPage && pPageInfo->m_nPageId > 0)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2011-12-16 00:59:10 -05:00
|
|
|
if(pGroupInfo->m_bLoadError)
|
2011-12-20 13:12:34 +00:00
|
|
|
return;
|
2011-12-16 00:59:10 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if(pGroupInfo->m_pModule /*&& !pGroupInfo->pModule->IsLoaded()*/)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2011-12-16 00:59:10 -05:00
|
|
|
SfxModule* pOldModule = pGroupInfo->m_pModule;
|
2014-04-16 11:39:08 +02:00
|
|
|
bool bIdentical = pGroupInfo->m_pModule == pGroupInfo->m_pShell;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2011-12-16 00:59:10 -05:00
|
|
|
WaitObject aWait(this);
|
|
|
|
//pGroupInfo->pModule = pGroupInfo->pModule->Load();
|
|
|
|
if(!pGroupInfo->m_pModule)
|
|
|
|
{
|
2014-04-16 11:39:08 +02:00
|
|
|
pGroupInfo->m_bLoadError = true;
|
2016-07-26 10:21:41 +01:00
|
|
|
ScopedVclPtrInstance<InfoBox>(pBox, sNotLoadedError)->Execute();
|
2011-12-20 13:12:34 +00:00
|
|
|
return;
|
2011-12-16 00:59:10 -05:00
|
|
|
}
|
|
|
|
if(bIdentical)
|
|
|
|
pGroupInfo->m_pShell = pGroupInfo->m_pModule;
|
2012-04-15 17:50:21 +02:00
|
|
|
// now test whether there was the same module in other groups, too (e. g. Text+HTML)
|
2014-07-15 13:08:40 +02:00
|
|
|
SvTreeListEntry* pTemp = pTreeLB->First();
|
2011-12-16 00:59:10 -05:00
|
|
|
while(pTemp)
|
|
|
|
{
|
2014-07-15 13:08:40 +02:00
|
|
|
if(!pTreeLB->GetParent(pTemp) && pTemp != pEntry)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-03-28 19:00:29 +01:00
|
|
|
OptionsGroupInfo* pTGInfo = static_cast<OptionsGroupInfo *>(pTemp->GetUserData());
|
2011-12-16 00:59:10 -05:00
|
|
|
if(pTGInfo->m_pModule == pOldModule)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2011-12-16 00:59:10 -05:00
|
|
|
pTGInfo->m_pModule = pGroupInfo->m_pModule;
|
|
|
|
if(bIdentical)
|
|
|
|
pTGInfo->m_pShell = pGroupInfo->m_pModule;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
2014-07-15 13:08:40 +02:00
|
|
|
pTemp = pTreeLB->Next(pTemp);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-16 00:59:10 -05:00
|
|
|
if(!pGroupInfo->m_pInItemSet)
|
|
|
|
pGroupInfo->m_pInItemSet = pGroupInfo->m_pShell
|
|
|
|
? pGroupInfo->m_pShell->CreateItemSet( pGroupInfo->m_nDialogId )
|
|
|
|
: CreateItemSet( pGroupInfo->m_nDialogId );
|
|
|
|
if(!pGroupInfo->m_pOutItemSet)
|
2017-06-14 09:35:26 +02:00
|
|
|
pGroupInfo->m_pOutItemSet = o3tl::make_unique<SfxItemSet>(
|
2011-12-16 00:59:10 -05:00
|
|
|
*pGroupInfo->m_pInItemSet->GetPool(),
|
|
|
|
pGroupInfo->m_pInItemSet->GetRanges());
|
|
|
|
}
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2016-08-23 01:08:41 +05:30
|
|
|
pPageInfo->m_pPage.disposeAndReset( ::CreateGeneralTabPage(pPageInfo->m_nPageId, pTabBox, *pGroupInfo->m_pInItemSet ) );
|
2012-11-29 12:35:21 +00:00
|
|
|
|
2016-08-23 01:08:41 +05:30
|
|
|
if(!pPageInfo->m_pPage && pGroupInfo->m_pModule)
|
|
|
|
pPageInfo->m_pPage.disposeAndReset( pGroupInfo->m_pModule->CreateTabPage(pPageInfo->m_nPageId, pTabBox, *pGroupInfo->m_pInItemSet) );
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2011-12-16 00:59:10 -05:00
|
|
|
DBG_ASSERT( pPageInfo->m_pPage, "tabpage could not created");
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( pPageInfo->m_pPage )
|
|
|
|
{
|
2017-03-29 08:43:55 +02:00
|
|
|
SvtViewOptions aTabPageOpt( EViewType::TabPage, OUString::number( pPageInfo->m_nPageId) );
|
2011-12-16 00:59:10 -05:00
|
|
|
pPageInfo->m_pPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) );
|
2017-06-14 09:35:26 +02:00
|
|
|
pPageInfo->m_pPage->Reset( pGroupInfo->m_pInItemSet.get() );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
2011-12-16 00:59:10 -05:00
|
|
|
else if ( 0 == pPageInfo->m_nPageId && !pPageInfo->m_pExtPage )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2011-12-16 00:59:10 -05:00
|
|
|
if ( !m_xContainerWinProvider.is() )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2013-01-31 10:31:47 +02:00
|
|
|
m_xContainerWinProvider = awt::ContainerWindowProvider::create( ::comphelper::getProcessComponentContext() );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2015-04-18 20:48:34 +01:00
|
|
|
pPageInfo->m_pExtPage = VclPtr<ExtensionsTabPage>::Create(
|
|
|
|
|
2014-07-15 13:08:40 +02:00
|
|
|
pTabBox, 0, pPageInfo->m_sPageURL, pPageInfo->m_sEventHdl, m_xContainerWinProvider );
|
2011-12-16 00:59:10 -05:00
|
|
|
}
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2011-12-16 00:59:10 -05:00
|
|
|
if ( pPageInfo->m_pPage )
|
|
|
|
{
|
|
|
|
if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId &&
|
|
|
|
pPageInfo->m_pPage->HasExchangeSupport())
|
|
|
|
{
|
|
|
|
pPageInfo->m_pPage->ActivatePage(*pGroupInfo->m_pOutItemSet);
|
|
|
|
}
|
|
|
|
pPageInfo->m_pPage->Show();
|
|
|
|
}
|
|
|
|
else if ( pPageInfo->m_pExtPage )
|
|
|
|
{
|
|
|
|
pPageInfo->m_pExtPage->Show();
|
|
|
|
pPageInfo->m_pExtPage->ActivatePage();
|
|
|
|
}
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2011-12-19 15:59:35 -05:00
|
|
|
{
|
2017-10-01 15:52:47 +03:00
|
|
|
OUString sTitleText = sTitle
|
|
|
|
+ " - " + pTreeLB->GetEntryText(pParent)
|
|
|
|
+ " - " + pTreeLB->GetEntryText(pEntry);
|
|
|
|
SetText(sTitleText);
|
2011-12-19 15:59:35 -05:00
|
|
|
}
|
|
|
|
|
2011-12-16 00:59:10 -05:00
|
|
|
pCurrentPageEntry = pEntry;
|
|
|
|
if ( !bForgetSelection )
|
|
|
|
{
|
|
|
|
if ( !pLastPageSaver )
|
|
|
|
pLastPageSaver = new LastPageSaver;
|
|
|
|
if ( !bIsFromExtensionManager )
|
|
|
|
pLastPageSaver->m_nLastPageId = pPageInfo->m_nPageId;
|
|
|
|
if ( pPageInfo->m_pExtPage )
|
|
|
|
{
|
|
|
|
if ( bIsFromExtensionManager )
|
|
|
|
pLastPageSaver->m_sLastPageURL_ExtMgr = pPageInfo->m_sPageURL;
|
|
|
|
else
|
|
|
|
pLastPageSaver->m_sLastPageURL_Tools = pPageInfo->m_sPageURL;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
2011-12-16 00:59:10 -05:00
|
|
|
pNewPage = pPageInfo->m_pPage;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
// restore lost focus, if necessary
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pFocusWin = Application::GetFocusWindow();
|
2009-10-31 00:36:06 +01:00
|
|
|
// if the focused window is not the options treebox and the old page has the focus
|
|
|
|
if ( pFocusWin && pFocusWin != pBox && pOldPage && pOldPage->HasChildPathFocus() )
|
|
|
|
// then set the focus to the new page or if we are on a group set the focus to the options treebox
|
|
|
|
pNewPage ? pNewPage->GrabFocus() : pBox->GrabFocus();
|
|
|
|
|
2014-05-19 16:35:40 +01:00
|
|
|
//fdo#58170 use current page's layout child HelpId, unless there isn't a
|
|
|
|
//current page
|
2014-05-19 17:54:44 +02:00
|
|
|
OString sHelpId(HID_OFADLG_TREELISTBOX);
|
2014-05-19 16:35:40 +01:00
|
|
|
if (::isLayoutEnabled(pNewPage))
|
|
|
|
{
|
2015-05-21 15:52:27 +02:00
|
|
|
vcl::Window *pFirstChild = pNewPage->GetWindow(GetWindowType::FirstChild);
|
2014-05-19 16:35:40 +01:00
|
|
|
assert(pFirstChild);
|
|
|
|
sHelpId = pFirstChild->GetHelpId();
|
|
|
|
}
|
|
|
|
pBox->SetHelpId(sHelpId);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2017-06-14 09:35:26 +02:00
|
|
|
std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2016-07-10 22:08:12 +02:00
|
|
|
Reference< XLinguProperties > xProp( LinguMgr::GetLinguPropertySet() );
|
2017-06-14 09:35:26 +02:00
|
|
|
std::unique_ptr<SfxItemSet> pRet;
|
2009-10-31 00:36:06 +01:00
|
|
|
switch(nId)
|
|
|
|
{
|
|
|
|
case SID_GENERAL_OPTIONS:
|
|
|
|
{
|
2017-06-14 09:35:26 +02:00
|
|
|
pRet = o3tl::make_unique<SfxItemSet>(
|
2014-06-27 10:26:55 +02:00
|
|
|
SfxGetpApp()->GetPool(),
|
2017-06-19 09:32:45 +02:00
|
|
|
svl::Items<
|
|
|
|
SID_HTML_MODE, SID_HTML_MODE,
|
2017-08-18 16:55:07 +02:00
|
|
|
SID_ATTR_METRIC, SID_ATTR_METRIC,
|
2017-06-19 09:32:45 +02:00
|
|
|
SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
|
|
|
|
SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER,
|
|
|
|
SID_ATTR_YEAR2000, SID_ATTR_YEAR2000>{} );
|
2009-10-31 00:36:06 +01:00
|
|
|
|
Make SfxItemSet ranges correct by construction
This is a follow-up to 45a7f5b62d0b1b21763c1c94255ef2309ea4280b "Keep WID ranges
sorted, and join adjacent ones". While SfxItemSet::MergeRange relies on the
m_pWhichRanges being sorted (and, under DBG_UTIL, asserts if they are not), the
various SfxItemSet constructors curiously only check (via assert or DBG_ASSERT)
that each individual range has an upper bound not smaller than its lower bound.
Arguably, all SfxItemSet instances should fulfill the stronger guarantees
required and checked by MergeRange.
And in many cases the ranges are statically known, so that the checking can
happen at compile time. Therefore, replace the two SfxItemSet ctors taking
explicit ranges with two other ctors that actually do proper checking. The
(templated) overload taking an svl::Items struct should be used in all cases
where the range values are statically known at compile time, while the overload
taking a std::initializer_list<Pair> is for the remaining cases (that can only
do runtime checking via assert). Most of those latter cases are simple cases
with a single range covering a single item, but a few are more complex.
(At least some of the uses of the existing SfxItemSet overload taking a
const sal_uInt16* pWhichPairTable
can probably also be strengthened, but that is left for another day.)
This commit is the first in a series of two. Apart from the manual changes to
compilerplugins/clang/store/sfxitemsetrewrite.cxx, include/svl/itemset.hxx, and
svl/source/items/itemset.cxx, it only consists of automatic rewriting of the
relevant SfxItemSet ctor calls (plus a few required manual fixes, see next).
But it does not yet check that the individual ranges are properly sorted (see
the TODO in svl::detail::validGap). That check will be enabled, and the ensuing
manual fixes will be made in a follow-up commit, to reduce the likelyhood of
accidents.
There were three cases of necessary manual intervention:
* sw/source/core/unocore/unostyle.cxx uses eAtr of enum type RES_FRMATR in
braced-init-list syntax now, so needs explicit narrowing conversion to
sal_uInt16.
* In sw/source/uibase/uiview/formatclipboard.cxx, the trailiing comma in the
definition of macro FORMAT_PAINTBRUSH_FRAME_IDS needed to be removed manually.
* In svx/source/svdraw/svdoashp.cxx, svx/source/svdraw/svdotext.cxx,
sw/source/uibase/app/docstyle.cxx, sw/source/uibase/shells/frmsh.cxx,
sw/source/uibase/shells/grfsh.cxx, and sw/source/uibase/shells/textsh1.cxx,
some comments had to be put back (see "TODO: the replaced range can contain
relevant comments" in compilerplugins/clang/store/sfxitemsetrewrite.cxx).
A few uses of the variadic form erroneously used nullptr instead of 0 for
termination. But this should have been harmless even if promoted std::nullptr_t
is larger than promoted sal_uInt16, assuming that the part of the nullptr value
that was interpreted as sal_uInt16/promoted int was all-zero bits. Similarly,
some uses made the harmless error of using 0L instead of 0.
Change-Id: I2afea97282803cb311b9321a99bb627520ef5e35
Reviewed-on: https://gerrit.libreoffice.org/38861
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-06-16 09:58:13 +02:00
|
|
|
SfxItemSet aOptSet( SfxGetpApp()->GetPool(), svl::Items<SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER>{} );
|
2014-06-27 10:26:55 +02:00
|
|
|
SfxGetpApp()->GetOptions(aOptSet);
|
2009-10-31 00:36:06 +01:00
|
|
|
pRet->Put(aOptSet);
|
|
|
|
|
|
|
|
utl::MiscCfg aMisc;
|
|
|
|
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
|
|
|
|
if ( pViewFrame )
|
|
|
|
{
|
2015-11-10 10:13:27 +01:00
|
|
|
const SfxPoolItem* pItem = nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
|
|
|
|
|
2012-04-15 17:50:21 +02:00
|
|
|
// miscellaneous - Year2000
|
2014-09-10 17:53:41 +02:00
|
|
|
if( SfxItemState::DEFAULT <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) )
|
2014-10-21 14:08:19 +02:00
|
|
|
pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast<const SfxUInt16Item*>(pItem)->GetValue() ) );
|
2009-10-31 00:36:06 +01:00
|
|
|
else
|
2011-01-14 12:41:27 +01:00
|
|
|
pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (sal_uInt16)aMisc.GetYear2000() ) );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
else
|
2011-01-14 12:41:27 +01:00
|
|
|
pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (sal_uInt16)aMisc.GetYear2000() ) );
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
|
2012-04-15 17:50:21 +02:00
|
|
|
// miscellaneous - Tabulator
|
2009-10-31 00:36:06 +01:00
|
|
|
pRet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning()));
|
|
|
|
|
2015-03-24 09:36:29 +02:00
|
|
|
SfxPrinterChangeFlags nFlag = aMisc.IsPaperSizeWarning() ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE;
|
|
|
|
nFlag |= aMisc.IsPaperOrientationWarning() ? SfxPrinterChangeFlags::CHG_ORIENTATION : SfxPrinterChangeFlags::NONE;
|
|
|
|
pRet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, static_cast<int>(nFlag) ));
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_LANGUAGE_OPTIONS :
|
|
|
|
{
|
2017-06-19 09:32:45 +02:00
|
|
|
pRet = o3tl::make_unique<SfxItemSet>(
|
|
|
|
SfxGetpApp()->GetPool(),
|
|
|
|
svl::Items<
|
2017-08-18 16:55:07 +02:00
|
|
|
SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
|
|
|
|
SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
|
2017-06-19 09:32:45 +02:00
|
|
|
SID_SET_DOCUMENT_LANGUAGE, SID_SET_DOCUMENT_LANGUAGE,
|
2017-08-18 16:55:07 +02:00
|
|
|
SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
|
|
|
|
SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
|
2017-06-19 09:32:45 +02:00
|
|
|
SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED>{});
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2012-04-15 17:50:21 +02:00
|
|
|
// for linguistic
|
2009-10-31 00:36:06 +01:00
|
|
|
SfxHyphenRegionItem aHyphen( SID_ATTR_HYPHENREGION );
|
|
|
|
|
|
|
|
sal_Int16 nMinLead = 2,
|
|
|
|
nMinTrail = 2;
|
|
|
|
if (xProp.is())
|
|
|
|
{
|
2013-05-14 15:54:42 +02:00
|
|
|
nMinLead = xProp->getHyphMinLeading();
|
|
|
|
nMinTrail = xProp->getHyphMinTrailing();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
aHyphen.GetMinLead() = (sal_uInt8)nMinLead;
|
|
|
|
aHyphen.GetMinTrail() = (sal_uInt8)nMinTrail;
|
|
|
|
|
|
|
|
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
|
|
|
|
if ( pViewFrame )
|
|
|
|
{
|
2015-11-10 10:13:27 +01:00
|
|
|
const SfxPoolItem* pItem = nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
|
2014-09-10 17:53:41 +02:00
|
|
|
if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_LANGUAGE, pItem))
|
2015-06-26 16:37:09 +02:00
|
|
|
pRet->Put(
|
|
|
|
SvxLanguageItem(
|
|
|
|
(static_cast<const SvxLanguageItem*>(pItem)
|
|
|
|
->GetLanguage()),
|
|
|
|
SID_ATTR_LANGUAGE));
|
2014-09-10 17:53:41 +02:00
|
|
|
if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_CHAR_CJK_LANGUAGE, pItem))
|
2015-06-26 16:37:09 +02:00
|
|
|
pRet->Put(
|
|
|
|
SvxLanguageItem(
|
|
|
|
(static_cast<const SvxLanguageItem*>(pItem)
|
|
|
|
->GetLanguage()),
|
|
|
|
SID_ATTR_CHAR_CJK_LANGUAGE));
|
2014-09-10 17:53:41 +02:00
|
|
|
if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_CHAR_CTL_LANGUAGE, pItem))
|
2015-06-26 16:37:09 +02:00
|
|
|
pRet->Put(
|
|
|
|
SvxLanguageItem(
|
|
|
|
(static_cast<const SvxLanguageItem*>(pItem)
|
|
|
|
->GetLanguage()),
|
|
|
|
SID_ATTR_CHAR_CTL_LANGUAGE));
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
pRet->Put(aHyphen);
|
2014-09-10 17:53:41 +02:00
|
|
|
if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_AUTOSPELL_CHECK, pItem))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-03-12 20:57:33 +01:00
|
|
|
SfxPoolItem* pClone = pItem->Clone();
|
2009-10-31 00:36:06 +01:00
|
|
|
pRet->Put(*pClone);
|
|
|
|
delete pClone;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-04-16 11:39:08 +02:00
|
|
|
bool bVal = false;
|
2009-10-31 00:36:06 +01:00
|
|
|
if (xProp.is())
|
|
|
|
{
|
2013-05-14 15:54:42 +02:00
|
|
|
bVal = xProp->getIsSpellAuto();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pRet->Put(SfxBoolItem(SID_AUTOSPELL_CHECK, bVal));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pRet->Put( SfxBoolItem( SID_SET_DOCUMENT_LANGUAGE, bIsForSetDocumentLanguage ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_INET_DLG :
|
2017-06-14 09:35:26 +02:00
|
|
|
pRet = o3tl::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(),
|
Make SfxItemSet ranges correct by construction
This is a follow-up to 45a7f5b62d0b1b21763c1c94255ef2309ea4280b "Keep WID ranges
sorted, and join adjacent ones". While SfxItemSet::MergeRange relies on the
m_pWhichRanges being sorted (and, under DBG_UTIL, asserts if they are not), the
various SfxItemSet constructors curiously only check (via assert or DBG_ASSERT)
that each individual range has an upper bound not smaller than its lower bound.
Arguably, all SfxItemSet instances should fulfill the stronger guarantees
required and checked by MergeRange.
And in many cases the ranges are statically known, so that the checking can
happen at compile time. Therefore, replace the two SfxItemSet ctors taking
explicit ranges with two other ctors that actually do proper checking. The
(templated) overload taking an svl::Items struct should be used in all cases
where the range values are statically known at compile time, while the overload
taking a std::initializer_list<Pair> is for the remaining cases (that can only
do runtime checking via assert). Most of those latter cases are simple cases
with a single range covering a single item, but a few are more complex.
(At least some of the uses of the existing SfxItemSet overload taking a
const sal_uInt16* pWhichPairTable
can probably also be strengthened, but that is left for another day.)
This commit is the first in a series of two. Apart from the manual changes to
compilerplugins/clang/store/sfxitemsetrewrite.cxx, include/svl/itemset.hxx, and
svl/source/items/itemset.cxx, it only consists of automatic rewriting of the
relevant SfxItemSet ctor calls (plus a few required manual fixes, see next).
But it does not yet check that the individual ranges are properly sorted (see
the TODO in svl::detail::validGap). That check will be enabled, and the ensuing
manual fixes will be made in a follow-up commit, to reduce the likelyhood of
accidents.
There were three cases of necessary manual intervention:
* sw/source/core/unocore/unostyle.cxx uses eAtr of enum type RES_FRMATR in
braced-init-list syntax now, so needs explicit narrowing conversion to
sal_uInt16.
* In sw/source/uibase/uiview/formatclipboard.cxx, the trailiing comma in the
definition of macro FORMAT_PAINTBRUSH_FRAME_IDS needed to be removed manually.
* In svx/source/svdraw/svdoashp.cxx, svx/source/svdraw/svdotext.cxx,
sw/source/uibase/app/docstyle.cxx, sw/source/uibase/shells/frmsh.cxx,
sw/source/uibase/shells/grfsh.cxx, and sw/source/uibase/shells/textsh1.cxx,
some comments had to be put back (see "TODO: the replaced range can contain
relevant comments" in compilerplugins/clang/store/sfxitemsetrewrite.cxx).
A few uses of the variadic form erroneously used nullptr instead of 0 for
termination. But this should have been harmless even if promoted std::nullptr_t
is larger than promoted sal_uInt16, assuming that the part of the nullptr value
that was interpreted as sal_uInt16/promoted int was all-zero bits. Similarly,
some uses made the harmless error of using 0L instead of 0.
Change-Id: I2afea97282803cb311b9321a99bb627520ef5e35
Reviewed-on: https://gerrit.libreoffice.org/38861
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-06-16 09:58:13 +02:00
|
|
|
svl::Items<SID_BASIC_ENABLED, SID_BASIC_ENABLED,
|
2009-10-31 00:36:06 +01:00
|
|
|
//SID_OPTIONS_START - ..END
|
|
|
|
SID_SAVEREL_INET, SID_SAVEREL_FSYS,
|
2016-05-31 10:30:35 +02:00
|
|
|
SID_INET_NOPROXY, SID_INET_FTP_PROXY_PORT,
|
Make SfxItemSet ranges correct by construction
This is a follow-up to 45a7f5b62d0b1b21763c1c94255ef2309ea4280b "Keep WID ranges
sorted, and join adjacent ones". While SfxItemSet::MergeRange relies on the
m_pWhichRanges being sorted (and, under DBG_UTIL, asserts if they are not), the
various SfxItemSet constructors curiously only check (via assert or DBG_ASSERT)
that each individual range has an upper bound not smaller than its lower bound.
Arguably, all SfxItemSet instances should fulfill the stronger guarantees
required and checked by MergeRange.
And in many cases the ranges are statically known, so that the checking can
happen at compile time. Therefore, replace the two SfxItemSet ctors taking
explicit ranges with two other ctors that actually do proper checking. The
(templated) overload taking an svl::Items struct should be used in all cases
where the range values are statically known at compile time, while the overload
taking a std::initializer_list<Pair> is for the remaining cases (that can only
do runtime checking via assert). Most of those latter cases are simple cases
with a single range covering a single item, but a few are more complex.
(At least some of the uses of the existing SfxItemSet overload taking a
const sal_uInt16* pWhichPairTable
can probably also be strengthened, but that is left for another day.)
This commit is the first in a series of two. Apart from the manual changes to
compilerplugins/clang/store/sfxitemsetrewrite.cxx, include/svl/itemset.hxx, and
svl/source/items/itemset.cxx, it only consists of automatic rewriting of the
relevant SfxItemSet ctor calls (plus a few required manual fixes, see next).
But it does not yet check that the individual ranges are properly sorted (see
the TODO in svl::detail::validGap). That check will be enabled, and the ensuing
manual fixes will be made in a follow-up commit, to reduce the likelyhood of
accidents.
There were three cases of necessary manual intervention:
* sw/source/core/unocore/unostyle.cxx uses eAtr of enum type RES_FRMATR in
braced-init-list syntax now, so needs explicit narrowing conversion to
sal_uInt16.
* In sw/source/uibase/uiview/formatclipboard.cxx, the trailiing comma in the
definition of macro FORMAT_PAINTBRUSH_FRAME_IDS needed to be removed manually.
* In svx/source/svdraw/svdoashp.cxx, svx/source/svdraw/svdotext.cxx,
sw/source/uibase/app/docstyle.cxx, sw/source/uibase/shells/frmsh.cxx,
sw/source/uibase/shells/grfsh.cxx, and sw/source/uibase/shells/textsh1.cxx,
some comments had to be put back (see "TODO: the replaced range can contain
relevant comments" in compilerplugins/clang/store/sfxitemsetrewrite.cxx).
A few uses of the variadic form erroneously used nullptr instead of 0 for
termination. But this should have been harmless even if promoted std::nullptr_t
is larger than promoted sal_uInt16, assuming that the part of the nullptr value
that was interpreted as sal_uInt16/promoted int was all-zero bits. Similarly,
some uses made the harmless error of using 0L instead of 0.
Change-Id: I2afea97282803cb311b9321a99bb627520ef5e35
Reviewed-on: https://gerrit.libreoffice.org/38861
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-06-16 09:58:13 +02:00
|
|
|
SID_SECURE_URL, SID_SECURE_URL>{} );
|
2014-06-27 10:26:55 +02:00
|
|
|
SfxGetpApp()->GetOptions(*pRet);
|
2009-10-31 00:36:06 +01:00
|
|
|
break;
|
|
|
|
case SID_FILTER_DLG:
|
2017-06-19 09:32:45 +02:00
|
|
|
pRet = o3tl::make_unique<SfxItemSet>(
|
|
|
|
SfxGetpApp()->GetPool(),
|
|
|
|
svl::Items<
|
|
|
|
SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT,
|
|
|
|
SID_ATTR_DOCINFO, SID_ATTR_AUTOSAVEMINUTE,
|
|
|
|
SID_SAVEREL_INET, SID_SAVEREL_FSYS,
|
|
|
|
SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING>{} );
|
2014-06-27 10:26:55 +02:00
|
|
|
SfxGetpApp()->GetOptions(*pRet);
|
2009-10-31 00:36:06 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_SB_STARBASEOPTIONS:
|
2017-06-14 09:35:26 +02:00
|
|
|
pRet = o3tl::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(),
|
Make SfxItemSet ranges correct by construction
This is a follow-up to 45a7f5b62d0b1b21763c1c94255ef2309ea4280b "Keep WID ranges
sorted, and join adjacent ones". While SfxItemSet::MergeRange relies on the
m_pWhichRanges being sorted (and, under DBG_UTIL, asserts if they are not), the
various SfxItemSet constructors curiously only check (via assert or DBG_ASSERT)
that each individual range has an upper bound not smaller than its lower bound.
Arguably, all SfxItemSet instances should fulfill the stronger guarantees
required and checked by MergeRange.
And in many cases the ranges are statically known, so that the checking can
happen at compile time. Therefore, replace the two SfxItemSet ctors taking
explicit ranges with two other ctors that actually do proper checking. The
(templated) overload taking an svl::Items struct should be used in all cases
where the range values are statically known at compile time, while the overload
taking a std::initializer_list<Pair> is for the remaining cases (that can only
do runtime checking via assert). Most of those latter cases are simple cases
with a single range covering a single item, but a few are more complex.
(At least some of the uses of the existing SfxItemSet overload taking a
const sal_uInt16* pWhichPairTable
can probably also be strengthened, but that is left for another day.)
This commit is the first in a series of two. Apart from the manual changes to
compilerplugins/clang/store/sfxitemsetrewrite.cxx, include/svl/itemset.hxx, and
svl/source/items/itemset.cxx, it only consists of automatic rewriting of the
relevant SfxItemSet ctor calls (plus a few required manual fixes, see next).
But it does not yet check that the individual ranges are properly sorted (see
the TODO in svl::detail::validGap). That check will be enabled, and the ensuing
manual fixes will be made in a follow-up commit, to reduce the likelyhood of
accidents.
There were three cases of necessary manual intervention:
* sw/source/core/unocore/unostyle.cxx uses eAtr of enum type RES_FRMATR in
braced-init-list syntax now, so needs explicit narrowing conversion to
sal_uInt16.
* In sw/source/uibase/uiview/formatclipboard.cxx, the trailiing comma in the
definition of macro FORMAT_PAINTBRUSH_FRAME_IDS needed to be removed manually.
* In svx/source/svdraw/svdoashp.cxx, svx/source/svdraw/svdotext.cxx,
sw/source/uibase/app/docstyle.cxx, sw/source/uibase/shells/frmsh.cxx,
sw/source/uibase/shells/grfsh.cxx, and sw/source/uibase/shells/textsh1.cxx,
some comments had to be put back (see "TODO: the replaced range can contain
relevant comments" in compilerplugins/clang/store/sfxitemsetrewrite.cxx).
A few uses of the variadic form erroneously used nullptr instead of 0 for
termination. But this should have been harmless even if promoted std::nullptr_t
is larger than promoted sal_uInt16, assuming that the part of the nullptr value
that was interpreted as sal_uInt16/promoted int was all-zero bits. Similarly,
some uses made the harmless error of using 0L instead of 0.
Change-Id: I2afea97282803cb311b9321a99bb627520ef5e35
Reviewed-on: https://gerrit.libreoffice.org/38861
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-06-16 09:58:13 +02:00
|
|
|
svl::Items<SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER>{} );
|
2009-10-31 00:36:06 +01:00
|
|
|
::offapp::ConnectionPoolConfig::GetOptions(*pRet);
|
2015-04-30 07:15:55 +03:00
|
|
|
svx::DbRegisteredNamesConfig::GetOptions(*pRet);
|
2009-10-31 00:36:06 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_SCH_EDITOPTIONS:
|
|
|
|
{
|
|
|
|
SvxChartOptions aChartOpt;
|
Make SfxItemSet ranges correct by construction
This is a follow-up to 45a7f5b62d0b1b21763c1c94255ef2309ea4280b "Keep WID ranges
sorted, and join adjacent ones". While SfxItemSet::MergeRange relies on the
m_pWhichRanges being sorted (and, under DBG_UTIL, asserts if they are not), the
various SfxItemSet constructors curiously only check (via assert or DBG_ASSERT)
that each individual range has an upper bound not smaller than its lower bound.
Arguably, all SfxItemSet instances should fulfill the stronger guarantees
required and checked by MergeRange.
And in many cases the ranges are statically known, so that the checking can
happen at compile time. Therefore, replace the two SfxItemSet ctors taking
explicit ranges with two other ctors that actually do proper checking. The
(templated) overload taking an svl::Items struct should be used in all cases
where the range values are statically known at compile time, while the overload
taking a std::initializer_list<Pair> is for the remaining cases (that can only
do runtime checking via assert). Most of those latter cases are simple cases
with a single range covering a single item, but a few are more complex.
(At least some of the uses of the existing SfxItemSet overload taking a
const sal_uInt16* pWhichPairTable
can probably also be strengthened, but that is left for another day.)
This commit is the first in a series of two. Apart from the manual changes to
compilerplugins/clang/store/sfxitemsetrewrite.cxx, include/svl/itemset.hxx, and
svl/source/items/itemset.cxx, it only consists of automatic rewriting of the
relevant SfxItemSet ctor calls (plus a few required manual fixes, see next).
But it does not yet check that the individual ranges are properly sorted (see
the TODO in svl::detail::validGap). That check will be enabled, and the ensuing
manual fixes will be made in a follow-up commit, to reduce the likelyhood of
accidents.
There were three cases of necessary manual intervention:
* sw/source/core/unocore/unostyle.cxx uses eAtr of enum type RES_FRMATR in
braced-init-list syntax now, so needs explicit narrowing conversion to
sal_uInt16.
* In sw/source/uibase/uiview/formatclipboard.cxx, the trailiing comma in the
definition of macro FORMAT_PAINTBRUSH_FRAME_IDS needed to be removed manually.
* In svx/source/svdraw/svdoashp.cxx, svx/source/svdraw/svdotext.cxx,
sw/source/uibase/app/docstyle.cxx, sw/source/uibase/shells/frmsh.cxx,
sw/source/uibase/shells/grfsh.cxx, and sw/source/uibase/shells/textsh1.cxx,
some comments had to be put back (see "TODO: the replaced range can contain
relevant comments" in compilerplugins/clang/store/sfxitemsetrewrite.cxx).
A few uses of the variadic form erroneously used nullptr instead of 0 for
termination. But this should have been harmless even if promoted std::nullptr_t
is larger than promoted sal_uInt16, assuming that the part of the nullptr value
that was interpreted as sal_uInt16/promoted int was all-zero bits. Similarly,
some uses made the harmless error of using 0L instead of 0.
Change-Id: I2afea97282803cb311b9321a99bb627520ef5e35
Reviewed-on: https://gerrit.libreoffice.org/38861
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-06-16 09:58:13 +02:00
|
|
|
pRet = o3tl::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), svl::Items<SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS>{} );
|
2009-10-31 00:36:06 +01:00
|
|
|
pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aChartOpt.GetDefaultColors() ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
|
|
|
|
{
|
|
|
|
switch(nId)
|
|
|
|
{
|
|
|
|
case SID_GENERAL_OPTIONS:
|
|
|
|
{
|
|
|
|
utl::MiscCfg aMisc;
|
2015-11-10 10:13:27 +01:00
|
|
|
const SfxPoolItem* pItem = nullptr;
|
Make SfxItemSet ranges correct by construction
This is a follow-up to 45a7f5b62d0b1b21763c1c94255ef2309ea4280b "Keep WID ranges
sorted, and join adjacent ones". While SfxItemSet::MergeRange relies on the
m_pWhichRanges being sorted (and, under DBG_UTIL, asserts if they are not), the
various SfxItemSet constructors curiously only check (via assert or DBG_ASSERT)
that each individual range has an upper bound not smaller than its lower bound.
Arguably, all SfxItemSet instances should fulfill the stronger guarantees
required and checked by MergeRange.
And in many cases the ranges are statically known, so that the checking can
happen at compile time. Therefore, replace the two SfxItemSet ctors taking
explicit ranges with two other ctors that actually do proper checking. The
(templated) overload taking an svl::Items struct should be used in all cases
where the range values are statically known at compile time, while the overload
taking a std::initializer_list<Pair> is for the remaining cases (that can only
do runtime checking via assert). Most of those latter cases are simple cases
with a single range covering a single item, but a few are more complex.
(At least some of the uses of the existing SfxItemSet overload taking a
const sal_uInt16* pWhichPairTable
can probably also be strengthened, but that is left for another day.)
This commit is the first in a series of two. Apart from the manual changes to
compilerplugins/clang/store/sfxitemsetrewrite.cxx, include/svl/itemset.hxx, and
svl/source/items/itemset.cxx, it only consists of automatic rewriting of the
relevant SfxItemSet ctor calls (plus a few required manual fixes, see next).
But it does not yet check that the individual ranges are properly sorted (see
the TODO in svl::detail::validGap). That check will be enabled, and the ensuing
manual fixes will be made in a follow-up commit, to reduce the likelyhood of
accidents.
There were three cases of necessary manual intervention:
* sw/source/core/unocore/unostyle.cxx uses eAtr of enum type RES_FRMATR in
braced-init-list syntax now, so needs explicit narrowing conversion to
sal_uInt16.
* In sw/source/uibase/uiview/formatclipboard.cxx, the trailiing comma in the
definition of macro FORMAT_PAINTBRUSH_FRAME_IDS needed to be removed manually.
* In svx/source/svdraw/svdoashp.cxx, svx/source/svdraw/svdotext.cxx,
sw/source/uibase/app/docstyle.cxx, sw/source/uibase/shells/frmsh.cxx,
sw/source/uibase/shells/grfsh.cxx, and sw/source/uibase/shells/textsh1.cxx,
some comments had to be put back (see "TODO: the replaced range can contain
relevant comments" in compilerplugins/clang/store/sfxitemsetrewrite.cxx).
A few uses of the variadic form erroneously used nullptr instead of 0 for
termination. But this should have been harmless even if promoted std::nullptr_t
is larger than promoted sal_uInt16, assuming that the part of the nullptr value
that was interpreted as sal_uInt16/promoted int was all-zero bits. Similarly,
some uses made the harmless error of using 0L instead of 0.
Change-Id: I2afea97282803cb311b9321a99bb627520ef5e35
Reviewed-on: https://gerrit.libreoffice.org/38861
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-06-16 09:58:13 +02:00
|
|
|
SfxItemSet aOptSet(SfxGetpApp()->GetPool(), svl::Items<SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER>{} );
|
2009-10-31 00:36:06 +01:00
|
|
|
aOptSet.Put(rSet);
|
|
|
|
if(aOptSet.Count())
|
2014-06-27 10:26:55 +02:00
|
|
|
SfxGetpApp()->SetOptions( aOptSet );
|
2012-04-15 17:50:21 +02:00
|
|
|
// get dispatcher anew, because SetOptions() might have destroyed the dispatcher
|
2009-10-31 00:36:06 +01:00
|
|
|
SfxViewFrame *pViewFrame = SfxViewFrame::Current();
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2012-04-15 17:50:21 +02:00
|
|
|
// evaluate Year2000
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nY2K = USHRT_MAX;
|
2014-09-10 17:53:41 +02:00
|
|
|
if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_YEAR2000, false, &pItem ) )
|
2014-10-21 14:08:19 +02:00
|
|
|
nY2K = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
|
2009-10-31 00:36:06 +01:00
|
|
|
if( USHRT_MAX != nY2K )
|
|
|
|
{
|
|
|
|
if ( pViewFrame )
|
|
|
|
{
|
|
|
|
SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
|
2016-03-30 17:55:05 +02:00
|
|
|
pDispatch->ExecuteList(SID_ATTR_YEAR2000,
|
|
|
|
SfxCallMode::ASYNCHRON, { pItem });
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
aMisc.SetYear2000(nY2K);
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2012-04-15 17:50:21 +02:00
|
|
|
// evaluate print
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-09-10 17:53:41 +02:00
|
|
|
if(SfxItemState::SET == rSet.GetItemState(SID_PRINTER_NOTFOUND_WARN, false, &pItem))
|
2014-10-21 14:08:19 +02:00
|
|
|
aMisc.SetNotFoundWarning(static_cast<const SfxBoolItem*>(pItem)->GetValue());
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2014-09-10 17:53:41 +02:00
|
|
|
if(SfxItemState::SET == rSet.GetItemState(SID_PRINTER_CHANGESTODOC, false, &pItem))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-10-21 14:08:19 +02:00
|
|
|
const SfxFlagItem* pFlag = static_cast<const SfxFlagItem*>(pItem);
|
2015-03-24 09:36:29 +02:00
|
|
|
aMisc.SetPaperSizeWarning(bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_SIZE ));
|
|
|
|
aMisc.SetPaperOrientationWarning(bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_ORIENTATION ));
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
// evaluate help options
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( SvtHelpOptions().IsHelpTips() != Help::IsQuickHelpEnabled() )
|
|
|
|
SvtHelpOptions().IsHelpTips() ? Help::EnableQuickHelp() : Help::DisableQuickHelp();
|
|
|
|
if ( SvtHelpOptions().IsExtendedHelp() != Help::IsBalloonHelpEnabled() )
|
|
|
|
SvtHelpOptions().IsExtendedHelp() ? Help::EnableBalloonHelp() : Help::DisableBalloonHelp();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_LANGUAGE_OPTIONS :
|
|
|
|
{
|
|
|
|
OfaTreeOptionsDialog::ApplyLanguageOptions(rSet);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_INET_DLG :
|
|
|
|
case SID_FILTER_DLG:
|
2014-06-27 10:26:55 +02:00
|
|
|
SfxGetpApp()->SetOptions( rSet );
|
2009-10-31 00:36:06 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_SB_STARBASEOPTIONS:
|
|
|
|
::offapp::ConnectionPoolConfig::SetOptions( rSet );
|
2015-04-30 07:15:55 +03:00
|
|
|
svx::DbRegisteredNamesConfig::SetOptions(rSet);
|
2009-10-31 00:36:06 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_SCH_EDITOPTIONS:
|
|
|
|
// nothing to do. Chart options only apply to newly created charts
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
2011-03-01 17:55:09 +01:00
|
|
|
OSL_FAIL( "Unhandled option in ApplyItemSet" );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet)
|
|
|
|
{
|
2014-04-16 11:39:08 +02:00
|
|
|
bool bSaveSpellCheck = false;
|
2015-11-10 10:13:27 +01:00
|
|
|
const SfxPoolItem* pItem = nullptr;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2013-05-13 10:43:34 +02:00
|
|
|
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
|
|
|
|
Reference< XLinguProperties > xProp = LinguProperties::create( xContext );
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( SfxItemState::SET == rSet.GetItemState(SID_ATTR_HYPHENREGION, false, &pItem ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-10-21 14:08:19 +02:00
|
|
|
const SfxHyphenRegionItem* pHyphenItem = static_cast<const SfxHyphenRegionItem*>(pItem);
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2013-05-13 10:43:34 +02:00
|
|
|
xProp->setHyphMinLeading( (sal_Int16) pHyphenItem->GetMinLead() );
|
|
|
|
xProp->setHyphMinTrailing( (sal_Int16) pHyphenItem->GetMinTrail() );
|
2014-04-16 11:39:08 +02:00
|
|
|
bSaveSpellCheck = true;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
SfxViewFrame *pViewFrame = SfxViewFrame::Current();
|
|
|
|
if ( pViewFrame )
|
|
|
|
{
|
|
|
|
SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
|
2015-11-10 10:13:27 +01:00
|
|
|
pItem = nullptr;
|
2014-09-10 17:53:41 +02:00
|
|
|
if(SfxItemState::SET == rSet.GetItemState( SID_ATTR_LANGUAGE, false, &pItem ))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2016-03-30 17:55:05 +02:00
|
|
|
pDispatch->ExecuteList(pItem->Which(), SfxCallMode::ASYNCHRON, { pItem });
|
2014-04-16 11:39:08 +02:00
|
|
|
bSaveSpellCheck = true;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
2014-09-10 17:53:41 +02:00
|
|
|
if(SfxItemState::SET == rSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE, false, &pItem ))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2016-03-30 17:55:05 +02:00
|
|
|
pDispatch->ExecuteList(pItem->Which(), SfxCallMode::ASYNCHRON, { pItem });
|
2014-04-16 11:39:08 +02:00
|
|
|
bSaveSpellCheck = true;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
2014-09-10 17:53:41 +02:00
|
|
|
if(SfxItemState::SET == rSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE, false, &pItem ))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2016-03-30 17:55:05 +02:00
|
|
|
pDispatch->ExecuteList(pItem->Which(), SfxCallMode::ASYNCHRON, { pItem });
|
2014-04-16 11:39:08 +02:00
|
|
|
bSaveSpellCheck = true;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2014-09-10 17:53:41 +02:00
|
|
|
if( SfxItemState::SET == rSet.GetItemState(SID_AUTOSPELL_CHECK, false, &pItem ))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-10-21 14:08:19 +02:00
|
|
|
bool bOnlineSpelling = static_cast<const SfxBoolItem*>(pItem)->GetValue();
|
2016-03-30 17:55:05 +02:00
|
|
|
pDispatch->ExecuteList(SID_AUTOSPELL_CHECK,
|
|
|
|
SfxCallMode::ASYNCHRON|SfxCallMode::RECORD, { pItem });
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2013-05-13 10:43:34 +02:00
|
|
|
xProp->setIsSpellAuto( bOnlineSpelling );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if( bSaveSpellCheck )
|
|
|
|
{
|
|
|
|
//! the config item has changed since we modified the
|
|
|
|
//! property set it uses
|
2014-10-11 16:01:26 +02:00
|
|
|
pDispatch->Execute(SID_SPELLCHECKER_CHANGED, SfxCallMode::ASYNCHRON);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-10 17:53:41 +02:00
|
|
|
if( SfxItemState::SET == rSet.GetItemState(SID_OPT_LOCALE_CHANGED, false, &pItem ))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
SfxViewFrame* _pViewFrame = SfxViewFrame::GetFirst();
|
|
|
|
while ( _pViewFrame )
|
|
|
|
{
|
2016-03-30 17:55:05 +02:00
|
|
|
_pViewFrame->GetDispatcher()->ExecuteList(pItem->Which(),
|
|
|
|
SfxCallMode::ASYNCHRON, { pItem });
|
2010-05-10 12:31:26 +02:00
|
|
|
_pViewFrame = SfxViewFrame::GetNext( *_pViewFrame );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sIdentifier;
|
2009-10-31 00:36:06 +01:00
|
|
|
Reference < XFrame > xCurrentFrame( _xFrame );
|
2012-12-14 12:58:00 +02:00
|
|
|
Reference < XModuleManager2 > xModuleManager = ModuleManager::create(::comphelper::getProcessComponentContext());
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( !xCurrentFrame.is() )
|
|
|
|
{
|
2012-12-14 12:58:00 +02:00
|
|
|
Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
|
|
|
|
xCurrentFrame = xDesktop->getCurrentFrame();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-04 14:56:48 +02:00
|
|
|
if ( xCurrentFrame.is() )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sIdentifier = xModuleManager->identify( xCurrentFrame );
|
|
|
|
}
|
2015-07-28 14:18:40 +02:00
|
|
|
catch ( css::frame::UnknownModuleException& )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-10-19 11:55:44 +02:00
|
|
|
SAL_INFO( "cui.options", "unknown module" );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
catch ( Exception& )
|
|
|
|
{
|
2012-01-16 22:16:03 +01:00
|
|
|
SAL_WARN( "cui.options", "getActiveModule_Impl(): exception of XModuleManager::identify()" );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return sIdentifier;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
|
|
|
|
{
|
|
|
|
sal_uInt16 nGroup = 0;
|
|
|
|
|
|
|
|
SvtOptionsDialogOptions aOptionsDlgOpt;
|
2017-03-07 19:45:59 +01:00
|
|
|
sal_uInt16 nPageId;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
// %PRODUCTNAME options
|
|
|
|
if ( !lcl_isOptionHidden( SID_GENERAL_OPTIONS, aOptionsDlgOpt ) )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName("ProductName", CuiResId(SID_GENERAL_OPTIONS_RES[0].first));
|
|
|
|
nGroup = AddGroup(CuiResId(SID_GENERAL_OPTIONS_RES[0].first), nullptr, nullptr, SID_GENERAL_OPTIONS );
|
|
|
|
const sal_uInt16 nEnd = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_GENERAL_OPTIONS_RES));
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2017-06-11 20:56:30 +01:00
|
|
|
for (sal_uInt16 i = 1; i < nEnd; ++i)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
OUString sNewTitle = CuiResId(SID_GENERAL_OPTIONS_RES[i].first);
|
|
|
|
nPageId = SID_GENERAL_OPTIONS_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// Disable Online Update page if service not installed
|
|
|
|
if( RID_SVXPAGE_ONLINEUPDATE == nPageId )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2013-05-13 13:51:44 +02:00
|
|
|
Reference < XInterface > xService( setup::UpdateCheck::create( ::comphelper::getProcessComponentContext() ) );
|
2009-10-31 00:36:06 +01:00
|
|
|
if( ! xService.is() )
|
|
|
|
continue;
|
|
|
|
}
|
2015-07-28 14:18:40 +02:00
|
|
|
catch ( css::uno::DeploymentException& )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2016-11-26 19:41:35 +01:00
|
|
|
|
|
|
|
// Disable Basic IDE options, if experimental features are not enabled
|
|
|
|
if( RID_SVXPAGE_BASICIDE_OPTIONS == nPageId )
|
|
|
|
{
|
|
|
|
SvtMiscOptions aMiscOpt;
|
|
|
|
if( ! aMiscOpt.IsExperimentalMode() )
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-16 10:20:11 +01:00
|
|
|
AddTabPage( nPageId, sNewTitle, nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Load and Save options
|
|
|
|
if ( !lcl_isOptionHidden( SID_FILTER_DLG, aOptionsDlgOpt ) )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName( "LoadSave", CuiResId(SID_FILTER_DLG_RES[0].first) );
|
|
|
|
nGroup = AddGroup( CuiResId(SID_FILTER_DLG_RES[0].first), nullptr, nullptr, SID_FILTER_DLG );
|
|
|
|
for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_FILTER_DLG_RES); ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
nPageId = (sal_uInt16)SID_FILTER_DLG_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage( nPageId, CuiResId(SID_FILTER_DLG_RES[i].first), nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Language options
|
|
|
|
SvtLanguageOptions aLanguageOptions;
|
|
|
|
if ( !lcl_isOptionHidden( SID_LANGUAGE_OPTIONS, aOptionsDlgOpt ) )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName("LanguageSettings", CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first));
|
|
|
|
nGroup = AddGroup(CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first), nullptr, nullptr, SID_LANGUAGE_OPTIONS );
|
|
|
|
for (sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_LANGUAGE_OPTIONS_RES); ++i)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
nPageId = (sal_uInt16)SID_LANGUAGE_OPTIONS_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
|
|
|
continue;
|
|
|
|
if ( ( RID_SVXPAGE_JSEARCH_OPTIONS != nPageId || aLanguageOptions.IsJapaneseFindEnabled() ) &&
|
|
|
|
( RID_SVXPAGE_ASIAN_LAYOUT != nPageId || aLanguageOptions.IsAsianTypographyEnabled() ) &&
|
|
|
|
( RID_SVXPAGE_OPTIONS_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) )
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage(nPageId, CuiResId(SID_LANGUAGE_OPTIONS_RES[i].first), nGroup);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aFactory = getCurrentFactory_Impl( _xFrame );
|
2013-10-11 11:39:54 +02:00
|
|
|
DBG_ASSERT( GetModuleIdentifier( _xFrame ) == aFactory, "S H I T!!!" );
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
// Writer and Writer/Web options
|
|
|
|
SvtModuleOptions aModuleOpt;
|
2015-04-07 10:59:56 +02:00
|
|
|
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-04-15 17:50:21 +02:00
|
|
|
// text document
|
2014-01-21 15:53:55 +01:00
|
|
|
if ( aFactory == "com.sun.star.text.TextDocument"
|
|
|
|
|| aFactory == "com.sun.star.text.WebDocument"
|
|
|
|
|| aFactory == "com.sun.star.text.GlobalDocument" )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2016-07-04 17:30:42 +01:00
|
|
|
SfxModule* pSwMod = SfxApplication::GetModule(SfxToolsModule::Writer);
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( !lcl_isOptionHidden( SID_SW_EDITOPTIONS, aOptionsDlgOpt ) )
|
|
|
|
{
|
2012-04-06 14:28:18 +02:00
|
|
|
if ( aFactory == "com.sun.star.text.WebDocument" )
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName( "WriterWeb", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) );
|
2009-10-31 00:36:06 +01:00
|
|
|
else
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName( "Writer", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) );
|
|
|
|
nGroup = AddGroup(CuiResId(SID_SW_EDITOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_EDITOPTIONS );
|
|
|
|
for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SW_EDITOPTIONS_RES); ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
nPageId = (sal_uInt16)SID_SW_EDITOPTIONS_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
|
|
|
continue;
|
2012-01-27 10:32:23 +01:00
|
|
|
if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || aLanguageOptions.IsCJKFontEnabled() ) &&
|
|
|
|
( RID_SW_TP_STD_FONT_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) &&
|
|
|
|
( RID_SW_TP_MAILCONFIG != nPageId || MailMergeCfg_Impl().IsEmailSupported() ) )
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage( nPageId, CuiResId(SID_SW_EDITOPTIONS_RES[i].first), nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
#ifdef DBG_UTIL
|
2015-11-06 09:35:16 +01:00
|
|
|
AddTabPage( RID_SW_TP_OPTTEST_PAGE, "Internal Test", nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-04-15 17:50:21 +02:00
|
|
|
// HTML documents
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( !lcl_isOptionHidden( SID_SW_ONLINEOPTIONS, aOptionsDlgOpt ) )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
nGroup = AddGroup(CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS );
|
|
|
|
for( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SW_ONLINEOPTIONS_RES); ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
nPageId = (sal_uInt16)SID_SW_ONLINEOPTIONS_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage(nPageId, CuiResId(SID_SW_ONLINEOPTIONS_RES[i].first), nGroup);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
#ifdef DBG_UTIL
|
2015-11-06 09:35:16 +01:00
|
|
|
AddTabPage( RID_SW_TP_OPTTEST_PAGE, "Internal Test", nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calc options
|
2015-04-07 10:59:56 +02:00
|
|
|
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-04-06 14:28:18 +02:00
|
|
|
if ( aFactory == "com.sun.star.sheet.SpreadsheetDocument" )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
if ( !lcl_isOptionHidden( SID_SC_EDITOPTIONS, aOptionsDlgOpt ) )
|
|
|
|
{
|
2016-07-04 17:30:42 +01:00
|
|
|
SfxModule* pScMod = SfxApplication::GetModule( SfxToolsModule::Calc );
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName( "Calc", CuiResId(SID_SC_EDITOPTIONS_RES[0].first) );
|
|
|
|
nGroup = AddGroup( CuiResId(SID_SC_EDITOPTIONS_RES[0].first), pScMod, pScMod, SID_SC_EDITOPTIONS );
|
|
|
|
const sal_uInt16 nCount = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_SC_EDITOPTIONS_RES));
|
2017-03-07 19:45:59 +01:00
|
|
|
for ( sal_uInt16 i = 1; i < nCount; ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
nPageId = (sal_uInt16)SID_SC_EDITOPTIONS_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
|
|
|
continue;
|
2013-09-29 10:49:07 +02:00
|
|
|
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage( nPageId, CuiResId(SID_SC_EDITOPTIONS_RES[i].first), nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Impress options
|
2016-07-04 17:30:42 +01:00
|
|
|
SfxModule* pSdMod = SfxApplication::GetModule( SfxToolsModule::Draw );
|
2015-04-07 10:59:56 +02:00
|
|
|
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-04-06 14:28:18 +02:00
|
|
|
if ( aFactory == "com.sun.star.presentation.PresentationDocument" )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
if ( !lcl_isOptionHidden( SID_SD_EDITOPTIONS, aOptionsDlgOpt ) )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName( "Impress", CuiResId(SID_SD_EDITOPTIONS_RES[0].first) );
|
|
|
|
nGroup = AddGroup( CuiResId(SID_SD_EDITOPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_EDITOPTIONS );
|
|
|
|
const sal_uInt16 nCount = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_SD_EDITOPTIONS_RES));
|
2017-03-07 19:45:59 +01:00
|
|
|
for ( sal_uInt16 i = 1; i < nCount; ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-08-09 08:41:17 +01:00
|
|
|
nPageId = (sal_uInt16)SID_SD_EDITOPTIONS_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
|
|
|
continue;
|
2013-09-29 10:49:07 +02:00
|
|
|
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage( nPageId, CuiResId(SID_SD_EDITOPTIONS_RES[i].first), nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw options
|
2015-04-07 10:59:56 +02:00
|
|
|
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-04-06 14:28:18 +02:00
|
|
|
if ( aFactory == "com.sun.star.drawing.DrawingDocument" )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
if ( !lcl_isOptionHidden( SID_SD_GRAPHIC_OPTIONS, aOptionsDlgOpt ) )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName( "Draw", CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first) );
|
|
|
|
nGroup = AddGroup( CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_GRAPHIC_OPTIONS );
|
|
|
|
const sal_uInt16 nCount = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_SD_GRAPHIC_OPTIONS_RES));
|
2017-03-07 19:45:59 +01:00
|
|
|
for ( sal_uInt16 i = 1; i < nCount; ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-08-09 08:41:17 +01:00
|
|
|
nPageId = (sal_uInt16)SID_SD_GRAPHIC_OPTIONS_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
|
|
|
continue;
|
2013-09-29 10:49:07 +02:00
|
|
|
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage( nPageId, CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[i].first), nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Math options
|
2015-04-07 10:59:56 +02:00
|
|
|
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-04-06 14:28:18 +02:00
|
|
|
if ( aFactory == "com.sun.star.formula.FormulaProperties" )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
if ( !lcl_isOptionHidden( SID_SM_EDITOPTIONS, aOptionsDlgOpt ) )
|
|
|
|
{
|
2016-07-04 17:30:42 +01:00
|
|
|
SfxModule* pSmMod = SfxApplication::GetModule(SfxToolsModule::Math);
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName( "Math", CuiResId(SID_SM_EDITOPTIONS_RES[0].first) );
|
|
|
|
nGroup = AddGroup(CuiResId(SID_SM_EDITOPTIONS_RES[0].first), pSmMod, pSmMod, SID_SM_EDITOPTIONS );
|
|
|
|
for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SM_EDITOPTIONS_RES); ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-08-09 08:41:17 +01:00
|
|
|
nPageId = (sal_uInt16)SID_SM_EDITOPTIONS_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage( nPageId, CuiResId(SID_SM_EDITOPTIONS_RES[i].first), nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Database - needed only if there is an application which integrates with databases
|
|
|
|
if ( !lcl_isOptionHidden( SID_SB_STARBASEOPTIONS, aOptionsDlgOpt ) &&
|
2015-04-07 10:59:56 +02:00
|
|
|
( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DATABASE )
|
|
|
|
|| aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER )
|
|
|
|
|| aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC )
|
2009-10-31 00:36:06 +01:00
|
|
|
) )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName( "Base", CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first) );
|
|
|
|
nGroup = AddGroup( CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first), nullptr, nullptr, SID_SB_STARBASEOPTIONS );
|
|
|
|
for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SB_STARBASEOPTIONS_RES); ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
nPageId = (sal_uInt16)SID_SB_STARBASEOPTIONS_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage( nPageId, CuiResId(SID_SB_STARBASEOPTIONS_RES[i].first), nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Chart options (always installed and active)
|
|
|
|
if ( !lcl_isOptionHidden( SID_SCH_EDITOPTIONS, aOptionsDlgOpt ) )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName( "Charts", CuiResId(SID_SCH_EDITOPTIONS_RES[0].first) );
|
|
|
|
nGroup = AddGroup( CuiResId(SID_SCH_EDITOPTIONS_RES[0].first), nullptr, nullptr, SID_SCH_EDITOPTIONS );
|
|
|
|
for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SCH_EDITOPTIONS_RES); ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
nPageId = (sal_uInt16)SID_SCH_EDITOPTIONS_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage( nPageId, CuiResId(SID_SCH_EDITOPTIONS_RES[i].first), nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Internet options
|
|
|
|
if ( !lcl_isOptionHidden( SID_INET_DLG, aOptionsDlgOpt ) )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
setGroupName("Internet", CuiResId(SID_INET_DLG_RES[0].first));
|
|
|
|
nGroup = AddGroup(CuiResId(SID_INET_DLG_RES[0].first), nullptr, nullptr, SID_INET_DLG );
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2017-06-11 20:56:30 +01:00
|
|
|
for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_INET_DLG_RES); ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
nPageId = (sal_uInt16)SID_INET_DLG_RES[i].second;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
|
|
|
|
continue;
|
2016-02-16 14:14:43 +02:00
|
|
|
#if defined(_WIN32)
|
2009-10-31 00:36:06 +01:00
|
|
|
// Disable E-mail tab-page on Windows
|
|
|
|
if ( nPageId == RID_SVXPAGE_INET_MAIL )
|
|
|
|
continue;
|
|
|
|
#endif
|
2017-06-11 20:56:30 +01:00
|
|
|
AddTabPage( nPageId, CuiResId(SID_INET_DLG_RES[i].first), nGroup );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-31 15:13:12 +02:00
|
|
|
bool isNodeActive( OptionsNode const * pNode, Module* pModule )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
if ( pNode )
|
|
|
|
{
|
2015-06-15 17:03:57 +02:00
|
|
|
// Node for all modules active?
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( pNode->m_bAllModules )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// OOo-Nodes (Writer, Calc, Impress...) are active if node is already inserted
|
2013-09-26 08:30:52 +02:00
|
|
|
if ( !getGroupName( pNode->m_sId, false ).isEmpty() )
|
2009-10-31 00:36:06 +01:00
|
|
|
return true;
|
|
|
|
|
|
|
|
// no module -> not active
|
|
|
|
if ( !pModule )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// search node in active module
|
|
|
|
if ( pModule->m_bActive )
|
|
|
|
{
|
2016-04-21 11:03:55 +02:00
|
|
|
for (OrderedEntry* j : pModule->m_aNodeList)
|
|
|
|
if ( j->m_sId == pNode->m_sId )
|
2009-10-31 00:36:06 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void OfaTreeOptionsDialog::LoadExtensionOptions( const OUString& rExtensionId )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-11-10 10:13:27 +01:00
|
|
|
Module* pModule = nullptr;
|
2012-07-31 10:06:09 +01:00
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
// when called by Tools - Options then load nodes of active module
|
2011-12-16 17:29:07 -02:00
|
|
|
if ( rExtensionId.isEmpty() )
|
2012-07-31 10:06:09 +01:00
|
|
|
{
|
2012-12-14 12:58:00 +02:00
|
|
|
pModule = LoadModule( GetModuleIdentifier( Reference< XFrame >() ) );
|
2012-07-31 10:06:09 +01:00
|
|
|
}
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2012-07-31 10:01:18 +01:00
|
|
|
VectorOfNodes aNodeList = LoadNodes( pModule, rExtensionId );
|
2009-10-31 00:36:06 +01:00
|
|
|
InsertNodes( aNodeList );
|
2012-07-31 10:06:09 +01:00
|
|
|
|
|
|
|
delete pModule;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString OfaTreeOptionsDialog::GetModuleIdentifier( const Reference< XFrame >& rFrame )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sModule;
|
2009-10-31 00:36:06 +01:00
|
|
|
Reference < XFrame > xCurrentFrame( rFrame );
|
2012-12-14 12:58:00 +02:00
|
|
|
Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
|
|
|
|
Reference < XModuleManager2 > xModuleManager = ModuleManager::create(xContext);
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
if ( !xCurrentFrame.is() )
|
|
|
|
{
|
2012-12-14 12:58:00 +02:00
|
|
|
Reference < XDesktop2 > xDesktop = Desktop::create( xContext );
|
|
|
|
xCurrentFrame = xDesktop->getCurrentFrame();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-05 14:55:34 +02:00
|
|
|
if ( xCurrentFrame.is() )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sModule = xModuleManager->identify( xCurrentFrame );
|
|
|
|
}
|
2015-07-28 14:18:40 +02:00
|
|
|
catch ( css::frame::UnknownModuleException& )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-10-19 11:55:44 +02:00
|
|
|
SAL_INFO( "cui.options", "unknown module" );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
catch ( Exception& )
|
|
|
|
{
|
2012-01-16 22:16:03 +01:00
|
|
|
SAL_WARN( "cui.options", "OfaTreeOptionsDialog::GetModuleIdentifier(): exception of XModuleManager::identify()" );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return sModule;
|
|
|
|
}
|
|
|
|
|
|
|
|
Module* OfaTreeOptionsDialog::LoadModule(
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& rModuleIdentifier )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-11-10 10:13:27 +01:00
|
|
|
Module* pModule = nullptr;
|
2012-07-25 19:06:42 +02:00
|
|
|
Reference< XNameAccess > xSet(
|
|
|
|
officecfg::Office::OptionsDialog::Modules::get());
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
Sequence< OUString > seqNames = xSet->getElementNames();
|
2012-07-25 19:06:42 +02:00
|
|
|
for ( int i = 0; i < seqNames.getLength(); ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sModule( seqNames[i] );
|
2012-07-25 19:06:42 +02:00
|
|
|
if ( rModuleIdentifier == sModule )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-07-25 19:06:42 +02:00
|
|
|
// current active module found
|
2015-11-20 13:04:26 +02:00
|
|
|
pModule = new Module;
|
2012-07-25 19:06:42 +02:00
|
|
|
pModule->m_bActive = true;
|
|
|
|
|
|
|
|
Reference< XNameAccess > xModAccess;
|
|
|
|
xSet->getByName( seqNames[i] ) >>= xModAccess;
|
|
|
|
if ( xModAccess.is() )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-07-25 19:06:42 +02:00
|
|
|
// load the nodes of this module
|
|
|
|
Reference< XNameAccess > xNodeAccess;
|
2012-10-05 10:07:15 +02:00
|
|
|
xModAccess->getByName( "Nodes" ) >>= xNodeAccess;
|
2012-07-25 19:06:42 +02:00
|
|
|
if ( xNodeAccess.is() )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
Sequence< OUString > xTemp = xNodeAccess->getElementNames();
|
2012-07-25 19:06:42 +02:00
|
|
|
Reference< XNameAccess > xAccess;
|
|
|
|
sal_Int32 nIndex = -1;
|
|
|
|
for ( int x = 0; x < xTemp.getLength(); ++x )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-07-25 19:06:42 +02:00
|
|
|
xNodeAccess->getByName( xTemp[x] ) >>= xAccess;
|
|
|
|
if ( xAccess.is() )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-10-05 10:07:15 +02:00
|
|
|
xAccess->getByName( "Index" ) >>= nIndex;
|
2012-07-25 19:06:42 +02:00
|
|
|
if ( nIndex < 0 )
|
|
|
|
// append nodes with index < 0
|
|
|
|
pModule->m_aNodeList.push_back(
|
|
|
|
new OrderedEntry( nIndex, xTemp[x] ) );
|
|
|
|
else
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-07-25 19:06:42 +02:00
|
|
|
// search position of the node
|
2017-03-07 19:45:59 +01:00
|
|
|
std::vector<OrderedEntry *>::size_type y = 0;
|
2012-07-25 19:06:42 +02:00
|
|
|
for ( ; y < pModule->m_aNodeList.size(); ++y )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-07-25 19:06:42 +02:00
|
|
|
sal_Int32 nNodeIdx = pModule->m_aNodeList[y]->m_nIndex;
|
|
|
|
if ( nNodeIdx < 0 || nNodeIdx > nIndex )
|
|
|
|
break;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
2012-07-25 19:06:42 +02:00
|
|
|
// and insert the node on this position
|
|
|
|
pModule->m_aNodeList.insert(
|
|
|
|
pModule->m_aNodeList.begin() + y,
|
|
|
|
new OrderedEntry( nIndex, xTemp[x] ) );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-09-10 20:23:57 +01:00
|
|
|
break;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return pModule;
|
|
|
|
}
|
|
|
|
|
2012-07-31 10:01:18 +01:00
|
|
|
VectorOfNodes OfaTreeOptionsDialog::LoadNodes(
|
2013-04-07 12:06:47 +02:00
|
|
|
Module* pModule, const OUString& rExtensionId)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-07-31 10:01:18 +01:00
|
|
|
VectorOfNodes aOutNodeList;
|
|
|
|
|
2012-07-25 19:06:42 +02:00
|
|
|
Reference< XNameAccess > xSet(
|
|
|
|
officecfg::Office::OptionsDialog::Nodes::get());
|
|
|
|
VectorOfNodes aNodeList;
|
2013-04-07 12:06:47 +02:00
|
|
|
Sequence< OUString > seqNames = xSet->getElementNames();
|
2012-07-25 19:06:42 +02:00
|
|
|
|
|
|
|
for ( int i = 0; i < seqNames.getLength(); ++i )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2013-09-26 08:30:52 +02:00
|
|
|
OUString sGroupName( seqNames[i] );
|
2012-07-25 19:06:42 +02:00
|
|
|
Reference< XNameAccess > xNodeAccess;
|
|
|
|
xSet->getByName( seqNames[i] ) >>= xNodeAccess;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2012-07-25 19:06:42 +02:00
|
|
|
if ( xNodeAccess.is() )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sNodeId, sLabel, sPageURL, sGroupId;
|
2012-07-25 19:06:42 +02:00
|
|
|
bool bAllModules = false;
|
|
|
|
sal_Int32 nGroupIndex = 0;
|
|
|
|
|
|
|
|
sNodeId = seqNames[i];
|
2012-10-05 10:07:15 +02:00
|
|
|
xNodeAccess->getByName( "Label" ) >>= sLabel;
|
|
|
|
xNodeAccess->getByName( "OptionsPage" ) >>= sPageURL;
|
|
|
|
xNodeAccess->getByName( "AllModules" ) >>= bAllModules;
|
|
|
|
xNodeAccess->getByName( "GroupId" ) >>= sGroupId;
|
|
|
|
xNodeAccess->getByName( "GroupIndex" ) >>= nGroupIndex;
|
2012-07-25 19:06:42 +02:00
|
|
|
|
|
|
|
if ( sLabel.isEmpty() )
|
|
|
|
sLabel = sGroupName;
|
2013-09-26 08:30:52 +02:00
|
|
|
OUString sTemp = getGroupName( sLabel, !rExtensionId.isEmpty() );
|
|
|
|
if ( !sTemp.isEmpty() )
|
2012-07-25 19:06:42 +02:00
|
|
|
sLabel = sTemp;
|
|
|
|
OptionsNode* pNode =
|
2015-11-20 13:04:26 +02:00
|
|
|
new OptionsNode( sNodeId, sLabel, sPageURL, bAllModules );
|
2012-07-25 19:06:42 +02:00
|
|
|
|
|
|
|
if ( rExtensionId.isEmpty() && !isNodeActive( pNode, pModule ) )
|
2012-02-14 14:19:07 +01:00
|
|
|
{
|
2012-07-25 19:06:42 +02:00
|
|
|
delete pNode;
|
|
|
|
continue;
|
|
|
|
}
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2012-07-25 19:06:42 +02:00
|
|
|
Reference< XNameAccess > xLeavesSet;
|
2012-10-05 10:07:15 +02:00
|
|
|
xNodeAccess->getByName( "Leaves" ) >>= xLeavesSet;
|
2012-07-25 19:06:42 +02:00
|
|
|
if ( xLeavesSet.is() )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
Sequence< OUString > seqLeaves = xLeavesSet->getElementNames();
|
2012-07-25 19:06:42 +02:00
|
|
|
for ( int j = 0; j < seqLeaves.getLength(); ++j )
|
2012-07-18 14:00:57 +02:00
|
|
|
{
|
2012-07-25 19:06:42 +02:00
|
|
|
Reference< XNameAccess > xLeaveAccess;
|
|
|
|
xLeavesSet->getByName( seqLeaves[j] ) >>= xLeaveAccess;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2012-07-25 19:06:42 +02:00
|
|
|
if ( xLeaveAccess.is() )
|
2012-07-18 14:00:57 +02:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sId, sLeafLabel, sEventHdl, sLeafURL, sLeafGrpId;
|
2012-07-25 19:06:42 +02:00
|
|
|
sal_Int32 nLeafGrpIdx = 0;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2012-10-05 10:07:15 +02:00
|
|
|
xLeaveAccess->getByName( "Id" ) >>= sId;
|
|
|
|
xLeaveAccess->getByName( "Label" ) >>= sLeafLabel;
|
|
|
|
xLeaveAccess->getByName( "OptionsPage" ) >>= sLeafURL;
|
|
|
|
xLeaveAccess->getByName( "EventHandlerService" ) >>= sEventHdl;
|
|
|
|
xLeaveAccess->getByName( "GroupId" ) >>= sLeafGrpId;
|
|
|
|
xLeaveAccess->getByName( "GroupIndex" ) >>= nLeafGrpIdx;
|
2012-07-18 14:00:57 +02:00
|
|
|
|
2012-07-25 19:06:42 +02:00
|
|
|
if ( rExtensionId.isEmpty() || sId == rExtensionId )
|
|
|
|
{
|
|
|
|
OptionsLeaf* pLeaf = new OptionsLeaf(
|
2015-11-20 13:04:26 +02:00
|
|
|
sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx );
|
2012-07-18 14:00:57 +02:00
|
|
|
|
2012-07-25 19:06:42 +02:00
|
|
|
if ( !sLeafGrpId.isEmpty() )
|
|
|
|
{
|
|
|
|
bool bAlreadyOpened = false;
|
|
|
|
if ( pNode->m_aGroupedLeaves.size() > 0 )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2016-04-25 09:59:16 +02:00
|
|
|
for (std::vector<OptionsLeaf*> & rGroup : pNode->m_aGroupedLeaves)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2016-04-25 09:59:16 +02:00
|
|
|
if ( rGroup.size() > 0 &&
|
|
|
|
rGroup[0]->m_sGroupId == sLeafGrpId )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-03-07 19:45:59 +01:00
|
|
|
std::vector<OptionsLeaf *>::size_type l = 0;
|
2016-04-25 09:59:16 +02:00
|
|
|
for ( ; l < rGroup.size(); ++l )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2016-04-25 09:59:16 +02:00
|
|
|
if ( rGroup[l]->m_nGroupIndex >= nLeafGrpIdx )
|
2009-10-31 00:36:06 +01:00
|
|
|
break;
|
|
|
|
}
|
2016-04-25 09:59:16 +02:00
|
|
|
rGroup.insert( rGroup.begin() + l, pLeaf );
|
2012-07-25 19:06:42 +02:00
|
|
|
bAlreadyOpened = true;
|
|
|
|
break;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
2012-07-25 19:06:42 +02:00
|
|
|
}
|
|
|
|
if ( !bAlreadyOpened )
|
|
|
|
{
|
|
|
|
VectorOfLeaves aGroupedLeaves;
|
|
|
|
aGroupedLeaves.push_back( pLeaf );
|
|
|
|
pNode->m_aGroupedLeaves.push_back( aGroupedLeaves );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
2012-07-25 19:06:42 +02:00
|
|
|
else
|
2013-03-02 02:53:46 +01:00
|
|
|
pNode->m_aLeaves.push_back( pLeaf );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-25 19:06:42 +02:00
|
|
|
// do not insert nodes without leaves
|
|
|
|
if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-07-31 10:01:18 +01:00
|
|
|
pModule ? aNodeList.push_back( pNode ) : aOutNodeList.push_back( pNode );
|
2012-07-25 19:06:42 +02:00
|
|
|
}
|
2013-09-10 20:29:12 +01:00
|
|
|
else
|
|
|
|
delete pNode;
|
2012-07-25 19:06:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pModule && aNodeList.size() > 0 )
|
|
|
|
{
|
2017-03-07 19:45:59 +01:00
|
|
|
for ( auto const & i: pModule->m_aNodeList )
|
2012-07-25 19:06:42 +02:00
|
|
|
{
|
2017-03-07 19:45:59 +01:00
|
|
|
OUString sNodeId = i->m_sId;
|
2017-03-10 09:37:41 +01:00
|
|
|
for ( auto j = aNodeList.begin(); j != aNodeList.end(); ++j )
|
2012-07-25 19:06:42 +02:00
|
|
|
{
|
2017-03-10 09:37:41 +01:00
|
|
|
OptionsNode* pNode = *j;
|
2012-07-25 19:06:42 +02:00
|
|
|
if ( pNode->m_sId == sNodeId )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2012-07-31 10:01:18 +01:00
|
|
|
aOutNodeList.push_back( pNode );
|
2017-03-10 09:37:41 +01:00
|
|
|
aNodeList.erase( j );
|
2012-07-25 19:06:42 +02:00
|
|
|
break;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-25 19:06:42 +02:00
|
|
|
|
2017-03-07 19:45:59 +01:00
|
|
|
for ( auto const & i: aNodeList )
|
|
|
|
aOutNodeList.push_back( i );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
2012-07-31 10:01:18 +01:00
|
|
|
return aOutNodeList;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
static sal_uInt16 lcl_getGroupId( const OUString& rGroupName, const SvTreeListBox& rTreeLB )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nRet = 0;
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = rTreeLB.First();
|
2009-10-31 00:36:06 +01:00
|
|
|
while( pEntry )
|
|
|
|
{
|
|
|
|
if ( !rTreeLB.GetParent( pEntry ) )
|
|
|
|
{
|
2013-09-26 08:30:52 +02:00
|
|
|
OUString sTemp( rTreeLB.GetEntryText( pEntry ) );
|
2016-04-12 16:39:03 +02:00
|
|
|
if ( sTemp == rGroupName )
|
2009-10-31 00:36:06 +01:00
|
|
|
return nRet;
|
|
|
|
nRet++;
|
|
|
|
}
|
|
|
|
pEntry = rTreeLB.Next( pEntry );
|
|
|
|
}
|
|
|
|
|
|
|
|
return USHRT_MAX;
|
|
|
|
}
|
|
|
|
|
2012-10-12 13:26:46 +02:00
|
|
|
static void lcl_insertLeaf(
|
2017-07-31 15:13:12 +02:00
|
|
|
OfaTreeOptionsDialog* pDlg, OptionsNode const * pNode, OptionsLeaf const * pLeaf, const SvTreeListBox& rTreeLB )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nGrpId = lcl_getGroupId( pNode->m_sLabel, rTreeLB );
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( USHRT_MAX == nGrpId )
|
|
|
|
{
|
2011-01-14 12:41:27 +01:00
|
|
|
sal_uInt16 nNodeGrpId = getGroupNodeId( pNode->m_sId );
|
2015-11-10 10:13:27 +01:00
|
|
|
nGrpId = pDlg->AddGroup( pNode->m_sLabel, nullptr, nullptr, nNodeGrpId );
|
2011-12-16 17:29:07 -02:00
|
|
|
if ( !pNode->m_sPageURL.isEmpty() )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2015-11-10 10:13:27 +01:00
|
|
|
SvTreeListEntry* pGrpEntry = rTreeLB.GetEntry( nullptr, nGrpId );
|
2009-10-31 00:36:06 +01:00
|
|
|
DBG_ASSERT( pGrpEntry, "OfaTreeOptionsDialog::InsertNodes(): no group" );
|
|
|
|
if ( pGrpEntry )
|
|
|
|
{
|
|
|
|
OptionsGroupInfo* pGrpInfo =
|
|
|
|
static_cast<OptionsGroupInfo*>(pGrpEntry->GetUserData());
|
|
|
|
pGrpInfo->m_sPageURL = pNode->m_sPageURL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OptionsPageInfo* pInfo = pDlg->AddTabPage( 0, pLeaf->m_sLabel, nGrpId );
|
|
|
|
pInfo->m_sPageURL = pLeaf->m_sPageURL;
|
|
|
|
pInfo->m_sEventHdl = pLeaf->m_sEventHdl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OfaTreeOptionsDialog::InsertNodes( const VectorOfNodes& rNodeList )
|
|
|
|
{
|
2016-04-21 11:03:55 +02:00
|
|
|
for (OptionsNode* pNode : rNodeList)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
|
|
|
|
{
|
2017-03-07 19:45:59 +01:00
|
|
|
for ( auto const & j: pNode->m_aGroupedLeaves )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-03-07 19:45:59 +01:00
|
|
|
for ( size_t k = 0; k < j.size(); ++k )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-03-07 19:45:59 +01:00
|
|
|
OptionsLeaf* pLeaf = j[k];
|
2014-07-15 13:08:40 +02:00
|
|
|
lcl_insertLeaf( this, pNode, pLeaf, *pTreeLB );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-07 19:45:59 +01:00
|
|
|
for ( auto const & j: pNode->m_aLeaves )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-03-07 19:45:59 +01:00
|
|
|
OptionsLeaf* pLeaf = j;
|
2014-07-15 13:08:40 +02:00
|
|
|
lcl_insertLeaf( this, pNode, pLeaf, *pTreeLB );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
short OfaTreeOptionsDialog::Execute()
|
|
|
|
{
|
2015-09-14 09:21:33 +01:00
|
|
|
std::unique_ptr< SvxDicListChgClamp > pClamp;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( !bIsFromExtensionManager )
|
|
|
|
{
|
|
|
|
// collect all DictionaryList Events while the dialog is executed
|
2016-07-10 22:08:12 +02:00
|
|
|
Reference<css::linguistic2::XSearchableDictionaryList> xDictionaryList(LinguMgr::GetDictionaryList());
|
2013-10-02 16:41:03 +02:00
|
|
|
pClamp.reset( new SvxDicListChgClamp( xDictionaryList ) );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
short nRet = SfxModalDialog::Execute();
|
|
|
|
|
|
|
|
if( RET_OK == nRet )
|
|
|
|
{
|
|
|
|
ApplyItemSets();
|
2011-11-11 22:48:37 +01:00
|
|
|
utl::ConfigManager::storeConfigItems();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// class ExtensionsTabPage -----------------------------------------------
|
|
|
|
ExtensionsTabPage::ExtensionsTabPage(
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pParent, WinBits nStyle, const OUString& rPageURL,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& rEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider ) :
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
TabPage( pParent, nStyle ),
|
|
|
|
|
|
|
|
m_sPageURL ( rPageURL ),
|
|
|
|
m_sEventHdl ( rEvtHdl ),
|
2016-06-24 13:12:25 +02:00
|
|
|
m_xWinProvider ( rProvider )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ExtensionsTabPage::~ExtensionsTabPage()
|
2015-01-15 15:47:39 +02:00
|
|
|
{
|
2015-03-10 09:07:06 +02:00
|
|
|
disposeOnce();
|
2015-01-15 15:47:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ExtensionsTabPage::dispose()
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
Hide();
|
|
|
|
DeactivatePage();
|
2014-04-07 23:53:55 +00:00
|
|
|
|
|
|
|
if ( m_xPage.is() )
|
|
|
|
{
|
|
|
|
Reference< XComponent > xComponent( m_xPage, UNO_QUERY );
|
|
|
|
if ( xComponent.is() )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
xComponent->dispose();
|
|
|
|
}
|
|
|
|
catch ( const Exception & )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_xPage.clear();
|
|
|
|
}
|
2015-01-15 15:47:39 +02:00
|
|
|
TabPage::dispose();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
void ExtensionsTabPage::CreateDialogWithHandler()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2011-12-16 17:29:07 -02:00
|
|
|
bool bWithHandler = ( !m_sEventHdl.isEmpty() );
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( bWithHandler )
|
|
|
|
{
|
|
|
|
Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
|
2015-10-30 07:59:06 +02:00
|
|
|
m_xEventHdl.set( xFactory->createInstance( m_sEventHdl ), UNO_QUERY );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !bWithHandler || m_xEventHdl.is() )
|
|
|
|
{
|
|
|
|
SetStyle( GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
|
|
|
|
Reference< awt::XWindowPeer > xParent( VCLUnoHelper::GetInterface( this ), UNO_QUERY );
|
2015-10-30 07:59:06 +02:00
|
|
|
m_xPage.set(
|
2009-10-31 00:36:06 +01:00
|
|
|
m_xWinProvider->createContainerWindow(
|
2013-04-07 12:06:47 +02:00
|
|
|
m_sPageURL, OUString(), xParent, m_xEventHdl ), UNO_QUERY );
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
Reference< awt::XControl > xPageControl( m_xPage, UNO_QUERY );
|
|
|
|
if ( xPageControl.is() )
|
|
|
|
{
|
|
|
|
Reference< awt::XWindowPeer > xWinPeer( xPageControl->getPeer() );
|
|
|
|
if ( xWinPeer.is() )
|
|
|
|
{
|
2016-11-10 12:53:02 +02:00
|
|
|
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWinPeer );
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( pWindow )
|
|
|
|
pWindow->SetStyle( pWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-08 11:20:33 +01:00
|
|
|
catch (const css::lang::IllegalArgumentException& e)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-09-29 16:21:54 +02:00
|
|
|
SAL_WARN("cui.options", "ExtensionsTabPage::CreateDialogWithHandler(): illegal argument:" << e);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
2014-09-08 11:20:33 +01:00
|
|
|
catch (const Exception& e)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-09-29 16:21:54 +02:00
|
|
|
SAL_WARN( "cui.options", "ExtensionsTabPage::CreateDialogWithHandler(): exception of XDialogProvider2::createDialogWithHandler(): " << e);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-16 11:39:08 +02:00
|
|
|
bool ExtensionsTabPage::DispatchAction( const OUString& rAction )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2014-04-16 11:39:08 +02:00
|
|
|
bool bRet = false;
|
2009-10-31 00:36:06 +01:00
|
|
|
if ( m_xEventHdl.is() )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2017-02-24 10:24:14 +02:00
|
|
|
bRet = m_xEventHdl->callHandlerMethod( m_xPage, Any( rAction ), "external_event" );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
catch ( Exception& )
|
|
|
|
{
|
2012-01-16 22:16:03 +01:00
|
|
|
SAL_WARN( "cui.options", "ExtensionsTabPage::DispatchAction(): exception of XDialogEventHandler::callHandlerMethod()" );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ExtensionsTabPage::ActivatePage()
|
|
|
|
{
|
|
|
|
TabPage::ActivatePage();
|
|
|
|
|
|
|
|
if ( !m_xPage.is() )
|
|
|
|
{
|
|
|
|
CreateDialogWithHandler();
|
|
|
|
|
|
|
|
if ( m_xPage.is() )
|
|
|
|
{
|
|
|
|
Point aPos = Point();
|
2014-07-16 13:26:53 +01:00
|
|
|
Size aSize = GetParent()->get_preferred_size();
|
2009-10-31 00:36:06 +01:00
|
|
|
m_xPage->setPosSize( aPos.X() + 1, aPos.Y() + 1,
|
|
|
|
aSize.Width() - 2, aSize.Height() - 2, awt::PosSize::POSSIZE );
|
2011-12-16 17:29:07 -02:00
|
|
|
if ( !m_sEventHdl.isEmpty() )
|
2012-10-05 10:07:15 +02:00
|
|
|
DispatchAction( "initialize" );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_xPage.is() )
|
|
|
|
{
|
2016-04-20 17:16:08 +02:00
|
|
|
m_xPage->setVisible( true );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ExtensionsTabPage::DeactivatePage()
|
|
|
|
{
|
|
|
|
TabPage::DeactivatePage();
|
|
|
|
|
|
|
|
if ( m_xPage.is() )
|
2016-04-20 17:16:08 +02:00
|
|
|
m_xPage->setVisible( false );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
void ExtensionsTabPage::ResetPage()
|
|
|
|
{
|
2012-10-05 10:07:15 +02:00
|
|
|
DispatchAction( "back" );
|
2009-10-31 00:36:06 +01:00
|
|
|
ActivatePage();
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
void ExtensionsTabPage::SavePage()
|
|
|
|
{
|
2012-10-05 10:07:15 +02:00
|
|
|
DispatchAction( "ok" );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2011-04-28 00:59:28 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|