LCOV - code coverage report
Current view: top level - libreoffice/cui/source/inc - treeopt.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 30 0.0 %
Date: 2012-12-27 Functions: 0 21 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <tools/resary.hxx>
      21             : #include <vcl/fixed.hxx>
      22             : 
      23             : class SfxModule;
      24             : class SfxShell;
      25             : 
      26             : // static ----------------------------------------------------------------
      27             : 
      28             : sal_Bool            EnableSSO();
      29             : CreateTabPage   GetSSOCreator( void );
      30             : 
      31             : // struct OrderedEntry ---------------------------------------------------
      32             : 
      33             : struct OrderedEntry
      34             : {
      35             :     sal_Int32       m_nIndex;
      36             :     rtl::OUString   m_sId;
      37             : 
      38           0 :     OrderedEntry( sal_Int32 nIndex, const rtl::OUString& rId ) :
      39           0 :         m_nIndex( nIndex ), m_sId( rId ) {}
      40             : };
      41             : 
      42             : typedef std::vector< OrderedEntry* > VectorOfOrderedEntries;
      43             : 
      44             : // struct Module ---------------------------------------------------------
      45             : 
      46           0 : struct Module
      47             : {
      48             :     rtl::OUString           m_sName;
      49             :     bool                    m_bActive;
      50             :     VectorOfOrderedEntries  m_aNodeList;
      51             : 
      52           0 :     Module( const rtl::OUString& rName ) : m_sName( rName ), m_bActive( false ) {}
      53             : };
      54             : 
      55             : // struct OptionsLeaf ----------------------------------------------------
      56             : 
      57           0 : struct OptionsLeaf
      58             : {
      59             :     rtl::OUString   m_sId;
      60             :     rtl::OUString   m_sLabel;
      61             :     rtl::OUString   m_sPageURL;
      62             :     rtl::OUString   m_sEventHdl;
      63             :     rtl::OUString   m_sGroupId;
      64             :     sal_Int32       m_nGroupIndex;
      65             : 
      66           0 :     OptionsLeaf(    const rtl::OUString& rId,
      67             :                     const rtl::OUString& rLabel,
      68             :                     const rtl::OUString& rPageURL,
      69             :                     const rtl::OUString& rEventHdl,
      70             :                     const rtl::OUString& rGroupId,
      71             :                     sal_Int32 nGroupIndex ) :
      72             :         m_sId( rId ),
      73             :         m_sLabel( rLabel ),
      74             :         m_sPageURL( rPageURL ),
      75             :         m_sEventHdl( rEventHdl ),
      76             :         m_sGroupId( rGroupId ),
      77           0 :         m_nGroupIndex( nGroupIndex ) {}
      78             : };
      79             : 
      80             : typedef ::std::vector< OptionsLeaf* > VectorOfLeaves;
      81             : typedef ::std::vector< VectorOfLeaves > VectorOfGroupedLeaves;
      82             : 
      83             : // struct OptionsNode ----------------------------------------------------
      84             : 
      85             : struct OptionsNode
      86             : {
      87             :     rtl::OUString           m_sId;
      88             :     rtl::OUString           m_sLabel;
      89             :     rtl::OUString           m_sPageURL;
      90             :     bool                    m_bAllModules;
      91             :     rtl::OUString           m_sGroupId;
      92             :     sal_Int32               m_nGroupIndex;
      93             :     VectorOfLeaves          m_aLeaves;
      94             :     VectorOfGroupedLeaves   m_aGroupedLeaves;
      95             : 
      96           0 :     OptionsNode(    const rtl::OUString& rId,
      97             :                     const rtl::OUString& rLabel,
      98             :                     const rtl::OUString& rPageURL,
      99             :                     bool bAllModules,
     100             :                     const rtl::OUString& rGroupId,
     101             :                     sal_Int32 nGroupIndex ) :
     102             :         m_sId( rId ),
     103             :         m_sLabel( rLabel ),
     104             :         m_sPageURL( rPageURL ),
     105             :         m_bAllModules( bAllModules ),
     106             :         m_sGroupId( rGroupId ),
     107           0 :         m_nGroupIndex( nGroupIndex ) {}
     108             : 
     109           0 :     ~OptionsNode()
     110           0 :     {
     111           0 :         for ( sal_uInt32 i = 0; i < m_aLeaves.size(); ++i )
     112           0 :             delete m_aLeaves[i];
     113           0 :         m_aLeaves.clear();
     114           0 :         m_aGroupedLeaves.clear();
     115           0 :     }
     116             : };
     117             : 
     118             : typedef ::std::vector< OptionsNode* > VectorOfNodes;
     119             : 
     120             : struct LastPageSaver
     121             : {
     122             :     sal_uInt16          m_nLastPageId;
     123             :     rtl::OUString   m_sLastPageURL_Tools;
     124             :     rtl::OUString   m_sLastPageURL_ExtMgr;
     125             : 
     126           0 :     LastPageSaver() : m_nLastPageId( USHRT_MAX ) {}
     127             : };
     128             : 
     129             : // class OfaTreeOptionsDialog --------------------------------------------
     130             : 
     131             : namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } }
     132             : namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowProvider; } } } }
     133             : 
     134             : struct OptionsPageInfo;
     135             : struct Module;
     136             : class ExtensionsTabPage;
     137             : class SvxColorTabPage;
     138             : typedef std::vector< ExtensionsTabPage* > VectorOfPages;
     139             : 
     140             : class OfaTreeOptionsDialog : public SfxModalDialog
     141             : {
     142             : private:
     143             :     OKButton        aOkPB;
     144             :     CancelButton    aCancelPB;
     145             :     HelpButton      aHelpPB;
     146             :     PushButton      aBackPB;
     147             : 
     148             :     FixedLine       aSeparatorFL;
     149             : 
     150             :     SvTreeListBox   aTreeLB;
     151             : 
     152             :     String          sTitle;
     153             :     String          sNotLoadedError;
     154             : 
     155             :     SvTreeListEntry*    pCurrentPageEntry;
     156             : 
     157             :     // for the ColorTabPage
     158             :     SfxItemSet*     pColorPageItemSet;
     159             :     SvxColorTabPage *mpColorPage;
     160             : 
     161             :     sal_Bool        bForgetSelection;
     162             :     sal_Bool        bExternBrowserActive;
     163             :     bool            bIsFromExtensionManager;
     164             : 
     165             :     // check "for the current document only" and set focus to "Western" languages box
     166             :     bool            bIsForSetDocumentLanguage;
     167             : 
     168             :     com::sun::star::uno::Reference < com::sun::star::awt::XContainerWindowProvider >
     169             :                     m_xContainerWinProvider;
     170             : 
     171             :     static LastPageSaver*   pLastPageSaver;
     172             : 
     173             :     SfxItemSet*     CreateItemSet( sal_uInt16 nId );
     174             :     void            ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
     175             :     void            InitTreeAndHandler();
     176             :     void            Initialize( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& _xFrame );
     177             :     void            ResizeTreeLB( void );   // resizes dialog so that treelistbox has no horizontal scroll bar
     178             : 
     179             :     void            LoadExtensionOptions( const rtl::OUString& rExtensionId );
     180             :     rtl::OUString   GetModuleIdentifier( const com::sun::star::uno::Reference<
     181             :                                             com::sun::star::frame::XFrame >& xFrame );
     182             :     Module*         LoadModule( const rtl::OUString& rModuleIdentifier );
     183             :     VectorOfNodes   LoadNodes( Module* pModule, const rtl::OUString& rExtensionId );
     184             :     void            InsertNodes( const VectorOfNodes& rNodeList );
     185             : 
     186             :     void SetPaneSize(Window *pPane);
     187             : 
     188             : protected:
     189             :     DECL_LINK(ExpandedHdl_Impl, SvTreeListBox* );
     190             :     DECL_LINK(ShowPageHdl_Impl, void *);
     191             :     DECL_LINK(BackHdl_Impl, void *);
     192             :     DECL_LINK(OKHdl_Impl, void *);
     193             :     DECL_LINK( HintHdl_Impl, Timer * );
     194             :     void SelectHdl_Impl();
     195             : 
     196             :     virtual long    Notify( NotifyEvent& rNEvt );
     197             :     virtual short   Execute();
     198             : 
     199             : public:
     200             :     OfaTreeOptionsDialog( Window* pParent,
     201             :         const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& _xFrame,
     202             :         bool bActivateLastSelection = true );
     203             :     OfaTreeOptionsDialog( Window* pParent, const rtl::OUString& rExtensionId );
     204             :     ~OfaTreeOptionsDialog();
     205             : 
     206             :     OptionsPageInfo*    AddTabPage( sal_uInt16 nId, const String& rPageName, sal_uInt16 nGroup );
     207             :     sal_uInt16              AddGroup(   const String& rGroupName,  SfxShell* pCreateShell,
     208             :                                     SfxModule* pCreateModule, sal_uInt16 nDialogId );
     209             : 
     210             :     void                ActivateLastSelection();
     211             :     void                ActivatePage( sal_uInt16 nResId );
     212             :     void                ActivatePage( const String& rPageURL );
     213             :     void                ApplyItemSets();
     214             : 
     215             :     // helper functions to call the language settings TabPage from the SpellDialog
     216             :     static void         ApplyLanguageOptions(const SfxItemSet& rSet);
     217             : };
     218             : 
     219             : // class OfaPageResource -------------------------------------------------
     220             : 
     221           0 : class OfaPageResource : public Resource
     222             : {
     223             :     ResStringArray      aGeneralDlgAry;
     224             :     ResStringArray      aInetDlgAry;
     225             :     ResStringArray      aLangDlgAry;
     226             :     ResStringArray      aTextDlgAry;
     227             :     ResStringArray      aHTMLDlgAry;
     228             :     ResStringArray      aCalcDlgAry;
     229             :     ResStringArray      aStarMathDlgAry;
     230             :     ResStringArray      aImpressDlgAry;
     231             :     ResStringArray      aDrawDlgAry;
     232             :     ResStringArray      aChartDlgAry;
     233             :     ResStringArray      aFilterDlgAry;
     234             :     ResStringArray      aDatasourcesDlgAry;
     235             : 
     236             : public:
     237             :     OfaPageResource();
     238             : 
     239           0 :     ResStringArray& GetGeneralArray()       {return aGeneralDlgAry;}
     240           0 :     ResStringArray& GetInetArray()          {return aInetDlgAry;}
     241           0 :     ResStringArray& GetLangArray()          {return aLangDlgAry;}
     242           0 :     ResStringArray& GetTextArray()          {return aTextDlgAry;}
     243           0 :     ResStringArray& GetHTMLArray()          {return aHTMLDlgAry;}
     244           0 :     ResStringArray& GetCalcArray()          {return aCalcDlgAry;}
     245           0 :     ResStringArray& GetStarMathArray()      {return aStarMathDlgAry;}
     246           0 :     ResStringArray& GetImpressArray()       {return aImpressDlgAry;}
     247           0 :     ResStringArray& GetDrawArray()          {return aDrawDlgAry;}
     248           0 :     ResStringArray& GetChartArray()         {return aChartDlgAry;}
     249           0 :     ResStringArray& GetFilterArray()        {return aFilterDlgAry;}
     250           0 :     ResStringArray& GetDatasourcesArray()   {return aDatasourcesDlgAry;}
     251             : };
     252             : 
     253             : // class ExtensionsTabPage -----------------------------------------------
     254             : 
     255             : namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } }
     256             : namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowEventHandler; } } } }
     257             : 
     258             : class ExtensionsTabPage : public TabPage
     259             : {
     260             : private:
     261             :     rtl::OUString       m_sPageURL;
     262             :     com::sun::star::uno::Reference< com::sun::star::awt::XWindow >
     263             :                         m_xPage;
     264             :     rtl::OUString       m_sEventHdl;
     265             :     com::sun::star::uno::Reference< com::sun::star::awt::XContainerWindowEventHandler >
     266             :                         m_xEventHdl;
     267             :     com::sun::star::uno::Reference< com::sun::star::awt::XContainerWindowProvider >
     268             :                         m_xWinProvider;
     269             :     bool                m_bIsWindowHidden;
     270             : 
     271             :     void                CreateDialogWithHandler();
     272             :     sal_Bool            DispatchAction( const rtl::OUString& rAction );
     273             : 
     274             : public:
     275             :     ExtensionsTabPage(
     276             :         Window* pParent, WinBits nStyle,
     277             :         const rtl::OUString& rPageURL, const rtl::OUString& rEvtHdl,
     278             :         const com::sun::star::uno::Reference<
     279             :             com::sun::star::awt::XContainerWindowProvider >& rProvider );
     280             : 
     281             :     virtual ~ExtensionsTabPage();
     282             : 
     283             :     virtual void    ActivatePage();
     284             :     virtual void    DeactivatePage();
     285             : 
     286             :     void            ResetPage();
     287             :     void            SavePage();
     288             : };
     289             : 
     290             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10