LCOV - code coverage report
Current view: top level - cui/source/inc - scriptdlg.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 9 0.0 %
Date: 2012-08-25 Functions: 0 9 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 8 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SCRIPTDLG_HXX
      30                 :            : #define _SCRIPTDLG_HXX
      31                 :            : 
      32                 :            : #include <memory>
      33                 :            : 
      34                 :            : #include "tools/solar.h"
      35                 :            : 
      36                 :            : #include <svtools/svtreebx.hxx>
      37                 :            : #include <vcl/dialog.hxx>
      38                 :            : #include <vcl/button.hxx>
      39                 :            : #include <vcl/fixed.hxx>
      40                 :            : #include <vcl/abstdlg.hxx>
      41                 :            : #include <sfx2/basedlgs.hxx>
      42                 :            : 
      43                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      44                 :            : #include <com/sun/star/script/browse/XBrowseNode.hpp>
      45                 :            : #include <com/sun/star/frame/XModel.hpp>
      46                 :            : 
      47                 :            : #include <boost/unordered_map.hpp>
      48                 :            : 
      49                 :            : #define OBJTYPE_BASICMANAGER    1L
      50                 :            : #define OBJTYPE_METHOD          2L
      51                 :            : #define OBJTYPE_SCRIPTCONTAINER     3L
      52                 :            : #define OBJTYPE_SFROOT      4L
      53                 :            : 
      54                 :            : #define INPUTMODE_NEWLIB        1
      55                 :            : #define INPUTMODE_NEWMACRO      2
      56                 :            : #define INPUTMODE_RENAME        3
      57                 :            : 
      58                 :            : typedef ::boost::unordered_map < ::rtl::OUString, ::rtl::OUString ,
      59                 :            :     ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > Selection_hash;
      60                 :            : 
      61                 :            : class SFEntry;
      62                 :            : 
      63                 :            : class SFTreeListBox : public SvTreeListBox
      64                 :            : {
      65                 :            :    friend class SvxScriptOrgDialog;
      66                 :            : private:
      67                 :            :     sal_uInt16          nMode;
      68                 :            :     Image m_hdImage;
      69                 :            :     Image m_libImage;
      70                 :            :     Image m_macImage;
      71                 :            :     Image m_docImage;
      72                 :            :     ::rtl::OUString m_sMyMacros;
      73                 :            :     ::rtl::OUString m_sProdMacros;
      74                 :            : 
      75                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >
      76                 :            :         getLangNodeFromRootNode( ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& root, ::rtl::OUString& language );
      77                 :            :     void delUserData( SvLBoxEntry* pEntry );
      78                 :            : 
      79                 :            :     ::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 );
      80                 :            : 
      81                 :            : protected:
      82                 :            :     void                    ExpandTree( SvLBoxEntry* pRootEntry );
      83                 :            :     virtual void            RequestingChildren( SvLBoxEntry* pParent );
      84                 :            :     virtual void            ExpandedHdl();
      85                 :            :     virtual long            ExpandingHdl();
      86                 :            : public:
      87                 :            :     void                    Init( const ::rtl::OUString& language );
      88                 :            :     void  RequestSubEntries(  SvLBoxEntry* pRootEntry, ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& node,
      89                 :            :                               ::com::sun::star::uno::Reference< com::sun::star::frame::XModel>& model  );
      90                 :            :                     SFTreeListBox( Window* pParent, const ResId& rRes );
      91                 :            :                     ~SFTreeListBox();
      92                 :            : 
      93                 :            :     void            ExpandAllTrees();
      94                 :            : 
      95                 :            : 
      96                 :            : 
      97                 :            :     SvLBoxEntry * insertEntry(String const & rText, sal_uInt16 nBitmap,
      98                 :            :                               SvLBoxEntry * pParent,
      99                 :            :                               bool bChildrenOnDemand,
     100                 :            :                               std::auto_ptr< SFEntry > aUserData,
     101                 :            :                               ::rtl::OUString factoryURL );
     102                 :            :     SvLBoxEntry * insertEntry(String const & rText, sal_uInt16 nBitmap,
     103                 :            :                               SvLBoxEntry * pParent,
     104                 :            :                               bool bChildrenOnDemand,
     105                 :            :                               std::auto_ptr< SFEntry > aUserData );
     106                 :            :     void deleteTree( SvLBoxEntry * pEntry );
     107                 :            :     void deleteAllTree( );
     108                 :            : };
     109                 :            : 
     110                 :            : class InputDialog : public ModalDialog
     111                 :            : {
     112                 :            : private:
     113                 :            :     FixedText       aText;
     114                 :            :     Edit            aEdit;
     115                 :            :     OKButton        aOKButton;
     116                 :            :     CancelButton    aCancelButton;
     117                 :            : 
     118                 :            : public:
     119                 :            :     InputDialog( Window * pParent, sal_uInt16 nMode );
     120                 :            :                 ~InputDialog();
     121                 :            : 
     122                 :          0 :     String      GetObjectName() const { return aEdit.GetText(); }
     123         [ #  # ]:          0 :     void        SetObjectName( const String& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.Len() ) );}
     124                 :            : };
     125                 :            : 
     126                 :            : class SFEntry
     127                 :            : {
     128                 :            : private:
     129                 :            :     sal_uInt8           nType;
     130                 :            :     bool            loaded;
     131                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > nodes;
     132                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > model;
     133                 :            :     SFEntry(){}
     134                 :            : public:
     135                 :            :                     SFEntry( sal_uInt8 nT )             { nType = nT; loaded=false; }
     136                 :          0 :                     SFEntry( sal_uInt8 nT,
     137                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& entryNodes ,
     138 [ #  # ][ #  # ]:          0 :                             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& entryModel) { nType = nT; nodes = entryNodes; loaded=false; model = entryModel; }
     139                 :            :                     SFEntry( const SFEntry& r ) { nType = r.nType; nodes = r.nodes; loaded = r.loaded; }
     140         [ #  # ]:          0 :     virtual         ~SFEntry() {}
     141                 :          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > GetNode() { return nodes ;}
     142                 :          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetModel() { return model ;};
     143                 :            :     sal_uInt8           GetType() const                     { return nType; }
     144                 :          0 :     bool            isLoaded() const                    { return loaded; }
     145                 :          0 :     void            setLoaded()                         { loaded=true; }
     146                 :            : };
     147                 :            : 
     148                 :            : class SvxScriptOrgDialog : public SfxModalDialog
     149                 :            : {
     150                 :            : protected:
     151                 :            :     FixedText               aScriptsTxt;
     152                 :            :     SFTreeListBox           aScriptsBox;
     153                 :            : 
     154                 :            :     PushButton              aRunButton;
     155                 :            :     CancelButton            aCloseButton;
     156                 :            :     PushButton              aCreateButton;
     157                 :            :     PushButton              aEditButton;
     158                 :            :     PushButton              aRenameButton;
     159                 :            :     PushButton              aDelButton;
     160                 :            :     HelpButton              aHelpButton;
     161                 :            : 
     162                 :            :     ::rtl::OUString         m_sLanguage;
     163                 :            :     static Selection_hash   m_lastSelection;
     164                 :            :     const String m_delErrStr;
     165                 :            :     const String m_delErrTitleStr;
     166                 :            :     const String m_delQueryStr;
     167                 :            :     const String m_delQueryTitleStr;
     168                 :            :     const String m_createErrStr;
     169                 :            :     const String m_createDupStr;
     170                 :            :     const String m_createErrTitleStr;
     171                 :            :     const String m_renameErrStr;
     172                 :            :     const String m_renameDupStr;
     173                 :            :     const String m_renameErrTitleStr;
     174                 :            : 
     175                 :            :     DECL_LINK( MacroSelectHdl, SvTreeListBox * );
     176                 :            :     DECL_LINK( ScriptSelectHdl, SvTreeListBox * );
     177                 :            :     DECL_LINK( ButtonHdl, Button * );
     178                 :            :     sal_Bool                getBoolProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xProps, ::rtl::OUString& propName );
     179                 :            :     void                CheckButtons(  ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& node );
     180                 :            : 
     181                 :            : 
     182                 :            :     void        createEntry( SvLBoxEntry* pEntry );
     183                 :            :     void        renameEntry( SvLBoxEntry* pEntry );
     184                 :            :     void        deleteEntry( SvLBoxEntry* pEntry );
     185                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >
     186                 :            :                 getBrowseNode( SvLBoxEntry* pEntry );
     187                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel( SvLBoxEntry* pEntry );
     188                 :            :     String      getListOfChildren( ::com::sun::star::uno::Reference< com::sun::star::script::browse::XBrowseNode > node, int depth );
     189                 :            :     void        StoreCurrentSelection();
     190                 :            :     void        RestorePreviousSelection();
     191                 :            : 
     192                 :            : public:
     193                 :            :                     // prob need another arg in the ctor
     194                 :            :                     // to specify the language or provider
     195                 :            :                     SvxScriptOrgDialog( Window* pParent, ::rtl::OUString language );
     196                 :            :                     ~SvxScriptOrgDialog();
     197                 :            : 
     198                 :            :     virtual short   Execute();
     199                 :            : 
     200                 :            : };
     201                 :            : 
     202                 :            : class SvxScriptErrorDialog : public VclAbstractDialog
     203                 :            : {
     204                 :            : private:
     205                 :            : 
     206                 :            :     ::rtl::OUString m_sMessage;
     207                 :            : 
     208                 :            :     DECL_LINK( ShowDialog, ::rtl::OUString* );
     209                 :            : 
     210                 :            : public:
     211                 :            : 
     212                 :            :     SvxScriptErrorDialog(
     213                 :            :         Window* parent, ::com::sun::star::uno::Any aException );
     214                 :            : 
     215                 :            :     ~SvxScriptErrorDialog();
     216                 :            : 
     217                 :            :     short           Execute();
     218                 :            : };
     219                 :            : 
     220                 :            : #endif // _SCRIPTDLG_HXX
     221                 :            : 
     222                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10