LCOV - code coverage report
Current view: top level - cui/source/inc - scriptdlg.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 13 0.0 %
Date: 2014-11-03 Functions: 0 11 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             : #ifndef INCLUDED_CUI_SOURCE_INC_SCRIPTDLG_HXX
      21             : #define INCLUDED_CUI_SOURCE_INC_SCRIPTDLG_HXX
      22             : 
      23             : #include <memory>
      24             : #include <svtools/treelistbox.hxx>
      25             : #include <vcl/dialog.hxx>
      26             : #include <vcl/button.hxx>
      27             : #include <vcl/fixed.hxx>
      28             : #include <vcl/abstdlg.hxx>
      29             : #include <sfx2/basedlgs.hxx>
      30             : 
      31             : #include <com/sun/star/beans/XPropertySet.hpp>
      32             : #include <com/sun/star/script/browse/XBrowseNode.hpp>
      33             : #include <com/sun/star/frame/XModel.hpp>
      34             : 
      35             : #include <boost/unordered_map.hpp>
      36             : 
      37             : #define OBJTYPE_BASICMANAGER    1L
      38             : #define OBJTYPE_METHOD          2L
      39             : #define OBJTYPE_SCRIPTCONTAINER 3L
      40             : #define OBJTYPE_SFROOT          4L
      41             : 
      42             : #define INPUTMODE_NEWLIB        1
      43             : #define INPUTMODE_NEWMACRO      2
      44             : #define INPUTMODE_RENAME        3
      45             : 
      46             : typedef ::boost::unordered_map < OUString, OUString ,
      47             :     OUStringHash, ::std::equal_to< OUString > > Selection_hash;
      48             : 
      49             : class SFEntry;
      50             : 
      51             : class SFTreeListBox : public SvTreeListBox
      52             : {
      53             :    friend class SvxScriptOrgDialog;
      54             : private:
      55             :     sal_uInt16          nMode;
      56             :     Image m_hdImage;
      57             :     Image m_libImage;
      58             :     Image m_macImage;
      59             :     Image m_docImage;
      60             :     OUString m_sMyMacros;
      61             :     OUString m_sProdMacros;
      62             : 
      63             :     ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >
      64             :         getLangNodeFromRootNode( ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& root, OUString& language );
      65             :     void delUserData( SvTreeListEntry* pEntry );
      66             : 
      67             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface  > getDocumentModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx, OUString& docName );
      68             : 
      69             : protected:
      70             :     void                    ExpandTree( SvTreeListEntry* pRootEntry );
      71             :     virtual void            RequestingChildren( SvTreeListEntry* pParent ) SAL_OVERRIDE;
      72             :     virtual void            ExpandedHdl() SAL_OVERRIDE;
      73             :     virtual bool            ExpandingHdl() SAL_OVERRIDE;
      74             : public:
      75             :     void                    Init( const OUString& language );
      76             :     void  RequestSubEntries(  SvTreeListEntry* pRootEntry, ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& node,
      77             :                               ::com::sun::star::uno::Reference< com::sun::star::frame::XModel>& model  );
      78             :                     SFTreeListBox(vcl::Window* pParent);
      79             :                     virtual ~SFTreeListBox();
      80             : 
      81             :     void            ExpandAllTrees();
      82             : 
      83             : 
      84             : 
      85             :     SvTreeListEntry * insertEntry(OUString const & rText, sal_uInt16 nBitmap,
      86             :                               SvTreeListEntry * pParent,
      87             :                               bool bChildrenOnDemand,
      88             :                               std::unique_ptr< SFEntry > && aUserData,
      89             :                               const OUString& factoryURL );
      90             :     SvTreeListEntry * insertEntry(OUString const & rText, sal_uInt16 nBitmap,
      91             :                               SvTreeListEntry * pParent,
      92             :                               bool bChildrenOnDemand,
      93             :                               std::unique_ptr< SFEntry > && aUserData );
      94             :     void deleteTree( SvTreeListEntry * pEntry );
      95             :     void deleteAllTree( );
      96             : };
      97             : 
      98           0 : class CuiInputDialog : public ModalDialog
      99             : {
     100             : private:
     101             :     Edit* m_pEdit;
     102             : public:
     103             :     CuiInputDialog(vcl::Window * pParent, sal_uInt16 nMode);
     104             : 
     105           0 :     OUString GetObjectName() const { return m_pEdit->GetText(); }
     106           0 :     void SetObjectName(const OUString& rName)
     107             :     {
     108           0 :         m_pEdit->SetText( rName );
     109           0 :         m_pEdit->SetSelection( Selection( 0, rName.getLength() ) );
     110           0 :     }
     111             : };
     112             : 
     113             : class SFEntry
     114             : {
     115             : private:
     116             :     sal_uInt8       nType;
     117             :     bool            loaded;
     118             :         ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > nodes;
     119             :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > model;
     120             :     SFEntry(){}
     121             : public:
     122             :                     SFEntry( sal_uInt8 nT )             { nType = nT; loaded=false; }
     123           0 :                     SFEntry( sal_uInt8 nT,
     124             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& entryNodes ,
     125           0 :                             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& entryModel) { nType = nT; nodes = entryNodes; loaded=false; model = entryModel; }
     126             :                     SFEntry( const SFEntry& r ) { nType = r.nType; nodes = r.nodes; loaded = r.loaded; }
     127           0 :     virtual         ~SFEntry() {}
     128           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > GetNode() { return nodes ;}
     129           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetModel() { return model ;};
     130             :     sal_uInt8           GetType() const                     { return nType; }
     131           0 :     bool            isLoaded() const                    { return loaded; }
     132           0 :     void            setLoaded()                         { loaded=true; }
     133             : };
     134             : 
     135             : class SvxScriptOrgDialog : public SfxModalDialog
     136             : {
     137             : protected:
     138             :     SFTreeListBox*          m_pScriptsBox;
     139             : 
     140             :     PushButton*             m_pRunButton;
     141             :     CloseButton*            m_pCloseButton;
     142             :     PushButton*             m_pCreateButton;
     143             :     PushButton*             m_pEditButton;
     144             :     PushButton*             m_pRenameButton;
     145             :     PushButton*             m_pDelButton;
     146             : 
     147             :     OUString         m_sLanguage;
     148             :     static Selection_hash   m_lastSelection;
     149             :     const OUString m_delErrStr;
     150             :     const OUString m_delErrTitleStr;
     151             :     const OUString m_delQueryStr;
     152             :     const OUString m_delQueryTitleStr;
     153             :     const OUString m_createErrStr;
     154             :     const OUString m_createDupStr;
     155             :     const OUString m_createErrTitleStr;
     156             :     const OUString m_renameErrStr;
     157             :     const OUString m_renameDupStr;
     158             :     const OUString m_renameErrTitleStr;
     159             : 
     160             :     DECL_LINK( MacroSelectHdl, SvTreeListBox * );
     161             :     DECL_LINK( ScriptSelectHdl, SvTreeListBox * );
     162             :     DECL_LINK( ButtonHdl, Button * );
     163             :     bool                getBoolProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xProps, OUString& propName );
     164             :     void                CheckButtons(  ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& node );
     165             : 
     166             : 
     167             :     void        createEntry( SvTreeListEntry* pEntry );
     168             :     void        renameEntry( SvTreeListEntry* pEntry );
     169             :     void        deleteEntry( SvTreeListEntry* pEntry );
     170             :     ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >
     171             :                 getBrowseNode( SvTreeListEntry* pEntry );
     172             :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel( SvTreeListEntry* pEntry );
     173             :     OUString    getListOfChildren( ::com::sun::star::uno::Reference< com::sun::star::script::browse::XBrowseNode > node, int depth );
     174             :     void        StoreCurrentSelection();
     175             :     void        RestorePreviousSelection();
     176             : 
     177             : public:
     178             :                     // prob need another arg in the ctor
     179             :                     // to specify the language or provider
     180             :                     SvxScriptOrgDialog( vcl::Window* pParent, const OUString& language );
     181             :                     virtual ~SvxScriptOrgDialog();
     182             : 
     183             :     virtual short   Execute() SAL_OVERRIDE;
     184             : 
     185             : };
     186             : 
     187             : class SvxScriptErrorDialog : public VclAbstractDialog
     188             : {
     189             : private:
     190             : 
     191             :     OUString m_sMessage;
     192             : 
     193             :     DECL_LINK( ShowDialog, OUString* );
     194             : 
     195             : public:
     196             : 
     197             :     SvxScriptErrorDialog(
     198             :         vcl::Window* parent, ::com::sun::star::uno::Any aException );
     199             : 
     200             :     virtual ~SvxScriptErrorDialog();
     201             : 
     202             :     short           Execute() SAL_OVERRIDE;
     203             : };
     204             : 
     205             : #endif // INCLUDED_CUI_SOURCE_INC_SCRIPTDLG_HXX
     206             : 
     207             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10