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

Generated by: LCOV version 1.10