LCOV - code coverage report
Current view: top level - cui/source/inc - treeopt.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 30 0.0 %
Date: 2012-08-25 Functions: 0 21 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 34 0.0 %

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

Generated by: LCOV version 1.10