1*2ee96f1cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2ee96f1cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2ee96f1cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2ee96f1cSAndrew Rist * distributed with this work for additional information 6*2ee96f1cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2ee96f1cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2ee96f1cSAndrew Rist * "License"); you may not use this file except in compliance 9*2ee96f1cSAndrew Rist * with the License. You may obtain a copy of the License at 10*2ee96f1cSAndrew Rist * 11*2ee96f1cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2ee96f1cSAndrew Rist * 13*2ee96f1cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2ee96f1cSAndrew Rist * software distributed under the License is distributed on an 15*2ee96f1cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2ee96f1cSAndrew Rist * KIND, either express or implied. See the License for the 17*2ee96f1cSAndrew Rist * specific language governing permissions and limitations 18*2ee96f1cSAndrew Rist * under the License. 19*2ee96f1cSAndrew Rist * 20*2ee96f1cSAndrew Rist *************************************************************/ 21*2ee96f1cSAndrew Rist 22*2ee96f1cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_cui.hxx" 26cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 27cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 28cdf0e10cSrcweir #include <com/sun/star/loader/CannotActivateFactoryException.hpp> 29cdf0e10cSrcweir #include <com/sun/star/linguistic2/XDictionaryList.hpp> 30cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp> 31cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 32cdf0e10cSrcweir #include <com/sun/star/frame/XModuleManager.hpp> 33cdf0e10cSrcweir #include <com/sun/star/util/XMacroExpander.hpp> 34cdf0e10cSrcweir #include <osl/module.hxx> 35cdf0e10cSrcweir #include <com/sun/star/util/XCloseable.hpp> 36cdf0e10cSrcweir #include <com/sun/star/frame/XLoadable.hpp> 37cdf0e10cSrcweir #include <tools/rcid.h> 38cdf0e10cSrcweir #include <tools/shl.hxx> 39cdf0e10cSrcweir #include <tools/urlobj.hxx> 40cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 41cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 42cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 43cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 44cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 45cdf0e10cSrcweir #include <com/sun/star/oooimprovement/XCoreController.hpp> 46cdf0e10cSrcweir #include <comphelper/configurationhelper.hxx> 47cdf0e10cSrcweir #include <com/sun/star/awt/XDialogProvider.hpp> 48cdf0e10cSrcweir #include <com/sun/star/awt/XDialogProvider2.hpp> 49cdf0e10cSrcweir #include <com/sun/star/awt/XContainerWindowProvider.hpp> 50cdf0e10cSrcweir #include <com/sun/star/awt/XDialogEventHandler.hpp> 51cdf0e10cSrcweir #include <com/sun/star/awt/XContainerWindowEventHandler.hpp> 52cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp> 53cdf0e10cSrcweir #include <com/sun/star/awt/XTopWindow.hpp> 54cdf0e10cSrcweir #include <com/sun/star/awt/XControl.hpp> 55cdf0e10cSrcweir #include <com/sun/star/awt/XTabController.hpp> 56cdf0e10cSrcweir #include <vcl/help.hxx> 57cdf0e10cSrcweir #include <linguistic/misc.hxx> 58cdf0e10cSrcweir #include <svtools/helpopt.hxx> 59cdf0e10cSrcweir #include <unotools/moduleoptions.hxx> 60cdf0e10cSrcweir #include <svl/languageoptions.hxx> 61cdf0e10cSrcweir #include <unotools/optionsdlg.hxx> 62cdf0e10cSrcweir #include <sfx2/module.hxx> 63cdf0e10cSrcweir #include <vcl/msgbox.hxx> 64cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 65cdf0e10cSrcweir #include <vcl/waitobj.hxx> 66cdf0e10cSrcweir #include <svl/slstitm.hxx> 67cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 68cdf0e10cSrcweir #include <unotools/viewoptions.hxx> 69cdf0e10cSrcweir #include <sfx2/printopt.hxx> 70cdf0e10cSrcweir #include <osl/module.h> 71cdf0e10cSrcweir #include <osl/process.h> 72cdf0e10cSrcweir #include <rtl/bootstrap.hxx> 73cdf0e10cSrcweir #include <unotools/misccfg.hxx> 74cdf0e10cSrcweir #include <sfx2/objsh.hxx> 75cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 76cdf0e10cSrcweir #include <sfx2/tplpitem.hxx> 77cdf0e10cSrcweir #include <svtools/apearcfg.hxx> 78cdf0e10cSrcweir #include <unotools/linguprops.hxx> 79cdf0e10cSrcweir #include <sfx2/app.hxx> 80cdf0e10cSrcweir #include <svx/xdef.hxx> 81cdf0e10cSrcweir #include <svx/xflclit.hxx> 82cdf0e10cSrcweir #include <svx/xpool.hxx> 83cdf0e10cSrcweir #include "cuitabarea.hxx" 84cdf0e10cSrcweir #include <svx/ofaitem.hxx> 85cdf0e10cSrcweir #include "opthtml.hxx" 86cdf0e10cSrcweir #include "optcolor.hxx" 87cdf0e10cSrcweir #include "optctl.hxx" 88cdf0e10cSrcweir #include "optjava.hxx" 89cdf0e10cSrcweir #include "optsave.hxx" 90cdf0e10cSrcweir #include "optpath.hxx" 91cdf0e10cSrcweir #include "cuioptgenrl.hxx" 92cdf0e10cSrcweir #include "optlingu.hxx" 93cdf0e10cSrcweir #include "optinet2.hxx" 94cdf0e10cSrcweir #include "optasian.hxx" 95cdf0e10cSrcweir #include "optaccessibility.hxx" 96cdf0e10cSrcweir #include "optjsearch.hxx" 97cdf0e10cSrcweir #include "connpooloptions.hxx" 98cdf0e10cSrcweir #include "optupdt.hxx" 99cdf0e10cSrcweir #include <optimprove.hxx> 100cdf0e10cSrcweir #include "optchart.hxx" 101cdf0e10cSrcweir #include "optgdlg.hxx" 102cdf0e10cSrcweir #include "optmemory.hxx" 103cdf0e10cSrcweir #include "optfltr.hxx" 104cdf0e10cSrcweir #include <cuires.hrc> 105cdf0e10cSrcweir #include "helpid.hrc" 106cdf0e10cSrcweir #include <dialmgr.hxx> 107cdf0e10cSrcweir #include "treeopt.hxx" 108cdf0e10cSrcweir #include "treeopt.hrc" 109cdf0e10cSrcweir #include "fontsubs.hxx" 110cdf0e10cSrcweir #include <editeng/unolingu.hxx> 111cdf0e10cSrcweir #include <svx/xtable.hxx> 112cdf0e10cSrcweir #include "connpoolconfig.hxx" 113cdf0e10cSrcweir #include "dbregister.hxx" 114cdf0e10cSrcweir #include "dbregisterednamesconfig.hxx" 115cdf0e10cSrcweir #include "cfgchart.hxx" 116cdf0e10cSrcweir #include <svx/dialogs.hrc> 117cdf0e10cSrcweir 118cdf0e10cSrcweir #ifndef _SVX_LANGITEM_HXX 119cdf0e10cSrcweir #define ITEMID_LANGUAGE SID_ATTR_CHAR_LANGUAGE 120cdf0e10cSrcweir #include <editeng/langitem.hxx> 121cdf0e10cSrcweir #endif 122cdf0e10cSrcweir 123cdf0e10cSrcweir 124cdf0e10cSrcweir #include <editeng/optitems.hxx> 125cdf0e10cSrcweir 126cdf0e10cSrcweir #include <svx/drawitem.hxx> 127cdf0e10cSrcweir #include <rtl/uri.hxx> 128cdf0e10cSrcweir 129cdf0e10cSrcweir #ifdef LINUX 130cdf0e10cSrcweir #include <string.h> 131cdf0e10cSrcweir #include <sys/types.h> 132cdf0e10cSrcweir #include <sys/stat.h> 133cdf0e10cSrcweir #include <unistd.h> 134cdf0e10cSrcweir #endif 135cdf0e10cSrcweir 136cdf0e10cSrcweir using namespace ::com::sun::star; 137cdf0e10cSrcweir using namespace ::com::sun::star::beans; 138cdf0e10cSrcweir using namespace ::com::sun::star::container; 139cdf0e10cSrcweir using namespace ::com::sun::star::frame; 140cdf0e10cSrcweir using namespace ::com::sun::star::lang; 141cdf0e10cSrcweir using namespace ::com::sun::star::linguistic2; 142cdf0e10cSrcweir using namespace ::com::sun::star::uno; 143cdf0e10cSrcweir using namespace ::com::sun::star::util; 144cdf0e10cSrcweir 145cdf0e10cSrcweir #ifdef C2U 146cdf0e10cSrcweir #error "Who define C2U before! I use it to create const ascii strings ..." 147cdf0e10cSrcweir #else 148cdf0e10cSrcweir #define C2U(cChar) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( cChar ) ) 149cdf0e10cSrcweir #endif 150cdf0e10cSrcweir 151cdf0e10cSrcweir #define HINT_TIMEOUT 200 152cdf0e10cSrcweir #define SELECT_FIRST_TIMEOUT 0 153cdf0e10cSrcweir #define SELECT_TIMEOUT 300 154cdf0e10cSrcweir #define COLORPAGE_UNKNOWN ((sal_uInt16)0xFFFF) 155cdf0e10cSrcweir #define EXPAND_PROTOCOL "vnd.sun.star.expand:" 156cdf0e10cSrcweir 157cdf0e10cSrcweir LastPageSaver* OfaTreeOptionsDialog::pLastPageSaver = NULL; 158cdf0e10cSrcweir 159cdf0e10cSrcweir // some stuff for easier changes for SvtViewOptions 160cdf0e10cSrcweir static const sal_Char* pViewOptDataName = "page data"; 161cdf0e10cSrcweir #define VIEWOPT_DATANAME rtl::OUString::createFromAscii( pViewOptDataName ) 162cdf0e10cSrcweir 163cdf0e10cSrcweir static XOutdevItemPool* mpStaticXOutdevItemPool = 0L; 164cdf0e10cSrcweir 165cdf0e10cSrcweir static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const String& rData ) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir rOpt.SetUserItem( VIEWOPT_DATANAME, makeAny( rtl::OUString( rData ) ) ); 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir static inline String GetViewOptUserItem( const SvtViewOptions& rOpt ) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) ); 173cdf0e10cSrcweir rtl::OUString aUserData; 174cdf0e10cSrcweir aAny >>= aUserData; 175cdf0e10cSrcweir 176cdf0e10cSrcweir return String( aUserData ); 177cdf0e10cSrcweir } 178cdf0e10cSrcweir 179cdf0e10cSrcweir struct ModuleToGroupNameMap_Impl 180cdf0e10cSrcweir { 181cdf0e10cSrcweir const char* m_pModule; 182cdf0e10cSrcweir String m_sGroupName; 183cdf0e10cSrcweir sal_uInt16 m_nNodeId; 184cdf0e10cSrcweir }; 185cdf0e10cSrcweir 186cdf0e10cSrcweir static OfaPageResource* pPageRes = NULL; 187cdf0e10cSrcweir 188cdf0e10cSrcweir static ModuleToGroupNameMap_Impl ModuleMap[] = 189cdf0e10cSrcweir { 190cdf0e10cSrcweir { "ProductName", String::EmptyString(), SID_GENERAL_OPTIONS }, 191cdf0e10cSrcweir { "LanguageSettings", String::EmptyString(), SID_LANGUAGE_OPTIONS }, 192cdf0e10cSrcweir { "Internet", String::EmptyString(), SID_INET_DLG }, 193cdf0e10cSrcweir { "LoadSave", String::EmptyString(), SID_FILTER_DLG }, 194cdf0e10cSrcweir { "Writer", String::EmptyString(), SID_SW_EDITOPTIONS }, 195cdf0e10cSrcweir { "WriterWeb", String::EmptyString(), SID_SW_ONLINEOPTIONS }, 196cdf0e10cSrcweir { "Math", String::EmptyString(), SID_SM_EDITOPTIONS }, 197cdf0e10cSrcweir { "Calc", String::EmptyString(), SID_SC_EDITOPTIONS }, 198cdf0e10cSrcweir { "Impress", String::EmptyString(), SID_SD_EDITOPTIONS }, 199cdf0e10cSrcweir { "Draw", String::EmptyString(), SID_SD_GRAPHIC_OPTIONS }, 200cdf0e10cSrcweir { "Charts", String::EmptyString(), SID_SCH_EDITOPTIONS }, 201cdf0e10cSrcweir { "Base", String::EmptyString(), SID_SB_STARBASEOPTIONS }, 202cdf0e10cSrcweir 203cdf0e10cSrcweir { NULL, String::EmptyString(), 0xFFFF } 204cdf0e10cSrcweir }; 205cdf0e10cSrcweir 206cdf0e10cSrcweir static void setGroupName( const rtl::OUString& rModule, const String& rGroupName ) 207cdf0e10cSrcweir { 208cdf0e10cSrcweir sal_uInt16 nIndex = 0; 209cdf0e10cSrcweir while ( ModuleMap[ nIndex ].m_pModule ) 210cdf0e10cSrcweir { 211cdf0e10cSrcweir rtl::OUString sTemp = 212cdf0e10cSrcweir rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule ); 213cdf0e10cSrcweir if ( sTemp == rModule ) 214cdf0e10cSrcweir { 215cdf0e10cSrcweir ModuleMap[ nIndex ].m_sGroupName = rGroupName; 216cdf0e10cSrcweir break; 217cdf0e10cSrcweir } 218cdf0e10cSrcweir ++nIndex; 219cdf0e10cSrcweir } 220cdf0e10cSrcweir } 221cdf0e10cSrcweir 222cdf0e10cSrcweir static String getGroupName( const rtl::OUString& rModule, bool bForced ) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir String sGroupName; 225cdf0e10cSrcweir sal_uInt16 nIndex = 0; 226cdf0e10cSrcweir while ( ModuleMap[ nIndex ].m_pModule ) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir rtl::OUString sTemp = 229cdf0e10cSrcweir rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule ); 230cdf0e10cSrcweir if ( sTemp == rModule ) 231cdf0e10cSrcweir { 232cdf0e10cSrcweir sGroupName = ModuleMap[ nIndex ].m_sGroupName; 233cdf0e10cSrcweir break; 234cdf0e10cSrcweir } 235cdf0e10cSrcweir ++nIndex; 236cdf0e10cSrcweir } 237cdf0e10cSrcweir 238cdf0e10cSrcweir if ( sGroupName.Len() == 0 && bForced ) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir if ( !pPageRes ) 241cdf0e10cSrcweir pPageRes = new OfaPageResource; 242cdf0e10cSrcweir 243cdf0e10cSrcweir if ( rModule == C2U("Writer") ) 244cdf0e10cSrcweir sGroupName = pPageRes->GetTextArray().GetString(0); 245cdf0e10cSrcweir else if ( rModule == C2U("WriterWeb") ) 246cdf0e10cSrcweir sGroupName = pPageRes->GetHTMLArray().GetString(0); 247cdf0e10cSrcweir else if ( rModule == C2U("Calc") ) 248cdf0e10cSrcweir sGroupName = pPageRes->GetCalcArray().GetString(0); 249cdf0e10cSrcweir else if ( rModule == C2U("Impress") ) 250cdf0e10cSrcweir sGroupName = pPageRes->GetImpressArray().GetString(0); 251cdf0e10cSrcweir else if ( rModule == C2U("Draw") ) 252cdf0e10cSrcweir sGroupName = pPageRes->GetDrawArray().GetString(0); 253cdf0e10cSrcweir else if ( rModule == C2U("Math") ) 254cdf0e10cSrcweir sGroupName = pPageRes->GetStarMathArray().GetString(0); 255cdf0e10cSrcweir else if ( rModule == C2U("Base") ) 256cdf0e10cSrcweir sGroupName = pPageRes->GetDatasourcesArray().GetString(0); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir return sGroupName; 259cdf0e10cSrcweir } 260cdf0e10cSrcweir 261cdf0e10cSrcweir static void deleteGroupNames() 262cdf0e10cSrcweir { 263cdf0e10cSrcweir sal_uInt16 nIndex = 0; 264cdf0e10cSrcweir while ( ModuleMap[ nIndex ].m_pModule ) 265cdf0e10cSrcweir ModuleMap[ nIndex++ ].m_sGroupName = String::EmptyString(); 266cdf0e10cSrcweir } 267cdf0e10cSrcweir 268cdf0e10cSrcweir static sal_uInt16 getGroupNodeId( const rtl::OUString& rModule ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir sal_uInt16 nNodeId = 0xFFFF, nIndex = 0; 271cdf0e10cSrcweir while ( ModuleMap[ nIndex ].m_pModule ) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir rtl::OUString sTemp = 274cdf0e10cSrcweir rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule ); 275cdf0e10cSrcweir if ( sTemp == rModule ) 276cdf0e10cSrcweir { 277cdf0e10cSrcweir nNodeId = ModuleMap[ nIndex ].m_nNodeId; 278cdf0e10cSrcweir break; 279cdf0e10cSrcweir } 280cdf0e10cSrcweir ++nIndex; 281cdf0e10cSrcweir } 282cdf0e10cSrcweir 283cdf0e10cSrcweir return nNodeId; 284cdf0e10cSrcweir } 285cdf0e10cSrcweir 286cdf0e10cSrcweir /*-- 29.10.2004 13:57:25--------------------------------------------------- 287cdf0e10cSrcweir 288cdf0e10cSrcweir -----------------------------------------------------------------------*/ 289cdf0e10cSrcweir class MailMergeCfg_Impl : public utl::ConfigItem 290cdf0e10cSrcweir { 291cdf0e10cSrcweir friend class SvxEMailTabPage; 292cdf0e10cSrcweir // variables 293cdf0e10cSrcweir sal_Bool bIsEmailSupported; 294cdf0e10cSrcweir 295cdf0e10cSrcweir public: 296cdf0e10cSrcweir MailMergeCfg_Impl(); 297cdf0e10cSrcweir virtual ~MailMergeCfg_Impl(); 298cdf0e10cSrcweir 299cdf0e10cSrcweir virtual void Commit(); 300cdf0e10cSrcweir virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); 301cdf0e10cSrcweir 302cdf0e10cSrcweir sal_Bool IsEmailSupported() const {return bIsEmailSupported;} 303cdf0e10cSrcweir 304cdf0e10cSrcweir }; 305cdf0e10cSrcweir /*-- 29.10.2004 13:57:25--------------------------------------------------- 306cdf0e10cSrcweir 307cdf0e10cSrcweir -----------------------------------------------------------------------*/ 308cdf0e10cSrcweir MailMergeCfg_Impl::MailMergeCfg_Impl() : 309cdf0e10cSrcweir utl::ConfigItem(C2U("Office.Writer/MailMergeWizard")), 310cdf0e10cSrcweir bIsEmailSupported(sal_False) 311cdf0e10cSrcweir { 312cdf0e10cSrcweir Sequence<rtl::OUString> aNames(1); 313cdf0e10cSrcweir aNames.getArray()[0] = C2U("EMailSupported"); 314cdf0e10cSrcweir const Sequence< Any > aValues = GetProperties(aNames); 315cdf0e10cSrcweir const Any* pValues = aValues.getConstArray(); 316cdf0e10cSrcweir if(aValues.getLength() && pValues[0].hasValue()) 317cdf0e10cSrcweir pValues[0] >>= bIsEmailSupported; 318cdf0e10cSrcweir } 319cdf0e10cSrcweir /*-- 29.10.2004 13:57:25--------------------------------------------------- 320cdf0e10cSrcweir 321cdf0e10cSrcweir -----------------------------------------------------------------------*/ 322cdf0e10cSrcweir MailMergeCfg_Impl::~MailMergeCfg_Impl() 323cdf0e10cSrcweir { 324cdf0e10cSrcweir } 325cdf0e10cSrcweir /* -------------------------------------------------------------------------*/ 326cdf0e10cSrcweir void MailMergeCfg_Impl::Commit() 327cdf0e10cSrcweir { 328cdf0e10cSrcweir } 329cdf0e10cSrcweir 330cdf0e10cSrcweir void MailMergeCfg_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) 331cdf0e10cSrcweir { 332cdf0e10cSrcweir } 333cdf0e10cSrcweir 334cdf0e10cSrcweir //typedef SfxTabPage* (*FNCreateTabPage)( Window *pParent, const SfxItemSet &rAttrSet ); 335cdf0e10cSrcweir SfxTabPage* CreateGeneralTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ) 336cdf0e10cSrcweir { 337cdf0e10cSrcweir CreateTabPage fnCreate = 0; 338cdf0e10cSrcweir switch(nId) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir case RID_SFXPAGE_SAVE: fnCreate = &SvxSaveTabPage::Create; break; 341cdf0e10cSrcweir case RID_SFXPAGE_PATH: fnCreate = &SvxPathTabPage::Create; break; 342cdf0e10cSrcweir case RID_SFXPAGE_GENERAL: fnCreate = &SvxGeneralTabPage::Create; break; 343cdf0e10cSrcweir case RID_SFXPAGE_PRINTOPTIONS: fnCreate = &SfxCommonPrintOptionsTabPage::Create; break; 344cdf0e10cSrcweir case OFA_TP_LANGUAGES: fnCreate = &OfaLanguagesTabPage::Create; break; 345cdf0e10cSrcweir case RID_SFXPAGE_LINGU: fnCreate = &SvxLinguTabPage::Create; break; 346cdf0e10cSrcweir case RID_SVXPAGE_COLOR: fnCreate = &SvxColorTabPage::Create; break; 347cdf0e10cSrcweir case OFA_TP_VIEW: fnCreate = &OfaViewTabPage::Create; break; 348cdf0e10cSrcweir case OFA_TP_MISC: fnCreate = &OfaMiscTabPage::Create; break; 349cdf0e10cSrcweir case OFA_TP_MEMORY: fnCreate = &OfaMemoryOptionsPage::Create; break; 350cdf0e10cSrcweir case RID_SVXPAGE_ASIAN_LAYOUT: fnCreate = &SvxAsianLayoutPage::Create; break; 351cdf0e10cSrcweir case RID_SVX_FONT_SUBSTITUTION: fnCreate = &SvxFontSubstTabPage::Create; break; 352cdf0e10cSrcweir case RID_SVXPAGE_INET_PROXY: fnCreate = &SvxProxyTabPage::Create; break; 353cdf0e10cSrcweir case RID_SVXPAGE_INET_SEARCH: fnCreate = &SvxSearchTabPage::Create; break; 354cdf0e10cSrcweir case RID_SVXPAGE_INET_SECURITY: fnCreate = &SvxSecurityTabPage::Create; break; 355cdf0e10cSrcweir case RID_SVXPAGE_INET_MAIL: fnCreate = &SvxEMailTabPage::Create; break; 356cdf0e10cSrcweir case RID_SVXPAGE_COLORCONFIG: fnCreate = &SvxColorOptionsTabPage::Create; break; 357cdf0e10cSrcweir case RID_OFAPAGE_HTMLOPT: fnCreate = &OfaHtmlTabPage::Create; break; 358cdf0e10cSrcweir case SID_OPTFILTER_MSOFFICE: fnCreate = &OfaMSFilterTabPage::Create; break; 359cdf0e10cSrcweir case RID_OFAPAGE_MSFILTEROPT2: fnCreate = &OfaMSFilterTabPage2::Create; break; 360cdf0e10cSrcweir case RID_SVXPAGE_JSEARCH_OPTIONS: fnCreate = &SvxJSearchOptionsPage::Create ; break; 361cdf0e10cSrcweir case SID_SB_CONNECTIONPOOLING: fnCreate = &::offapp::ConnectionPoolOptionsPage::Create; break; 362cdf0e10cSrcweir case SID_SB_DBREGISTEROPTIONS: fnCreate = &::svx::DbRegistrationOptionsPage::Create; break; 363cdf0e10cSrcweir case RID_SVXPAGE_ACCESSIBILITYCONFIG: fnCreate = &SvxAccessibilityOptionsTabPage::Create; break; 364cdf0e10cSrcweir case RID_SVXPAGE_SSO: fnCreate = GetSSOCreator(); break; 365cdf0e10cSrcweir case RID_SVXPAGE_OPTIONS_CTL: fnCreate = &SvxCTLOptionsPage::Create ; break; 366cdf0e10cSrcweir //added by jmeng begin 367cdf0e10cSrcweir case RID_SVXPAGE_INET_MOZPLUGIN: fnCreate = &MozPluginTabPage::Create; break; 368cdf0e10cSrcweir //added by jmeng end 369cdf0e10cSrcweir case RID_SVXPAGE_OPTIONS_JAVA: fnCreate = &SvxJavaOptionsPage::Create ; break; 370cdf0e10cSrcweir case RID_SVXPAGE_ONLINEUPDATE: fnCreate = &SvxOnlineUpdateTabPage::Create; break; 371cdf0e10cSrcweir case RID_OPTPAGE_CHART_DEFCOLORS: fnCreate = &SvxDefaultColorOptPage::Create; break; 372cdf0e10cSrcweir case RID_SVXPAGE_IMPROVEMENT: fnCreate = &SvxImprovementOptionsPage::Create; break; 373cdf0e10cSrcweir } 374cdf0e10cSrcweir 375cdf0e10cSrcweir SfxTabPage* pRet = fnCreate ? (*fnCreate)( pParent, rSet ) : NULL; 376cdf0e10cSrcweir return pRet; 377cdf0e10cSrcweir } 378cdf0e10cSrcweir 379cdf0e10cSrcweir 380cdf0e10cSrcweir struct OptionsMapping_Impl 381cdf0e10cSrcweir { 382cdf0e10cSrcweir const char* m_pGroupName; 383cdf0e10cSrcweir const char* m_pPageName; 384cdf0e10cSrcweir sal_uInt16 m_nPageId; 385cdf0e10cSrcweir }; 386cdf0e10cSrcweir 387cdf0e10cSrcweir static OptionsMapping_Impl __READONLY_DATA OptionsMap_Impl[] = 388cdf0e10cSrcweir { 389cdf0e10cSrcweir // GROUP PAGE PAGE-ID 390cdf0e10cSrcweir { "ProductName", NULL, SID_GENERAL_OPTIONS }, 391cdf0e10cSrcweir { "ProductName", "UserData", RID_SFXPAGE_GENERAL }, 392cdf0e10cSrcweir { "ProductName", "General", OFA_TP_MISC }, 393cdf0e10cSrcweir { "ProductName", "Memory", OFA_TP_MEMORY }, 394cdf0e10cSrcweir { "ProductName", "View", OFA_TP_VIEW }, 395cdf0e10cSrcweir { "ProductName", "Print", RID_SFXPAGE_PRINTOPTIONS }, 396cdf0e10cSrcweir { "ProductName", "Paths", RID_SFXPAGE_PATH }, 397cdf0e10cSrcweir { "ProductName", "Colors", RID_SVXPAGE_COLOR }, 398cdf0e10cSrcweir { "ProductName", "Fonts", RID_SVX_FONT_SUBSTITUTION }, 399cdf0e10cSrcweir { "ProductName", "Security", RID_SVXPAGE_INET_SECURITY }, 400cdf0e10cSrcweir { "ProductName", "Appearance", RID_SVXPAGE_COLORCONFIG }, 401cdf0e10cSrcweir { "ProductName", "Accessibility", RID_SVXPAGE_ACCESSIBILITYCONFIG }, 402cdf0e10cSrcweir { "ProductName", "Java", RID_SVXPAGE_OPTIONS_JAVA }, 403cdf0e10cSrcweir { "ProductName", "NetworkIdentity", RID_SVXPAGE_SSO }, 404cdf0e10cSrcweir { "ProductName", "OnlineUpdate", RID_SVXPAGE_ONLINEUPDATE }, 405cdf0e10cSrcweir { "ProductName", "ImprovementProgram", RID_SVXPAGE_IMPROVEMENT }, 406cdf0e10cSrcweir { "LanguageSettings", NULL, SID_LANGUAGE_OPTIONS }, 407cdf0e10cSrcweir { "LanguageSettings", "Languages", OFA_TP_LANGUAGES }, 408cdf0e10cSrcweir { "LanguageSettings", "WritingAids", RID_SFXPAGE_LINGU }, 409cdf0e10cSrcweir { "LanguageSettings", "SearchingInJapanese", RID_SVXPAGE_JSEARCH_OPTIONS }, 410cdf0e10cSrcweir { "LanguageSettings", "AsianLayout", RID_SVXPAGE_ASIAN_LAYOUT }, 411cdf0e10cSrcweir { "LanguageSettings", "ComplexTextLayout", RID_SVXPAGE_OPTIONS_CTL }, 412cdf0e10cSrcweir { "Internet", NULL, SID_INET_DLG }, 413cdf0e10cSrcweir { "Internet", "Proxy", RID_SVXPAGE_INET_PROXY }, 414cdf0e10cSrcweir { "Internet", "Search", RID_SVXPAGE_INET_SEARCH }, 415cdf0e10cSrcweir { "Internet", "Email", RID_SVXPAGE_INET_MAIL }, 416cdf0e10cSrcweir { "Internet", "MozillaPlugin", RID_SVXPAGE_INET_MOZPLUGIN }, 417cdf0e10cSrcweir { "LoadSave", NULL, SID_FILTER_DLG }, 418cdf0e10cSrcweir { "LoadSave", "General", RID_SFXPAGE_SAVE }, 419cdf0e10cSrcweir { "LoadSave", "VBAProperties", SID_OPTFILTER_MSOFFICE }, 420cdf0e10cSrcweir { "LoadSave", "MicrosoftOffice", RID_OFAPAGE_MSFILTEROPT2 }, 421cdf0e10cSrcweir { "LoadSave", "HTMLCompatibility", RID_OFAPAGE_HTMLOPT }, 422cdf0e10cSrcweir { "Writer", NULL, SID_SW_EDITOPTIONS }, 423cdf0e10cSrcweir { "Writer", "General", RID_SW_TP_OPTLOAD_PAGE }, 424cdf0e10cSrcweir { "Writer", "View", RID_SW_TP_CONTENT_OPT }, 425cdf0e10cSrcweir { "Writer", "FormattingAids", RID_SW_TP_OPTSHDWCRSR }, 426cdf0e10cSrcweir { "Writer", "Grid", RID_SVXPAGE_GRID }, 427cdf0e10cSrcweir { "Writer", "BasicFontsWestern", RID_SW_TP_STD_FONT }, 428cdf0e10cSrcweir { "Writer", "BasicFontsAsian", RID_SW_TP_STD_FONT_CJK }, 429cdf0e10cSrcweir { "Writer", "BasicFontsCTL", RID_SW_TP_STD_FONT_CTL }, 430cdf0e10cSrcweir { "Writer", "Print", RID_SW_TP_OPTPRINT_PAGE }, 431cdf0e10cSrcweir { "Writer", "Table", RID_SW_TP_OPTTABLE_PAGE }, 432cdf0e10cSrcweir { "Writer", "Changes", RID_SW_TP_REDLINE_OPT }, 433cdf0e10cSrcweir { "Writer", "Compatibility", RID_SW_TP_OPTCOMPATIBILITY_PAGE }, 434cdf0e10cSrcweir { "Writer", "AutoCaption", RID_SW_TP_OPTCAPTION_PAGE }, 435cdf0e10cSrcweir { "Writer", "MailMerge", RID_SW_TP_MAILCONFIG }, 436cdf0e10cSrcweir { "WriterWeb", NULL, SID_SW_ONLINEOPTIONS }, 437cdf0e10cSrcweir { "WriterWeb", "View", RID_SW_TP_HTML_CONTENT_OPT }, 438cdf0e10cSrcweir { "WriterWeb", "FormattingAids", RID_SW_TP_HTML_OPTSHDWCRSR }, 439cdf0e10cSrcweir { "WriterWeb", "Grid", RID_SW_TP_HTML_OPTGRID_PAGE }, 440cdf0e10cSrcweir { "WriterWeb", "Print", RID_SW_TP_HTML_OPTPRINT_PAGE }, 441cdf0e10cSrcweir { "WriterWeb", "Table", RID_SW_TP_HTML_OPTTABLE_PAGE }, 442cdf0e10cSrcweir { "WriterWeb", "Background", RID_SW_TP_BACKGROUND }, 443cdf0e10cSrcweir { "Math", NULL, SID_SM_EDITOPTIONS }, 444cdf0e10cSrcweir { "Math", "Settings", SID_SM_TP_PRINTOPTIONS }, 445cdf0e10cSrcweir { "Calc", NULL, SID_SC_EDITOPTIONS }, 446cdf0e10cSrcweir { "Calc", "General", SID_SC_TP_LAYOUT }, 447cdf0e10cSrcweir { "Calc", "View", SID_SC_TP_CONTENT }, 448cdf0e10cSrcweir { "Calc", "International", RID_OFA_TP_INTERNATIONAL }, 449cdf0e10cSrcweir { "Calc", "Calculate", SID_SC_TP_CALC }, 450cdf0e10cSrcweir { "Calc", "SortLists", SID_SC_TP_USERLISTS }, 451cdf0e10cSrcweir { "Calc", "Changes", SID_SC_TP_CHANGES }, 452cdf0e10cSrcweir { "Calc", "Grid", SID_SC_TP_GRID }, 453cdf0e10cSrcweir { "Calc", "Print", RID_SC_TP_PRINT }, 454cdf0e10cSrcweir { "Impress", NULL, SID_SD_EDITOPTIONS }, 455cdf0e10cSrcweir { "Impress", "General", SID_SI_TP_MISC }, 456cdf0e10cSrcweir { "Impress", "View", SID_SI_TP_CONTENTS }, 457cdf0e10cSrcweir { "Impress", "Grid", SID_SI_TP_SNAP }, 458cdf0e10cSrcweir { "Impress", "Print", SID_SI_TP_PRINT }, 459cdf0e10cSrcweir { "Draw", NULL, SID_SD_GRAPHIC_OPTIONS }, 460cdf0e10cSrcweir { "Draw", "General", SID_SD_TP_MISC }, 461cdf0e10cSrcweir { "Draw", "View", SID_SD_TP_CONTENTS }, 462cdf0e10cSrcweir { "Draw", "Grid", SID_SD_TP_SNAP }, 463cdf0e10cSrcweir { "Draw", "Print", SID_SD_TP_PRINT }, 464cdf0e10cSrcweir { "Charts", NULL, SID_SCH_EDITOPTIONS }, 465cdf0e10cSrcweir { "Charts", "DefaultColors", RID_OPTPAGE_CHART_DEFCOLORS }, 466cdf0e10cSrcweir { "Base", NULL, SID_SB_STARBASEOPTIONS }, 467cdf0e10cSrcweir { "Base", "Connections", SID_SB_CONNECTIONPOOLING }, 468cdf0e10cSrcweir { "Base", "Databases", SID_SB_DBREGISTEROPTIONS }, 469cdf0e10cSrcweir { NULL, NULL, 0 } 470cdf0e10cSrcweir }; 471cdf0e10cSrcweir 472cdf0e10cSrcweir static sal_Bool lcl_getStringFromID( sal_uInt16 _nPageId, String& _rGroupName, String& _rPageName ) 473cdf0e10cSrcweir { 474cdf0e10cSrcweir sal_Bool bRet = sal_False; 475cdf0e10cSrcweir 476cdf0e10cSrcweir sal_uInt16 nIdx = 0; 477cdf0e10cSrcweir while ( OptionsMap_Impl[nIdx].m_pGroupName != NULL ) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir if ( _nPageId == OptionsMap_Impl[nIdx].m_nPageId ) 480cdf0e10cSrcweir { 481cdf0e10cSrcweir bRet = sal_True; 482cdf0e10cSrcweir _rGroupName = String( OptionsMap_Impl[nIdx].m_pGroupName, RTL_TEXTENCODING_ASCII_US ); 483cdf0e10cSrcweir if ( OptionsMap_Impl[nIdx].m_pPageName != NULL ) 484cdf0e10cSrcweir _rPageName = String( OptionsMap_Impl[nIdx].m_pPageName, RTL_TEXTENCODING_ASCII_US ); 485cdf0e10cSrcweir break; 486cdf0e10cSrcweir } 487cdf0e10cSrcweir ++nIdx; 488cdf0e10cSrcweir } 489cdf0e10cSrcweir 490cdf0e10cSrcweir return bRet; 491cdf0e10cSrcweir } 492cdf0e10cSrcweir 493cdf0e10cSrcweir static sal_Bool lcl_isOptionHidden( sal_uInt16 _nPageId, const SvtOptionsDialogOptions& _rOptOptions ) 494cdf0e10cSrcweir { 495cdf0e10cSrcweir sal_Bool bIsHidden = sal_False; 496cdf0e10cSrcweir String sGroupName, sPageName; 497cdf0e10cSrcweir if ( lcl_getStringFromID( _nPageId, sGroupName, sPageName ) ) 498cdf0e10cSrcweir { 499cdf0e10cSrcweir if ( sPageName.Len() == 0 ) 500cdf0e10cSrcweir bIsHidden = _rOptOptions.IsGroupHidden( sGroupName ); 501cdf0e10cSrcweir else 502cdf0e10cSrcweir bIsHidden = _rOptOptions.IsPageHidden( sPageName, sGroupName ); 503cdf0e10cSrcweir } 504cdf0e10cSrcweir return bIsHidden; 505cdf0e10cSrcweir } 506cdf0e10cSrcweir 507cdf0e10cSrcweir /* -----------------11.02.99 09:56------------------- 508cdf0e10cSrcweir * 509cdf0e10cSrcweir * --------------------------------------------------*/ 510cdf0e10cSrcweir struct OptionsPageInfo 511cdf0e10cSrcweir { 512cdf0e10cSrcweir SfxTabPage* m_pPage; 513cdf0e10cSrcweir sal_uInt16 m_nPageId; 514cdf0e10cSrcweir rtl::OUString m_sPageURL; 515cdf0e10cSrcweir rtl::OUString m_sEventHdl; 516cdf0e10cSrcweir ExtensionsTabPage* m_pExtPage; 517cdf0e10cSrcweir 518cdf0e10cSrcweir OptionsPageInfo( sal_uInt16 nId ) : m_pPage( NULL ), m_nPageId( nId ), m_pExtPage( NULL ) {} 519cdf0e10cSrcweir }; 520cdf0e10cSrcweir 521cdf0e10cSrcweir struct OptionsGroupInfo 522cdf0e10cSrcweir { 523cdf0e10cSrcweir SfxItemSet* m_pInItemSet; 524cdf0e10cSrcweir SfxItemSet* m_pOutItemSet; 525cdf0e10cSrcweir SfxShell* m_pShell; // used to create the page 526cdf0e10cSrcweir SfxModule* m_pModule; // used to create the ItemSet 527cdf0e10cSrcweir sal_uInt16 m_nDialogId; // Id of the former dialog 528cdf0e10cSrcweir sal_Bool m_bLoadError; // load fails? 529cdf0e10cSrcweir rtl::OUString m_sPageURL; 530cdf0e10cSrcweir ExtensionsTabPage* m_pExtPage; 531cdf0e10cSrcweir 532cdf0e10cSrcweir OptionsGroupInfo( SfxShell* pSh, SfxModule* pMod, sal_uInt16 nId ) : 533cdf0e10cSrcweir m_pInItemSet( NULL ), m_pOutItemSet( NULL ), m_pShell( pSh ), 534cdf0e10cSrcweir m_pModule( pMod ), m_nDialogId( nId ), m_bLoadError( sal_False ), 535cdf0e10cSrcweir m_sPageURL( rtl::OUString() ), m_pExtPage( NULL ) {} 536cdf0e10cSrcweir ~OptionsGroupInfo() { delete m_pInItemSet; delete m_pOutItemSet; } 537cdf0e10cSrcweir }; 538cdf0e10cSrcweir 539cdf0e10cSrcweir /* -----------------04.05.99 15:51------------------- 540cdf0e10cSrcweir * 541cdf0e10cSrcweir * --------------------------------------------------*/ 542cdf0e10cSrcweir sal_Bool OfaOptionsTreeListBox::Collapse( SvLBoxEntry* pParent ) 543cdf0e10cSrcweir { 544cdf0e10cSrcweir bInCollapse = sal_True; 545cdf0e10cSrcweir sal_Bool bRet = SvTreeListBox::Collapse(pParent); 546cdf0e10cSrcweir bInCollapse = sal_False; 547cdf0e10cSrcweir return bRet; 548cdf0e10cSrcweir } 549cdf0e10cSrcweir 550cdf0e10cSrcweir // ----------------------------------------------------------------------- 551cdf0e10cSrcweir 552cdf0e10cSrcweir #define INI_LIST() \ 553cdf0e10cSrcweir aOkPB ( this, CUI_RES( PB_OK ) ),\ 554cdf0e10cSrcweir aCancelPB ( this, CUI_RES( PB_CANCEL ) ),\ 555cdf0e10cSrcweir aHelpPB ( this, CUI_RES( PB_HELP ) ),\ 556cdf0e10cSrcweir aBackPB ( this, CUI_RES( PB_BACK ) ),\ 557cdf0e10cSrcweir aHiddenGB ( this, CUI_RES( FB_BORDER ) ),\ 558cdf0e10cSrcweir aPageTitleFT ( this, CUI_RES( FT_PAGE_TITLE ) ),\ 559cdf0e10cSrcweir aLine1FL ( this, CUI_RES( FL_LINE_1 ) ),\ 560cdf0e10cSrcweir aHelpFT ( this, CUI_RES( FT_HELPTEXT ) ),\ 561cdf0e10cSrcweir aHelpImg ( this, CUI_RES( IMG_HELP ) ),\ 562cdf0e10cSrcweir aHelpTextsArr ( CUI_RES( STR_HELPTEXTS ) ),\ 563cdf0e10cSrcweir aTreeLB ( this, CUI_RES( TLB_PAGES ) ),\ 564cdf0e10cSrcweir sTitle ( GetText() ),\ 565cdf0e10cSrcweir sNotLoadedError ( CUI_RES( ST_LOAD_ERROR ) ),\ 566cdf0e10cSrcweir pCurrentPageEntry ( NULL ),\ 567cdf0e10cSrcweir pColorPageItemSet ( NULL ),\ 568cdf0e10cSrcweir pColorTab ( NULL ),\ 569cdf0e10cSrcweir nChangeType ( CT_NONE ),\ 570cdf0e10cSrcweir nUnknownType ( COLORPAGE_UNKNOWN ),\ 571cdf0e10cSrcweir nUnknownPos ( COLORPAGE_UNKNOWN ),\ 572cdf0e10cSrcweir bIsAreaTP ( sal_False ),\ 573cdf0e10cSrcweir bForgetSelection ( sal_False ),\ 574cdf0e10cSrcweir bImageResized ( sal_False ),\ 575cdf0e10cSrcweir bInSelectHdl_Impl ( false ),\ 576cdf0e10cSrcweir bIsFromExtensionManager( false ), \ 577cdf0e10cSrcweir bIsForSetDocumentLanguage( false ) 578cdf0e10cSrcweir 579cdf0e10cSrcweir // Ctor() with Frame ----------------------------------------------------- 580cdf0e10cSrcweir using namespace ::com::sun::star; 581cdf0e10cSrcweir OfaTreeOptionsDialog::OfaTreeOptionsDialog( 582cdf0e10cSrcweir Window* pParent, 583cdf0e10cSrcweir const Reference< XFrame >& _xFrame, 584cdf0e10cSrcweir bool bActivateLastSelection ) : 585cdf0e10cSrcweir 586cdf0e10cSrcweir SfxModalDialog( pParent, CUI_RES( RID_OFADLG_OPTIONS_TREE ) ), 587cdf0e10cSrcweir INI_LIST() 588cdf0e10cSrcweir { 589cdf0e10cSrcweir FreeResource(); 590cdf0e10cSrcweir 591cdf0e10cSrcweir InitTreeAndHandler(); 592cdf0e10cSrcweir Initialize( _xFrame ); 593cdf0e10cSrcweir LoadExtensionOptions( rtl::OUString() ); 594cdf0e10cSrcweir ResizeTreeLB(); 595cdf0e10cSrcweir if (bActivateLastSelection) 596cdf0e10cSrcweir ActivateLastSelection(); 597cdf0e10cSrcweir 598cdf0e10cSrcweir aTreeLB.SetAccessibleName(GetDisplayText()); 599cdf0e10cSrcweir } 600cdf0e10cSrcweir 601cdf0e10cSrcweir // Ctor() with ExtensionId ----------------------------------------------- 602cdf0e10cSrcweir 603cdf0e10cSrcweir OfaTreeOptionsDialog::OfaTreeOptionsDialog( Window* pParent, const rtl::OUString& rExtensionId ) : 604cdf0e10cSrcweir 605cdf0e10cSrcweir SfxModalDialog( pParent, CUI_RES( RID_OFADLG_OPTIONS_TREE ) ), 606cdf0e10cSrcweir 607cdf0e10cSrcweir INI_LIST() 608cdf0e10cSrcweir 609cdf0e10cSrcweir { 610cdf0e10cSrcweir FreeResource(); 611cdf0e10cSrcweir 612cdf0e10cSrcweir bIsFromExtensionManager = ( rExtensionId.getLength() > 0 ); 613cdf0e10cSrcweir InitTreeAndHandler(); 614cdf0e10cSrcweir LoadExtensionOptions( rExtensionId ); 615cdf0e10cSrcweir ResizeTreeLB(); 616cdf0e10cSrcweir ActivateLastSelection(); 617cdf0e10cSrcweir } 618cdf0e10cSrcweir 619cdf0e10cSrcweir /* -----------------11.02.99 07:58------------------- 620cdf0e10cSrcweir * 621cdf0e10cSrcweir * --------------------------------------------------*/ 622cdf0e10cSrcweir 623cdf0e10cSrcweir OfaTreeOptionsDialog::~OfaTreeOptionsDialog() 624cdf0e10cSrcweir { 625cdf0e10cSrcweir SvLBoxEntry* pEntry = aTreeLB.First(); 626cdf0e10cSrcweir // first children 627cdf0e10cSrcweir while(pEntry) 628cdf0e10cSrcweir { 629cdf0e10cSrcweir // if Child (has parent), then OptionsPageInfo 630cdf0e10cSrcweir if(aTreeLB.GetParent(pEntry)) 631cdf0e10cSrcweir { 632cdf0e10cSrcweir OptionsPageInfo *pPageInfo = (OptionsPageInfo *)pEntry->GetUserData(); 633cdf0e10cSrcweir if(pPageInfo->m_pPage) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir pPageInfo->m_pPage->FillUserData(); 636cdf0e10cSrcweir String aPageData(pPageInfo->m_pPage->GetUserData()); 637cdf0e10cSrcweir if ( aPageData.Len() ) 638cdf0e10cSrcweir { 639cdf0e10cSrcweir SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pPageInfo->m_nPageId ) ); 640cdf0e10cSrcweir SetViewOptUserItem( aTabPageOpt, aPageData ); 641cdf0e10cSrcweir } 642cdf0e10cSrcweir delete pPageInfo->m_pPage; 643cdf0e10cSrcweir } 644cdf0e10cSrcweir 645cdf0e10cSrcweir if (pPageInfo->m_nPageId == RID_SFXPAGE_LINGU) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir // write personal dictionaries 648cdf0e10cSrcweir Reference< XDictionaryList > xDicList( SvxGetDictionaryList() ); 649cdf0e10cSrcweir if (xDicList.is()) 650cdf0e10cSrcweir { 651cdf0e10cSrcweir linguistic::SaveDictionaries( xDicList ); 652cdf0e10cSrcweir } 653cdf0e10cSrcweir } 654cdf0e10cSrcweir 655cdf0e10cSrcweir if( pPageInfo->m_pExtPage ) 656cdf0e10cSrcweir delete pPageInfo->m_pExtPage; 657cdf0e10cSrcweir 658cdf0e10cSrcweir delete pPageInfo; 659cdf0e10cSrcweir } 660cdf0e10cSrcweir pEntry = aTreeLB.Next(pEntry); 661cdf0e10cSrcweir } 662cdf0e10cSrcweir 663cdf0e10cSrcweir // and parents 664cdf0e10cSrcweir pEntry = aTreeLB.First(); 665cdf0e10cSrcweir while(pEntry) 666cdf0e10cSrcweir { 667cdf0e10cSrcweir if(!aTreeLB.GetParent(pEntry)) 668cdf0e10cSrcweir { 669cdf0e10cSrcweir OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)pEntry->GetUserData(); 670cdf0e10cSrcweir if ( pGroupInfo && pGroupInfo->m_pExtPage ) 671cdf0e10cSrcweir delete pGroupInfo->m_pExtPage; 672cdf0e10cSrcweir delete pGroupInfo; 673cdf0e10cSrcweir } 674cdf0e10cSrcweir pEntry = aTreeLB.Next(pEntry); 675cdf0e10cSrcweir } 676cdf0e10cSrcweir delete pColorPageItemSet; 677cdf0e10cSrcweir deleteGroupNames(); 678cdf0e10cSrcweir } 679cdf0e10cSrcweir 680cdf0e10cSrcweir /* -----------------11.02.99 08:21------------------- 681cdf0e10cSrcweir * 682cdf0e10cSrcweir * --------------------------------------------------*/ 683cdf0e10cSrcweir OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage( 684cdf0e10cSrcweir sal_uInt16 nId, const String& rPageName, sal_uInt16 nGroup ) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir OptionsPageInfo* pPageInfo = new OptionsPageInfo( nId ); 687cdf0e10cSrcweir SvLBoxEntry* pParent = aTreeLB.GetEntry( 0, nGroup ); 688cdf0e10cSrcweir DBG_ASSERT( pParent, "OfaTreeOptionsDialog::AddTabPage(): no group found" ); 689cdf0e10cSrcweir SvLBoxEntry* pEntry = aTreeLB.InsertEntry( rPageName, pParent ); 690cdf0e10cSrcweir pEntry->SetUserData( pPageInfo ); 691cdf0e10cSrcweir return pPageInfo; 692cdf0e10cSrcweir } 693cdf0e10cSrcweir 694cdf0e10cSrcweir /* -----------------11.02.99 10:02------------------- 695cdf0e10cSrcweir * der ItemSet* geht in den Besitz des Dialogs 696cdf0e10cSrcweir * --------------------------------------------------*/ 697cdf0e10cSrcweir sal_uInt16 OfaTreeOptionsDialog::AddGroup(const String& rGroupName, 698cdf0e10cSrcweir SfxShell* pCreateShell, 699cdf0e10cSrcweir SfxModule* pCreateModule, 700cdf0e10cSrcweir sal_uInt16 nDialogId ) 701cdf0e10cSrcweir { 702cdf0e10cSrcweir SvLBoxEntry* pEntry = aTreeLB.InsertEntry(rGroupName); 703cdf0e10cSrcweir OptionsGroupInfo* pInfo = 704cdf0e10cSrcweir new OptionsGroupInfo( pCreateShell, pCreateModule, nDialogId ); 705cdf0e10cSrcweir pEntry->SetUserData(pInfo); 706cdf0e10cSrcweir sal_uInt16 nRet = 0; 707cdf0e10cSrcweir pEntry = aTreeLB.First(); 708cdf0e10cSrcweir while(pEntry) 709cdf0e10cSrcweir { 710cdf0e10cSrcweir if(!aTreeLB.GetParent(pEntry)) 711cdf0e10cSrcweir nRet++; 712cdf0e10cSrcweir pEntry = aTreeLB.Next(pEntry); 713cdf0e10cSrcweir } 714cdf0e10cSrcweir return nRet - 1; 715cdf0e10cSrcweir } 716cdf0e10cSrcweir 717cdf0e10cSrcweir /* -----------------11.02.99 10:31------------------- 718cdf0e10cSrcweir * 719cdf0e10cSrcweir * --------------------------------------------------*/ 720cdf0e10cSrcweir IMPL_LINK(OfaTreeOptionsDialog, ShowPageHdl_Impl, SvTreeListBox*, EMPTYARG) 721cdf0e10cSrcweir { 722cdf0e10cSrcweir if ( aSelectTimer.GetTimeout() == SELECT_FIRST_TIMEOUT ) 723cdf0e10cSrcweir { 724cdf0e10cSrcweir aSelectTimer.SetTimeout( SELECT_TIMEOUT ); 725cdf0e10cSrcweir SelectHdl_Impl( NULL ); 726cdf0e10cSrcweir } 727cdf0e10cSrcweir else if ( aSelectTimer.GetTimeout() == SELECT_TIMEOUT ) 728cdf0e10cSrcweir aSelectTimer.Start(); 729cdf0e10cSrcweir 730cdf0e10cSrcweir return 0; 731cdf0e10cSrcweir } 732cdf0e10cSrcweir /* -----------------11.02.99 10:49------------------- 733cdf0e10cSrcweir * 734cdf0e10cSrcweir * --------------------------------------------------*/ 735cdf0e10cSrcweir IMPL_LINK( OfaTreeOptionsDialog, BackHdl_Impl, PushButton*, EMPTYARG ) 736cdf0e10cSrcweir { 737cdf0e10cSrcweir if ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) ) 738cdf0e10cSrcweir { 739cdf0e10cSrcweir OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pCurrentPageEntry->GetUserData(); 740cdf0e10cSrcweir if ( pPageInfo->m_pPage ) 741cdf0e10cSrcweir { 742cdf0e10cSrcweir OptionsGroupInfo* pGroupInfo = 743cdf0e10cSrcweir (OptionsGroupInfo*)aTreeLB.GetParent( pCurrentPageEntry )->GetUserData(); 744cdf0e10cSrcweir if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId ) 745cdf0e10cSrcweir pPageInfo->m_pPage->Reset( *pColorPageItemSet ); 746cdf0e10cSrcweir else 747cdf0e10cSrcweir pPageInfo->m_pPage->Reset( *pGroupInfo->m_pInItemSet ); 748cdf0e10cSrcweir } 749cdf0e10cSrcweir else if ( pPageInfo->m_pExtPage ) 750cdf0e10cSrcweir pPageInfo->m_pExtPage->ResetPage(); 751cdf0e10cSrcweir } 752cdf0e10cSrcweir return 0; 753cdf0e10cSrcweir } 754cdf0e10cSrcweir /* -----------------11.02.99 16:45------------------- 755cdf0e10cSrcweir * 756cdf0e10cSrcweir * --------------------------------------------------*/ 757cdf0e10cSrcweir IMPL_LINK( OfaTreeOptionsDialog, OKHdl_Impl, Button *, EMPTYARG ) 758cdf0e10cSrcweir { 759cdf0e10cSrcweir aTreeLB.EndSelection(); 760cdf0e10cSrcweir if ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) ) 761cdf0e10cSrcweir { 762cdf0e10cSrcweir OptionsPageInfo* pPageInfo = (OptionsPageInfo *)pCurrentPageEntry->GetUserData(); 763cdf0e10cSrcweir if ( pPageInfo->m_pPage ) 764cdf0e10cSrcweir { 765cdf0e10cSrcweir OptionsGroupInfo* pGroupInfo = 766cdf0e10cSrcweir (OptionsGroupInfo *)aTreeLB.GetParent(pCurrentPageEntry)->GetUserData(); 767cdf0e10cSrcweir if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId 768cdf0e10cSrcweir && pPageInfo->m_pPage->HasExchangeSupport() ) 769cdf0e10cSrcweir { 770cdf0e10cSrcweir int nLeave = pPageInfo->m_pPage->DeactivatePage(pGroupInfo->m_pOutItemSet); 771cdf0e10cSrcweir if ( nLeave == SfxTabPage::KEEP_PAGE ) 772cdf0e10cSrcweir { 773cdf0e10cSrcweir //die Seite darf nicht verlassen werden! 774cdf0e10cSrcweir aTreeLB.Select(pCurrentPageEntry); 775cdf0e10cSrcweir return 0; 776cdf0e10cSrcweir } 777cdf0e10cSrcweir } 778cdf0e10cSrcweir pPageInfo->m_pPage->Hide(); 779cdf0e10cSrcweir } 780cdf0e10cSrcweir } 781cdf0e10cSrcweir 782cdf0e10cSrcweir SvLBoxEntry* pEntry = aTreeLB.First(); 783cdf0e10cSrcweir while ( pEntry ) 784cdf0e10cSrcweir { 785cdf0e10cSrcweir if ( aTreeLB.GetParent( pEntry ) ) 786cdf0e10cSrcweir { 787cdf0e10cSrcweir OptionsPageInfo* pPageInfo = (OptionsPageInfo *)pEntry->GetUserData(); 788cdf0e10cSrcweir if ( pPageInfo->m_pPage && !pPageInfo->m_pPage->HasExchangeSupport() ) 789cdf0e10cSrcweir { 790cdf0e10cSrcweir OptionsGroupInfo* pGroupInfo = 791cdf0e10cSrcweir (OptionsGroupInfo*)aTreeLB.GetParent(pEntry)->GetUserData(); 792cdf0e10cSrcweir pPageInfo->m_pPage->FillItemSet(*pGroupInfo->m_pOutItemSet); 793cdf0e10cSrcweir } 794cdf0e10cSrcweir 795cdf0e10cSrcweir if ( pPageInfo->m_pExtPage ) 796cdf0e10cSrcweir { 797cdf0e10cSrcweir pPageInfo->m_pExtPage->DeactivatePage(); 798cdf0e10cSrcweir pPageInfo->m_pExtPage->SavePage(); 799cdf0e10cSrcweir } 800cdf0e10cSrcweir } 801cdf0e10cSrcweir pEntry = aTreeLB.Next(pEntry); 802cdf0e10cSrcweir } 803cdf0e10cSrcweir EndDialog(RET_OK); 804cdf0e10cSrcweir return 0; 805cdf0e10cSrcweir } 806cdf0e10cSrcweir 807cdf0e10cSrcweir /* -----------------17.02.99 09:15------------------- 808cdf0e10cSrcweir * Eine aufgeklappte Gruppe soll vollstaendig sichtbar sein 809cdf0e10cSrcweir * --------------------------------------------------*/ 810cdf0e10cSrcweir IMPL_LINK(OfaTreeOptionsDialog, ExpandedHdl_Impl, SvTreeListBox*, pBox ) 811cdf0e10cSrcweir { 812cdf0e10cSrcweir pBox->Update(); 813cdf0e10cSrcweir pBox->InitStartEntry(); 814cdf0e10cSrcweir SvLBoxEntry* pEntry = pBox->GetHdlEntry(); 815cdf0e10cSrcweir if(pEntry && pBox->IsExpanded(pEntry)) 816cdf0e10cSrcweir { 817cdf0e10cSrcweir sal_uInt32 nChildCount = pBox->GetChildCount( pEntry ); 818cdf0e10cSrcweir 819cdf0e10cSrcweir SvLBoxEntry* pNext = pEntry; 820cdf0e10cSrcweir for(sal_uInt32 i = 0; i < nChildCount;i++) 821cdf0e10cSrcweir { 822cdf0e10cSrcweir pNext = pBox->GetNextEntryInView(pNext); 823cdf0e10cSrcweir if(!pNext) 824cdf0e10cSrcweir { 825cdf0e10cSrcweir pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) ); 826cdf0e10cSrcweir break; 827cdf0e10cSrcweir } 828cdf0e10cSrcweir else 829cdf0e10cSrcweir { 830cdf0e10cSrcweir Size aSz(pBox->GetOutputSizePixel()); 831cdf0e10cSrcweir int nHeight = pBox->GetEntryHeight(); 832cdf0e10cSrcweir Point aPos(pBox->GetEntryPosition(pNext)); 833cdf0e10cSrcweir if(aPos.Y()+nHeight > aSz.Height()) 834cdf0e10cSrcweir { 835cdf0e10cSrcweir pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) ); 836cdf0e10cSrcweir break; 837cdf0e10cSrcweir } 838cdf0e10cSrcweir } 839cdf0e10cSrcweir } 840cdf0e10cSrcweir } 841cdf0e10cSrcweir return 0; 842cdf0e10cSrcweir } 843cdf0e10cSrcweir 844cdf0e10cSrcweir /* -----------------11.02.99 10:49------------------- 845cdf0e10cSrcweir * 846cdf0e10cSrcweir * --------------------------------------------------*/ 847cdf0e10cSrcweir void OfaTreeOptionsDialog::ApplyItemSets() 848cdf0e10cSrcweir { 849cdf0e10cSrcweir SvLBoxEntry* pEntry = aTreeLB.First(); 850cdf0e10cSrcweir while(pEntry) 851cdf0e10cSrcweir { 852cdf0e10cSrcweir if(!aTreeLB.GetParent(pEntry)) 853cdf0e10cSrcweir { 854cdf0e10cSrcweir OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo *)pEntry->GetUserData(); 855cdf0e10cSrcweir if(pGroupInfo->m_pOutItemSet) 856cdf0e10cSrcweir { 857cdf0e10cSrcweir if(pGroupInfo->m_pShell) 858cdf0e10cSrcweir pGroupInfo->m_pShell->ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet); 859cdf0e10cSrcweir else 860cdf0e10cSrcweir ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet); 861cdf0e10cSrcweir } 862cdf0e10cSrcweir } 863cdf0e10cSrcweir pEntry = aTreeLB.Next(pEntry); 864cdf0e10cSrcweir } 865cdf0e10cSrcweir } 866cdf0e10cSrcweir 867cdf0e10cSrcweir void OfaTreeOptionsDialog::InitTreeAndHandler() 868cdf0e10cSrcweir { 869cdf0e10cSrcweir aTreeLB.SetNodeDefaultImages(); 870cdf0e10cSrcweir aPageImages = ImageList( CUI_RES( RID_IMGLIST_TREEOPT ) ); 871cdf0e10cSrcweir aPageImagesHC = ImageList( CUI_RES( RID_IMGLIST_TREEOPT_HC ) ); 872cdf0e10cSrcweir 873cdf0e10cSrcweir aTreeLB.SetHelpId( HID_OFADLG_TREELISTBOX ); 874cdf0e10cSrcweir aTreeLB.SetStyle( aTreeLB.GetStyle()|WB_HASBUTTONS | WB_HASBUTTONSATROOT | 875cdf0e10cSrcweir WB_HASLINES | WB_HASLINESATROOT | 876cdf0e10cSrcweir WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE | WB_QUICK_SEARCH ); 877cdf0e10cSrcweir aTreeLB.SetSpaceBetweenEntries( 0 ); 878cdf0e10cSrcweir aTreeLB.SetSelectionMode( SINGLE_SELECTION ); 879cdf0e10cSrcweir aTreeLB.SetSublistOpenWithLeftRight( sal_True ); 880cdf0e10cSrcweir aTreeLB.SetExpandedHdl( LINK( this, OfaTreeOptionsDialog, ExpandedHdl_Impl ) ); 881cdf0e10cSrcweir aTreeLB.SetSelectHdl( LINK( this, OfaTreeOptionsDialog, ShowPageHdl_Impl ) ); 882cdf0e10cSrcweir aBackPB.SetClickHdl( LINK( this, OfaTreeOptionsDialog, BackHdl_Impl ) ); 883cdf0e10cSrcweir aOkPB.SetClickHdl( LINK( this, OfaTreeOptionsDialog, OKHdl_Impl ) ); 884cdf0e10cSrcweir 885cdf0e10cSrcweir aHiddenGB.Show(); 886cdf0e10cSrcweir aSelectTimer.SetTimeout( SELECT_FIRST_TIMEOUT ); 887cdf0e10cSrcweir aSelectTimer.SetTimeoutHdl( LINK( this, OfaTreeOptionsDialog, SelectHdl_Impl ) ); 888cdf0e10cSrcweir } 889cdf0e10cSrcweir 890cdf0e10cSrcweir /* -----------------17.02.99 09:51------------------- 891cdf0e10cSrcweir * 892cdf0e10cSrcweir * --------------------------------------------------*/ 893cdf0e10cSrcweir void OfaTreeOptionsDialog::ActivatePage( sal_uInt16 nResId ) 894cdf0e10cSrcweir { 895cdf0e10cSrcweir bIsForSetDocumentLanguage = false; 896cdf0e10cSrcweir if ( nResId == OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE ) 897cdf0e10cSrcweir { 898cdf0e10cSrcweir bIsForSetDocumentLanguage = true; 899cdf0e10cSrcweir nResId = OFA_TP_LANGUAGES; 900cdf0e10cSrcweir } 901cdf0e10cSrcweir 902cdf0e10cSrcweir DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" ); 903cdf0e10cSrcweir if ( !pLastPageSaver ) 904cdf0e10cSrcweir pLastPageSaver = new LastPageSaver; 905cdf0e10cSrcweir bForgetSelection = sal_True; 906cdf0e10cSrcweir sal_uInt16 nTemp = pLastPageSaver->m_nLastPageId; 907cdf0e10cSrcweir pLastPageSaver->m_nLastPageId = nResId; 908cdf0e10cSrcweir ActivateLastSelection(); 909cdf0e10cSrcweir pLastPageSaver->m_nLastPageId = nTemp; 910cdf0e10cSrcweir } 911cdf0e10cSrcweir 912cdf0e10cSrcweir void OfaTreeOptionsDialog::ActivatePage( const String& rPageURL ) 913cdf0e10cSrcweir { 914cdf0e10cSrcweir DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" ); 915cdf0e10cSrcweir if ( !pLastPageSaver ) 916cdf0e10cSrcweir pLastPageSaver = new LastPageSaver; 917cdf0e10cSrcweir bForgetSelection = sal_True; 918cdf0e10cSrcweir pLastPageSaver->m_nLastPageId = 0; 919cdf0e10cSrcweir pLastPageSaver->m_sLastPageURL_Tools = rPageURL; 920cdf0e10cSrcweir ActivateLastSelection(); 921cdf0e10cSrcweir } 922cdf0e10cSrcweir 923cdf0e10cSrcweir /* -----------------16.02.99 13:17------------------- 924cdf0e10cSrcweir * 925cdf0e10cSrcweir * --------------------------------------------------*/ 926cdf0e10cSrcweir void OfaTreeOptionsDialog::ActivateLastSelection() 927cdf0e10cSrcweir { 928cdf0e10cSrcweir SvLBoxEntry* pEntry = NULL; 929cdf0e10cSrcweir if ( pLastPageSaver ) 930cdf0e10cSrcweir { 931cdf0e10cSrcweir String sExpand( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL ) ); 932cdf0e10cSrcweir String sLastURL = bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr 933cdf0e10cSrcweir : pLastPageSaver->m_sLastPageURL_Tools; 934cdf0e10cSrcweir if ( sLastURL.Len() == 0 ) 935cdf0e10cSrcweir { 936cdf0e10cSrcweir sLastURL = !bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr 937cdf0e10cSrcweir : pLastPageSaver->m_sLastPageURL_Tools; 938cdf0e10cSrcweir } 939cdf0e10cSrcweir 940cdf0e10cSrcweir // MacroExpander to convert "expand"-URL to "file"-URL 941cdf0e10cSrcweir Reference< XMacroExpander > m_xMacroExpander; 942cdf0e10cSrcweir bool bMustExpand = ( INetURLObject( sLastURL ).GetProtocol() == INET_PROT_FILE ); 943cdf0e10cSrcweir 944cdf0e10cSrcweir if ( bMustExpand ) 945cdf0e10cSrcweir { 946cdf0e10cSrcweir Reference< XComponentContext > xContext; 947cdf0e10cSrcweir Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY ); 948cdf0e10cSrcweir xProps->getPropertyValue( 949cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ) >>= xContext; 950cdf0e10cSrcweir if ( xContext.is() ) 951cdf0e10cSrcweir m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >( 952cdf0e10cSrcweir xContext->getValueByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 953cdf0e10cSrcweir "/singletons/com.sun.star.util.theMacroExpander" ) ) ), UNO_QUERY ); 954cdf0e10cSrcweir } 955cdf0e10cSrcweir 956cdf0e10cSrcweir SvLBoxEntry* pTemp = aTreeLB.First(); 957cdf0e10cSrcweir while( !pEntry && pTemp ) 958cdf0e10cSrcweir { 959cdf0e10cSrcweir // restore only selection of a leaf 960cdf0e10cSrcweir if ( aTreeLB.GetParent( pTemp ) && pTemp->GetUserData() ) 961cdf0e10cSrcweir { 962cdf0e10cSrcweir OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pTemp->GetUserData(); 963cdf0e10cSrcweir String sPageURL = pPageInfo->m_sPageURL; 964cdf0e10cSrcweir if ( bMustExpand 965cdf0e10cSrcweir && sPageURL.Len() > 0 966cdf0e10cSrcweir && sExpand.Match( sPageURL ) == STRING_MATCH ) 967cdf0e10cSrcweir { 968cdf0e10cSrcweir // cut protocol 969cdf0e10cSrcweir ::rtl::OUString sTemp( sPageURL.Copy( sizeof( EXPAND_PROTOCOL ) -1 ) ); 970cdf0e10cSrcweir // decode uri class chars 971cdf0e10cSrcweir sTemp = ::rtl::Uri::decode( 972cdf0e10cSrcweir sTemp, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); 973cdf0e10cSrcweir // expand string 974cdf0e10cSrcweir sPageURL = m_xMacroExpander->expandMacros( sTemp ); 975cdf0e10cSrcweir } 976cdf0e10cSrcweir 977cdf0e10cSrcweir if ( ( !bIsFromExtensionManager 978cdf0e10cSrcweir && pPageInfo->m_nPageId && pPageInfo->m_nPageId == pLastPageSaver->m_nLastPageId ) 979cdf0e10cSrcweir || ( !pPageInfo->m_nPageId && sLastURL == sPageURL ) ) 980cdf0e10cSrcweir pEntry = pTemp; 981cdf0e10cSrcweir } 982cdf0e10cSrcweir pTemp = aTreeLB.Next(pTemp); 983cdf0e10cSrcweir } 984cdf0e10cSrcweir } 985cdf0e10cSrcweir 986cdf0e10cSrcweir if ( !pEntry ) 987cdf0e10cSrcweir { 988cdf0e10cSrcweir pEntry = aTreeLB.First(); 989cdf0e10cSrcweir pEntry = aTreeLB.Next(pEntry); 990cdf0e10cSrcweir } 991cdf0e10cSrcweir 992cdf0e10cSrcweir SvLBoxEntry* pParent = aTreeLB.GetParent(pEntry); 993cdf0e10cSrcweir aTreeLB.Expand(pParent); 994cdf0e10cSrcweir aTreeLB.MakeVisible(pParent); 995cdf0e10cSrcweir aTreeLB.MakeVisible(pEntry); 996cdf0e10cSrcweir aTreeLB.Select(pEntry); 997cdf0e10cSrcweir aTreeLB.GrabFocus(); 998cdf0e10cSrcweir } 999cdf0e10cSrcweir 1000cdf0e10cSrcweir /* -----------------22.02.99 08:52------------------- 1001cdf0e10cSrcweir * 1002cdf0e10cSrcweir * --------------------------------------------------*/ 1003cdf0e10cSrcweir long OfaTreeOptionsDialog::Notify( NotifyEvent& rNEvt ) 1004cdf0e10cSrcweir { 1005cdf0e10cSrcweir if ( rNEvt.GetType() == EVENT_KEYINPUT ) 1006cdf0e10cSrcweir { 1007cdf0e10cSrcweir const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); 1008cdf0e10cSrcweir const KeyCode aKeyCode = pKEvt->GetKeyCode(); 1009cdf0e10cSrcweir 1010cdf0e10cSrcweir if( aKeyCode.GetCode() == KEY_PAGEUP || 1011cdf0e10cSrcweir aKeyCode.GetCode() == KEY_PAGEDOWN) 1012cdf0e10cSrcweir { 1013cdf0e10cSrcweir SvLBoxEntry* pCurEntry = aTreeLB.FirstSelected(); 1014cdf0e10cSrcweir SvLBoxEntry* pTemp = 0; 1015cdf0e10cSrcweir if(aKeyCode.GetCode() == KEY_PAGEDOWN) 1016cdf0e10cSrcweir { 1017cdf0e10cSrcweir pTemp = aTreeLB.Next( pCurEntry ) ; 1018cdf0e10cSrcweir if(pTemp && !aTreeLB.GetParent(pTemp)) 1019cdf0e10cSrcweir { 1020cdf0e10cSrcweir pTemp = aTreeLB.Next( pTemp ) ; 1021cdf0e10cSrcweir aTreeLB.Select(pTemp); 1022cdf0e10cSrcweir } 1023cdf0e10cSrcweir } 1024cdf0e10cSrcweir else 1025cdf0e10cSrcweir { 1026cdf0e10cSrcweir pTemp = aTreeLB.Prev( pCurEntry ) ; 1027cdf0e10cSrcweir if(pTemp && !aTreeLB.GetParent(pTemp)) 1028cdf0e10cSrcweir { 1029cdf0e10cSrcweir pTemp = aTreeLB.Prev( pTemp ) ; 1030cdf0e10cSrcweir } 1031cdf0e10cSrcweir } 1032cdf0e10cSrcweir if(pTemp) 1033cdf0e10cSrcweir { 1034cdf0e10cSrcweir if(!aTreeLB.IsExpanded(aTreeLB.GetParent(pTemp))) 1035cdf0e10cSrcweir aTreeLB.Expand(aTreeLB.GetParent(pTemp)); 1036cdf0e10cSrcweir aTreeLB.MakeVisible(pTemp); 1037cdf0e10cSrcweir aTreeLB.Select(pTemp); 1038cdf0e10cSrcweir } 1039cdf0e10cSrcweir } 1040cdf0e10cSrcweir } 1041cdf0e10cSrcweir return SfxModalDialog::Notify(rNEvt); 1042cdf0e10cSrcweir } 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir // -------------------------------------------------------------------- 1045cdf0e10cSrcweir 1046cdf0e10cSrcweir void OfaTreeOptionsDialog::DataChanged( const DataChangedEvent& rDCEvt ) 1047cdf0e10cSrcweir { 1048cdf0e10cSrcweir SfxModalDialog::DataChanged( rDCEvt ); 1049cdf0e10cSrcweir 1050cdf0e10cSrcweir SvLBoxEntry* pEntry = aTreeLB.GetCurEntry(); 1051cdf0e10cSrcweir if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) && 1052cdf0e10cSrcweir !aTreeLB.GetParent(pEntry)) 1053cdf0e10cSrcweir { 1054cdf0e10cSrcweir OptionsGroupInfo* pInfo = static_cast<OptionsGroupInfo*>(pEntry->GetUserData()); 1055cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); 1056cdf0e10cSrcweir ImageList* pImgLst = bHighContrast ? &aPageImagesHC : &aPageImages; 1057cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i ) 1058cdf0e10cSrcweir { 1059cdf0e10cSrcweir if ( aHelpTextsArr.GetValue(i) == pInfo->m_nDialogId ) 1060cdf0e10cSrcweir { 1061cdf0e10cSrcweir aHelpImg.SetImage( pImgLst->GetImage( pInfo->m_nDialogId ) ); 1062cdf0e10cSrcweir break; 1063cdf0e10cSrcweir } 1064cdf0e10cSrcweir } 1065cdf0e10cSrcweir } 1066cdf0e10cSrcweir } 1067cdf0e10cSrcweir class FlagSet_Impl 1068cdf0e10cSrcweir { 1069cdf0e10cSrcweir bool & rFlag; 1070cdf0e10cSrcweir public: 1071cdf0e10cSrcweir FlagSet_Impl(bool& bFlag) : rFlag(bFlag){rFlag = true;} 1072cdf0e10cSrcweir ~FlagSet_Impl(){rFlag = false;} 1073cdf0e10cSrcweir }; 1074cdf0e10cSrcweir 1075cdf0e10cSrcweir IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG ) 1076cdf0e10cSrcweir { 1077cdf0e10cSrcweir SvTreeListBox* pBox = &aTreeLB; 1078cdf0e10cSrcweir SvLBoxEntry* pEntry = pBox->GetCurEntry(); 1079cdf0e10cSrcweir SvLBoxEntry* pParent = pBox->GetParent(pEntry); 1080cdf0e10cSrcweir pBox->EndSelection(); 1081cdf0e10cSrcweir 1082cdf0e10cSrcweir DBG_ASSERT(!bInSelectHdl_Impl, "Timeout handler called twice"); 1083cdf0e10cSrcweir if(bInSelectHdl_Impl || pCurrentPageEntry == pEntry) 1084cdf0e10cSrcweir return 0; 1085cdf0e10cSrcweir //#111938# lock the SelectHdl_Impl to prevent multiple executes 1086cdf0e10cSrcweir FlagSet_Impl aFlag(bInSelectHdl_Impl); 1087cdf0e10cSrcweir TabPage* pOldPage = NULL; 1088cdf0e10cSrcweir TabPage* pNewPage = NULL; 1089cdf0e10cSrcweir OptionsPageInfo* pOptPageInfo = ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) ) 1090cdf0e10cSrcweir ? (OptionsPageInfo*)pCurrentPageEntry->GetUserData() : NULL; 1091cdf0e10cSrcweir 1092cdf0e10cSrcweir if ( pOptPageInfo && pOptPageInfo->m_pPage && pOptPageInfo->m_pPage->IsVisible() ) 1093cdf0e10cSrcweir { 1094cdf0e10cSrcweir pOldPage = pOptPageInfo->m_pPage; 1095cdf0e10cSrcweir OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)aTreeLB.GetParent(pCurrentPageEntry)->GetUserData(); 1096cdf0e10cSrcweir int nLeave = SfxTabPage::LEAVE_PAGE; 1097cdf0e10cSrcweir if ( RID_SVXPAGE_COLOR != pOptPageInfo->m_nPageId && pOptPageInfo->m_pPage->HasExchangeSupport() ) 1098cdf0e10cSrcweir nLeave = pOptPageInfo->m_pPage->DeactivatePage( pGroupInfo->m_pOutItemSet ); 1099cdf0e10cSrcweir 1100cdf0e10cSrcweir if ( nLeave == SfxTabPage::KEEP_PAGE ) 1101cdf0e10cSrcweir { 1102cdf0e10cSrcweir // we cannot leave this page 1103cdf0e10cSrcweir pBox->Select( pCurrentPageEntry ); 1104cdf0e10cSrcweir return 0; 1105cdf0e10cSrcweir } 1106cdf0e10cSrcweir else 1107cdf0e10cSrcweir pOptPageInfo->m_pPage->Hide(); 1108cdf0e10cSrcweir } 1109cdf0e10cSrcweir else if ( pOptPageInfo && pOptPageInfo->m_pExtPage ) 1110cdf0e10cSrcweir { 1111cdf0e10cSrcweir pOptPageInfo->m_pExtPage->Hide(); 1112cdf0e10cSrcweir pOptPageInfo->m_pExtPage->DeactivatePage(); 1113cdf0e10cSrcweir } 1114cdf0e10cSrcweir else if ( pCurrentPageEntry && !aTreeLB.GetParent( pCurrentPageEntry ) ) 1115cdf0e10cSrcweir { 1116cdf0e10cSrcweir OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)pCurrentPageEntry->GetUserData(); 1117cdf0e10cSrcweir if ( pGroupInfo && pGroupInfo->m_pExtPage ) 1118cdf0e10cSrcweir { 1119cdf0e10cSrcweir pGroupInfo->m_pExtPage->Hide(); 1120cdf0e10cSrcweir pGroupInfo->m_pExtPage->DeactivatePage(); 1121cdf0e10cSrcweir } 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir if ( pParent ) 1124cdf0e10cSrcweir { 1125cdf0e10cSrcweir aPageTitleFT.Hide(); 1126cdf0e10cSrcweir aLine1FL.Hide(); 1127cdf0e10cSrcweir aHelpFT.Hide(); 1128cdf0e10cSrcweir aHelpImg.Hide(); 1129cdf0e10cSrcweir OptionsPageInfo *pPageInfo = (OptionsPageInfo *)pEntry->GetUserData(); 1130cdf0e10cSrcweir OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo *)pParent->GetUserData(); 1131cdf0e10cSrcweir if(!pPageInfo->m_pPage && pPageInfo->m_nPageId > 0) 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir if(pGroupInfo->m_bLoadError) 1134cdf0e10cSrcweir return 0; 1135cdf0e10cSrcweir if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId ) 1136cdf0e10cSrcweir { 1137cdf0e10cSrcweir if(!pColorPageItemSet) 1138cdf0e10cSrcweir { 1139cdf0e10cSrcweir // Move usage of a static XOutdevItemPool instance here 1140cdf0e10cSrcweir if(!mpStaticXOutdevItemPool) 1141cdf0e10cSrcweir { 1142cdf0e10cSrcweir mpStaticXOutdevItemPool = new XOutdevItemPool(); 1143cdf0e10cSrcweir } 1144cdf0e10cSrcweir pColorPageItemSet = new SfxItemSet( *mpStaticXOutdevItemPool, XATTR_FILLSTYLE, XATTR_FILLCOLOR); 1145cdf0e10cSrcweir pColorPageItemSet->Put( XFillColorItem() ); 1146cdf0e10cSrcweir } 1147cdf0e10cSrcweir } 1148cdf0e10cSrcweir else 1149cdf0e10cSrcweir { 1150cdf0e10cSrcweir if(pGroupInfo->m_pModule /*&& !pGroupInfo->pModule->IsLoaded()*/) 1151cdf0e10cSrcweir { 1152cdf0e10cSrcweir SfxModule* pOldModule = pGroupInfo->m_pModule; 1153cdf0e10cSrcweir sal_Bool bIdentical = pGroupInfo->m_pModule == pGroupInfo->m_pShell; 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir WaitObject aWait(this); 1156cdf0e10cSrcweir //pGroupInfo->pModule = pGroupInfo->pModule->Load(); 1157cdf0e10cSrcweir if(!pGroupInfo->m_pModule) 1158cdf0e10cSrcweir { 1159cdf0e10cSrcweir pGroupInfo->m_bLoadError = sal_True; 1160cdf0e10cSrcweir InfoBox(pBox, sNotLoadedError).Execute(); 1161cdf0e10cSrcweir return 0; 1162cdf0e10cSrcweir } 1163cdf0e10cSrcweir if(bIdentical) 1164cdf0e10cSrcweir pGroupInfo->m_pShell = pGroupInfo->m_pModule; 1165cdf0e10cSrcweir //jetzt noch testen, ob es auch in anderen Gruppen das gleiche Module gab (z.B. Text+HTML) 1166cdf0e10cSrcweir SvLBoxEntry* pTemp = aTreeLB.First(); 1167cdf0e10cSrcweir while(pTemp) 1168cdf0e10cSrcweir { 1169cdf0e10cSrcweir if(!aTreeLB.GetParent(pTemp) && pTemp != pEntry) 1170cdf0e10cSrcweir { 1171cdf0e10cSrcweir OptionsGroupInfo* pTGInfo = (OptionsGroupInfo *)pTemp->GetUserData(); 1172cdf0e10cSrcweir if(pTGInfo->m_pModule == pOldModule) 1173cdf0e10cSrcweir { 1174cdf0e10cSrcweir pTGInfo->m_pModule = pGroupInfo->m_pModule; 1175cdf0e10cSrcweir if(bIdentical) 1176cdf0e10cSrcweir pTGInfo->m_pShell = pGroupInfo->m_pModule; 1177cdf0e10cSrcweir } 1178cdf0e10cSrcweir } 1179cdf0e10cSrcweir pTemp = aTreeLB.Next(pTemp); 1180cdf0e10cSrcweir } 1181cdf0e10cSrcweir } 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir // if ( pPageInfo->nPageId != RID_OPTPAGE_CHART_DEFCOLORS ) 1184cdf0e10cSrcweir { 1185cdf0e10cSrcweir if(!pGroupInfo->m_pInItemSet) 1186cdf0e10cSrcweir pGroupInfo->m_pInItemSet = pGroupInfo->m_pShell 1187cdf0e10cSrcweir ? pGroupInfo->m_pShell->CreateItemSet( pGroupInfo->m_nDialogId ) 1188cdf0e10cSrcweir : CreateItemSet( pGroupInfo->m_nDialogId ); 1189cdf0e10cSrcweir if(!pGroupInfo->m_pOutItemSet) 1190cdf0e10cSrcweir pGroupInfo->m_pOutItemSet = new SfxItemSet( 1191cdf0e10cSrcweir *pGroupInfo->m_pInItemSet->GetPool(), 1192cdf0e10cSrcweir pGroupInfo->m_pInItemSet->GetRanges()); 1193cdf0e10cSrcweir } 1194cdf0e10cSrcweir } 1195cdf0e10cSrcweir 1196cdf0e10cSrcweir if(pGroupInfo->m_pModule) 1197cdf0e10cSrcweir { 1198cdf0e10cSrcweir pPageInfo->m_pPage = pGroupInfo->m_pModule->CreateTabPage( 1199cdf0e10cSrcweir pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet ); 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir else if(RID_SVXPAGE_COLOR != pPageInfo->m_nPageId) 1202cdf0e10cSrcweir pPageInfo->m_pPage = ::CreateGeneralTabPage( pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet ); 1203cdf0e10cSrcweir else 1204cdf0e10cSrcweir { 1205cdf0e10cSrcweir pPageInfo->m_pPage = ::CreateGeneralTabPage( 1206cdf0e10cSrcweir pPageInfo->m_nPageId, this, *pColorPageItemSet ); 1207cdf0e10cSrcweir SvxColorTabPage& rColPage = *(SvxColorTabPage*)pPageInfo->m_pPage; 1208cdf0e10cSrcweir const OfaPtrItem* pPtr = NULL; 1209cdf0e10cSrcweir if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() ) 1210cdf0e10cSrcweir pPtr = (const OfaPtrItem*)SfxViewFrame::Current()-> 1211cdf0e10cSrcweir GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON ); 1212cdf0e10cSrcweir pColorTab = pPtr ? (XColorTable*)pPtr->GetValue() : XColorTable::GetStdColorTable(); 1213cdf0e10cSrcweir 1214cdf0e10cSrcweir rColPage.SetColorTable( pColorTab ); 1215cdf0e10cSrcweir rColPage.SetPageType( &nUnknownType ); 1216cdf0e10cSrcweir rColPage.SetDlgType( &nUnknownType ); 1217cdf0e10cSrcweir rColPage.SetPos( &nUnknownPos ); 1218cdf0e10cSrcweir rColPage.SetAreaTP( &bIsAreaTP ); 1219cdf0e10cSrcweir rColPage.SetColorChgd( (ChangeType*)&nChangeType ); 1220cdf0e10cSrcweir rColPage.Construct(); 1221cdf0e10cSrcweir } 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir DBG_ASSERT( pPageInfo->m_pPage, "tabpage could not created"); 1224cdf0e10cSrcweir if ( pPageInfo->m_pPage ) 1225cdf0e10cSrcweir { 1226cdf0e10cSrcweir SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pPageInfo->m_nPageId ) ); 1227cdf0e10cSrcweir pPageInfo->m_pPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) ); 1228cdf0e10cSrcweir 1229cdf0e10cSrcweir Point aTreePos(aTreeLB.GetPosPixel()); 1230cdf0e10cSrcweir Size aTreeSize(aTreeLB.GetSizePixel()); 1231cdf0e10cSrcweir Point aGBPos(aHiddenGB.GetPosPixel()); 1232cdf0e10cSrcweir Size aPageSize(pPageInfo->m_pPage->GetSizePixel()); 1233cdf0e10cSrcweir Size aGBSize(aHiddenGB.GetSizePixel()); 1234cdf0e10cSrcweir Point aPagePos( aGBPos.X() + ( aGBSize.Width() - aPageSize.Width() ) / 2, 1235cdf0e10cSrcweir aGBPos.Y() + ( aGBSize.Height() - aPageSize.Height() ) / 2 ); 1236cdf0e10cSrcweir pPageInfo->m_pPage->SetPosPixel( aPagePos ); 1237cdf0e10cSrcweir if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId ) 1238cdf0e10cSrcweir { 1239cdf0e10cSrcweir pPageInfo->m_pPage->Reset( *pColorPageItemSet ); 1240cdf0e10cSrcweir pPageInfo->m_pPage->ActivatePage( *pColorPageItemSet ); 1241cdf0e10cSrcweir } 1242cdf0e10cSrcweir else 1243cdf0e10cSrcweir { 1244cdf0e10cSrcweir pPageInfo->m_pPage->Reset( *pGroupInfo->m_pInItemSet ); 1245cdf0e10cSrcweir } 1246cdf0e10cSrcweir } 1247cdf0e10cSrcweir } 1248cdf0e10cSrcweir else if ( 0 == pPageInfo->m_nPageId && !pPageInfo->m_pExtPage ) 1249cdf0e10cSrcweir { 1250cdf0e10cSrcweir if ( !m_xContainerWinProvider.is() ) 1251cdf0e10cSrcweir { 1252cdf0e10cSrcweir Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); 1253cdf0e10cSrcweir m_xContainerWinProvider = Reference < awt::XContainerWindowProvider >( 1254cdf0e10cSrcweir xFactory->createInstance( 1255cdf0e10cSrcweir C2U("com.sun.star.awt.ContainerWindowProvider") ), UNO_QUERY ); 1256cdf0e10cSrcweir DBG_ASSERT( m_xContainerWinProvider.is(), "service com.sun.star.awt.ContainerWindowProvider could not be loaded" ); 1257cdf0e10cSrcweir } 1258cdf0e10cSrcweir 1259cdf0e10cSrcweir pPageInfo->m_pExtPage = new ExtensionsTabPage( 1260cdf0e10cSrcweir this, 0, pPageInfo->m_sPageURL, pPageInfo->m_sEventHdl, m_xContainerWinProvider ); 1261cdf0e10cSrcweir Size aSize = aHiddenGB.GetSizePixel(); 1262cdf0e10cSrcweir aSize.Width() = aSize.Width() - 4; 1263cdf0e10cSrcweir aSize.Height() = aSize.Height() - 4; 1264cdf0e10cSrcweir Point aPos = aHiddenGB.GetPosPixel(); 1265cdf0e10cSrcweir aPos.X() = aPos.X() + 2; 1266cdf0e10cSrcweir aPos.Y() = aPos.Y() + 2; 1267cdf0e10cSrcweir pPageInfo->m_pExtPage->SetPosSizePixel( aPos, aSize ); 1268cdf0e10cSrcweir } 1269cdf0e10cSrcweir 1270cdf0e10cSrcweir if ( pPageInfo->m_pPage ) 1271cdf0e10cSrcweir { 1272cdf0e10cSrcweir if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId && 1273cdf0e10cSrcweir pPageInfo->m_pPage->HasExchangeSupport()) 1274cdf0e10cSrcweir { 1275cdf0e10cSrcweir pPageInfo->m_pPage->ActivatePage(*pGroupInfo->m_pOutItemSet); 1276cdf0e10cSrcweir } 1277cdf0e10cSrcweir pPageInfo->m_pPage->Show(); 1278cdf0e10cSrcweir } 1279cdf0e10cSrcweir else if ( pPageInfo->m_pExtPage ) 1280cdf0e10cSrcweir { 1281cdf0e10cSrcweir pPageInfo->m_pExtPage->Show(); 1282cdf0e10cSrcweir pPageInfo->m_pExtPage->ActivatePage(); 1283cdf0e10cSrcweir } 1284cdf0e10cSrcweir 1285cdf0e10cSrcweir String sTmpTitle = sTitle; 1286cdf0e10cSrcweir sTmpTitle += String::CreateFromAscii(" - "); 1287cdf0e10cSrcweir sTmpTitle += aTreeLB.GetEntryText(pParent); 1288cdf0e10cSrcweir sTmpTitle += String::CreateFromAscii(" - "); 1289cdf0e10cSrcweir sTmpTitle += aTreeLB.GetEntryText(pEntry); 1290cdf0e10cSrcweir SetText(sTmpTitle); 1291cdf0e10cSrcweir pCurrentPageEntry = pEntry; 1292cdf0e10cSrcweir if ( !bForgetSelection ) 1293cdf0e10cSrcweir { 1294cdf0e10cSrcweir if ( !pLastPageSaver ) 1295cdf0e10cSrcweir pLastPageSaver = new LastPageSaver; 1296cdf0e10cSrcweir if ( !bIsFromExtensionManager ) 1297cdf0e10cSrcweir pLastPageSaver->m_nLastPageId = pPageInfo->m_nPageId; 1298cdf0e10cSrcweir if ( pPageInfo->m_pExtPage ) 1299cdf0e10cSrcweir { 1300cdf0e10cSrcweir if ( bIsFromExtensionManager ) 1301cdf0e10cSrcweir pLastPageSaver->m_sLastPageURL_ExtMgr = pPageInfo->m_sPageURL; 1302cdf0e10cSrcweir else 1303cdf0e10cSrcweir pLastPageSaver->m_sLastPageURL_Tools = pPageInfo->m_sPageURL; 1304cdf0e10cSrcweir } 1305cdf0e10cSrcweir } 1306cdf0e10cSrcweir pNewPage = pPageInfo->m_pPage; 1307cdf0e10cSrcweir } 1308cdf0e10cSrcweir else 1309cdf0e10cSrcweir { 1310cdf0e10cSrcweir OptionsGroupInfo* pTGInfo = (OptionsGroupInfo *)pEntry->GetUserData(); 1311cdf0e10cSrcweir if ( pTGInfo->m_sPageURL.getLength() == 0 ) 1312cdf0e10cSrcweir { 1313cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); 1314cdf0e10cSrcweir ImageList* pImgLst = bHighContrast ? &aPageImagesHC : &aPageImages; 1315cdf0e10cSrcweir //hier den Hilfetext anzeigen 1316cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i ) 1317cdf0e10cSrcweir { 1318cdf0e10cSrcweir if ( aHelpTextsArr.GetValue(i) == pTGInfo->m_nDialogId ) 1319cdf0e10cSrcweir { 1320cdf0e10cSrcweir aHelpFT.SetText(aHelpTextsArr.GetString(i)); 1321cdf0e10cSrcweir aHelpImg.SetImage(pImgLst->GetImage(pTGInfo->m_nDialogId)); 1322cdf0e10cSrcweir break; 1323cdf0e10cSrcweir } 1324cdf0e10cSrcweir } 1325cdf0e10cSrcweir 1326cdf0e10cSrcweir aPageTitleFT.Show(); 1327cdf0e10cSrcweir aLine1FL.Show(); 1328cdf0e10cSrcweir aHelpFT.Show(); 1329cdf0e10cSrcweir aHelpImg.Show(); 1330cdf0e10cSrcweir 1331cdf0e10cSrcweir //auf die Groesse der Bitmap anpassen 1332cdf0e10cSrcweir if(!bImageResized) 1333cdf0e10cSrcweir { 1334cdf0e10cSrcweir const long nCtrlDist = 2; 1335cdf0e10cSrcweir bImageResized = sal_True; 1336cdf0e10cSrcweir Point aImgPos(aHelpImg.GetPosPixel()); 1337cdf0e10cSrcweir Size aImgSize(aHelpImg.GetSizePixel()); 1338cdf0e10cSrcweir Point aTitlePos(aPageTitleFT.GetPosPixel()); 1339cdf0e10cSrcweir Point aLinePos(aLine1FL.GetPosPixel()); 1340cdf0e10cSrcweir Point aHelpPos(aHelpFT.GetPosPixel()); 1341cdf0e10cSrcweir Size aHelpSize(aHelpFT.GetSizePixel()); 1342cdf0e10cSrcweir long nXDiff = 0; 1343cdf0e10cSrcweir long nYDiff = 0; 1344cdf0e10cSrcweir if(aTitlePos.X() <= (aImgPos.X() + aImgSize.Width() + nCtrlDist)) 1345cdf0e10cSrcweir { 1346cdf0e10cSrcweir nXDiff = aImgPos.X() + aImgSize.Width() + nCtrlDist - aTitlePos.X(); 1347cdf0e10cSrcweir } 1348cdf0e10cSrcweir if(aLinePos.Y() <= (aImgPos.Y() + aImgSize.Height() + nCtrlDist)) 1349cdf0e10cSrcweir { 1350cdf0e10cSrcweir nYDiff = aImgPos.Y() + aImgSize.Height() + nCtrlDist - aLinePos.Y(); 1351cdf0e10cSrcweir } 1352cdf0e10cSrcweir aLinePos.Y() += nYDiff; 1353cdf0e10cSrcweir aLine1FL.SetPosPixel(aLinePos); 1354cdf0e10cSrcweir 1355cdf0e10cSrcweir aTitlePos.X() += nXDiff; 1356cdf0e10cSrcweir aPageTitleFT.SetPosPixel(aTitlePos); 1357cdf0e10cSrcweir 1358cdf0e10cSrcweir aHelpPos.X() += nXDiff; 1359cdf0e10cSrcweir aHelpPos.Y() += nYDiff; 1360cdf0e10cSrcweir aHelpSize.Width() -= nXDiff; 1361cdf0e10cSrcweir aHelpSize.Height() -= nYDiff; 1362cdf0e10cSrcweir aHelpFT.SetPosSizePixel(aHelpPos, aHelpSize); 1363cdf0e10cSrcweir 1364cdf0e10cSrcweir Font aFont = aHelpFT.GetFont(); 1365cdf0e10cSrcweir Size aSz = aFont.GetSize(); 1366cdf0e10cSrcweir aSz.Height() = (aSz.Height() * 14 ) / 10; 1367cdf0e10cSrcweir aFont.SetSize(aSz); 1368cdf0e10cSrcweir aPageTitleFT.SetFont(aFont); 1369cdf0e10cSrcweir } 1370cdf0e10cSrcweir 1371cdf0e10cSrcweir String sTmpTitle = sTitle; 1372cdf0e10cSrcweir sTmpTitle += String::CreateFromAscii(" - "); 1373cdf0e10cSrcweir aPageTitleFT.SetText(aTreeLB.GetEntryText(pEntry)); 1374cdf0e10cSrcweir sTmpTitle += aPageTitleFT.GetText(); 1375cdf0e10cSrcweir SetText(sTmpTitle); 1376cdf0e10cSrcweir pCurrentPageEntry = NULL; 1377cdf0e10cSrcweir } 1378cdf0e10cSrcweir else 1379cdf0e10cSrcweir { 1380cdf0e10cSrcweir if ( !pTGInfo->m_pExtPage ) 1381cdf0e10cSrcweir { 1382cdf0e10cSrcweir if ( !m_xContainerWinProvider.is() ) 1383cdf0e10cSrcweir { 1384cdf0e10cSrcweir Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); 1385cdf0e10cSrcweir m_xContainerWinProvider = Reference < awt::XContainerWindowProvider >( 1386cdf0e10cSrcweir xFactory->createInstance( 1387cdf0e10cSrcweir C2U("com.sun.star.awt.ContainerWindowProvider") ), UNO_QUERY ); 1388cdf0e10cSrcweir DBG_ASSERT( m_xContainerWinProvider.is(), "service com.sun.star.awt.ContainerWindowProvider could not be loaded" ); 1389cdf0e10cSrcweir } 1390cdf0e10cSrcweir 1391cdf0e10cSrcweir pTGInfo->m_pExtPage = 1392cdf0e10cSrcweir new ExtensionsTabPage( this, 0, pTGInfo->m_sPageURL, rtl::OUString(), m_xContainerWinProvider ); 1393cdf0e10cSrcweir Size aSize = aHiddenGB.GetSizePixel(); 1394cdf0e10cSrcweir aSize.Width() = aSize.Width() - 4; 1395cdf0e10cSrcweir aSize.Height() = aSize.Height() - 4; 1396cdf0e10cSrcweir Point aPos = aHiddenGB.GetPosPixel(); 1397cdf0e10cSrcweir aPos.X() = aPos.X() + 2; 1398cdf0e10cSrcweir aPos.Y() = aPos.Y() + 2; 1399cdf0e10cSrcweir pTGInfo->m_pExtPage->SetPosSizePixel( aPos, aSize ); 1400cdf0e10cSrcweir } 1401cdf0e10cSrcweir 1402cdf0e10cSrcweir if ( pTGInfo->m_pExtPage ) 1403cdf0e10cSrcweir { 1404cdf0e10cSrcweir pTGInfo->m_pExtPage->Show(); 1405cdf0e10cSrcweir pTGInfo->m_pExtPage->ActivatePage(); 1406cdf0e10cSrcweir } 1407cdf0e10cSrcweir 1408cdf0e10cSrcweir pCurrentPageEntry = pEntry; 1409cdf0e10cSrcweir } 1410cdf0e10cSrcweir } 1411cdf0e10cSrcweir 1412cdf0e10cSrcweir // restore lost focus, if necessary 1413cdf0e10cSrcweir Window* pFocusWin = Application::GetFocusWindow(); 1414cdf0e10cSrcweir // if the focused window is not the options treebox and the old page has the focus 1415cdf0e10cSrcweir if ( pFocusWin && pFocusWin != pBox && pOldPage && pOldPage->HasChildPathFocus() ) 1416cdf0e10cSrcweir // then set the focus to the new page or if we are on a group set the focus to the options treebox 1417cdf0e10cSrcweir pNewPage ? pNewPage->GrabFocus() : pBox->GrabFocus(); 1418cdf0e10cSrcweir 1419cdf0e10cSrcweir return 0; 1420cdf0e10cSrcweir } 1421cdf0e10cSrcweir 1422cdf0e10cSrcweir /* -----------------11.02.99 15:51------------------- 1423cdf0e10cSrcweir * 1424cdf0e10cSrcweir * --------------------------------------------------*/ 1425cdf0e10cSrcweir 1426cdf0e10cSrcweir OfaPageResource::OfaPageResource() : 1427cdf0e10cSrcweir Resource(CUI_RES(RID_OFADLG_OPTIONS_TREE_PAGES)), 1428cdf0e10cSrcweir aGeneralDlgAry(CUI_RES(SID_GENERAL_OPTIONS)), 1429cdf0e10cSrcweir aInetDlgAry(CUI_RES(SID_INET_DLG)), 1430cdf0e10cSrcweir aLangDlgAry(CUI_RES(SID_LANGUAGE_OPTIONS)), 1431cdf0e10cSrcweir aTextDlgAry(CUI_RES(SID_SW_EDITOPTIONS)), 1432cdf0e10cSrcweir aHTMLDlgAry(CUI_RES(SID_SW_ONLINEOPTIONS)), 1433cdf0e10cSrcweir aCalcDlgAry(CUI_RES(SID_SC_EDITOPTIONS)), 1434cdf0e10cSrcweir aStarMathDlgAry(CUI_RES(SID_SM_EDITOPTIONS)), 1435cdf0e10cSrcweir aImpressDlgAry(CUI_RES(SID_SD_EDITOPTIONS)), 1436cdf0e10cSrcweir aDrawDlgAry(CUI_RES(SID_SD_GRAPHIC_OPTIONS)), 1437cdf0e10cSrcweir aChartDlgAry(CUI_RES(SID_SCH_EDITOPTIONS)), 1438cdf0e10cSrcweir aFilterDlgAry(CUI_RES(SID_FILTER_DLG)), 1439cdf0e10cSrcweir aDatasourcesDlgAry(CUI_RES(SID_SB_STARBASEOPTIONS)) 1440cdf0e10cSrcweir { 1441cdf0e10cSrcweir FreeResource(); 1442cdf0e10cSrcweir } 1443cdf0e10cSrcweir 1444cdf0e10cSrcweir sal_Bool EnableSSO( void ) 1445cdf0e10cSrcweir { 1446cdf0e10cSrcweir // SSO must be enabled if the configuration manager bootstrap settings 1447cdf0e10cSrcweir // are configured as follows ... 1448cdf0e10cSrcweir // CFG_Offline=false 1449cdf0e10cSrcweir // CFG_ServerType=uno ( or unspecified ) 1450cdf0e10cSrcweir // CFG_BackendService= 1451cdf0e10cSrcweir // com.sun.star.comp.configuration.backend.LdapSingleBackend 1452cdf0e10cSrcweir 1453cdf0e10cSrcweir rtl::OUString theIniFile; 1454cdf0e10cSrcweir osl_getExecutableFile( &theIniFile.pData ); 1455cdf0e10cSrcweir theIniFile = theIniFile.copy( 0, theIniFile.lastIndexOf( '/' ) + 1 ) + 1456cdf0e10cSrcweir rtl::OUString::createFromAscii( SAL_CONFIGFILE( "configmgr" ) ); 1457cdf0e10cSrcweir ::rtl::Bootstrap theBootstrap( theIniFile ); 1458cdf0e10cSrcweir 1459cdf0e10cSrcweir rtl::OUString theOfflineValue; 1460cdf0e10cSrcweir rtl::OUString theDefaultOfflineValue = rtl::OUString::createFromAscii( "false" ); 1461cdf0e10cSrcweir theBootstrap.getFrom( rtl::OUString::createFromAscii( "CFG_Offline" ), 1462cdf0e10cSrcweir theOfflineValue, 1463cdf0e10cSrcweir theDefaultOfflineValue ); 1464cdf0e10cSrcweir 1465cdf0e10cSrcweir rtl::OUString theServerTypeValue; 1466cdf0e10cSrcweir theBootstrap.getFrom( rtl::OUString::createFromAscii( "CFG_ServerType" ), 1467cdf0e10cSrcweir theServerTypeValue ); 1468cdf0e10cSrcweir 1469cdf0e10cSrcweir rtl::OUString theBackendServiceTypeValue; 1470cdf0e10cSrcweir theBootstrap.getFrom( rtl::OUString::createFromAscii( "CFG_BackendService" ), 1471cdf0e10cSrcweir theBackendServiceTypeValue ); 1472cdf0e10cSrcweir 1473cdf0e10cSrcweir sal_Bool bSSOEnabled = 1474cdf0e10cSrcweir ( theOfflineValue == theDefaultOfflineValue && 1475cdf0e10cSrcweir ( theServerTypeValue.getLength() == 0 || 1476cdf0e10cSrcweir theServerTypeValue == rtl::OUString::createFromAscii( "uno" ) ) && 1477cdf0e10cSrcweir theBackendServiceTypeValue == 1478cdf0e10cSrcweir rtl::OUString::createFromAscii( 1479cdf0e10cSrcweir "com.sun.star.comp.configuration.backend.LdapSingleBackend" ) ); 1480cdf0e10cSrcweir if ( bSSOEnabled && GetSSOCreator() == 0 ) 1481cdf0e10cSrcweir { 1482cdf0e10cSrcweir bSSOEnabled = sal_False; 1483cdf0e10cSrcweir } 1484cdf0e10cSrcweir return bSSOEnabled; 1485cdf0e10cSrcweir } 1486cdf0e10cSrcweir 1487cdf0e10cSrcweir extern "C" { static void SAL_CALL thisModule() {} } 1488cdf0e10cSrcweir 1489cdf0e10cSrcweir CreateTabPage GetSSOCreator( void ) 1490cdf0e10cSrcweir { 1491cdf0e10cSrcweir static CreateTabPage theSymbol = 0; 1492cdf0e10cSrcweir if ( theSymbol == 0 ) 1493cdf0e10cSrcweir { 1494cdf0e10cSrcweir osl::Module aModule; 1495cdf0e10cSrcweir rtl::OUString theModuleName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "ssoopt" ) ) ); 1496cdf0e10cSrcweir if( aModule.loadRelative( 1497cdf0e10cSrcweir &thisModule, theModuleName, SAL_LOADMODULE_DEFAULT ) ) 1498cdf0e10cSrcweir { 1499cdf0e10cSrcweir rtl::OUString theSymbolName( rtl::OUString::createFromAscii( "CreateSSOTabPage" ) ); 1500cdf0e10cSrcweir theSymbol = reinterpret_cast<CreateTabPage>(aModule.getFunctionSymbol( theSymbolName )); 1501cdf0e10cSrcweir } 1502cdf0e10cSrcweir } 1503cdf0e10cSrcweir 1504cdf0e10cSrcweir return theSymbol; 1505cdf0e10cSrcweir } 1506cdf0e10cSrcweir 1507cdf0e10cSrcweir SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) 1508cdf0e10cSrcweir { 1509cdf0e10cSrcweir Reference< XPropertySet > xProp( SvxGetLinguPropertySet() ); 1510cdf0e10cSrcweir SfxItemSet* pRet = 0; 1511cdf0e10cSrcweir switch(nId) 1512cdf0e10cSrcweir { 1513cdf0e10cSrcweir case SID_GENERAL_OPTIONS: 1514cdf0e10cSrcweir { 1515cdf0e10cSrcweir pRet = new SfxItemSet( 1516cdf0e10cSrcweir SFX_APP()->GetPool(), 1517cdf0e10cSrcweir SID_ATTR_METRIC, SID_ATTR_SPELL, 1518cdf0e10cSrcweir SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK, 1519cdf0e10cSrcweir SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER, 1520cdf0e10cSrcweir SID_ATTR_YEAR2000, SID_ATTR_YEAR2000, 1521cdf0e10cSrcweir SID_HTML_MODE, SID_HTML_MODE, 1522cdf0e10cSrcweir 0 ); 1523cdf0e10cSrcweir 1524cdf0e10cSrcweir SfxItemSet aOptSet( SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER ); 1525cdf0e10cSrcweir SFX_APP()->GetOptions(aOptSet); 1526cdf0e10cSrcweir pRet->Put(aOptSet); 1527cdf0e10cSrcweir 1528cdf0e10cSrcweir utl::MiscCfg aMisc; 1529cdf0e10cSrcweir const SfxPoolItem* pItem; 1530cdf0e10cSrcweir SfxViewFrame* pViewFrame = SfxViewFrame::Current(); 1531cdf0e10cSrcweir if ( pViewFrame ) 1532cdf0e10cSrcweir { 1533cdf0e10cSrcweir SfxDispatcher* pDispatch = pViewFrame->GetDispatcher(); 1534cdf0e10cSrcweir 1535cdf0e10cSrcweir // Sonstiges - Year2000 1536cdf0e10cSrcweir if( SFX_ITEM_AVAILABLE <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) ) 1537cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, ((const SfxUInt16Item*)pItem)->GetValue() ) ); 1538cdf0e10cSrcweir else 1539cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (sal_uInt16)aMisc.GetYear2000() ) ); 1540cdf0e10cSrcweir } 1541cdf0e10cSrcweir else 1542cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (sal_uInt16)aMisc.GetYear2000() ) ); 1543cdf0e10cSrcweir 1544cdf0e10cSrcweir 1545cdf0e10cSrcweir // Sonstiges - Tabulator 1546cdf0e10cSrcweir pRet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning())); 1547cdf0e10cSrcweir 1548cdf0e10cSrcweir sal_uInt16 nFlag = aMisc.IsPaperSizeWarning() ? SFX_PRINTER_CHG_SIZE : 0; 1549cdf0e10cSrcweir nFlag |= aMisc.IsPaperOrientationWarning() ? SFX_PRINTER_CHG_ORIENTATION : 0; 1550cdf0e10cSrcweir pRet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, nFlag )); 1551cdf0e10cSrcweir 1552cdf0e10cSrcweir } 1553cdf0e10cSrcweir break; 1554cdf0e10cSrcweir case SID_LANGUAGE_OPTIONS : 1555cdf0e10cSrcweir { 1556cdf0e10cSrcweir pRet = new SfxItemSet(SFX_APP()->GetPool(), 1557cdf0e10cSrcweir SID_ATTR_LANGUAGE, SID_AUTOSPELL_CHECK, 1558cdf0e10cSrcweir SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE, 1559cdf0e10cSrcweir SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED, 1560cdf0e10cSrcweir SID_SET_DOCUMENT_LANGUAGE, SID_SET_DOCUMENT_LANGUAGE, 1561cdf0e10cSrcweir 0 ); 1562cdf0e10cSrcweir 1563cdf0e10cSrcweir // fuer die Linguistik 1564cdf0e10cSrcweir 1565cdf0e10cSrcweir Reference< XSpellChecker1 > xSpell = SvxGetSpellChecker(); 1566cdf0e10cSrcweir pRet->Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL )); 1567cdf0e10cSrcweir SfxHyphenRegionItem aHyphen( SID_ATTR_HYPHENREGION ); 1568cdf0e10cSrcweir 1569cdf0e10cSrcweir sal_Int16 nMinLead = 2, 1570cdf0e10cSrcweir nMinTrail = 2; 1571cdf0e10cSrcweir if (xProp.is()) 1572cdf0e10cSrcweir { 1573cdf0e10cSrcweir xProp->getPropertyValue( String::CreateFromAscii( 1574cdf0e10cSrcweir UPN_HYPH_MIN_LEADING) ) >>= nMinLead; 1575cdf0e10cSrcweir xProp->getPropertyValue( String::CreateFromAscii( 1576cdf0e10cSrcweir UPN_HYPH_MIN_TRAILING) ) >>= nMinTrail; 1577cdf0e10cSrcweir } 1578cdf0e10cSrcweir aHyphen.GetMinLead() = (sal_uInt8)nMinLead; 1579cdf0e10cSrcweir aHyphen.GetMinTrail() = (sal_uInt8)nMinTrail; 1580cdf0e10cSrcweir 1581cdf0e10cSrcweir const SfxPoolItem* pItem; 1582cdf0e10cSrcweir SfxPoolItem* pClone; 1583cdf0e10cSrcweir SfxViewFrame* pViewFrame = SfxViewFrame::Current(); 1584cdf0e10cSrcweir if ( pViewFrame ) 1585cdf0e10cSrcweir { 1586cdf0e10cSrcweir SfxDispatcher* pDispatch = pViewFrame->GetDispatcher(); 1587cdf0e10cSrcweir if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_LANGUAGE, pItem)) 1588cdf0e10cSrcweir pRet->Put(SfxUInt16Item(SID_ATTR_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage())); 1589cdf0e10cSrcweir if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_CHAR_CJK_LANGUAGE, pItem)) 1590cdf0e10cSrcweir pRet->Put(SfxUInt16Item(SID_ATTR_CHAR_CJK_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage())); 1591cdf0e10cSrcweir if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_CHAR_CTL_LANGUAGE, pItem)) 1592cdf0e10cSrcweir pRet->Put(SfxUInt16Item(SID_ATTR_CHAR_CTL_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage())); 1593cdf0e10cSrcweir 1594cdf0e10cSrcweir pRet->Put(aHyphen); 1595cdf0e10cSrcweir if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_AUTOSPELL_CHECK, pItem)) 1596cdf0e10cSrcweir { 1597cdf0e10cSrcweir pClone = pItem->Clone(); 1598cdf0e10cSrcweir pRet->Put(*pClone); 1599cdf0e10cSrcweir delete pClone; 1600cdf0e10cSrcweir } 1601cdf0e10cSrcweir else 1602cdf0e10cSrcweir { 1603cdf0e10cSrcweir sal_Bool bVal = sal_False; 1604cdf0e10cSrcweir if (xProp.is()) 1605cdf0e10cSrcweir { 1606cdf0e10cSrcweir xProp->getPropertyValue( String::CreateFromAscii( UPN_IS_SPELL_AUTO) ) >>= bVal; 1607cdf0e10cSrcweir } 1608cdf0e10cSrcweir 1609cdf0e10cSrcweir pRet->Put(SfxBoolItem(SID_AUTOSPELL_CHECK, bVal)); 1610cdf0e10cSrcweir } 1611cdf0e10cSrcweir } 1612cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SET_DOCUMENT_LANGUAGE, bIsForSetDocumentLanguage ) ); 1613cdf0e10cSrcweir } 1614cdf0e10cSrcweir break; 1615cdf0e10cSrcweir case SID_INET_DLG : 1616cdf0e10cSrcweir pRet = new SfxItemSet( SFX_APP()->GetPool(), 1617cdf0e10cSrcweir SID_BASIC_ENABLED, SID_BASIC_ENABLED, 1618cdf0e10cSrcweir //SID_OPTIONS_START - ..END 1619369c5206SMathias Bauer SID_INET_EMAIL_NAME, SID_INET_PROXY_PORT, 1620cdf0e10cSrcweir SID_SAVEREL_INET, SID_SAVEREL_FSYS, 1621cdf0e10cSrcweir SID_INET_SMTPSERVER, SID_INET_SMTPSERVER, 1622cdf0e10cSrcweir SID_INET_NOPROXY, SID_INET_SOCKS_PROXY_PORT, 1623cdf0e10cSrcweir SID_INET_DNS_AUTO, SID_INET_DNS_SERVER, 1624cdf0e10cSrcweir SID_SECURE_URL, SID_SECURE_URL, 1625cdf0e10cSrcweir 0L ); 1626cdf0e10cSrcweir SFX_APP()->GetOptions(*pRet); 1627cdf0e10cSrcweir break; 1628cdf0e10cSrcweir case SID_FILTER_DLG: 1629cdf0e10cSrcweir pRet = new SfxItemSet( SFX_APP()->GetPool(), 1630cdf0e10cSrcweir SID_ATTR_DOCINFO, SID_ATTR_AUTOSAVEMINUTE, 1631cdf0e10cSrcweir SID_SAVEREL_INET, SID_SAVEREL_FSYS, 1632cdf0e10cSrcweir SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING, 1633cdf0e10cSrcweir SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT, 1634cdf0e10cSrcweir 0 ); 1635cdf0e10cSrcweir SFX_APP()->GetOptions(*pRet); 1636cdf0e10cSrcweir break; 1637cdf0e10cSrcweir 1638cdf0e10cSrcweir case SID_SB_STARBASEOPTIONS: 1639cdf0e10cSrcweir pRet = new SfxItemSet( SFX_APP()->GetPool(), 1640cdf0e10cSrcweir SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER, 1641cdf0e10cSrcweir 0 ); 1642cdf0e10cSrcweir ::offapp::ConnectionPoolConfig::GetOptions(*pRet); 1643cdf0e10cSrcweir ::svx::DbRegisteredNamesConfig::GetOptions(*pRet); 1644cdf0e10cSrcweir break; 1645cdf0e10cSrcweir 1646cdf0e10cSrcweir case SID_SCH_EDITOPTIONS: 1647cdf0e10cSrcweir { 1648cdf0e10cSrcweir SvxChartOptions aChartOpt; 1649cdf0e10cSrcweir pRet = new SfxItemSet( SFX_APP()->GetPool(), SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS ); 1650cdf0e10cSrcweir pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aChartOpt.GetDefaultColors() ) ); 1651cdf0e10cSrcweir break; 1652cdf0e10cSrcweir } 1653cdf0e10cSrcweir } 1654cdf0e10cSrcweir return pRet; 1655cdf0e10cSrcweir } 1656cdf0e10cSrcweir 1657cdf0e10cSrcweir void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) 1658cdf0e10cSrcweir { 1659cdf0e10cSrcweir switch(nId) 1660cdf0e10cSrcweir { 1661cdf0e10cSrcweir case SID_GENERAL_OPTIONS: 1662cdf0e10cSrcweir { 1663cdf0e10cSrcweir utl::MiscCfg aMisc; 1664cdf0e10cSrcweir const SfxPoolItem* pItem; 1665cdf0e10cSrcweir SfxItemSet aOptSet(SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER ); 1666cdf0e10cSrcweir aOptSet.Put(rSet); 1667cdf0e10cSrcweir if(aOptSet.Count()) 1668cdf0e10cSrcweir SFX_APP()->SetOptions( aOptSet ); 1669cdf0e10cSrcweir // Dispatcher neu holen, weil SetOptions() ggf. den Dispatcher zerst"ort hat 1670cdf0e10cSrcweir SfxViewFrame *pViewFrame = SfxViewFrame::Current(); 1671cdf0e10cSrcweir // ------------------------------------------------------------------------- 1672cdf0e10cSrcweir // Year2000 auswerten 1673cdf0e10cSrcweir // ------------------------------------------------------------------------- 1674cdf0e10cSrcweir sal_uInt16 nY2K = USHRT_MAX; 1675cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_YEAR2000, sal_False, &pItem ) ) 1676cdf0e10cSrcweir nY2K = ((const SfxUInt16Item*)pItem)->GetValue(); 1677cdf0e10cSrcweir if( USHRT_MAX != nY2K ) 1678cdf0e10cSrcweir { 1679cdf0e10cSrcweir if ( pViewFrame ) 1680cdf0e10cSrcweir { 1681cdf0e10cSrcweir SfxDispatcher* pDispatch = pViewFrame->GetDispatcher(); 1682cdf0e10cSrcweir pDispatch->Execute( SID_ATTR_YEAR2000, SFX_CALLMODE_ASYNCHRON, pItem, 0L); 1683cdf0e10cSrcweir } 1684cdf0e10cSrcweir aMisc.SetYear2000(nY2K); 1685cdf0e10cSrcweir } 1686cdf0e10cSrcweir 1687cdf0e10cSrcweir // ------------------------------------------------------------------------- 1688cdf0e10cSrcweir // Drucken auswerten 1689cdf0e10cSrcweir // ------------------------------------------------------------------------- 1690cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState(SID_PRINTER_NOTFOUND_WARN, sal_False, &pItem)) 1691cdf0e10cSrcweir aMisc.SetNotFoundWarning(((const SfxBoolItem*)pItem)->GetValue()); 1692cdf0e10cSrcweir 1693cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState(SID_PRINTER_CHANGESTODOC, sal_False, &pItem)) 1694cdf0e10cSrcweir { 1695cdf0e10cSrcweir const SfxFlagItem* pFlag = (const SfxFlagItem*)pItem; 1696cdf0e10cSrcweir aMisc.SetPaperSizeWarning(0 != (pFlag->GetValue() & SFX_PRINTER_CHG_SIZE )); 1697cdf0e10cSrcweir aMisc.SetPaperOrientationWarning(0 != (pFlag->GetValue() & SFX_PRINTER_CHG_ORIENTATION )); 1698cdf0e10cSrcweir } 1699cdf0e10cSrcweir // ------------------------------------------------------------------------- 1700cdf0e10cSrcweir // evaluate help options 1701cdf0e10cSrcweir // ------------------------------------------------------------------------- 1702cdf0e10cSrcweir if ( SvtHelpOptions().IsHelpTips() != Help::IsQuickHelpEnabled() ) 1703cdf0e10cSrcweir SvtHelpOptions().IsHelpTips() ? Help::EnableQuickHelp() : Help::DisableQuickHelp(); 1704cdf0e10cSrcweir if ( SvtHelpOptions().IsExtendedHelp() != Help::IsBalloonHelpEnabled() ) 1705cdf0e10cSrcweir SvtHelpOptions().IsExtendedHelp() ? Help::EnableBalloonHelp() : Help::DisableBalloonHelp(); 1706cdf0e10cSrcweir } 1707cdf0e10cSrcweir break; 1708cdf0e10cSrcweir case SID_LANGUAGE_OPTIONS : 1709cdf0e10cSrcweir { 1710cdf0e10cSrcweir OfaTreeOptionsDialog::ApplyLanguageOptions(rSet); 1711cdf0e10cSrcweir } 1712cdf0e10cSrcweir break; 1713cdf0e10cSrcweir case SID_INET_DLG : 1714cdf0e10cSrcweir case SID_FILTER_DLG: 1715cdf0e10cSrcweir SFX_APP()->SetOptions( rSet ); 1716cdf0e10cSrcweir break; 1717cdf0e10cSrcweir 1718cdf0e10cSrcweir case SID_SB_STARBASEOPTIONS: 1719cdf0e10cSrcweir ::offapp::ConnectionPoolConfig::SetOptions( rSet ); 1720cdf0e10cSrcweir ::svx::DbRegisteredNamesConfig::SetOptions(rSet); 1721cdf0e10cSrcweir break; 1722cdf0e10cSrcweir 1723cdf0e10cSrcweir case SID_SCH_EDITOPTIONS: 1724cdf0e10cSrcweir // nothing to do. Chart options only apply to newly created charts 1725cdf0e10cSrcweir break; 1726cdf0e10cSrcweir 1727cdf0e10cSrcweir default: 1728cdf0e10cSrcweir { 1729cdf0e10cSrcweir DBG_ERROR( "Unhandled option in ApplyItemSet" ); 1730cdf0e10cSrcweir } 1731cdf0e10cSrcweir break; 1732cdf0e10cSrcweir } 1733cdf0e10cSrcweir 1734cdf0e10cSrcweir } 1735cdf0e10cSrcweir void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet) 1736cdf0e10cSrcweir { 1737cdf0e10cSrcweir sal_Bool bSaveSpellCheck = sal_False; 1738cdf0e10cSrcweir const SfxPoolItem* pItem; 1739cdf0e10cSrcweir 1740cdf0e10cSrcweir if ( SFX_ITEM_SET == rSet.GetItemState( SID_SPELL_MODIFIED, sal_False, &pItem ) ) 1741cdf0e10cSrcweir { 1742cdf0e10cSrcweir bSaveSpellCheck = ( (const SfxBoolItem*)pItem )->GetValue(); 1743cdf0e10cSrcweir } 1744cdf0e10cSrcweir Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); 1745cdf0e10cSrcweir Reference< XPropertySet > xProp( 1746cdf0e10cSrcweir xMgr->createInstance( ::rtl::OUString::createFromAscii( 1747cdf0e10cSrcweir "com.sun.star.linguistic2.LinguProperties") ), 1748cdf0e10cSrcweir UNO_QUERY ); 1749cdf0e10cSrcweir if ( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_HYPHENREGION, sal_False, &pItem ) ) 1750cdf0e10cSrcweir { 1751cdf0e10cSrcweir const SfxHyphenRegionItem* pHyphenItem = (const SfxHyphenRegionItem*)pItem; 1752cdf0e10cSrcweir 1753cdf0e10cSrcweir if (xProp.is()) 1754cdf0e10cSrcweir { 1755cdf0e10cSrcweir xProp->setPropertyValue( 1756cdf0e10cSrcweir String::CreateFromAscii(UPN_HYPH_MIN_LEADING), 1757cdf0e10cSrcweir makeAny((sal_Int16) pHyphenItem->GetMinLead()) ); 1758cdf0e10cSrcweir xProp->setPropertyValue( 1759cdf0e10cSrcweir String::CreateFromAscii(UPN_HYPH_MIN_TRAILING), 1760cdf0e10cSrcweir makeAny((sal_Int16) pHyphenItem->GetMinTrail()) ); 1761cdf0e10cSrcweir } 1762cdf0e10cSrcweir bSaveSpellCheck = sal_True; 1763cdf0e10cSrcweir } 1764cdf0e10cSrcweir 1765cdf0e10cSrcweir SfxViewFrame *pViewFrame = SfxViewFrame::Current(); 1766cdf0e10cSrcweir if ( pViewFrame ) 1767cdf0e10cSrcweir { 1768cdf0e10cSrcweir SfxDispatcher* pDispatch = pViewFrame->GetDispatcher(); 1769cdf0e10cSrcweir pItem = 0; 1770cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_LANGUAGE, sal_False, &pItem )) 1771cdf0e10cSrcweir { 1772cdf0e10cSrcweir pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L); 1773cdf0e10cSrcweir bSaveSpellCheck = sal_True; 1774cdf0e10cSrcweir } 1775cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE, sal_False, &pItem )) 1776cdf0e10cSrcweir { 1777cdf0e10cSrcweir pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L); 1778cdf0e10cSrcweir bSaveSpellCheck = sal_True; 1779cdf0e10cSrcweir } 1780cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE, sal_False, &pItem )) 1781cdf0e10cSrcweir { 1782cdf0e10cSrcweir pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L); 1783cdf0e10cSrcweir bSaveSpellCheck = sal_True; 1784cdf0e10cSrcweir } 1785cdf0e10cSrcweir 1786cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState(SID_AUTOSPELL_CHECK, sal_False, &pItem )) 1787cdf0e10cSrcweir { 1788cdf0e10cSrcweir sal_Bool bOnlineSpelling = ((const SfxBoolItem*)pItem)->GetValue(); 1789cdf0e10cSrcweir pDispatch->Execute(SID_AUTOSPELL_CHECK, 1790cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD, pItem, 0L); 1791cdf0e10cSrcweir 1792cdf0e10cSrcweir if (xProp.is()) 1793cdf0e10cSrcweir { 1794cdf0e10cSrcweir xProp->setPropertyValue( 1795cdf0e10cSrcweir String::CreateFromAscii(UPN_IS_SPELL_AUTO), 1796cdf0e10cSrcweir makeAny(bOnlineSpelling) ); 1797cdf0e10cSrcweir } 1798cdf0e10cSrcweir } 1799cdf0e10cSrcweir 1800cdf0e10cSrcweir if( bSaveSpellCheck ) 1801cdf0e10cSrcweir { 1802cdf0e10cSrcweir //! the config item has changed since we modified the 1803cdf0e10cSrcweir //! property set it uses 1804cdf0e10cSrcweir pDispatch->Execute(SID_SPELLCHECKER_CHANGED, SFX_CALLMODE_ASYNCHRON); 1805cdf0e10cSrcweir } 1806cdf0e10cSrcweir } 1807cdf0e10cSrcweir 1808cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState(SID_OPT_LOCALE_CHANGED, sal_False, &pItem )) 1809cdf0e10cSrcweir { 1810cdf0e10cSrcweir SfxViewFrame* _pViewFrame = SfxViewFrame::GetFirst(); 1811cdf0e10cSrcweir while ( _pViewFrame ) 1812cdf0e10cSrcweir { 1813cdf0e10cSrcweir _pViewFrame->GetDispatcher()->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L); 1814cdf0e10cSrcweir _pViewFrame = SfxViewFrame::GetNext( *_pViewFrame ); 1815cdf0e10cSrcweir } 1816cdf0e10cSrcweir } 1817cdf0e10cSrcweir } 1818cdf0e10cSrcweir 1819cdf0e10cSrcweir rtl::OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame ) 1820cdf0e10cSrcweir { 1821cdf0e10cSrcweir rtl::OUString sIdentifier; 1822cdf0e10cSrcweir Reference < XFrame > xCurrentFrame( _xFrame ); 1823cdf0e10cSrcweir Reference < XModuleManager > xModuleManager( ::comphelper::getProcessServiceFactory()->createInstance( 1824cdf0e10cSrcweir DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), UNO_QUERY ); 1825cdf0e10cSrcweir if ( !xCurrentFrame.is() ) 1826cdf0e10cSrcweir { 1827cdf0e10cSrcweir Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( 1828cdf0e10cSrcweir DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); 1829cdf0e10cSrcweir if ( xDesktop.is() ) 1830cdf0e10cSrcweir xCurrentFrame = xDesktop->getCurrentFrame(); 1831cdf0e10cSrcweir } 1832cdf0e10cSrcweir 1833cdf0e10cSrcweir if ( xCurrentFrame.is() && xModuleManager.is() ) 1834cdf0e10cSrcweir { 1835cdf0e10cSrcweir try 1836cdf0e10cSrcweir { 1837cdf0e10cSrcweir sIdentifier = xModuleManager->identify( xCurrentFrame ); 1838cdf0e10cSrcweir } 1839cdf0e10cSrcweir catch ( ::com::sun::star::frame::UnknownModuleException& ) 1840cdf0e10cSrcweir { 1841cdf0e10cSrcweir DBG_WARNING( "getActiveModule_Impl(): unknown module" ); 1842cdf0e10cSrcweir } 1843cdf0e10cSrcweir catch ( Exception& ) 1844cdf0e10cSrcweir { 1845cdf0e10cSrcweir DBG_ERRORFILE( "getActiveModule_Impl(): exception of XModuleManager::identify()" ); 1846cdf0e10cSrcweir } 1847cdf0e10cSrcweir } 1848cdf0e10cSrcweir 1849cdf0e10cSrcweir return sIdentifier; 1850cdf0e10cSrcweir } 1851cdf0e10cSrcweir 1852cdf0e10cSrcweir void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) 1853cdf0e10cSrcweir { 1854cdf0e10cSrcweir OfaPageResource aDlgResource; 1855cdf0e10cSrcweir sal_uInt16 nGroup = 0; 1856cdf0e10cSrcweir 1857cdf0e10cSrcweir SvtOptionsDialogOptions aOptionsDlgOpt; 1858cdf0e10cSrcweir sal_uInt16 i, nPageId; 1859cdf0e10cSrcweir 1860cdf0e10cSrcweir // %PRODUCTNAME options 1861cdf0e10cSrcweir sal_Bool isSSOEnabled = EnableSSO(); 1862cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_GENERAL_OPTIONS, aOptionsDlgOpt ) ) 1863cdf0e10cSrcweir { 1864cdf0e10cSrcweir ResStringArray& rGeneralArray = aDlgResource.GetGeneralArray(); 1865cdf0e10cSrcweir setGroupName( C2U("ProductName"), rGeneralArray.GetString(0) ); 1866cdf0e10cSrcweir nGroup = AddGroup( rGeneralArray.GetString(0), 0, 0, SID_GENERAL_OPTIONS ); 1867cdf0e10cSrcweir sal_uInt16 nEnd = static_cast< sal_uInt16 >( rGeneralArray.Count() ); 1868cdf0e10cSrcweir String sPageTitle; 1869cdf0e10cSrcweir 1870cdf0e10cSrcweir for ( i = 1; i < nEnd; ++i ) 1871cdf0e10cSrcweir { 1872cdf0e10cSrcweir String sNewTitle = rGeneralArray.GetString(i); 1873cdf0e10cSrcweir nPageId = (sal_uInt16)rGeneralArray.GetValue(i); 1874cdf0e10cSrcweir if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 1875cdf0e10cSrcweir continue; 1876cdf0e10cSrcweir 1877cdf0e10cSrcweir // Disable Online Update page if service not installed 1878cdf0e10cSrcweir if( RID_SVXPAGE_ONLINEUPDATE == nPageId ) 1879cdf0e10cSrcweir { 1880cdf0e10cSrcweir const ::rtl::OUString sService = C2U("com.sun.star.setup.UpdateCheck"); 1881cdf0e10cSrcweir 1882cdf0e10cSrcweir try 1883cdf0e10cSrcweir { 1884cdf0e10cSrcweir Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); 1885cdf0e10cSrcweir Reference < XInterface > xService( xFactory->createInstance( sService ) ); 1886cdf0e10cSrcweir 1887cdf0e10cSrcweir if( ! xService.is() ) 1888cdf0e10cSrcweir continue; 1889cdf0e10cSrcweir } 1890cdf0e10cSrcweir catch ( ::com::sun::star::loader::CannotActivateFactoryException& ) 1891cdf0e10cSrcweir { 1892cdf0e10cSrcweir continue; 1893cdf0e10cSrcweir } 1894cdf0e10cSrcweir } 1895cdf0e10cSrcweir // Disable OOoImprovement page if not enabled 1896cdf0e10cSrcweir if( RID_SVXPAGE_IMPROVEMENT == nPageId ) 1897cdf0e10cSrcweir { 1898cdf0e10cSrcweir continue; 1899cdf0e10cSrcweir } 1900cdf0e10cSrcweir if ( nPageId != RID_SVXPAGE_SSO || isSSOEnabled ) 1901cdf0e10cSrcweir { 1902cdf0e10cSrcweir AddTabPage( nPageId, sNewTitle, nGroup ); 1903cdf0e10cSrcweir } 1904cdf0e10cSrcweir } 1905cdf0e10cSrcweir // private iteration hack for Improvement Program 1906cdf0e10cSrcweir // hack for OOo 3.1 1907cdf0e10cSrcweir // should not be in found in any later release 1908cdf0e10cSrcweir for(bool bOnce = false; bOnce==false; bOnce=true) 1909cdf0e10cSrcweir { 1910cdf0e10cSrcweir String sNewTitle = C2U("Improvement Program"); 1911cdf0e10cSrcweir { 1912cdf0e10cSrcweir SvxImprovementPage aTempTabPage(this); 1913cdf0e10cSrcweir sNewTitle = aTempTabPage.GetTitleText(); 1914cdf0e10cSrcweir } 1915cdf0e10cSrcweir nPageId = RID_SVXPAGE_IMPROVEMENT; 1916cdf0e10cSrcweir if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 1917cdf0e10cSrcweir continue; 1918cdf0e10cSrcweir // Disable OOoImprovement page if not enabled 1919cdf0e10cSrcweir { 1920cdf0e10cSrcweir const ::rtl::OUString sService = C2U("com.sun.star.oooimprovement.CoreController"); 1921cdf0e10cSrcweir try 1922cdf0e10cSrcweir { 1923cdf0e10cSrcweir Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); 1924cdf0e10cSrcweir Reference < ::com::sun::star::oooimprovement::XCoreController > xService( xFactory->createInstance( sService ), UNO_QUERY ); 1925cdf0e10cSrcweir 1926cdf0e10cSrcweir if( ! xService.is() ) 1927cdf0e10cSrcweir continue; 1928cdf0e10cSrcweir if( ! xService->showBuiltinOptionsPage(1)) 1929cdf0e10cSrcweir continue; 1930cdf0e10cSrcweir } 1931cdf0e10cSrcweir catch ( ::com::sun::star::loader::CannotActivateFactoryException& ) 1932cdf0e10cSrcweir { 1933cdf0e10cSrcweir continue; 1934cdf0e10cSrcweir } 1935cdf0e10cSrcweir } 1936cdf0e10cSrcweir if ( nPageId != RID_SVXPAGE_SSO || isSSOEnabled ) 1937cdf0e10cSrcweir { 1938cdf0e10cSrcweir AddTabPage( nPageId, sNewTitle, nGroup ); 1939cdf0e10cSrcweir } 1940cdf0e10cSrcweir } 1941cdf0e10cSrcweir } 1942cdf0e10cSrcweir 1943cdf0e10cSrcweir // Load and Save options 1944cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_FILTER_DLG, aOptionsDlgOpt ) ) 1945cdf0e10cSrcweir { 1946cdf0e10cSrcweir ResStringArray& rFilterArray = aDlgResource.GetFilterArray(); 1947cdf0e10cSrcweir setGroupName( C2U("LoadSave"), rFilterArray.GetString(0) ); 1948cdf0e10cSrcweir nGroup = AddGroup( rFilterArray.GetString(0), 0, 0, SID_FILTER_DLG ); 1949cdf0e10cSrcweir for ( i = 1; i < rFilterArray.Count(); ++i ) 1950cdf0e10cSrcweir { 1951cdf0e10cSrcweir nPageId = (sal_uInt16)rFilterArray.GetValue(i); 1952cdf0e10cSrcweir if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 1953cdf0e10cSrcweir AddTabPage( nPageId, rFilterArray.GetString(i), nGroup ); 1954cdf0e10cSrcweir } 1955cdf0e10cSrcweir } 1956cdf0e10cSrcweir 1957cdf0e10cSrcweir // Language options 1958cdf0e10cSrcweir SvtLanguageOptions aLanguageOptions; 1959cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_LANGUAGE_OPTIONS, aOptionsDlgOpt ) ) 1960cdf0e10cSrcweir { 1961cdf0e10cSrcweir ResStringArray& rLangArray = aDlgResource.GetLangArray(); 1962cdf0e10cSrcweir setGroupName( C2U("LanguageSettings"), rLangArray.GetString(0) ); 1963cdf0e10cSrcweir nGroup = AddGroup( rLangArray.GetString(0), 0, 0, SID_LANGUAGE_OPTIONS ); 1964cdf0e10cSrcweir for ( i = 1; i < rLangArray.Count(); ++i ) 1965cdf0e10cSrcweir { 1966cdf0e10cSrcweir nPageId = (sal_uInt16)rLangArray.GetValue(i); 1967cdf0e10cSrcweir if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 1968cdf0e10cSrcweir continue; 1969cdf0e10cSrcweir if ( ( RID_SVXPAGE_JSEARCH_OPTIONS != nPageId || aLanguageOptions.IsJapaneseFindEnabled() ) && 1970cdf0e10cSrcweir ( RID_SVXPAGE_ASIAN_LAYOUT != nPageId || aLanguageOptions.IsAsianTypographyEnabled() ) && 1971cdf0e10cSrcweir ( RID_SVXPAGE_OPTIONS_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) ) 1972cdf0e10cSrcweir AddTabPage( nPageId, rLangArray.GetString(i), nGroup ); 1973cdf0e10cSrcweir } 1974cdf0e10cSrcweir } 1975cdf0e10cSrcweir 1976cdf0e10cSrcweir 1977cdf0e10cSrcweir rtl::OUString aFactory = getCurrentFactory_Impl( _xFrame ); 1978cdf0e10cSrcweir rtl::OUString sTemp = GetModuleIdentifier( comphelper::getProcessServiceFactory(), _xFrame ); 1979cdf0e10cSrcweir DBG_ASSERT( sTemp == aFactory, "S H I T!!!" ); 1980cdf0e10cSrcweir 1981cdf0e10cSrcweir // Writer and Writer/Web options 1982cdf0e10cSrcweir sal_Bool bHasAnyFilter = sal_False; 1983cdf0e10cSrcweir SvtModuleOptions aModuleOpt; 1984cdf0e10cSrcweir if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) 1985cdf0e10cSrcweir { 1986cdf0e10cSrcweir // Textdokument 1987cdf0e10cSrcweir bHasAnyFilter = sal_True; 1988cdf0e10cSrcweir ResStringArray& rTextArray = aDlgResource.GetTextArray(); 1989cdf0e10cSrcweir if ( aFactory.equalsAscii( "com.sun.star.text.TextDocument" ) 1990cdf0e10cSrcweir || aFactory.equalsAscii( "com.sun.star.text.WebDocument" ) 1991cdf0e10cSrcweir || aFactory.equalsAscii( "com.sun.star.text.GlobalDocument" ) ) 1992cdf0e10cSrcweir { 1993cdf0e10cSrcweir SfxModule* pSwMod = (*(SfxModule**) GetAppData(SHL_WRITER)); 1994cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_SW_EDITOPTIONS, aOptionsDlgOpt ) ) 1995cdf0e10cSrcweir { 1996cdf0e10cSrcweir if ( aFactory.equalsAscii( "com.sun.star.text.WebDocument" ) ) 1997cdf0e10cSrcweir setGroupName( C2U("WriterWeb"), rTextArray.GetString(0) ); 1998cdf0e10cSrcweir else 1999cdf0e10cSrcweir setGroupName( C2U("Writer"), rTextArray.GetString(0) ); 2000cdf0e10cSrcweir nGroup = AddGroup(rTextArray.GetString(0), pSwMod, pSwMod, SID_SW_EDITOPTIONS ); 2001cdf0e10cSrcweir for ( i = 1; i < rTextArray.Count(); ++i ) 2002cdf0e10cSrcweir { 2003cdf0e10cSrcweir nPageId = (sal_uInt16)rTextArray.GetValue(i); 2004cdf0e10cSrcweir if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 2005cdf0e10cSrcweir continue; 2006cdf0e10cSrcweir if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || aLanguageOptions.IsCJKFontEnabled() ) && 2007cdf0e10cSrcweir ( RID_SW_TP_STD_FONT_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) && 2008cdf0e10cSrcweir ( RID_SW_TP_MAILCONFIG != nPageId || MailMergeCfg_Impl().IsEmailSupported() ) ) 2009cdf0e10cSrcweir AddTabPage( nPageId, rTextArray.GetString(i), nGroup ); 2010cdf0e10cSrcweir } 2011cdf0e10cSrcweir #ifdef DBG_UTIL 2012cdf0e10cSrcweir AddTabPage( RID_SW_TP_OPTTEST_PAGE, String::CreateFromAscii("Interner Test"), nGroup ); 2013cdf0e10cSrcweir #endif 2014cdf0e10cSrcweir } 2015cdf0e10cSrcweir 2016cdf0e10cSrcweir // HTML-Dokument 2017cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_SW_ONLINEOPTIONS, aOptionsDlgOpt ) ) 2018cdf0e10cSrcweir { 2019cdf0e10cSrcweir ResStringArray& rHTMLArray = aDlgResource.GetHTMLArray(); 2020cdf0e10cSrcweir nGroup = AddGroup(rHTMLArray.GetString(0), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS ); 2021cdf0e10cSrcweir for( i = 1; i < rHTMLArray.Count(); ++i ) 2022cdf0e10cSrcweir { 2023cdf0e10cSrcweir nPageId = (sal_uInt16)rHTMLArray.GetValue(i); 2024cdf0e10cSrcweir if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 2025cdf0e10cSrcweir AddTabPage( nPageId, rHTMLArray.GetString(i), nGroup ); 2026cdf0e10cSrcweir } 2027cdf0e10cSrcweir #ifdef DBG_UTIL 2028cdf0e10cSrcweir AddTabPage( RID_SW_TP_OPTTEST_PAGE, String::CreateFromAscii("Interner Test"), nGroup ); 2029cdf0e10cSrcweir #endif 2030cdf0e10cSrcweir } 2031cdf0e10cSrcweir } 2032cdf0e10cSrcweir } 2033cdf0e10cSrcweir 2034cdf0e10cSrcweir // Calc options 2035cdf0e10cSrcweir if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) ) 2036cdf0e10cSrcweir { 2037cdf0e10cSrcweir bHasAnyFilter = sal_True; 2038cdf0e10cSrcweir if ( aFactory.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" )) 2039cdf0e10cSrcweir { 2040cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_SC_EDITOPTIONS, aOptionsDlgOpt ) ) 2041cdf0e10cSrcweir { 2042cdf0e10cSrcweir ResStringArray& rCalcArray = aDlgResource.GetCalcArray(); 2043cdf0e10cSrcweir SfxModule* pScMod = ( *( SfxModule** ) GetAppData( SHL_CALC ) ); 2044cdf0e10cSrcweir setGroupName( C2U("Calc"), rCalcArray.GetString(0) ); 2045cdf0e10cSrcweir nGroup = AddGroup( rCalcArray.GetString( 0 ), pScMod, pScMod, SID_SC_EDITOPTIONS ); 2046cdf0e10cSrcweir const sal_uInt16 nCount = static_cast< const sal_uInt16 >( rCalcArray.Count() ); 2047cdf0e10cSrcweir for ( i = 1; i < nCount; ++i ) 2048cdf0e10cSrcweir { 2049cdf0e10cSrcweir nPageId = (sal_uInt16)rCalcArray.GetValue(i); 2050cdf0e10cSrcweir if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 2051cdf0e10cSrcweir continue; 2052cdf0e10cSrcweir // if( bCTL || nId != RID_OFA_TP_INTERNATIONAL ) 2053cdf0e10cSrcweir // #103755# if an international tabpage is need one day, this should be used again... ;-) 2054cdf0e10cSrcweir if ( nPageId != RID_OFA_TP_INTERNATIONAL ) 2055cdf0e10cSrcweir AddTabPage( nPageId, rCalcArray.GetString( i ), nGroup ); 2056cdf0e10cSrcweir } 2057cdf0e10cSrcweir } 2058cdf0e10cSrcweir } 2059cdf0e10cSrcweir } 2060cdf0e10cSrcweir 2061cdf0e10cSrcweir // Impress options 2062cdf0e10cSrcweir SfxModule* pSdMod = ( *( SfxModule** ) GetAppData( SHL_DRAW ) ); 2063cdf0e10cSrcweir if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) ) 2064cdf0e10cSrcweir { 2065cdf0e10cSrcweir bHasAnyFilter = sal_True; 2066cdf0e10cSrcweir if ( aFactory.equalsAscii( "com.sun.star.presentation.PresentationDocument" )) 2067cdf0e10cSrcweir { 2068cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_SD_EDITOPTIONS, aOptionsDlgOpt ) ) 2069cdf0e10cSrcweir { 2070cdf0e10cSrcweir ResStringArray& rImpressArray = aDlgResource.GetImpressArray(); 2071cdf0e10cSrcweir setGroupName( C2U("Impress"), rImpressArray.GetString(0) ); 2072cdf0e10cSrcweir nGroup = AddGroup( rImpressArray.GetString( 0 ), pSdMod, pSdMod, SID_SD_EDITOPTIONS ); 2073cdf0e10cSrcweir const sal_Bool bCTL = aLanguageOptions.IsCTLFontEnabled(); 2074cdf0e10cSrcweir const sal_uInt16 nCount = static_cast< const sal_uInt16 >( rImpressArray.Count() ); 2075cdf0e10cSrcweir for ( i = 1; i < nCount; ++i ) 2076cdf0e10cSrcweir { 2077cdf0e10cSrcweir nPageId = (sal_uInt16)rImpressArray.GetValue(i); 2078cdf0e10cSrcweir if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 2079cdf0e10cSrcweir continue; 2080cdf0e10cSrcweir if ( bCTL || nPageId != RID_OFA_TP_INTERNATIONAL_IMPR ) 2081cdf0e10cSrcweir AddTabPage( nPageId, rImpressArray.GetString(i), nGroup ); 2082cdf0e10cSrcweir } 2083cdf0e10cSrcweir } 2084cdf0e10cSrcweir } 2085cdf0e10cSrcweir } 2086cdf0e10cSrcweir 2087cdf0e10cSrcweir // Draw options 2088cdf0e10cSrcweir if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ) 2089cdf0e10cSrcweir { 2090cdf0e10cSrcweir if ( aFactory.equalsAscii( "com.sun.star.drawing.DrawingDocument" )) 2091cdf0e10cSrcweir { 2092cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_SD_GRAPHIC_OPTIONS, aOptionsDlgOpt ) ) 2093cdf0e10cSrcweir { 2094cdf0e10cSrcweir ResStringArray& rDrawArray = aDlgResource.GetDrawArray(); 2095cdf0e10cSrcweir setGroupName( C2U("Draw"), rDrawArray.GetString(0) ); 2096cdf0e10cSrcweir nGroup = AddGroup( rDrawArray.GetString( 0 ), pSdMod, pSdMod, SID_SD_GRAPHIC_OPTIONS ); 2097cdf0e10cSrcweir const sal_Bool bCTL = aLanguageOptions.IsCTLFontEnabled(); 2098cdf0e10cSrcweir const sal_uInt16 nCount = static_cast< const sal_uInt16 >( rDrawArray.Count() ); 2099cdf0e10cSrcweir for ( i = 1; i < nCount; ++i ) 2100cdf0e10cSrcweir { 2101cdf0e10cSrcweir nPageId = (sal_uInt16)rDrawArray.GetValue(i); 2102cdf0e10cSrcweir if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 2103cdf0e10cSrcweir continue; 2104cdf0e10cSrcweir if ( bCTL || nPageId != RID_OFA_TP_INTERNATIONAL_SD ) 2105cdf0e10cSrcweir AddTabPage( nPageId, rDrawArray.GetString(i), nGroup ); 2106cdf0e10cSrcweir } 2107cdf0e10cSrcweir } 2108cdf0e10cSrcweir } 2109cdf0e10cSrcweir } 2110cdf0e10cSrcweir 2111cdf0e10cSrcweir // Math options 2112cdf0e10cSrcweir if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) ) 2113cdf0e10cSrcweir { 2114cdf0e10cSrcweir if ( aFactory.equalsAscii( "com.sun.star.formula.FormulaProperties" )) 2115cdf0e10cSrcweir { 2116cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_SM_EDITOPTIONS, aOptionsDlgOpt ) ) 2117cdf0e10cSrcweir { 2118cdf0e10cSrcweir ResStringArray& rStarMathArray = aDlgResource.GetStarMathArray(); 2119cdf0e10cSrcweir SfxModule* pSmMod = (*(SfxModule**) GetAppData(SHL_SM)); 2120cdf0e10cSrcweir setGroupName( C2U("Math"), rStarMathArray.GetString(0) ); 2121cdf0e10cSrcweir nGroup = AddGroup(rStarMathArray.GetString(0), pSmMod, pSmMod, SID_SM_EDITOPTIONS ); 2122cdf0e10cSrcweir for ( i = 1; i < rStarMathArray.Count(); ++i ) 2123cdf0e10cSrcweir { 2124cdf0e10cSrcweir nPageId = (sal_uInt16)rStarMathArray.GetValue(i); 2125cdf0e10cSrcweir if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 2126cdf0e10cSrcweir AddTabPage( nPageId, rStarMathArray.GetString(i), nGroup ); 2127cdf0e10cSrcweir } 2128cdf0e10cSrcweir } 2129cdf0e10cSrcweir } 2130cdf0e10cSrcweir } 2131cdf0e10cSrcweir 2132cdf0e10cSrcweir // Database - needed only if there is an application which integrates with databases 2133cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_SB_STARBASEOPTIONS, aOptionsDlgOpt ) && 2134cdf0e10cSrcweir ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) 2135cdf0e10cSrcweir || aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) 2136cdf0e10cSrcweir || aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) 2137cdf0e10cSrcweir ) ) 2138cdf0e10cSrcweir { 2139cdf0e10cSrcweir ResStringArray& rDSArray = aDlgResource.GetDatasourcesArray(); 2140cdf0e10cSrcweir setGroupName( C2U("Base"), rDSArray.GetString(0) ); 2141cdf0e10cSrcweir nGroup = AddGroup( rDSArray.GetString(0), 0, NULL, SID_SB_STARBASEOPTIONS ); 2142cdf0e10cSrcweir for ( i = 1; i < rDSArray.Count(); ++i ) 2143cdf0e10cSrcweir { 2144cdf0e10cSrcweir nPageId = (sal_uInt16)rDSArray.GetValue(i); 2145cdf0e10cSrcweir if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 2146cdf0e10cSrcweir AddTabPage( nPageId, rDSArray.GetString(i), nGroup ); 2147cdf0e10cSrcweir } 2148cdf0e10cSrcweir } 2149cdf0e10cSrcweir 2150cdf0e10cSrcweir // Chart options (always installed and active) 2151cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_SCH_EDITOPTIONS, aOptionsDlgOpt ) ) 2152cdf0e10cSrcweir { 2153cdf0e10cSrcweir ResStringArray& rChartArray = aDlgResource.GetChartArray(); 2154cdf0e10cSrcweir setGroupName( C2U("Charts"), rChartArray.GetString(0) ); 2155cdf0e10cSrcweir nGroup = AddGroup( rChartArray.GetString(0), 0, 0, SID_SCH_EDITOPTIONS ); 2156cdf0e10cSrcweir for ( i = 1; i < rChartArray.Count(); ++i ) 2157cdf0e10cSrcweir { 2158cdf0e10cSrcweir nPageId = (sal_uInt16)rChartArray.GetValue(i); 2159cdf0e10cSrcweir if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 2160cdf0e10cSrcweir AddTabPage( nPageId, rChartArray.GetString(i), nGroup ); 2161cdf0e10cSrcweir } 2162cdf0e10cSrcweir } 2163cdf0e10cSrcweir 2164cdf0e10cSrcweir // Internet options 2165cdf0e10cSrcweir if ( !lcl_isOptionHidden( SID_INET_DLG, aOptionsDlgOpt ) ) 2166cdf0e10cSrcweir { 2167cdf0e10cSrcweir ResStringArray& rInetArray = aDlgResource.GetInetArray(); 2168cdf0e10cSrcweir setGroupName( C2U("Internet"), rInetArray.GetString(0) ); 2169cdf0e10cSrcweir nGroup = AddGroup(rInetArray.GetString(0), 0, 0, SID_INET_DLG ); 2170cdf0e10cSrcweir 2171cdf0e10cSrcweir for ( i = 1; i < rInetArray.Count(); ++i ) 2172cdf0e10cSrcweir { 2173cdf0e10cSrcweir nPageId = (sal_uInt16)rInetArray.GetValue(i); 2174cdf0e10cSrcweir if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) 2175cdf0e10cSrcweir continue; 2176cdf0e10cSrcweir #if defined WNT 2177cdf0e10cSrcweir // Disable E-mail tab-page on Windows 2178cdf0e10cSrcweir if ( nPageId == RID_SVXPAGE_INET_MAIL ) 2179cdf0e10cSrcweir continue; 2180cdf0e10cSrcweir #endif 2181cdf0e10cSrcweir #if defined MACOSX 2182cdf0e10cSrcweir // Disable Mozilla Plug-in tab-page on Mac 2183cdf0e10cSrcweir if ( nPageId == RID_SVXPAGE_INET_MOZPLUGIN ) 2184cdf0e10cSrcweir continue; 2185cdf0e10cSrcweir #endif 2186cdf0e10cSrcweir #ifdef LINUX 2187cdf0e10cSrcweir // Disable Mozilla Plug-in tab-page on Linux if we find a 2188cdf0e10cSrcweir // globally installed plugin 2189cdf0e10cSrcweir if ( nPageId == RID_SVXPAGE_INET_MOZPLUGIN ) { 2190cdf0e10cSrcweir struct stat sb; 2191cdf0e10cSrcweir char *p; 2192cdf0e10cSrcweir bool bHaveSystemWidePlugin = false; 2193cdf0e10cSrcweir char mozpaths[]="/usr/lib/mozilla/plugins/libnpsoplugin.so:/usr/lib/firefox/plugins/libnpsoplugin.so:/usr/lib/mozilla-firefox/plugins/libnpsoplugin.so:/usr/lib/iceweasel/plugins/libnpsoplugin.so:/usr/lib/iceape/plugins/libnpsoplugin.so:/usr/lib/browser-plugins/libnpsoplugin.so:/usr/lib64/browser-plugins/libnpsoplugin.so"; 2194cdf0e10cSrcweir 2195cdf0e10cSrcweir p = strtok(mozpaths, ":"); 2196cdf0e10cSrcweir while (p != NULL) { 2197cdf0e10cSrcweir if (stat(p, &sb) != -1) { 2198cdf0e10cSrcweir bHaveSystemWidePlugin = true; 2199cdf0e10cSrcweir break; 2200cdf0e10cSrcweir } 2201cdf0e10cSrcweir p = strtok(NULL, ":"); 2202cdf0e10cSrcweir } 2203cdf0e10cSrcweir 2204cdf0e10cSrcweir if (bHaveSystemWidePlugin == true) 2205cdf0e10cSrcweir continue; 2206cdf0e10cSrcweir } 2207cdf0e10cSrcweir #endif 2208cdf0e10cSrcweir AddTabPage( nPageId, rInetArray.GetString(i), nGroup ); 2209cdf0e10cSrcweir } 2210cdf0e10cSrcweir } 2211cdf0e10cSrcweir 2212cdf0e10cSrcweir /*!!! 2213cdf0e10cSrcweir ResizeTreeLB(); 2214cdf0e10cSrcweir ActivateLastSelection(); 2215cdf0e10cSrcweir */ 2216cdf0e10cSrcweir } 2217cdf0e10cSrcweir 2218cdf0e10cSrcweir namespace 2219cdf0e10cSrcweir { 2220cdf0e10cSrcweir void MoveControl( Control& _rCtrl, long _nDeltaPixel ) 2221cdf0e10cSrcweir { 2222cdf0e10cSrcweir Point aPt( _rCtrl.GetPosPixel() ); 2223cdf0e10cSrcweir aPt.X() += _nDeltaPixel; 2224cdf0e10cSrcweir _rCtrl.SetPosPixel( aPt ); 2225cdf0e10cSrcweir } 2226cdf0e10cSrcweir } 2227cdf0e10cSrcweir 2228cdf0e10cSrcweir void OfaTreeOptionsDialog::ResizeTreeLB( void ) 2229cdf0e10cSrcweir { 2230cdf0e10cSrcweir const long nMax = aHiddenGB.GetSizePixel().Width() * 42 / 100; 2231cdf0e10cSrcweir // don't ask where 42 comes from... but it looks / feels ok ;-) 2232cdf0e10cSrcweir long nDelta = 50; // min. 2233cdf0e10cSrcweir sal_uInt16 nDepth = 0; 2234cdf0e10cSrcweir const long nIndent0 = PixelToLogic( Size( 28, 0 ) ).Width(); 2235cdf0e10cSrcweir const long nIndent1 = PixelToLogic( Size( 52, 0 ) ).Width(); 2236cdf0e10cSrcweir 2237cdf0e10cSrcweir SvTreeList* pTreeList = aTreeLB.GetModel(); 2238cdf0e10cSrcweir DBG_ASSERT( pTreeList, "-OfaTreeOptionsDialog::ResizeTreeLB(): no model, no cookies!" ); 2239cdf0e10cSrcweir 2240cdf0e10cSrcweir SvListEntry* pEntry = pTreeList->First(); 2241cdf0e10cSrcweir while( pEntry ) 2242cdf0e10cSrcweir { 2243cdf0e10cSrcweir long n = aTreeLB.GetTextWidth( aTreeLB.GetEntryText( static_cast< SvLBoxEntry* >( pEntry ) ) ); 2244cdf0e10cSrcweir n += ( nDepth == 0 )? nIndent0 : nIndent1; 2245cdf0e10cSrcweir 2246cdf0e10cSrcweir if( n > nDelta ) 2247cdf0e10cSrcweir nDelta = n; 2248cdf0e10cSrcweir 2249cdf0e10cSrcweir pEntry = pTreeList->Next( pEntry, &nDepth ); 2250cdf0e10cSrcweir } 2251cdf0e10cSrcweir 2252cdf0e10cSrcweir nDelta = LogicToPixel( Size( nDelta + 3, 0 ) ).Width(); // + extra space [logic] 2253cdf0e10cSrcweir nDelta += GetSettings().GetStyleSettings().GetScrollBarSize(); // + scroll bar, in case it's needed 2254cdf0e10cSrcweir 2255cdf0e10cSrcweir if( nDelta > nMax ) 2256cdf0e10cSrcweir nDelta = nMax; 2257cdf0e10cSrcweir 2258cdf0e10cSrcweir // starting resizing with this 2259cdf0e10cSrcweir Size aSize( GetSizePixel() ); 2260cdf0e10cSrcweir aSize.Width() += nDelta; 2261cdf0e10cSrcweir SetSizePixel( aSize ); 2262cdf0e10cSrcweir 2263cdf0e10cSrcweir // resize treelistbox 2264cdf0e10cSrcweir aSize = aTreeLB.GetSizePixel(); 2265cdf0e10cSrcweir aSize.Width() += nDelta; 2266cdf0e10cSrcweir aTreeLB.SetSizePixel( aSize ); 2267cdf0e10cSrcweir 2268cdf0e10cSrcweir // ... and move depending controls 2269cdf0e10cSrcweir MoveControl( aOkPB, nDelta ); 2270cdf0e10cSrcweir MoveControl( aCancelPB, nDelta ); 2271cdf0e10cSrcweir MoveControl( aHelpPB, nDelta ); 2272cdf0e10cSrcweir MoveControl( aBackPB, nDelta ); 2273cdf0e10cSrcweir MoveControl( aHiddenGB, nDelta ); 2274cdf0e10cSrcweir MoveControl( aPageTitleFT, nDelta ); 2275cdf0e10cSrcweir MoveControl( aLine1FL, nDelta ); 2276cdf0e10cSrcweir MoveControl( aHelpFT, nDelta ); 2277cdf0e10cSrcweir MoveControl( aHelpImg, nDelta ); 2278cdf0e10cSrcweir } 2279cdf0e10cSrcweir 2280cdf0e10cSrcweir bool isNodeActive( OptionsNode* pNode, Module* pModule ) 2281cdf0e10cSrcweir { 2282cdf0e10cSrcweir if ( pNode ) 2283cdf0e10cSrcweir { 2284cdf0e10cSrcweir // Node for all modules actine? 2285cdf0e10cSrcweir if ( pNode->m_bAllModules ) 2286cdf0e10cSrcweir return true; 2287cdf0e10cSrcweir 2288cdf0e10cSrcweir // OOo-Nodes (Writer, Calc, Impress...) are active if node is already inserted 2289cdf0e10cSrcweir if ( getGroupName( pNode->m_sId, false ).Len() > 0 ) 2290cdf0e10cSrcweir return true; 2291cdf0e10cSrcweir 2292cdf0e10cSrcweir // no module -> not active 2293cdf0e10cSrcweir if ( !pModule ) 2294cdf0e10cSrcweir return false; 2295cdf0e10cSrcweir 2296cdf0e10cSrcweir // search node in active module 2297cdf0e10cSrcweir if ( pModule->m_bActive ) 2298cdf0e10cSrcweir { 2299cdf0e10cSrcweir for ( sal_uInt32 j = 0; j < pModule->m_aNodeList.size(); ++j ) 2300cdf0e10cSrcweir if ( pModule->m_aNodeList[j]->m_sId == pNode->m_sId ) 2301cdf0e10cSrcweir return true; 2302cdf0e10cSrcweir } 2303cdf0e10cSrcweir } 2304cdf0e10cSrcweir return false; 2305cdf0e10cSrcweir } 2306cdf0e10cSrcweir 2307cdf0e10cSrcweir void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtensionId ) 2308cdf0e10cSrcweir { 2309cdf0e10cSrcweir Module* pModule = NULL; 2310cdf0e10cSrcweir Reference< XMultiServiceFactory > xMSFac = comphelper::getProcessServiceFactory(); 2311cdf0e10cSrcweir // open optionsdialog.xcu 2312cdf0e10cSrcweir Reference< XNameAccess > xRoot( 2313cdf0e10cSrcweir ::comphelper::ConfigurationHelper::openConfig( 2314cdf0e10cSrcweir xMSFac, C2U("org.openoffice.Office.OptionsDialog"), 2315cdf0e10cSrcweir ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY ); 2316cdf0e10cSrcweir DBG_ASSERT( xRoot.is(), "OfaTreeOptionsDialog::LoadExtensionOptions(): no config" ); 2317cdf0e10cSrcweir // when called by Tools - Options then load nodes of active module 2318cdf0e10cSrcweir if ( rExtensionId.getLength() == 0 ) 2319cdf0e10cSrcweir pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ), xRoot ); 2320cdf0e10cSrcweir 2321cdf0e10cSrcweir VectorOfNodes aNodeList; 2322cdf0e10cSrcweir LoadNodes( xRoot, pModule, rExtensionId, aNodeList ); 2323cdf0e10cSrcweir InsertNodes( aNodeList ); 2324cdf0e10cSrcweir } 2325cdf0e10cSrcweir 2326cdf0e10cSrcweir rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier( 2327cdf0e10cSrcweir const Reference< XMultiServiceFactory >& xMFac, const Reference< XFrame >& rFrame ) 2328cdf0e10cSrcweir { 2329cdf0e10cSrcweir rtl::OUString sModule; 2330cdf0e10cSrcweir Reference < XFrame > xCurrentFrame( rFrame ); 2331cdf0e10cSrcweir Reference < XModuleManager > xModuleManager( xMFac->createInstance( 2332cdf0e10cSrcweir C2U("com.sun.star.frame.ModuleManager") ), UNO_QUERY ); 2333cdf0e10cSrcweir 2334cdf0e10cSrcweir if ( !xCurrentFrame.is() ) 2335cdf0e10cSrcweir { 2336cdf0e10cSrcweir Reference < XDesktop > xDesktop( xMFac->createInstance( 2337cdf0e10cSrcweir C2U("com.sun.star.frame.Desktop") ), UNO_QUERY ); 2338cdf0e10cSrcweir if ( xDesktop.is() ) 2339cdf0e10cSrcweir xCurrentFrame = xDesktop->getCurrentFrame(); 2340cdf0e10cSrcweir } 2341cdf0e10cSrcweir 2342cdf0e10cSrcweir if ( xCurrentFrame.is() && xModuleManager.is() ) 2343cdf0e10cSrcweir { 2344cdf0e10cSrcweir try 2345cdf0e10cSrcweir { 2346cdf0e10cSrcweir sModule = xModuleManager->identify( xCurrentFrame ); 2347cdf0e10cSrcweir } 2348cdf0e10cSrcweir catch ( ::com::sun::star::frame::UnknownModuleException& ) 2349cdf0e10cSrcweir { 2350cdf0e10cSrcweir DBG_WARNING( "OfaTreeOptionsDialog::GetModuleIdentifier(): unknown module" ); 2351cdf0e10cSrcweir } 2352cdf0e10cSrcweir catch ( Exception& ) 2353cdf0e10cSrcweir { 2354cdf0e10cSrcweir DBG_ERRORFILE( "OfaTreeOptionsDialog::GetModuleIdentifier(): exception of XModuleManager::identify()" ); 2355cdf0e10cSrcweir } 2356cdf0e10cSrcweir } 2357cdf0e10cSrcweir return sModule; 2358cdf0e10cSrcweir } 2359cdf0e10cSrcweir 2360cdf0e10cSrcweir Module* OfaTreeOptionsDialog::LoadModule( 2361cdf0e10cSrcweir const rtl::OUString& rModuleIdentifier, const Reference< XNameAccess >& xRoot ) 2362cdf0e10cSrcweir { 2363cdf0e10cSrcweir Module* pModule = NULL; 2364cdf0e10cSrcweir Reference< XNameAccess > xSet; 2365cdf0e10cSrcweir 2366cdf0e10cSrcweir if ( xRoot->hasByName( C2U("Modules") ) ) 2367cdf0e10cSrcweir { 2368cdf0e10cSrcweir xRoot->getByName( C2U("Modules") ) >>= xSet; 2369cdf0e10cSrcweir if ( xSet.is() ) 2370cdf0e10cSrcweir { 2371cdf0e10cSrcweir Sequence< rtl::OUString > seqNames = xSet->getElementNames(); 2372cdf0e10cSrcweir for ( int i = 0; i < seqNames.getLength(); ++i ) 2373cdf0e10cSrcweir { 2374cdf0e10cSrcweir rtl::OUString sModule( seqNames[i] ); 2375cdf0e10cSrcweir if ( rModuleIdentifier == sModule ) 2376cdf0e10cSrcweir { 2377cdf0e10cSrcweir // current active module found 2378cdf0e10cSrcweir pModule = new Module( sModule ); 2379cdf0e10cSrcweir pModule->m_bActive = true; 2380cdf0e10cSrcweir 2381cdf0e10cSrcweir Reference< XNameAccess > xModAccess; 2382cdf0e10cSrcweir xSet->getByName( seqNames[i] ) >>= xModAccess; 2383cdf0e10cSrcweir if ( xModAccess.is() ) 2384cdf0e10cSrcweir { 2385cdf0e10cSrcweir // load the nodes of this module 2386cdf0e10cSrcweir Reference< XNameAccess > xNodeAccess; 2387cdf0e10cSrcweir xModAccess->getByName( C2U("Nodes") ) >>= xNodeAccess; 2388cdf0e10cSrcweir if ( xNodeAccess.is() ) 2389cdf0e10cSrcweir { 2390cdf0e10cSrcweir Sequence< rtl::OUString > xTemp = xNodeAccess->getElementNames(); 2391cdf0e10cSrcweir Reference< XNameAccess > xAccess; 2392cdf0e10cSrcweir sal_Int32 nIndex = -1; 2393cdf0e10cSrcweir for ( int x = 0; x < xTemp.getLength(); ++x ) 2394cdf0e10cSrcweir { 2395cdf0e10cSrcweir xNodeAccess->getByName( xTemp[x] ) >>= xAccess; 2396cdf0e10cSrcweir if ( xAccess.is() ) 2397cdf0e10cSrcweir { 2398cdf0e10cSrcweir xAccess->getByName( C2U("Index") ) >>= nIndex; 2399cdf0e10cSrcweir if ( nIndex < 0 ) 2400cdf0e10cSrcweir // append nodes with index < 0 2401cdf0e10cSrcweir pModule->m_aNodeList.push_back( 2402cdf0e10cSrcweir new OrderedEntry( nIndex, xTemp[x] ) ); 2403cdf0e10cSrcweir else 2404cdf0e10cSrcweir { 2405cdf0e10cSrcweir // search position of the node 2406cdf0e10cSrcweir sal_uInt32 y = 0; 2407cdf0e10cSrcweir for ( ; y < pModule->m_aNodeList.size(); ++y ) 2408cdf0e10cSrcweir { 2409cdf0e10cSrcweir sal_Int32 nNodeIdx = pModule->m_aNodeList[y]->m_nIndex; 2410cdf0e10cSrcweir if ( nNodeIdx < 0 || nNodeIdx > nIndex ) 2411cdf0e10cSrcweir break; 2412cdf0e10cSrcweir } 2413cdf0e10cSrcweir // and insert the node on this position 2414cdf0e10cSrcweir pModule->m_aNodeList.insert( 2415cdf0e10cSrcweir pModule->m_aNodeList.begin() + y, 2416cdf0e10cSrcweir new OrderedEntry( nIndex, xTemp[x] ) ); 2417cdf0e10cSrcweir } 2418cdf0e10cSrcweir } 2419cdf0e10cSrcweir } 2420cdf0e10cSrcweir } 2421cdf0e10cSrcweir } 2422cdf0e10cSrcweir } 2423cdf0e10cSrcweir } 2424cdf0e10cSrcweir } 2425cdf0e10cSrcweir } 2426cdf0e10cSrcweir return pModule; 2427cdf0e10cSrcweir } 2428cdf0e10cSrcweir 2429cdf0e10cSrcweir void OfaTreeOptionsDialog::LoadNodes( 2430cdf0e10cSrcweir const Reference< XNameAccess >& xRoot, Module* pModule, 2431cdf0e10cSrcweir const rtl::OUString& rExtensionId, VectorOfNodes& rOutNodeList ) 2432cdf0e10cSrcweir { 2433cdf0e10cSrcweir Reference< XNameAccess > xSet; 2434cdf0e10cSrcweir if ( xRoot->hasByName( C2U("Nodes") ) ) 2435cdf0e10cSrcweir { 2436cdf0e10cSrcweir xRoot->getByName( C2U("Nodes") ) >>= xSet; 2437cdf0e10cSrcweir if ( xSet.is() ) 2438cdf0e10cSrcweir { 2439cdf0e10cSrcweir VectorOfNodes aNodeList; 2440cdf0e10cSrcweir Sequence< rtl::OUString > seqNames = xSet->getElementNames(); 2441cdf0e10cSrcweir 2442cdf0e10cSrcweir for ( int i = 0; i < seqNames.getLength(); ++i ) 2443cdf0e10cSrcweir { 2444cdf0e10cSrcweir String sGroupName( seqNames[i] ); 2445cdf0e10cSrcweir Reference< XNameAccess > xNodeAccess; 2446cdf0e10cSrcweir xSet->getByName( seqNames[i] ) >>= xNodeAccess; 2447cdf0e10cSrcweir 2448cdf0e10cSrcweir if ( xNodeAccess.is() ) 2449cdf0e10cSrcweir { 2450cdf0e10cSrcweir rtl::OUString sNodeId, sLabel, sPageURL, sGroupId; 2451cdf0e10cSrcweir bool bAllModules = false; 2452cdf0e10cSrcweir sal_Int32 nGroupIndex = 0; 2453cdf0e10cSrcweir 2454cdf0e10cSrcweir sNodeId = seqNames[i]; 2455cdf0e10cSrcweir xNodeAccess->getByName( C2U("Label") ) >>= sLabel; 2456cdf0e10cSrcweir xNodeAccess->getByName( C2U("OptionsPage") ) >>= sPageURL; 2457cdf0e10cSrcweir xNodeAccess->getByName( C2U("AllModules") ) >>= bAllModules; 2458cdf0e10cSrcweir xNodeAccess->getByName( C2U("GroupId") ) >>= sGroupId; 2459cdf0e10cSrcweir xNodeAccess->getByName( C2U("GroupIndex") ) >>= nGroupIndex; 2460cdf0e10cSrcweir 2461cdf0e10cSrcweir if ( sLabel.getLength() == 0 ) 2462cdf0e10cSrcweir sLabel = sGroupName; 2463cdf0e10cSrcweir String sTemp = getGroupName( sLabel, rExtensionId.getLength() > 0 ); 2464cdf0e10cSrcweir if ( sTemp.Len() > 0 ) 2465cdf0e10cSrcweir sLabel = sTemp; 2466cdf0e10cSrcweir OptionsNode* pNode = 2467cdf0e10cSrcweir new OptionsNode( sNodeId, sLabel, sPageURL, bAllModules, sGroupId, nGroupIndex ); 2468cdf0e10cSrcweir 2469cdf0e10cSrcweir if ( !rExtensionId.getLength() && !isNodeActive( pNode, pModule ) ) 2470cdf0e10cSrcweir { 2471cdf0e10cSrcweir delete pNode; 2472cdf0e10cSrcweir continue; 2473cdf0e10cSrcweir } 2474cdf0e10cSrcweir 2475cdf0e10cSrcweir Reference< XNameAccess > xLeavesSet; 2476cdf0e10cSrcweir xNodeAccess->getByName( C2U( "Leaves" ) ) >>= xLeavesSet; 2477cdf0e10cSrcweir if ( xLeavesSet.is() ) 2478cdf0e10cSrcweir { 2479cdf0e10cSrcweir Sequence< rtl::OUString > seqLeaves = xLeavesSet->getElementNames(); 2480cdf0e10cSrcweir for ( int j = 0; j < seqLeaves.getLength(); ++j ) 2481cdf0e10cSrcweir { 2482cdf0e10cSrcweir Reference< XNameAccess > xLeaveAccess; 2483cdf0e10cSrcweir xLeavesSet->getByName( seqLeaves[j] ) >>= xLeaveAccess; 2484cdf0e10cSrcweir 2485cdf0e10cSrcweir if ( xLeaveAccess.is() ) 2486cdf0e10cSrcweir { 2487cdf0e10cSrcweir rtl::OUString sId, sLeafLabel, sEventHdl, sLeafURL, sLeafGrpId; 2488cdf0e10cSrcweir sal_Int32 nLeafGrpIdx = 0; 2489cdf0e10cSrcweir 2490cdf0e10cSrcweir xLeaveAccess->getByName( C2U("Id") ) >>= sId; 2491cdf0e10cSrcweir xLeaveAccess->getByName( C2U("Label") ) >>= sLeafLabel; 2492cdf0e10cSrcweir xLeaveAccess->getByName( C2U("OptionsPage") ) >>= sLeafURL; 2493cdf0e10cSrcweir xLeaveAccess->getByName( C2U("EventHandlerService") ) >>= sEventHdl; 2494cdf0e10cSrcweir xLeaveAccess->getByName( C2U("GroupId") ) >>= sLeafGrpId; 2495cdf0e10cSrcweir xLeaveAccess->getByName( C2U("GroupIndex") ) >>= nLeafGrpIdx; 2496cdf0e10cSrcweir 2497cdf0e10cSrcweir if ( !rExtensionId.getLength() || sId == rExtensionId ) 2498cdf0e10cSrcweir { 2499cdf0e10cSrcweir OptionsLeaf* pLeaf = new OptionsLeaf( 2500cdf0e10cSrcweir sId, sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx ); 2501cdf0e10cSrcweir 2502cdf0e10cSrcweir if ( sLeafGrpId.getLength() > 0 ) 2503cdf0e10cSrcweir { 2504cdf0e10cSrcweir bool bAlreadyOpened = false; 2505cdf0e10cSrcweir if ( pNode->m_aGroupedLeaves.size() > 0 ) 2506cdf0e10cSrcweir { 2507cdf0e10cSrcweir for ( sal_uInt32 k = 0; 2508cdf0e10cSrcweir k < pNode->m_aGroupedLeaves.size(); ++k ) 2509cdf0e10cSrcweir { 2510cdf0e10cSrcweir if ( pNode->m_aGroupedLeaves[k].size() > 0 && 2511cdf0e10cSrcweir pNode->m_aGroupedLeaves[k][0]->m_sGroupId 2512cdf0e10cSrcweir == sLeafGrpId ) 2513cdf0e10cSrcweir { 2514cdf0e10cSrcweir sal_uInt32 l = 0; 2515cdf0e10cSrcweir for ( ; l < pNode->m_aGroupedLeaves[k].size(); ++l ) 2516cdf0e10cSrcweir { 2517cdf0e10cSrcweir if ( pNode->m_aGroupedLeaves[k][l]-> 2518cdf0e10cSrcweir m_nGroupIndex >= nLeafGrpIdx ) 2519cdf0e10cSrcweir break; 2520cdf0e10cSrcweir } 2521cdf0e10cSrcweir pNode->m_aGroupedLeaves[k].insert( 2522cdf0e10cSrcweir pNode->m_aGroupedLeaves[k].begin() + l, pLeaf ); 2523cdf0e10cSrcweir bAlreadyOpened = true; 2524cdf0e10cSrcweir break; 2525cdf0e10cSrcweir } 2526cdf0e10cSrcweir } 2527cdf0e10cSrcweir } 2528cdf0e10cSrcweir if ( !bAlreadyOpened ) 2529cdf0e10cSrcweir { 2530cdf0e10cSrcweir VectorOfLeaves aGroupedLeaves; 2531cdf0e10cSrcweir aGroupedLeaves.push_back( pLeaf ); 2532cdf0e10cSrcweir pNode->m_aGroupedLeaves.push_back( aGroupedLeaves ); 2533cdf0e10cSrcweir } 2534cdf0e10cSrcweir } 2535cdf0e10cSrcweir else 2536cdf0e10cSrcweir pNode->m_aLeaves.push_back( 2537cdf0e10cSrcweir new OptionsLeaf( 2538cdf0e10cSrcweir sId, sLeafLabel, sLeafURL, 2539cdf0e10cSrcweir sEventHdl, sLeafGrpId, nLeafGrpIdx ) ); 2540cdf0e10cSrcweir } 2541cdf0e10cSrcweir } 2542cdf0e10cSrcweir } 2543cdf0e10cSrcweir } 2544cdf0e10cSrcweir 2545cdf0e10cSrcweir // do not insert nodes without leaves 2546cdf0e10cSrcweir if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 ) 2547cdf0e10cSrcweir { 2548cdf0e10cSrcweir pModule ? aNodeList.push_back( pNode ) : rOutNodeList.push_back( pNode ); 2549cdf0e10cSrcweir } 2550cdf0e10cSrcweir } 2551cdf0e10cSrcweir } 2552cdf0e10cSrcweir 2553cdf0e10cSrcweir if ( pModule && aNodeList.size() > 0 ) 2554cdf0e10cSrcweir { 2555cdf0e10cSrcweir sal_uInt32 i = 0, j = 0; 2556cdf0e10cSrcweir for ( ; i < pModule->m_aNodeList.size(); ++i ) 2557cdf0e10cSrcweir { 2558cdf0e10cSrcweir rtl::OUString sNodeId = pModule->m_aNodeList[i]->m_sId; 2559cdf0e10cSrcweir for ( j = 0; j < aNodeList.size(); ++j ) 2560cdf0e10cSrcweir { 2561cdf0e10cSrcweir OptionsNode* pNode = aNodeList[j]; 2562cdf0e10cSrcweir if ( pNode->m_sId == sNodeId ) 2563cdf0e10cSrcweir { 2564cdf0e10cSrcweir rOutNodeList.push_back( pNode ); 2565cdf0e10cSrcweir aNodeList.erase( aNodeList.begin() + j ); 2566cdf0e10cSrcweir break; 2567cdf0e10cSrcweir } 2568cdf0e10cSrcweir } 2569cdf0e10cSrcweir } 2570cdf0e10cSrcweir 2571cdf0e10cSrcweir for ( i = 0; i < aNodeList.size(); ++i ) 2572cdf0e10cSrcweir rOutNodeList.push_back( aNodeList[i] ); 2573cdf0e10cSrcweir } 2574cdf0e10cSrcweir } 2575cdf0e10cSrcweir } 2576cdf0e10cSrcweir } 2577cdf0e10cSrcweir 2578cdf0e10cSrcweir sal_uInt16 lcl_getGroupId( const rtl::OUString& rGroupName, const SvTreeListBox& rTreeLB ) 2579cdf0e10cSrcweir { 2580cdf0e10cSrcweir String sGroupName( rGroupName ); 2581cdf0e10cSrcweir sal_uInt16 nRet = 0; 2582cdf0e10cSrcweir SvLBoxEntry* pEntry = rTreeLB.First(); 2583cdf0e10cSrcweir while( pEntry ) 2584cdf0e10cSrcweir { 2585cdf0e10cSrcweir if ( !rTreeLB.GetParent( pEntry ) ) 2586cdf0e10cSrcweir { 2587cdf0e10cSrcweir String sTemp( rTreeLB.GetEntryText( pEntry ) ); 2588cdf0e10cSrcweir if ( sTemp == sGroupName ) 2589cdf0e10cSrcweir return nRet; 2590cdf0e10cSrcweir nRet++; 2591cdf0e10cSrcweir } 2592cdf0e10cSrcweir pEntry = rTreeLB.Next( pEntry ); 2593cdf0e10cSrcweir } 2594cdf0e10cSrcweir 2595cdf0e10cSrcweir return USHRT_MAX; 2596cdf0e10cSrcweir } 2597cdf0e10cSrcweir 2598cdf0e10cSrcweir void lcl_insertLeaf( 2599cdf0e10cSrcweir OfaTreeOptionsDialog* pDlg, OptionsNode* pNode, OptionsLeaf* pLeaf, const SvTreeListBox& rTreeLB ) 2600cdf0e10cSrcweir { 2601cdf0e10cSrcweir sal_uInt16 nGrpId = lcl_getGroupId( pNode->m_sLabel, rTreeLB ); 2602cdf0e10cSrcweir if ( USHRT_MAX == nGrpId ) 2603cdf0e10cSrcweir { 2604cdf0e10cSrcweir sal_uInt16 nNodeGrpId = getGroupNodeId( pNode->m_sId ); 2605cdf0e10cSrcweir nGrpId = pDlg->AddGroup( pNode->m_sLabel, NULL, NULL, nNodeGrpId ); 2606cdf0e10cSrcweir if ( pNode->m_sPageURL.getLength() > 0 ) 2607cdf0e10cSrcweir { 2608cdf0e10cSrcweir SvLBoxEntry* pGrpEntry = rTreeLB.GetEntry( 0, nGrpId ); 2609cdf0e10cSrcweir DBG_ASSERT( pGrpEntry, "OfaTreeOptionsDialog::InsertNodes(): no group" ); 2610cdf0e10cSrcweir if ( pGrpEntry ) 2611cdf0e10cSrcweir { 2612cdf0e10cSrcweir OptionsGroupInfo* pGrpInfo = 2613cdf0e10cSrcweir static_cast<OptionsGroupInfo*>(pGrpEntry->GetUserData()); 2614cdf0e10cSrcweir pGrpInfo->m_sPageURL = pNode->m_sPageURL; 2615cdf0e10cSrcweir } 2616cdf0e10cSrcweir } 2617cdf0e10cSrcweir } 2618cdf0e10cSrcweir OptionsPageInfo* pInfo = pDlg->AddTabPage( 0, pLeaf->m_sLabel, nGrpId ); 2619cdf0e10cSrcweir pInfo->m_sPageURL = pLeaf->m_sPageURL; 2620cdf0e10cSrcweir pInfo->m_sEventHdl = pLeaf->m_sEventHdl; 2621cdf0e10cSrcweir } 2622cdf0e10cSrcweir 2623cdf0e10cSrcweir void OfaTreeOptionsDialog::InsertNodes( const VectorOfNodes& rNodeList ) 2624cdf0e10cSrcweir { 2625cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < rNodeList.size(); ++i ) 2626cdf0e10cSrcweir { 2627cdf0e10cSrcweir OptionsNode* pNode = rNodeList[i]; 2628cdf0e10cSrcweir 2629cdf0e10cSrcweir if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 ) 2630cdf0e10cSrcweir { 2631cdf0e10cSrcweir sal_uInt32 j = 0; 2632cdf0e10cSrcweir for ( ; j < pNode->m_aGroupedLeaves.size(); ++j ) 2633cdf0e10cSrcweir { 2634cdf0e10cSrcweir for ( sal_uInt32 k = 0; k < pNode->m_aGroupedLeaves[j].size(); ++k ) 2635cdf0e10cSrcweir { 2636cdf0e10cSrcweir OptionsLeaf* pLeaf = pNode->m_aGroupedLeaves[j][k]; 2637cdf0e10cSrcweir lcl_insertLeaf( this, pNode, pLeaf, aTreeLB ); 2638cdf0e10cSrcweir } 2639cdf0e10cSrcweir } 2640cdf0e10cSrcweir 2641cdf0e10cSrcweir for ( j = 0; j < pNode->m_aLeaves.size(); ++j ) 2642cdf0e10cSrcweir { 2643cdf0e10cSrcweir OptionsLeaf* pLeaf = pNode->m_aLeaves[j]; 2644cdf0e10cSrcweir lcl_insertLeaf( this, pNode, pLeaf, aTreeLB ); 2645cdf0e10cSrcweir } 2646cdf0e10cSrcweir } 2647cdf0e10cSrcweir } 2648cdf0e10cSrcweir } 2649cdf0e10cSrcweir 2650cdf0e10cSrcweir short OfaTreeOptionsDialog::Execute() 2651cdf0e10cSrcweir { 2652cdf0e10cSrcweir ::std::auto_ptr< SvxDicListChgClamp > pClamp; 2653cdf0e10cSrcweir if ( !bIsFromExtensionManager ) 2654cdf0e10cSrcweir { 2655cdf0e10cSrcweir // collect all DictionaryList Events while the dialog is executed 2656cdf0e10cSrcweir Reference<com::sun::star::linguistic2::XDictionaryList> xDictionaryList(SvxGetDictionaryList()); 2657cdf0e10cSrcweir pClamp = ::std::auto_ptr< SvxDicListChgClamp >( new SvxDicListChgClamp( xDictionaryList ) ); 2658cdf0e10cSrcweir } 2659cdf0e10cSrcweir short nRet = SfxModalDialog::Execute(); 2660cdf0e10cSrcweir 2661cdf0e10cSrcweir if( RET_OK == nRet ) 2662cdf0e10cSrcweir { 2663cdf0e10cSrcweir ApplyItemSets(); 2664cdf0e10cSrcweir if( GetColorTable() ) 2665cdf0e10cSrcweir { 2666cdf0e10cSrcweir GetColorTable()->Save(); 2667cdf0e10cSrcweir 2668cdf0e10cSrcweir // notify current viewframe it it uses the same color table 2669cdf0e10cSrcweir if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() ) 2670cdf0e10cSrcweir { 2671cdf0e10cSrcweir const OfaPtrItem* pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON ); 2672cdf0e10cSrcweir if( pPtr ) 2673cdf0e10cSrcweir { 2674cdf0e10cSrcweir XColorTable* _pColorTab = (XColorTable*)pPtr->GetValue(); 2675cdf0e10cSrcweir 2676cdf0e10cSrcweir if( _pColorTab && 2677cdf0e10cSrcweir _pColorTab->GetPath() == GetColorTable()->GetPath() && 2678cdf0e10cSrcweir _pColorTab->GetName() == GetColorTable()->GetName() ) 2679cdf0e10cSrcweir SfxObjectShell::Current()->PutItem( SvxColorTableItem( GetColorTable(), SID_COLOR_TABLE ) ); 2680cdf0e10cSrcweir } 2681cdf0e10cSrcweir } 2682cdf0e10cSrcweir } 2683cdf0e10cSrcweir 2684cdf0e10cSrcweir utl::ConfigManager::GetConfigManager()->StoreConfigItems(); 2685cdf0e10cSrcweir } 2686cdf0e10cSrcweir 2687cdf0e10cSrcweir return nRet; 2688cdf0e10cSrcweir } 2689cdf0e10cSrcweir 2690cdf0e10cSrcweir // class ExtensionsTabPage ----------------------------------------------- 2691cdf0e10cSrcweir 2692cdf0e10cSrcweir ExtensionsTabPage::ExtensionsTabPage( 2693cdf0e10cSrcweir Window* pParent, WinBits nStyle, const rtl::OUString& rPageURL, 2694cdf0e10cSrcweir const rtl::OUString& rEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider ) : 2695cdf0e10cSrcweir 2696cdf0e10cSrcweir TabPage( pParent, nStyle ), 2697cdf0e10cSrcweir 2698cdf0e10cSrcweir m_sPageURL ( rPageURL ), 2699cdf0e10cSrcweir m_sEventHdl ( rEvtHdl ), 2700cdf0e10cSrcweir m_xWinProvider ( rProvider ), 2701cdf0e10cSrcweir m_bIsWindowHidden ( false ) 2702cdf0e10cSrcweir 2703cdf0e10cSrcweir { 2704cdf0e10cSrcweir } 2705cdf0e10cSrcweir 2706cdf0e10cSrcweir // ----------------------------------------------------------------------- 2707cdf0e10cSrcweir 2708cdf0e10cSrcweir ExtensionsTabPage::~ExtensionsTabPage() 2709cdf0e10cSrcweir { 2710cdf0e10cSrcweir Hide(); 2711cdf0e10cSrcweir DeactivatePage(); 2712cdf0e10cSrcweir } 2713cdf0e10cSrcweir 2714cdf0e10cSrcweir // ----------------------------------------------------------------------- 2715cdf0e10cSrcweir 2716cdf0e10cSrcweir void ExtensionsTabPage::CreateDialogWithHandler() 2717cdf0e10cSrcweir { 2718cdf0e10cSrcweir try 2719cdf0e10cSrcweir { 2720cdf0e10cSrcweir bool bWithHandler = ( m_sEventHdl.getLength() > 0 ); 2721cdf0e10cSrcweir if ( bWithHandler ) 2722cdf0e10cSrcweir { 2723cdf0e10cSrcweir Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); 2724cdf0e10cSrcweir m_xEventHdl = Reference< awt::XContainerWindowEventHandler >( 2725cdf0e10cSrcweir xFactory->createInstance( m_sEventHdl ), UNO_QUERY ); 2726cdf0e10cSrcweir } 2727cdf0e10cSrcweir 2728cdf0e10cSrcweir if ( !bWithHandler || m_xEventHdl.is() ) 2729cdf0e10cSrcweir { 2730cdf0e10cSrcweir SetStyle( GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL ); 2731cdf0e10cSrcweir Reference< awt::XWindowPeer > xParent( VCLUnoHelper::GetInterface( this ), UNO_QUERY ); 2732cdf0e10cSrcweir m_xPage = Reference < awt::XWindow >( 2733cdf0e10cSrcweir m_xWinProvider->createContainerWindow( 2734cdf0e10cSrcweir m_sPageURL, rtl::OUString(), xParent, m_xEventHdl ), UNO_QUERY ); 2735cdf0e10cSrcweir 2736cdf0e10cSrcweir Reference< awt::XControl > xPageControl( m_xPage, UNO_QUERY ); 2737cdf0e10cSrcweir if ( xPageControl.is() ) 2738cdf0e10cSrcweir { 2739cdf0e10cSrcweir Reference< awt::XWindowPeer > xWinPeer( xPageControl->getPeer() ); 2740cdf0e10cSrcweir if ( xWinPeer.is() ) 2741cdf0e10cSrcweir { 2742cdf0e10cSrcweir Window* pWindow = VCLUnoHelper::GetWindow( xWinPeer ); 2743cdf0e10cSrcweir if ( pWindow ) 2744cdf0e10cSrcweir pWindow->SetStyle( pWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL ); 2745cdf0e10cSrcweir } 2746cdf0e10cSrcweir } 2747cdf0e10cSrcweir } 2748cdf0e10cSrcweir } 2749cdf0e10cSrcweir catch ( ::com::sun::star::lang::IllegalArgumentException& ) 2750cdf0e10cSrcweir { 2751cdf0e10cSrcweir DBG_ERRORFILE( "ExtensionsTabPage::CreateDialogWithHandler(): illegal argument" ); 2752cdf0e10cSrcweir } 2753cdf0e10cSrcweir catch ( Exception& ) 2754cdf0e10cSrcweir { 2755cdf0e10cSrcweir DBG_ERRORFILE( "ExtensionsTabPage::CreateDialogWithHandler(): exception of XDialogProvider2::createDialogWithHandler()" ); 2756cdf0e10cSrcweir } 2757cdf0e10cSrcweir } 2758cdf0e10cSrcweir 2759cdf0e10cSrcweir // ----------------------------------------------------------------------- 2760cdf0e10cSrcweir 2761cdf0e10cSrcweir sal_Bool ExtensionsTabPage::DispatchAction( const rtl::OUString& rAction ) 2762cdf0e10cSrcweir { 2763cdf0e10cSrcweir sal_Bool bRet = sal_False; 2764cdf0e10cSrcweir if ( m_xEventHdl.is() ) 2765cdf0e10cSrcweir { 2766cdf0e10cSrcweir try 2767cdf0e10cSrcweir { 2768cdf0e10cSrcweir bRet = m_xEventHdl->callHandlerMethod( m_xPage, makeAny( rAction ), C2U("external_event") ); 2769cdf0e10cSrcweir } 2770cdf0e10cSrcweir catch ( Exception& ) 2771cdf0e10cSrcweir { 2772cdf0e10cSrcweir DBG_ERRORFILE( "ExtensionsTabPage::DispatchAction(): exception of XDialogEventHandler::callHandlerMethod()" ); 2773cdf0e10cSrcweir } 2774cdf0e10cSrcweir } 2775cdf0e10cSrcweir return bRet; 2776cdf0e10cSrcweir } 2777cdf0e10cSrcweir 2778cdf0e10cSrcweir // ----------------------------------------------------------------------- 2779cdf0e10cSrcweir 2780cdf0e10cSrcweir void ExtensionsTabPage::ActivatePage() 2781cdf0e10cSrcweir { 2782cdf0e10cSrcweir TabPage::ActivatePage(); 2783cdf0e10cSrcweir 2784cdf0e10cSrcweir if ( !m_xPage.is() ) 2785cdf0e10cSrcweir { 2786cdf0e10cSrcweir CreateDialogWithHandler(); 2787cdf0e10cSrcweir 2788cdf0e10cSrcweir if ( m_xPage.is() ) 2789cdf0e10cSrcweir { 2790cdf0e10cSrcweir Point aPos = Point(); 2791cdf0e10cSrcweir Size aSize = GetSizePixel(); 2792cdf0e10cSrcweir m_xPage->setPosSize( aPos.X() + 1, aPos.Y() + 1, 2793cdf0e10cSrcweir aSize.Width() - 2, aSize.Height() - 2, awt::PosSize::POSSIZE ); 2794cdf0e10cSrcweir if ( m_sEventHdl.getLength() > 0 ) 2795cdf0e10cSrcweir DispatchAction( C2U("initialize") ); 2796cdf0e10cSrcweir } 2797cdf0e10cSrcweir } 2798cdf0e10cSrcweir 2799cdf0e10cSrcweir if ( m_xPage.is() ) 2800cdf0e10cSrcweir { 2801cdf0e10cSrcweir m_xPage->setVisible( sal_True ); 2802cdf0e10cSrcweir m_bIsWindowHidden = false; 2803cdf0e10cSrcweir } 2804cdf0e10cSrcweir } 2805cdf0e10cSrcweir 2806cdf0e10cSrcweir // ----------------------------------------------------------------------- 2807cdf0e10cSrcweir 2808cdf0e10cSrcweir void ExtensionsTabPage::DeactivatePage() 2809cdf0e10cSrcweir { 2810cdf0e10cSrcweir TabPage::DeactivatePage(); 2811cdf0e10cSrcweir 2812cdf0e10cSrcweir if ( m_xPage.is() ) 2813cdf0e10cSrcweir m_xPage->setVisible( sal_False ); 2814cdf0e10cSrcweir } 2815cdf0e10cSrcweir 2816cdf0e10cSrcweir // ----------------------------------------------------------------------- 2817cdf0e10cSrcweir 2818cdf0e10cSrcweir void ExtensionsTabPage::ResetPage() 2819cdf0e10cSrcweir { 2820cdf0e10cSrcweir DispatchAction( C2U("back") ); 2821cdf0e10cSrcweir ActivatePage(); 2822cdf0e10cSrcweir } 2823cdf0e10cSrcweir 2824cdf0e10cSrcweir // ----------------------------------------------------------------------- 2825cdf0e10cSrcweir 2826cdf0e10cSrcweir void ExtensionsTabPage::SavePage() 2827cdf0e10cSrcweir { 2828cdf0e10cSrcweir DispatchAction( C2U("ok") ); 2829cdf0e10cSrcweir } 2830