LCOV - code coverage report
Current view: top level - libreoffice/cui/source/inc - selector.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 21 0.0 %
Date: 2012-12-27 Functions: 0 12 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             : #ifndef _SVXSELECTOR_HXX
      20             : #define _SVXSELECTOR_HXX
      21             : 
      22             : #include <vcl/lstbox.hxx>
      23             : #include <vcl/fixed.hxx>
      24             : #include <vcl/group.hxx>
      25             : #include <vcl/menubtn.hxx>
      26             : #include <svtools/treelistbox.hxx>
      27             : 
      28             : #include <com/sun/star/uno/XComponentContext.hpp>
      29             : #include <com/sun/star/frame/XFrame.hpp>
      30             : #include <com/sun/star/container/XNameAccess.hpp>
      31             : #include <com/sun/star/script/browse/XBrowseNode.hpp>
      32             : 
      33             : #include <sfx2/minarray.hxx>
      34             : #include <boost/ptr_container/ptr_vector.hpp>
      35             : 
      36             : #define SVX_CFGGROUP_FUNCTION 1
      37             : #define SVX_CFGFUNCTION_SLOT  2
      38             : #define SVX_CFGGROUP_SCRIPTCONTAINER  3
      39             : #define SVX_CFGFUNCTION_SCRIPT 4
      40             : 
      41           0 : struct SvxGroupInfo_Impl
      42             : {
      43             :     sal_uInt16          nKind;
      44             :     sal_uInt16          nOrd;
      45             :     ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >
      46             :                     xBrowseNode;
      47             :     ::rtl::OUString sURL;
      48             :     ::rtl::OUString sHelpText;
      49             :     sal_Bool            bWasOpened;
      50             : 
      51           0 :     SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr )
      52             :         :nKind( n )
      53             :         ,nOrd( nr )
      54             :         ,xBrowseNode()
      55             :         ,sURL()
      56             :         ,sHelpText()
      57           0 :         ,bWasOpened(sal_False)
      58             :     {
      59           0 :     }
      60             : 
      61           0 :     SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, const ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& _rxNode )
      62             :         :nKind( n )
      63             :         ,nOrd( nr )
      64             :         ,xBrowseNode( _rxNode )
      65             :         ,sURL()
      66             :         ,sHelpText()
      67           0 :         ,bWasOpened(sal_False)
      68             :     {
      69           0 :     }
      70             : 
      71           0 :     SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, const ::rtl::OUString& _rURL, const ::rtl::OUString& _rHelpText )
      72             :         :nKind( n )
      73             :         ,nOrd( nr )
      74             :         ,xBrowseNode()
      75             :         ,sURL( _rURL )
      76             :         ,sHelpText( _rHelpText )
      77           0 :         ,bWasOpened(sal_False)
      78             :     {
      79           0 :     }
      80             : };
      81             : 
      82             : typedef boost::ptr_vector<SvxGroupInfo_Impl> SvxGroupInfoArr_Impl;
      83             : 
      84           0 : class ImageProvider
      85             : {
      86             : public:
      87           0 :     virtual ~ImageProvider() {}
      88             : 
      89             :     virtual Image GetImage( const rtl::OUString& rCommandURL ) = 0;
      90             : };
      91             : 
      92             : class SvxConfigFunctionListBox : public SvTreeListBox
      93             : {
      94             : friend class SvxConfigGroupListBox;
      95             :     Timer                           aTimer;
      96             :     SvTreeListEntry*                    pCurEntry;
      97             :     SvxGroupInfoArr_Impl            aArr;
      98             :     SvTreeListEntry*                    m_pDraggingEntry;
      99             : 
     100             :     DECL_LINK(TimerHdl, void *);
     101             :     virtual void                    MouseMove( const MouseEvent& rMEvt );
     102             : 
     103             : public:
     104             :                                     SvxConfigFunctionListBox(Window* pParent);
     105             :                                     ~SvxConfigFunctionListBox();
     106             :     void                            ClearAll();
     107             :     String                          GetHelpText( SvTreeListEntry *pEntry );
     108             :     using Window::GetHelpText;
     109             :     SvTreeListEntry*                GetLastSelectedEntry();
     110             :     void                            FunctionSelected();
     111             : 
     112             :     // drag n drop methods
     113             :     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
     114             : 
     115             :     virtual DragDropMode    NotifyStartDrag(
     116             :         TransferDataContainer&, SvTreeListEntry* );
     117             : 
     118             :     virtual void        DragFinished( sal_Int8 );
     119             : };
     120             : 
     121             : class SvxConfigGroupListBox : public SvTreeListBox
     122             : {
     123             :     SvxGroupInfoArr_Impl            aArr;
     124             :     bool                            m_bShowSlots;
     125             : 
     126             :     SvxConfigFunctionListBox*  pFunctionListBox;
     127             :     ImageProvider*                  m_pImageProvider;
     128             : 
     129             :     ::com::sun::star::uno::Reference
     130             :         < ::com::sun::star::frame::XFrame > m_xFrame;
     131             : 
     132             :     ::com::sun::star::uno::Reference
     133             :         < ::com::sun::star::container::XNameAccess > m_xModuleCommands;
     134             : 
     135             :     Image m_hdImage;
     136             :     Image m_libImage;
     137             :     Image m_macImage;
     138             :     Image m_docImage;
     139             :     ::rtl::OUString m_sMyMacros;
     140             :     ::rtl::OUString m_sProdMacros;
     141             :     Image GetImage(
     142             :         ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > node,
     143             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xCtx,
     144             :         bool bIsRootNode
     145             :     );
     146             : 
     147             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface  > getDocumentModel(
     148             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx,
     149             :         ::rtl::OUString& docName
     150             :     );
     151             : 
     152             : private:
     153             :     void    fillScriptList(
     154             :         const ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& _rxRootNode,
     155             :         SvTreeListEntry* _pParentEntry,
     156             :         bool _bCheapChildrenOnDemand
     157             :     );
     158             : 
     159             : protected:
     160             :     virtual void    RequestingChildren( SvTreeListEntry *pEntry);
     161             :     virtual sal_Bool    Expand( SvTreeListEntry* pParent );
     162             :     using SvListView::Expand;
     163             : 
     164             : public:
     165             :             SvxConfigGroupListBox(Window* pParent);
     166             :             ~SvxConfigGroupListBox();
     167             : 
     168             :     void    Init(bool bShowSlots, const ::com::sun::star::uno::Reference
     169             :                     < ::com::sun::star::frame::XFrame >& xFrame);
     170             : 
     171             :     void    Open( SvTreeListEntry*, sal_Bool );
     172             :     void    ClearAll();
     173             :     void    GroupSelected();
     174             : 
     175           0 :     void    SetFunctionListBox( SvxConfigFunctionListBox *pBox )
     176           0 :         { pFunctionListBox = pBox; }
     177             : 
     178           0 :     void    SetImageProvider( ImageProvider* provider )
     179           0 :         { m_pImageProvider = provider; }
     180             : };
     181             : 
     182             : class SvxScriptSelectorDialog : public ModelessDialog
     183             : {
     184             :     FixedText*                      m_pDialogDescription;
     185             :     SvxConfigGroupListBox*          m_pCategories;
     186             :     SvxConfigFunctionListBox*       m_pCommands;
     187             :     PushButton*                     m_pOKButton;
     188             :     PushButton*                     m_pCancelButton;
     189             :     VclMultiLineEdit*               m_pDescriptionText;
     190             :     OUString                        m_sDefaultDesc;
     191             :     sal_Bool                        m_bShowSlots;
     192             :     Link                            m_aAddHdl;
     193             : 
     194             :     DECL_LINK( ClickHdl, Button * );
     195             :     DECL_LINK( SelectHdl, Control* );
     196             :     DECL_LINK( FunctionDoubleClickHdl, Control* );
     197             : 
     198             :     void                            UpdateUI();
     199             : 
     200             : public:
     201             : 
     202             :     SvxScriptSelectorDialog (
     203             :         Window* pParent = NULL,
     204             :         sal_Bool bShowSlots = sal_False,
     205             :         const ::com::sun::star::uno::Reference
     206             :             < ::com::sun::star::frame::XFrame >& xFrame = 0
     207             :     );
     208             : 
     209             :     ~SvxScriptSelectorDialog ( );
     210             : 
     211           0 :     void        SetAddHdl( const Link& rLink ) { m_aAddHdl = rLink; }
     212           0 :     const Link& GetAddHdl() const { return m_aAddHdl; }
     213             : 
     214           0 :     void        SetImageProvider(ImageProvider* provider)
     215             :     {
     216           0 :         m_pCategories->SetImageProvider(provider);
     217           0 :     }
     218             : 
     219             :     String      GetScriptURL() const;
     220             :     String      GetSelectedDisplayName();
     221             :     String      GetSelectedHelpText();
     222             :     void        SetRunLabel();
     223             :     void        SetDialogDescription(const String& rDescription);
     224             : };
     225             : 
     226             : #endif
     227             : 
     228             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10