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

Generated by: LCOV version 1.10