1c4eee24dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3c4eee24dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4c4eee24dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5c4eee24dSAndrew Rist * distributed with this work for additional information 6c4eee24dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7c4eee24dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8c4eee24dSAndrew Rist * "License"); you may not use this file except in compliance 9c4eee24dSAndrew Rist * with the License. You may obtain a copy of the License at 10c4eee24dSAndrew Rist * 11c4eee24dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12c4eee24dSAndrew Rist * 13c4eee24dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14c4eee24dSAndrew Rist * software distributed under the License is distributed on an 15c4eee24dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16c4eee24dSAndrew Rist * KIND, either express or implied. See the License for the 17c4eee24dSAndrew Rist * specific language governing permissions and limitations 18c4eee24dSAndrew Rist * under the License. 19c4eee24dSAndrew Rist * 20c4eee24dSAndrew Rist *************************************************************/ 21c4eee24dSAndrew Rist 22c4eee24dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 25cdf0e10cSrcweir #include <sfx2/basedlgs.hxx> 26cdf0e10cSrcweir #include <sfx2/tabdlg.hxx> 27cdf0e10cSrcweir #include <svtools/svtreebx.hxx> 28cdf0e10cSrcweir #include <tools/resary.hxx> 29cdf0e10cSrcweir #include <vcl/image.hxx> 30cdf0e10cSrcweir #include <vcl/fixbrd.hxx> 31cdf0e10cSrcweir #include <vcl/fixed.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <vector> 34cdf0e10cSrcweir 35cdf0e10cSrcweir // static ---------------------------------------------------------------- 36cdf0e10cSrcweir 37cdf0e10cSrcweir sal_Bool EnableSSO(); 38cdf0e10cSrcweir CreateTabPage GetSSOCreator( void ); 39cdf0e10cSrcweir 40cdf0e10cSrcweir // class OfaOptionsTreeListBox ------------------------------------------- 41cdf0e10cSrcweir 42cdf0e10cSrcweir //!#define NUMBER_OF_OPTION_PAGES 12 43cdf0e10cSrcweir class SfxModule; 44cdf0e10cSrcweir class SfxShell; 45cdf0e10cSrcweir class SfxItemSet; 4697e8a929SArmin Le Grand class XColorList; 47*c7be74b1SArmin Le Grand typedef ::boost::shared_ptr< XColorList > XColorListSharedPtr; 48*c7be74b1SArmin Le Grand 49cdf0e10cSrcweir class OfaOptionsTreeListBox : public SvTreeListBox 50cdf0e10cSrcweir { 51cdf0e10cSrcweir using SvListView::Collapse; 52cdf0e10cSrcweir 53cdf0e10cSrcweir private: 54cdf0e10cSrcweir sal_Bool bInCollapse; 55cdf0e10cSrcweir 56cdf0e10cSrcweir public: OfaOptionsTreeListBox(Window * pParent,const ResId & rResId)57cdf0e10cSrcweir OfaOptionsTreeListBox(Window* pParent, const ResId& rResId) : 58cdf0e10cSrcweir SvTreeListBox( pParent, rResId ), bInCollapse(sal_False) {} 59cdf0e10cSrcweir 60cdf0e10cSrcweir virtual sal_Bool Collapse( SvLBoxEntry* pParent ); IsInCollapse() const61cdf0e10cSrcweir sal_Bool IsInCollapse()const {return bInCollapse;} 62cdf0e10cSrcweir }; 63cdf0e10cSrcweir 64cdf0e10cSrcweir // struct OrderedEntry --------------------------------------------------- 65cdf0e10cSrcweir 66cdf0e10cSrcweir struct OrderedEntry 67cdf0e10cSrcweir { 68cdf0e10cSrcweir sal_Int32 m_nIndex; 69cdf0e10cSrcweir rtl::OUString m_sId; 70cdf0e10cSrcweir OrderedEntryOrderedEntry71cdf0e10cSrcweir OrderedEntry( sal_Int32 nIndex, const rtl::OUString& rId ) : 72cdf0e10cSrcweir m_nIndex( nIndex ), m_sId( rId ) {} 73cdf0e10cSrcweir }; 74cdf0e10cSrcweir 75cdf0e10cSrcweir typedef std::vector< OrderedEntry* > VectorOfOrderedEntries; 76cdf0e10cSrcweir 77cdf0e10cSrcweir // struct Module --------------------------------------------------------- 78cdf0e10cSrcweir 79cdf0e10cSrcweir struct Module 80cdf0e10cSrcweir { 81cdf0e10cSrcweir rtl::OUString m_sName; 82cdf0e10cSrcweir bool m_bActive; 83cdf0e10cSrcweir VectorOfOrderedEntries m_aNodeList; 84cdf0e10cSrcweir ModuleModule85cdf0e10cSrcweir Module( const rtl::OUString& rName ) : m_sName( rName ), m_bActive( false ) {} 86cdf0e10cSrcweir }; 87cdf0e10cSrcweir 88cdf0e10cSrcweir // struct OptionsLeaf ---------------------------------------------------- 89cdf0e10cSrcweir 90cdf0e10cSrcweir struct OptionsLeaf 91cdf0e10cSrcweir { 92cdf0e10cSrcweir rtl::OUString m_sId; 93cdf0e10cSrcweir rtl::OUString m_sLabel; 94cdf0e10cSrcweir rtl::OUString m_sPageURL; 95cdf0e10cSrcweir rtl::OUString m_sEventHdl; 96cdf0e10cSrcweir rtl::OUString m_sGroupId; 97cdf0e10cSrcweir sal_Int32 m_nGroupIndex; 98cdf0e10cSrcweir OptionsLeafOptionsLeaf99cdf0e10cSrcweir OptionsLeaf( const rtl::OUString& rId, 100cdf0e10cSrcweir const rtl::OUString& rLabel, 101cdf0e10cSrcweir const rtl::OUString& rPageURL, 102cdf0e10cSrcweir const rtl::OUString& rEventHdl, 103cdf0e10cSrcweir const rtl::OUString& rGroupId, 104cdf0e10cSrcweir sal_Int32 nGroupIndex ) : 105cdf0e10cSrcweir m_sId( rId ), 106cdf0e10cSrcweir m_sLabel( rLabel ), 107cdf0e10cSrcweir m_sPageURL( rPageURL ), 108cdf0e10cSrcweir m_sEventHdl( rEventHdl ), 109cdf0e10cSrcweir m_sGroupId( rGroupId ), 110cdf0e10cSrcweir m_nGroupIndex( nGroupIndex ) {} 111cdf0e10cSrcweir }; 112cdf0e10cSrcweir 113cdf0e10cSrcweir typedef ::std::vector< OptionsLeaf* > VectorOfLeaves; 114cdf0e10cSrcweir typedef ::std::vector< VectorOfLeaves > VectorOfGroupedLeaves; 115cdf0e10cSrcweir 116cdf0e10cSrcweir // struct OptionsNode ---------------------------------------------------- 117cdf0e10cSrcweir 118cdf0e10cSrcweir struct OptionsNode 119cdf0e10cSrcweir { 120cdf0e10cSrcweir rtl::OUString m_sId; 121cdf0e10cSrcweir rtl::OUString m_sLabel; 122cdf0e10cSrcweir rtl::OUString m_sPageURL; 123cdf0e10cSrcweir bool m_bAllModules; 124cdf0e10cSrcweir rtl::OUString m_sGroupId; 125cdf0e10cSrcweir sal_Int32 m_nGroupIndex; 126cdf0e10cSrcweir VectorOfLeaves m_aLeaves; 127cdf0e10cSrcweir VectorOfGroupedLeaves m_aGroupedLeaves; 128cdf0e10cSrcweir OptionsNodeOptionsNode129cdf0e10cSrcweir OptionsNode( const rtl::OUString& rId, 130cdf0e10cSrcweir const rtl::OUString& rLabel, 131cdf0e10cSrcweir const rtl::OUString& rPageURL, 132cdf0e10cSrcweir bool bAllModules, 133cdf0e10cSrcweir const rtl::OUString& rGroupId, 134cdf0e10cSrcweir sal_Int32 nGroupIndex ) : 135cdf0e10cSrcweir m_sId( rId ), 136cdf0e10cSrcweir m_sLabel( rLabel ), 137cdf0e10cSrcweir m_sPageURL( rPageURL ), 138cdf0e10cSrcweir m_bAllModules( bAllModules ), 139cdf0e10cSrcweir m_sGroupId( rGroupId ), 140cdf0e10cSrcweir m_nGroupIndex( nGroupIndex ) {} 141cdf0e10cSrcweir ~OptionsNodeOptionsNode142cdf0e10cSrcweir ~OptionsNode() 143cdf0e10cSrcweir { 144cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < m_aLeaves.size(); ++i ) 145cdf0e10cSrcweir delete m_aLeaves[i]; 146cdf0e10cSrcweir m_aLeaves.clear(); 147cdf0e10cSrcweir m_aGroupedLeaves.clear(); 148cdf0e10cSrcweir } 149cdf0e10cSrcweir }; 150cdf0e10cSrcweir 151cdf0e10cSrcweir typedef ::std::vector< OptionsNode* > VectorOfNodes; 152cdf0e10cSrcweir 153cdf0e10cSrcweir struct LastPageSaver 154cdf0e10cSrcweir { 155cdf0e10cSrcweir sal_uInt16 m_nLastPageId; 156cdf0e10cSrcweir rtl::OUString m_sLastPageURL_Tools; 157cdf0e10cSrcweir rtl::OUString m_sLastPageURL_ExtMgr; 158cdf0e10cSrcweir LastPageSaverLastPageSaver159cdf0e10cSrcweir LastPageSaver() : m_nLastPageId( USHRT_MAX ) {} 160cdf0e10cSrcweir }; 161cdf0e10cSrcweir 162cdf0e10cSrcweir // class OfaTreeOptionsDialog -------------------------------------------- 163cdf0e10cSrcweir 164cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } } 165cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace container { class XNameAccess; } } } } 166cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } } 167cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowProvider; } } } } 168cdf0e10cSrcweir 169cdf0e10cSrcweir struct OptionsPageInfo; 170cdf0e10cSrcweir struct Module; 171cdf0e10cSrcweir class ExtensionsTabPage; 172cdf0e10cSrcweir typedef std::vector< ExtensionsTabPage* > VectorOfPages; 173cdf0e10cSrcweir 174cdf0e10cSrcweir class OfaTreeOptionsDialog : public SfxModalDialog 175cdf0e10cSrcweir { 176cdf0e10cSrcweir private: 177cdf0e10cSrcweir OKButton aOkPB; 178cdf0e10cSrcweir CancelButton aCancelPB; 179cdf0e10cSrcweir HelpButton aHelpPB; 180cdf0e10cSrcweir PushButton aBackPB; 181cdf0e10cSrcweir 182cdf0e10cSrcweir FixedBorder aHiddenGB; 183cdf0e10cSrcweir FixedText aPageTitleFT; 184cdf0e10cSrcweir FixedLine aLine1FL; 185cdf0e10cSrcweir FixedText aHelpFT; 186cdf0e10cSrcweir FixedImage aHelpImg; 187cdf0e10cSrcweir 188cdf0e10cSrcweir ImageList aPageImages; 189cdf0e10cSrcweir ImageList aPageImagesHC; 190cdf0e10cSrcweir 191cdf0e10cSrcweir ResStringArray aHelpTextsArr; 192cdf0e10cSrcweir 193cdf0e10cSrcweir OfaOptionsTreeListBox aTreeLB; 194cdf0e10cSrcweir 195cdf0e10cSrcweir String sTitle; 196cdf0e10cSrcweir String sNotLoadedError; 197cdf0e10cSrcweir 198cdf0e10cSrcweir SvLBoxEntry* pCurrentPageEntry; 199cdf0e10cSrcweir 200cdf0e10cSrcweir // for the ColorTabPage 201*c7be74b1SArmin Le Grand SfxItemSet* pColorPageItemSet; 202*c7be74b1SArmin Le Grand XColorListSharedPtr maColorTab; 203cdf0e10cSrcweir sal_uInt16 nChangeType; 204cdf0e10cSrcweir sal_uInt16 nUnknownType; 205cdf0e10cSrcweir sal_uInt16 nUnknownPos; 206cdf0e10cSrcweir sal_Bool bIsAreaTP; 207cdf0e10cSrcweir 208cdf0e10cSrcweir sal_Bool bForgetSelection; 209cdf0e10cSrcweir sal_Bool bExternBrowserActive; 210cdf0e10cSrcweir sal_Bool bImageResized; 211cdf0e10cSrcweir bool bInSelectHdl_Impl; 212cdf0e10cSrcweir bool bIsFromExtensionManager; 213cdf0e10cSrcweir 214cdf0e10cSrcweir // check "for the current document only" and set focus to "Western" languages box 215cdf0e10cSrcweir bool bIsForSetDocumentLanguage; 216cdf0e10cSrcweir 217cdf0e10cSrcweir Timer aSelectTimer; 218cdf0e10cSrcweir 219cdf0e10cSrcweir com::sun::star::uno::Reference < com::sun::star::awt::XContainerWindowProvider > 220cdf0e10cSrcweir m_xContainerWinProvider; 221cdf0e10cSrcweir 222cdf0e10cSrcweir static LastPageSaver* pLastPageSaver; 223cdf0e10cSrcweir 224cdf0e10cSrcweir SfxItemSet* CreateItemSet( sal_uInt16 nId ); 225cdf0e10cSrcweir void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ); 226cdf0e10cSrcweir void InitTreeAndHandler(); 227cdf0e10cSrcweir void Initialize( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& _xFrame ); 228cdf0e10cSrcweir void ResizeTreeLB( void ); // resizes dialog so that treelistbox has no horizontal scroll bar 229cdf0e10cSrcweir 230cdf0e10cSrcweir void LoadExtensionOptions( const rtl::OUString& rExtensionId ); 231cdf0e10cSrcweir rtl::OUString GetModuleIdentifier( const com::sun::star::uno::Reference< 232cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory >& xMFac, 233cdf0e10cSrcweir const com::sun::star::uno::Reference< 234cdf0e10cSrcweir com::sun::star::frame::XFrame >& xFrame ); 235cdf0e10cSrcweir Module* LoadModule( const rtl::OUString& rModuleIdentifier, 236cdf0e10cSrcweir const com::sun::star::uno::Reference< 237cdf0e10cSrcweir com::sun::star::container::XNameAccess >& xRoot ); 238cdf0e10cSrcweir void LoadNodes( const com::sun::star::uno::Reference< 239cdf0e10cSrcweir com::sun::star::container::XNameAccess >& xRoot, 240cdf0e10cSrcweir Module* pModule, 241cdf0e10cSrcweir const rtl::OUString& rExtensionId, 242cdf0e10cSrcweir VectorOfNodes& rOutNodeList ); 243cdf0e10cSrcweir void InsertNodes( const VectorOfNodes& rNodeList ); 244cdf0e10cSrcweir 245cdf0e10cSrcweir protected: 246cdf0e10cSrcweir DECL_LINK(ExpandedHdl_Impl, SvTreeListBox* ); 247cdf0e10cSrcweir DECL_LINK(ShowPageHdl_Impl, SvTreeListBox* ); 248cdf0e10cSrcweir DECL_LINK(BackHdl_Impl, PushButton* ); 249cdf0e10cSrcweir DECL_LINK( OKHdl_Impl, Button * ); 250cdf0e10cSrcweir DECL_LINK( HintHdl_Impl, Timer * ); 251cdf0e10cSrcweir DECL_LINK( SelectHdl_Impl, Timer * ); 252cdf0e10cSrcweir 253cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 254cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 255cdf0e10cSrcweir virtual short Execute(); 256cdf0e10cSrcweir 257cdf0e10cSrcweir public: 258cdf0e10cSrcweir OfaTreeOptionsDialog( Window* pParent, 259cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& _xFrame, 260cdf0e10cSrcweir bool bActivateLastSelection = true ); 261cdf0e10cSrcweir OfaTreeOptionsDialog( Window* pParent, const rtl::OUString& rExtensionId ); 262cdf0e10cSrcweir ~OfaTreeOptionsDialog(); 263cdf0e10cSrcweir 264cdf0e10cSrcweir OptionsPageInfo* AddTabPage( sal_uInt16 nId, const String& rPageName, sal_uInt16 nGroup ); 265cdf0e10cSrcweir sal_uInt16 AddGroup( const String& rGroupName, SfxShell* pCreateShell, 266cdf0e10cSrcweir SfxModule* pCreateModule, sal_uInt16 nDialogId ); 267cdf0e10cSrcweir 268cdf0e10cSrcweir void ActivateLastSelection(); 269cdf0e10cSrcweir void ActivatePage( sal_uInt16 nResId ); 270cdf0e10cSrcweir void ActivatePage( const String& rPageURL ); 271cdf0e10cSrcweir void ApplyItemSets(); 272cdf0e10cSrcweir GetColorChanged() const273cdf0e10cSrcweir sal_uInt16 GetColorChanged() const { return nChangeType; } GetColorTable()274*c7be74b1SArmin Le Grand XColorListSharedPtr GetColorTable() { return maColorTab; } 275cdf0e10cSrcweir 276cdf0e10cSrcweir // helper functions to call the language settings TabPage from the SpellDialog 277cdf0e10cSrcweir static void ApplyLanguageOptions(const SfxItemSet& rSet); 278cdf0e10cSrcweir }; 279cdf0e10cSrcweir 280cdf0e10cSrcweir // class OfaPageResource ------------------------------------------------- 281cdf0e10cSrcweir 282cdf0e10cSrcweir class OfaPageResource : public Resource 283cdf0e10cSrcweir { 284cdf0e10cSrcweir ResStringArray aGeneralDlgAry; 285cdf0e10cSrcweir ResStringArray aInetDlgAry; 286cdf0e10cSrcweir ResStringArray aLangDlgAry; 287cdf0e10cSrcweir ResStringArray aTextDlgAry; 288cdf0e10cSrcweir ResStringArray aHTMLDlgAry; 289cdf0e10cSrcweir ResStringArray aCalcDlgAry; 290cdf0e10cSrcweir ResStringArray aStarMathDlgAry; 291cdf0e10cSrcweir ResStringArray aImpressDlgAry; 292cdf0e10cSrcweir ResStringArray aDrawDlgAry; 293cdf0e10cSrcweir ResStringArray aChartDlgAry; 294cdf0e10cSrcweir ResStringArray aFilterDlgAry; 295cdf0e10cSrcweir ResStringArray aDatasourcesDlgAry; 296cdf0e10cSrcweir 297cdf0e10cSrcweir public: 298cdf0e10cSrcweir OfaPageResource(); 299cdf0e10cSrcweir GetGeneralArray()300cdf0e10cSrcweir ResStringArray& GetGeneralArray() {return aGeneralDlgAry;} GetInetArray()301cdf0e10cSrcweir ResStringArray& GetInetArray() {return aInetDlgAry;} GetLangArray()302cdf0e10cSrcweir ResStringArray& GetLangArray() {return aLangDlgAry;} GetTextArray()303cdf0e10cSrcweir ResStringArray& GetTextArray() {return aTextDlgAry;} GetHTMLArray()304cdf0e10cSrcweir ResStringArray& GetHTMLArray() {return aHTMLDlgAry;} GetCalcArray()305cdf0e10cSrcweir ResStringArray& GetCalcArray() {return aCalcDlgAry;} GetStarMathArray()306cdf0e10cSrcweir ResStringArray& GetStarMathArray() {return aStarMathDlgAry;} GetImpressArray()307cdf0e10cSrcweir ResStringArray& GetImpressArray() {return aImpressDlgAry;} GetDrawArray()308cdf0e10cSrcweir ResStringArray& GetDrawArray() {return aDrawDlgAry;} GetChartArray()309cdf0e10cSrcweir ResStringArray& GetChartArray() {return aChartDlgAry;} GetFilterArray()310cdf0e10cSrcweir ResStringArray& GetFilterArray() {return aFilterDlgAry;} GetDatasourcesArray()311cdf0e10cSrcweir ResStringArray& GetDatasourcesArray() {return aDatasourcesDlgAry;} 312cdf0e10cSrcweir }; 313cdf0e10cSrcweir 314cdf0e10cSrcweir // class ExtensionsTabPage ----------------------------------------------- 315cdf0e10cSrcweir 316cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } } 317cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowEventHandler; } } } } 318cdf0e10cSrcweir 319cdf0e10cSrcweir class ExtensionsTabPage : public TabPage 320cdf0e10cSrcweir { 321cdf0e10cSrcweir private: 322cdf0e10cSrcweir rtl::OUString m_sPageURL; 323cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::awt::XWindow > 324cdf0e10cSrcweir m_xPage; 325cdf0e10cSrcweir rtl::OUString m_sEventHdl; 326cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::awt::XContainerWindowEventHandler > 327cdf0e10cSrcweir m_xEventHdl; 328cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::awt::XContainerWindowProvider > 329cdf0e10cSrcweir m_xWinProvider; 330cdf0e10cSrcweir bool m_bIsWindowHidden; 331cdf0e10cSrcweir 332cdf0e10cSrcweir void CreateDialogWithHandler(); 333cdf0e10cSrcweir sal_Bool DispatchAction( const rtl::OUString& rAction ); 334cdf0e10cSrcweir 335cdf0e10cSrcweir public: 336cdf0e10cSrcweir ExtensionsTabPage( 337cdf0e10cSrcweir Window* pParent, WinBits nStyle, 338cdf0e10cSrcweir const rtl::OUString& rPageURL, const rtl::OUString& rEvtHdl, 339cdf0e10cSrcweir const com::sun::star::uno::Reference< 340cdf0e10cSrcweir com::sun::star::awt::XContainerWindowProvider >& rProvider ); 341cdf0e10cSrcweir 342cdf0e10cSrcweir virtual ~ExtensionsTabPage(); 343cdf0e10cSrcweir 344cdf0e10cSrcweir virtual void ActivatePage(); 345cdf0e10cSrcweir virtual void DeactivatePage(); 346cdf0e10cSrcweir 347cdf0e10cSrcweir void ResetPage(); 348cdf0e10cSrcweir void SavePage(); 349cdf0e10cSrcweir }; 350cdf0e10cSrcweir 351