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

Generated by: LCOV version 1.11