LCOV - code coverage report
Current view: top level - cui/source/dialogs - scriptdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 49 749 6.5 %
Date: 2012-08-25 Functions: 10 54 18.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 42 1805 2.3 %

           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                 :            : #include <memory>
      30                 :            : 
      31                 :            : #include <sfx2/objsh.hxx>
      32                 :            : #include <vcl/svapp.hxx>
      33                 :            : #include <vcl/msgbox.hxx>
      34                 :            : #include <osl/mutex.hxx>
      35                 :            : 
      36                 :            : #include <cuires.hrc>
      37                 :            : #include "scriptdlg.hrc"
      38                 :            : #include "scriptdlg.hxx"
      39                 :            : #include <dialmgr.hxx>
      40                 :            : #include "selector.hxx"
      41                 :            : 
      42                 :            : #include <com/sun/star/uno/XComponentContext.hpp>
      43                 :            : #include <com/sun/star/frame/XDesktop.hpp>
      44                 :            : #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
      45                 :            : #include <com/sun/star/script/provider/XScriptProvider.hpp>
      46                 :            : #include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
      47                 :            : #include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
      48                 :            : #include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
      49                 :            : #include <com/sun/star/script/provider/ScriptErrorRaisedException.hpp>
      50                 :            : #include <com/sun/star/script/provider/ScriptExceptionRaisedException.hpp>
      51                 :            : #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp>
      52                 :            : #include <com/sun/star/frame/XModuleManager.hpp>
      53                 :            : #include <com/sun/star/script/XInvocation.hpp>
      54                 :            : #include <com/sun/star/document/XEmbeddedScripts.hpp>
      55                 :            : 
      56                 :            : #include <cppuhelper/implbase1.hxx>
      57                 :            : #include <comphelper/documentinfo.hxx>
      58                 :            : #include <comphelper/uno3.hxx>
      59                 :            : #include <comphelper/processfactory.hxx>
      60                 :            : #include <comphelper/broadcasthelper.hxx>
      61                 :            : #include <comphelper/propertycontainer.hxx>
      62                 :            : #include <comphelper/proparrhlp.hxx>
      63                 :            : 
      64                 :            : #include <basic/sbx.hxx>
      65                 :            : #include <svtools/imagemgr.hxx>
      66                 :            : #include <tools/urlobj.hxx>
      67                 :            : #include <vector>
      68                 :            : #include <algorithm>
      69                 :            : 
      70                 :            : using namespace ::com::sun::star;
      71                 :            : using namespace ::com::sun::star::uno;
      72                 :            : using namespace ::com::sun::star::script;
      73                 :            : using namespace ::com::sun::star::frame;
      74                 :            : using namespace ::com::sun::star::document;
      75                 :            : 
      76                 :          0 : void ShowErrorDialog( const Any& aException )
      77                 :            : {
      78 [ #  # ][ #  # ]:          0 :     SvxScriptErrorDialog* pDlg = new SvxScriptErrorDialog( NULL, aException );
      79                 :          0 :     pDlg->Execute();
      80         [ #  # ]:          0 :     delete pDlg;
      81                 :          0 : }
      82                 :            : 
      83                 :          0 : SFTreeListBox::SFTreeListBox( Window* pParent, const ResId& rResId ) :
      84                 :          0 :     SvTreeListBox( pParent, ResId( rResId.GetId(),*rResId.GetResMgr() ) ),
      85                 :          0 :     m_hdImage(ResId(IMG_HARDDISK,*rResId.GetResMgr())),
      86                 :          0 :     m_libImage(ResId(IMG_LIB,*rResId.GetResMgr())),
      87                 :          0 :     m_macImage(ResId(IMG_MACRO,*rResId.GetResMgr())),
      88                 :          0 :     m_docImage(ResId(IMG_DOCUMENT,*rResId.GetResMgr())),
      89                 :          0 :     m_sMyMacros(String(ResId(STR_MYMACROS,*rResId.GetResMgr()))),
      90 [ #  # ][ #  # ]:          0 :     m_sProdMacros(String(ResId(STR_PRODMACROS,*rResId.GetResMgr())))
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
          #  #  #  #  #  
             #  #  #  #  
                      # ]
      91                 :            : {
      92         [ #  # ]:          0 :     FreeResource();
      93         [ #  # ]:          0 :     SetSelectionMode( SINGLE_SELECTION );
      94                 :            : 
      95         [ #  # ]:          0 :     SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL |
      96                 :            :                    WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HIDESELECTION |
      97         [ #  # ]:          0 :                    WB_HASLINES | WB_HASLINESATROOT );
      98         [ #  # ]:          0 :     SetNodeDefaultImages();
      99                 :            : 
     100                 :          0 :     nMode = 0xFF;    // everything
     101                 :          0 : }
     102                 :            : 
     103 [ #  # ][ #  # ]:          0 : SFTreeListBox::~SFTreeListBox()
         [ #  # ][ #  # ]
     104                 :            : {
     105         [ #  # ]:          0 :     deleteAllTree();
     106         [ #  # ]:          0 : }
     107                 :            : 
     108                 :          0 : void SFTreeListBox::delUserData( SvLBoxEntry* pEntry )
     109                 :            : {
     110         [ #  # ]:          0 :     if ( pEntry )
     111                 :            :     {
     112                 :            : 
     113         [ #  # ]:          0 :         String text = GetEntryText( pEntry );
     114                 :          0 :         SFEntry* pUserData = (SFEntry*)pEntry->GetUserData();
     115         [ #  # ]:          0 :         if ( pUserData )
     116                 :            :         {
     117 [ #  # ][ #  # ]:          0 :             delete pUserData;
     118                 :            :             // TBD seem to get a Select event on node that is remove ( below )
     119                 :            :             // so need to be able to detect that this node is not to be
     120                 :            :             // processed in order to do this, setting userData to NULL ( must
     121                 :            :             // be a better way to do this )
     122                 :          0 :             pUserData = 0;
     123                 :          0 :             pEntry->SetUserData( pUserData );
     124         [ #  # ]:          0 :         }
     125                 :            :     }
     126                 :          0 : }
     127                 :            : 
     128                 :          0 : void SFTreeListBox::deleteTree( SvLBoxEntry* pEntry )
     129                 :            : {
     130                 :            : 
     131                 :          0 :     delUserData( pEntry );
     132                 :          0 :     pEntry = FirstChild( pEntry );
     133         [ #  # ]:          0 :     while ( pEntry )
     134                 :            :     {
     135                 :          0 :         SvLBoxEntry* pNextEntry = NextSibling( pEntry );
     136                 :          0 :         deleteTree( pEntry );
     137                 :          0 :         GetModel()->Remove( pEntry );
     138                 :          0 :         pEntry = pNextEntry;
     139                 :            :     }
     140                 :          0 : }
     141                 :            : 
     142                 :          0 : void SFTreeListBox::deleteAllTree()
     143                 :            : {
     144                 :          0 :     SvLBoxEntry* pEntry =  GetEntry( 0 );
     145                 :            : 
     146                 :            :     // TBD - below is a candidate for a destroyAllTrees method
     147         [ #  # ]:          0 :     if ( pEntry )
     148                 :            :     {
     149         [ #  # ]:          0 :         while ( pEntry )
     150                 :            :         {
     151         [ #  # ]:          0 :             String text = GetEntryText( pEntry );
     152         [ #  # ]:          0 :             SvLBoxEntry* pNextEntry = NextSibling( pEntry ) ;
     153         [ #  # ]:          0 :             deleteTree( pEntry );
     154         [ #  # ]:          0 :             GetModel()->Remove( pEntry );
     155                 :          0 :             pEntry = pNextEntry;
     156         [ #  # ]:          0 :         }
     157                 :            :     }
     158                 :          0 : }
     159                 :            : 
     160                 :          0 : void SFTreeListBox::Init( const ::rtl::OUString& language  )
     161                 :            : {
     162         [ #  # ]:          0 :     SetUpdateMode( sal_False );
     163                 :            : 
     164         [ #  # ]:          0 :     deleteAllTree();
     165                 :            : 
     166                 :          0 :     Reference< browse::XBrowseNode > rootNode;
     167                 :          0 :     Reference< XComponentContext > xCtx;
     168                 :            : 
     169         [ #  # ]:          0 :     Sequence< Reference< browse::XBrowseNode > > children;
     170                 :            : 
     171         [ #  # ]:          0 :     ::rtl::OUString userStr( RTL_CONSTASCII_USTRINGPARAM("user") );
     172         [ #  # ]:          0 :     ::rtl::OUString shareStr( RTL_CONSTASCII_USTRINGPARAM("share") );
     173                 :            : 
     174         [ #  # ]:          0 :     ::rtl::OUString singleton( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.script.browse.theBrowseNodeFactory" ) );
     175                 :            : 
     176                 :            :     try
     177                 :            :     {
     178                 :            :         Reference < beans::XPropertySet > xProps(
     179 [ #  # ][ #  # ]:          0 :             ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
     180                 :            : 
     181         [ #  # ]:          0 :         xCtx.set( xProps->getPropertyValue( rtl::OUString(
     182 [ #  # ][ #  # ]:          0 :             RTL_CONSTASCII_USTRINGPARAM("DefaultContext" ))), UNO_QUERY_THROW );
                 [ #  # ]
     183                 :            : 
     184                 :            :         Reference< browse::XBrowseNodeFactory > xFac(
     185 [ #  # ][ #  # ]:          0 :             xCtx->getValueByName( singleton ), UNO_QUERY_THROW );
                 [ #  # ]
     186                 :            : 
     187         [ #  # ]:          0 :         rootNode.set( xFac->createView(
     188 [ #  # ][ #  # ]:          0 :             browse::BrowseNodeFactoryViewTypes::MACROORGANIZER ) );
     189                 :            : 
     190 [ #  # ][ #  # ]:          0 :         if (  rootNode.is() && rootNode->hasChildNodes() == sal_True )
         [ #  # ][ #  # ]
                 [ #  # ]
     191                 :            :         {
     192 [ #  # ][ #  # ]:          0 :             children = rootNode->getChildNodes();
         [ #  # ][ #  # ]
     193         [ #  # ]:          0 :         }
     194                 :            :     }
     195         [ #  # ]:          0 :     catch( Exception& e )
     196                 :            :     {
     197                 :            :         OSL_TRACE("Exception getting root browse node from factory: %s",
     198                 :            :             ::rtl::OUStringToOString(
     199                 :            :                 e.Message , RTL_TEXTENCODING_ASCII_US ).pData->buffer );
     200                 :            :         // TODO exception handling
     201                 :            :     }
     202                 :            : 
     203                 :          0 :     Reference<XModel> xDocumentModel;
     204         [ #  # ]:          0 :     for ( sal_Int32 n = 0; n < children.getLength(); n++ )
     205                 :            :     {
     206                 :          0 :         bool app = false;
     207 [ #  # ][ #  # ]:          0 :         ::rtl::OUString uiName = children[ n ]->getName();
                 [ #  # ]
     208                 :          0 :         ::rtl::OUString factoryURL;
     209 [ #  # ][ #  # ]:          0 :         if ( uiName.equals( userStr ) || uiName.equals( shareStr ) )
                 [ #  # ]
     210                 :            :         {
     211                 :          0 :             app = true;
     212         [ #  # ]:          0 :             if ( uiName.equals( userStr ) )
     213                 :            :             {
     214                 :          0 :                 uiName = m_sMyMacros;
     215                 :            :             }
     216                 :            :             else
     217                 :            :             {
     218                 :          0 :                 uiName = m_sProdMacros;
     219                 :            :             }
     220                 :            :         }
     221                 :            :         else
     222                 :            :         {
     223 [ #  # ][ #  # ]:          0 :             xDocumentModel.set(getDocumentModel(xCtx, uiName ), UNO_QUERY);
     224                 :            : 
     225         [ #  # ]:          0 :             if ( xDocumentModel.is() )
     226                 :            :             {
     227                 :            :                 Reference< ::com::sun::star::frame::XModuleManager >
     228 [ #  # ][ #  # ]:          0 :                     xModuleManager( xCtx->getServiceManager()->createInstanceWithContext(
                 [ #  # ]
     229                 :          0 :                         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager") ), xCtx ),
     230 [ #  # ][ #  # ]:          0 :                                     UNO_QUERY_THROW );
                 [ #  # ]
     231                 :            : 
     232                 :            :                 Reference<container::XNameAccess> xModuleConfig(
     233         [ #  # ]:          0 :                     xModuleManager, UNO_QUERY_THROW );
     234                 :            :                 // get the long name of the document:
     235         [ #  # ]:          0 :                 Sequence<beans::PropertyValue> moduleDescr;
     236                 :            :                 try{
     237 [ #  # ][ #  # ]:          0 :                     ::rtl::OUString appModule = xModuleManager->identify( xDocumentModel );
     238 [ #  # ][ #  # ]:          0 :                     xModuleConfig->getByName(appModule) >>= moduleDescr;
         [ #  # ][ #  # ]
     239         [ #  # ]:          0 :                 } catch(const uno::Exception&)
     240                 :            :                     {}
     241                 :            : 
     242                 :            :                 beans::PropertyValue const * pmoduleDescr =
     243                 :          0 :                     moduleDescr.getConstArray();
     244         [ #  # ]:          0 :                 for ( sal_Int32 pos = moduleDescr.getLength(); pos--; )
     245                 :            :                 {
     246         [ #  # ]:          0 :                     if ( pmoduleDescr[ pos ].Name == "ooSetupFactoryEmptyDocumentURL" )
     247                 :            :                     {
     248                 :          0 :                         pmoduleDescr[ pos ].Value >>= factoryURL;
     249                 :          0 :                         break;
     250                 :            :                     }
     251         [ #  # ]:          0 :                 }
     252                 :            :             }
     253                 :            :         }
     254                 :            : 
     255                 :          0 :         ::rtl::OUString lang( language );
     256                 :            :         Reference< browse::XBrowseNode > langEntries =
     257 [ #  # ][ #  # ]:          0 :             getLangNodeFromRootNode( children[ n ], lang );
     258                 :            : 
     259                 :            :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     260                 :            :         insertEntry( uiName, app ? IMG_HARDDISK : IMG_DOCUMENT,
     261 [ #  # ][ #  # ]:          0 :             0, true, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SFROOT, langEntries, xDocumentModel )), factoryURL );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     262                 :            :         SAL_WNODEPRECATED_DECLARATIONS_POP
     263                 :          0 :     }
     264                 :            : 
     265 [ #  # ][ #  # ]:          0 :     SetUpdateMode( sal_True );
     266                 :          0 : }
     267                 :            : 
     268                 :            : Reference< XInterface  >
     269                 :          0 : SFTreeListBox::getDocumentModel( Reference< XComponentContext >& xCtx, ::rtl::OUString& docName )
     270                 :            : {
     271                 :          0 :     Reference< XInterface > xModel;
     272                 :            :     Reference< lang::XMultiComponentFactory > mcf =
     273 [ #  # ][ #  # ]:          0 :             xCtx->getServiceManager();
     274                 :            :     Reference< frame::XDesktop > desktop (
     275         [ #  # ]:          0 :         mcf->createInstanceWithContext(
     276                 :          0 :             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ),                 xCtx ),
     277 [ #  # ][ #  # ]:          0 :             UNO_QUERY );
                 [ #  # ]
     278                 :            : 
     279                 :            :     Reference< container::XEnumerationAccess > componentsAccess =
     280 [ #  # ][ #  # ]:          0 :         desktop->getComponents();
     281                 :            :     Reference< container::XEnumeration > components =
     282 [ #  # ][ #  # ]:          0 :         componentsAccess->createEnumeration();
     283 [ #  # ][ #  # ]:          0 :     while (components->hasMoreElements())
                 [ #  # ]
     284                 :            :     {
     285                 :            :         Reference< frame::XModel > model(
     286 [ #  # ][ #  # ]:          0 :             components->nextElement(), UNO_QUERY );
                 [ #  # ]
     287         [ #  # ]:          0 :         if ( model.is() )
     288                 :            :         {
     289         [ #  # ]:          0 :             ::rtl::OUString sTdocUrl = ::comphelper::DocumentInfo::getDocumentTitle( model );
     290         [ #  # ]:          0 :             if( sTdocUrl.equals( docName ) )
     291                 :            :             {
     292         [ #  # ]:          0 :                 xModel = model;
     293                 :            :                 break;
     294         [ #  # ]:          0 :             }
     295                 :            :         }
     296         [ #  # ]:          0 :     }
     297                 :          0 :     return xModel;
     298                 :            : }
     299                 :            : 
     300                 :            : Reference< browse::XBrowseNode >
     301                 :          0 : SFTreeListBox::getLangNodeFromRootNode( Reference< browse::XBrowseNode >& rootNode, ::rtl::OUString& language )
     302                 :            : {
     303                 :          0 :     Reference< browse::XBrowseNode > langNode;
     304                 :            : 
     305                 :            :     try
     306                 :            :     {
     307 [ #  # ][ #  # ]:          0 :         Sequence < Reference< browse::XBrowseNode > > children = rootNode->getChildNodes();
     308         [ #  # ]:          0 :         for ( sal_Int32 n = 0; n < children.getLength(); n++ )
     309                 :            :         {
     310 [ #  # ][ #  # ]:          0 :             if ( children[ n ]->getName().equals( language ) )
         [ #  # ][ #  # ]
     311                 :            :             {
     312 [ #  # ][ #  # ]:          0 :                 langNode = children[ n ];
     313                 :          0 :                 break;
     314                 :            :             }
     315 [ #  # ][ #  # ]:          0 :         }
     316                 :            :     }
     317         [ #  # ]:          0 :     catch ( Exception& )
     318                 :            :     {
     319                 :            :         // if getChildNodes() throws an exception we just return
     320                 :            :         // the empty Reference
     321                 :            :     }
     322                 :          0 :     return langNode;
     323                 :            : }
     324                 :            : 
     325                 :          0 : void SFTreeListBox:: RequestSubEntries( SvLBoxEntry* pRootEntry, Reference< ::com::sun::star::script::browse::XBrowseNode >& node,
     326                 :            :                                        Reference< XModel >& model )
     327                 :            : {
     328         [ #  # ]:          0 :     if (! node.is() )
     329                 :            :     {
     330                 :          0 :         return;
     331                 :            :     }
     332                 :            : 
     333         [ #  # ]:          0 :     Sequence< Reference< browse::XBrowseNode > > children;
     334                 :            :     try
     335                 :            :     {
     336 [ #  # ][ #  # ]:          0 :         children = node->getChildNodes();
         [ #  # ][ #  # ]
                 [ #  # ]
     337                 :            :     }
     338         [ #  # ]:          0 :     catch ( Exception& )
     339                 :            :     {
     340                 :            :         // if we catch an exception in getChildNodes then no entries are added
     341                 :            :     }
     342                 :            : 
     343         [ #  # ]:          0 :     for ( sal_Int32 n = 0; n < children.getLength(); n++ )
     344                 :            :     {
     345 [ #  # ][ #  # ]:          0 :         ::rtl::OUString name( children[ n ]->getName() );
                 [ #  # ]
     346 [ #  # ][ #  # ]:          0 :         if (  children[ n ]->getType() !=  browse::BrowseNodeTypes::SCRIPT)
         [ #  # ][ #  # ]
     347                 :            :         {
     348                 :            :             SAL_WNODEPRECATED_DECLARATIONS_PUSH
     349 [ #  # ][ #  # ]:          0 :             insertEntry( name, IMG_LIB, pRootEntry, true, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SCRIPTCONTAINER, children[ n ],model )));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     350                 :            :             SAL_WNODEPRECATED_DECLARATIONS_POP
     351                 :            :         }
     352                 :            :         else
     353                 :            :         {
     354 [ #  # ][ #  # ]:          0 :             if ( children[ n ]->getType() == browse::BrowseNodeTypes::SCRIPT )
         [ #  # ][ #  # ]
     355                 :            :             {
     356                 :            :                 SAL_WNODEPRECATED_DECLARATIONS_PUSH
     357 [ #  # ][ #  # ]:          0 :                 insertEntry( name, IMG_MACRO, pRootEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_METHOD, children[ n ],model )));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     358                 :            :                 SAL_WNODEPRECATED_DECLARATIONS_POP
     359                 :            : 
     360                 :            :             }
     361                 :            :         }
     362         [ #  # ]:          0 :     }
     363                 :            : }
     364                 :            : 
     365                 :          0 : long SFTreeListBox::ExpandingHdl()
     366                 :            : {
     367                 :          0 :     return sal_True;
     368                 :            : }
     369                 :            : 
     370                 :          0 : void SFTreeListBox::ExpandAllTrees()
     371                 :            : {
     372                 :          0 : }
     373                 :            : 
     374                 :            : SAL_WNODEPRECATED_DECLARATIONS_PUSH
     375                 :          0 : SvLBoxEntry * SFTreeListBox::insertEntry(
     376                 :            :     String const & rText, sal_uInt16 nBitmap, SvLBoxEntry * pParent,
     377                 :            :     bool bChildrenOnDemand, std::auto_ptr< SFEntry > aUserData, ::rtl::OUString factoryURL )
     378                 :            : {
     379                 :            :     SvLBoxEntry * p;
     380 [ #  # ][ #  # ]:          0 :     if( nBitmap == IMG_DOCUMENT && !factoryURL.isEmpty() )
                 [ #  # ]
     381                 :            :     {
     382 [ #  # ][ #  # ]:          0 :         Image aImage = SvFileInformationManager::GetFileImage( INetURLObject(factoryURL), false );
                 [ #  # ]
     383                 :            :         p = InsertEntry(
     384                 :            :             rText, aImage, aImage, pParent, bChildrenOnDemand, LIST_APPEND,
     385 [ #  # ][ #  # ]:          0 :             aUserData.release()); // XXX possible leak
     386                 :            :     }
     387                 :            :     else
     388                 :            :     {
     389         [ #  # ]:          0 :         p = insertEntry( rText, nBitmap, pParent, bChildrenOnDemand, aUserData );
     390                 :            :     }
     391                 :          0 :     return p;
     392                 :            : }
     393                 :            : SAL_WNODEPRECATED_DECLARATIONS_POP
     394                 :            : 
     395                 :            : SAL_WNODEPRECATED_DECLARATIONS_PUSH
     396                 :          0 : SvLBoxEntry * SFTreeListBox::insertEntry(
     397                 :            :     String const & rText, sal_uInt16 nBitmap, SvLBoxEntry * pParent,
     398                 :            :     bool bChildrenOnDemand, std::auto_ptr< SFEntry > aUserData )
     399                 :            : {
     400         [ #  # ]:          0 :     Image aImage;
     401         [ #  # ]:          0 :     if( nBitmap == IMG_HARDDISK )
     402                 :            :     {
     403         [ #  # ]:          0 :         aImage = m_hdImage;
     404                 :            :     }
     405         [ #  # ]:          0 :     else if( nBitmap == IMG_LIB )
     406                 :            :     {
     407         [ #  # ]:          0 :         aImage = m_libImage;
     408                 :            :     }
     409         [ #  # ]:          0 :     else if( nBitmap == IMG_MACRO )
     410                 :            :     {
     411         [ #  # ]:          0 :         aImage = m_macImage;
     412                 :            :     }
     413         [ #  # ]:          0 :     else if( nBitmap == IMG_DOCUMENT )
     414                 :            :     {
     415         [ #  # ]:          0 :         aImage = m_docImage;
     416                 :            :     }
     417                 :            :     SvLBoxEntry * p = InsertEntry(
     418                 :            :         rText, aImage, aImage, pParent, bChildrenOnDemand, LIST_APPEND,
     419         [ #  # ]:          0 :         aUserData.release()); // XXX possible leak
     420         [ #  # ]:          0 :    return p;
     421                 :            : }
     422                 :            : SAL_WNODEPRECATED_DECLARATIONS_POP
     423                 :            : 
     424                 :          0 : void SFTreeListBox::RequestingChildren( SvLBoxEntry* pEntry )
     425                 :            : {
     426                 :          0 :     SFEntry* userData = 0;
     427         [ #  # ]:          0 :     if ( !pEntry )
     428                 :            :     {
     429                 :          0 :         return;
     430                 :            :     }
     431                 :          0 :     userData = (SFEntry*)pEntry->GetUserData();
     432                 :            : 
     433                 :          0 :     Reference< browse::XBrowseNode > node;
     434                 :          0 :     Reference< XModel > model;
     435 [ #  # ][ #  # ]:          0 :     if ( userData && !userData->isLoaded() )
                 [ #  # ]
     436                 :            :     {
     437 [ #  # ][ #  # ]:          0 :         node = userData->GetNode();
     438 [ #  # ][ #  # ]:          0 :         model = userData->GetModel();
     439         [ #  # ]:          0 :         RequestSubEntries( pEntry, node, model );
     440                 :          0 :         userData->setLoaded();
     441                 :          0 :     }
     442                 :            : }
     443                 :            : 
     444                 :          0 : void SFTreeListBox::ExpandedHdl()
     445                 :            : {
     446                 :          0 : }
     447                 :            : 
     448                 :            : // ----------------------------------------------------------------------------
     449                 :            : // InputDialog ------------------------------------------------------------
     450                 :            : // ----------------------------------------------------------------------------
     451                 :          0 : InputDialog::InputDialog(Window * pParent, sal_uInt16 nMode )
     452                 :          0 :     : ModalDialog( pParent, CUI_RES( RID_DLG_NEWLIB ) ),
     453         [ #  # ]:          0 :         aText( this, CUI_RES( FT_NEWLIB ) ),
     454         [ #  # ]:          0 :         aEdit( this, CUI_RES( ED_LIBNAME ) ),
     455         [ #  # ]:          0 :         aOKButton( this, CUI_RES( PB_OK ) ),
     456 [ #  # ][ #  # ]:          0 :         aCancelButton( this, CUI_RES( PB_CANCEL ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     457                 :            : {
     458         [ #  # ]:          0 :     aEdit.GrabFocus();
     459         [ #  # ]:          0 :     if ( nMode == INPUTMODE_NEWLIB )
     460                 :            :     {
     461 [ #  # ][ #  # ]:          0 :         SetText( String( CUI_RES( STR_NEWLIB ) ) );
         [ #  # ][ #  # ]
     462                 :            :     }
     463         [ #  # ]:          0 :     else if ( nMode == INPUTMODE_NEWMACRO )
     464                 :            :     {
     465 [ #  # ][ #  # ]:          0 :         SetText( String( CUI_RES( STR_NEWMACRO ) ) );
         [ #  # ][ #  # ]
     466 [ #  # ][ #  # ]:          0 :         aText.SetText( String( CUI_RES( STR_FT_NEWMACRO ) ) );
         [ #  # ][ #  # ]
     467                 :            :     }
     468         [ #  # ]:          0 :     else if ( nMode == INPUTMODE_RENAME )
     469                 :            :     {
     470 [ #  # ][ #  # ]:          0 :         SetText( String( CUI_RES( STR_RENAME ) ) );
         [ #  # ][ #  # ]
     471 [ #  # ][ #  # ]:          0 :         aText.SetText( String( CUI_RES( STR_FT_RENAME ) ) );
         [ #  # ][ #  # ]
     472                 :            :     }
     473         [ #  # ]:          0 :     FreeResource();
     474                 :            : 
     475                 :            :     // some resizing so that the text fits
     476                 :          0 :     Point point, newPoint;
     477                 :          0 :     Size siz, newSiz;
     478                 :            :     long gap;
     479                 :            : 
     480                 :            :     sal_uInt16 style = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP |
     481                 :          0 :                    TEXT_DRAW_LEFT | TEXT_DRAW_WORDBREAK;
     482                 :            : 
     483                 :            :     // get dimensions of dialog instructions control
     484         [ #  # ]:          0 :     point = aText.GetPosPixel();
     485         [ #  # ]:          0 :     siz = aText.GetSizePixel();
     486                 :            : 
     487                 :            :     // get dimensions occupied by text in the control
     488                 :            :     Rectangle rect =
     489 [ #  # ][ #  # ]:          0 :         GetTextRect( Rectangle( point, siz ), aText.GetText(), style );
         [ #  # ][ #  # ]
     490         [ #  # ]:          0 :     newSiz = rect.GetSize();
     491                 :            : 
     492                 :            :     // the gap is the difference between the text width and its control width
     493                 :          0 :     gap = siz.Height() - newSiz.Height();
     494                 :            : 
     495                 :            :     //resize the text field
     496                 :          0 :     newSiz = Size( siz.Width(), siz.Height() - gap );
     497         [ #  # ]:          0 :     aText.SetSizePixel( newSiz );
     498                 :            : 
     499                 :            :     //move the OK & cancel buttons
     500         [ #  # ]:          0 :     point = aEdit.GetPosPixel();
     501                 :          0 :     newPoint = Point( point.X(), point.Y() - gap );
     502         [ #  # ]:          0 :     aEdit.SetPosPixel( newPoint );
     503                 :            : 
     504                 :          0 : }
     505                 :            : 
     506 [ #  # ][ #  # ]:          0 : InputDialog::~InputDialog()
         [ #  # ][ #  # ]
     507                 :            : {
     508         [ #  # ]:          0 : }
     509                 :            : // ----------------------------------------------------------------------------
     510                 :            : // ScriptOrgDialog ------------------------------------------------------------
     511                 :            : // ----------------------------------------------------------------------------
     512                 :          0 : SvxScriptOrgDialog::SvxScriptOrgDialog( Window* pParent, ::rtl::OUString language )
     513                 :          0 :     :    SfxModalDialog( pParent, CUI_RES( RID_DLG_SCRIPTORGANIZER ) ),
     514         [ #  # ]:          0 :         aScriptsTxt( this, CUI_RES( SF_TXT_SCRIPTS ) ),
     515         [ #  # ]:          0 :         aScriptsBox( this, CUI_RES( SF_CTRL_SCRIPTSBOX ) ),
     516         [ #  # ]:          0 :         aRunButton(    this, CUI_RES( SF_PB_RUN ) ),
     517         [ #  # ]:          0 :         aCloseButton( this, CUI_RES( SF_PB_CLOSE ) ),
     518         [ #  # ]:          0 :         aCreateButton( this, CUI_RES( SF_PB_CREATE ) ),
     519         [ #  # ]:          0 :         aEditButton( this, CUI_RES( SF_PB_EDIT ) ),
     520         [ #  # ]:          0 :         aRenameButton(this, CUI_RES( SF_PB_RENAME ) ),
     521         [ #  # ]:          0 :         aDelButton(    this, CUI_RES( SF_PB_DEL ) ),
     522         [ #  # ]:          0 :         aHelpButton( this, CUI_RES( SF_PB_HELP ) ),
     523                 :            :         m_sLanguage( language ),
     524         [ #  # ]:          0 :         m_delErrStr( CUI_RES( RID_SVXSTR_DELFAILED ) ),
     525         [ #  # ]:          0 :         m_delErrTitleStr( CUI_RES( RID_SVXSTR_DELFAILED_TITLE ) ),
     526         [ #  # ]:          0 :         m_delQueryStr( CUI_RES( RID_SVXSTR_DELQUERY ) ),
     527         [ #  # ]:          0 :         m_delQueryTitleStr( CUI_RES( RID_SVXSTR_DELQUERY_TITLE ) ) ,
     528         [ #  # ]:          0 :         m_createErrStr( CUI_RES ( RID_SVXSTR_CREATEFAILED ) ),
     529         [ #  # ]:          0 :         m_createDupStr( CUI_RES ( RID_SVXSTR_CREATEFAILEDDUP ) ),
     530         [ #  # ]:          0 :         m_createErrTitleStr( CUI_RES( RID_SVXSTR_CREATEFAILED_TITLE ) ),
     531         [ #  # ]:          0 :         m_renameErrStr( CUI_RES ( RID_SVXSTR_RENAMEFAILED ) ),
     532 [ #  # ][ #  # ]:          0 :         m_renameErrTitleStr( CUI_RES( RID_SVXSTR_RENAMEFAILED_TITLE ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     533                 :            : {
     534                 :            : 
     535                 :            :     // must be a neater way to deal with the strings than as above
     536                 :            :     // append the language to the dialog title
     537         [ #  # ]:          0 :     String winTitle( GetText() );
     538 [ #  # ][ #  # ]:          0 :     winTitle.SearchAndReplace( rtl::OUString( "%MACROLANG" ), m_sLanguage );
         [ #  # ][ #  # ]
                 [ #  # ]
     539         [ #  # ]:          0 :     SetText( winTitle );
     540                 :            : 
     541         [ #  # ]:          0 :     aScriptsBox.SetSelectHdl( LINK( this, SvxScriptOrgDialog, ScriptSelectHdl ) );
     542         [ #  # ]:          0 :     aRunButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
     543         [ #  # ]:          0 :     aCloseButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
     544         [ #  # ]:          0 :     aRenameButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
     545         [ #  # ]:          0 :     aEditButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
     546         [ #  # ]:          0 :     aDelButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
     547         [ #  # ]:          0 :     aCreateButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) );
     548                 :            : 
     549         [ #  # ]:          0 :     aRunButton.Disable();
     550         [ #  # ]:          0 :     aRenameButton.Disable();
     551         [ #  # ]:          0 :     aEditButton.Disable();
     552         [ #  # ]:          0 :     aDelButton.Disable();
     553         [ #  # ]:          0 :     aCreateButton.Disable();
     554                 :            : 
     555         [ #  # ]:          0 :     aScriptsBox.Init( m_sLanguage );
     556         [ #  # ]:          0 :     RestorePreviousSelection();
     557 [ #  # ][ #  # ]:          0 :     FreeResource();
     558                 :          0 : }
     559                 :            : 
     560 [ #  # ][ #  # ]:          0 : SvxScriptOrgDialog::~SvxScriptOrgDialog()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     561                 :            : {
     562                 :            :     // clear the SelectHdl so that it isn't called during the dtor
     563         [ #  # ]:          0 :     aScriptsBox.SetSelectHdl( Link() );
     564         [ #  # ]:          0 : };
     565                 :            : 
     566                 :          0 : short SvxScriptOrgDialog::Execute()
     567                 :            : {
     568                 :            : 
     569                 :          0 :     SfxObjectShell *pDoc = SfxObjectShell::GetFirst();
     570                 :            : 
     571                 :            :     // force load of MSPs for all documents
     572         [ #  # ]:          0 :     while ( pDoc )
     573                 :            :     {
     574                 :            :         Reference< provider::XScriptProviderSupplier > xSPS =
     575                 :            :             Reference< provider::XScriptProviderSupplier >
     576 [ #  # ][ #  # ]:          0 :                                         ( pDoc->GetModel(), UNO_QUERY );
     577         [ #  # ]:          0 :         if ( xSPS.is() )
     578                 :            :         {
     579                 :            :             Reference< provider::XScriptProvider > ScriptProvider =
     580 [ #  # ][ #  # ]:          0 :             xSPS->getScriptProvider();
     581                 :            :         }
     582                 :            : 
     583         [ #  # ]:          0 :         pDoc = SfxObjectShell::GetNext(*pDoc);
     584                 :          0 :     }
     585                 :          0 :     aScriptsBox.ExpandAllTrees();
     586                 :            : 
     587                 :          0 :     Window* pPrevDlgParent = Application::GetDefDialogParent();
     588                 :          0 :     Application::SetDefDialogParent( this );
     589                 :          0 :     short nRet = ModalDialog::Execute();
     590                 :          0 :     Application::SetDefDialogParent( pPrevDlgParent );
     591                 :          0 :     return nRet;
     592                 :            : }
     593                 :            : 
     594                 :          0 : void SvxScriptOrgDialog::CheckButtons( Reference< browse::XBrowseNode >& node )
     595                 :            : {
     596         [ #  # ]:          0 :     if ( node.is() )
     597                 :            :     {
     598 [ #  # ][ #  # ]:          0 :         if ( node->getType() == browse::BrowseNodeTypes::SCRIPT)
                 [ #  # ]
     599                 :            :         {
     600         [ #  # ]:          0 :             aRunButton.Enable();
     601                 :            :         }
     602                 :            :         else
     603                 :            :         {
     604         [ #  # ]:          0 :             aRunButton.Disable();
     605                 :            :         }
     606         [ #  # ]:          0 :         Reference< beans::XPropertySet > xProps( node, UNO_QUERY );
     607                 :            : 
     608         [ #  # ]:          0 :         if ( !xProps.is() )
     609                 :            :         {
     610         [ #  # ]:          0 :             aEditButton.Disable();
     611         [ #  # ]:          0 :             aDelButton.Disable();
     612         [ #  # ]:          0 :             aCreateButton.Disable();
     613         [ #  # ]:          0 :             aRunButton.Disable();
     614                 :          0 :             return;
     615                 :            :         }
     616                 :            : 
     617                 :          0 :         ::rtl::OUString sName("Editable")  ;
     618                 :            : 
     619 [ #  # ][ #  # ]:          0 :         if ( getBoolProperty( xProps, sName ) )
     620                 :            :         {
     621         [ #  # ]:          0 :             aEditButton.Enable();
     622                 :            :         }
     623                 :            :         else
     624                 :            :         {
     625         [ #  # ]:          0 :             aEditButton.Disable();
     626                 :            :         }
     627                 :            : 
     628                 :          0 :         sName = rtl::OUString("Deletable")  ;
     629                 :            : 
     630 [ #  # ][ #  # ]:          0 :         if ( getBoolProperty( xProps, sName ) )
     631                 :            :         {
     632         [ #  # ]:          0 :             aDelButton.Enable();
     633                 :            :         }
     634                 :            :         else
     635                 :            :         {
     636         [ #  # ]:          0 :             aDelButton.Disable();
     637                 :            :         }
     638                 :            : 
     639                 :          0 :         sName = rtl::OUString("Creatable")  ;
     640                 :            : 
     641 [ #  # ][ #  # ]:          0 :         if ( getBoolProperty( xProps, sName ) )
     642                 :            :         {
     643         [ #  # ]:          0 :             aCreateButton.Enable();
     644                 :            :         }
     645                 :            :         else
     646                 :            :         {
     647         [ #  # ]:          0 :             aCreateButton.Disable();
     648                 :            :         }
     649                 :            : 
     650                 :          0 :         sName = rtl::OUString("Renamable")  ;
     651                 :            : 
     652 [ #  # ][ #  # ]:          0 :         if ( getBoolProperty( xProps, sName ) )
     653                 :            :         {
     654         [ #  # ]:          0 :             aRenameButton.Enable();
     655                 :            :         }
     656                 :            :         else
     657                 :            :         {
     658         [ #  # ]:          0 :             aRenameButton.Disable();
     659         [ #  # ]:          0 :         }
     660                 :            :     }
     661                 :            :     else
     662                 :            :     {
     663                 :            :         // no node info available, disable all configurable actions
     664                 :          0 :         aDelButton.Disable();
     665                 :          0 :         aCreateButton.Disable();
     666                 :          0 :         aEditButton.Disable();
     667                 :          0 :         aRunButton.Disable();
     668                 :          0 :         aRenameButton.Disable();
     669                 :            :     }
     670                 :            : }
     671                 :            : 
     672                 :          0 : IMPL_LINK( SvxScriptOrgDialog, ScriptSelectHdl, SvTreeListBox *, pBox )
     673                 :            : {
     674 [ #  # ][ #  # ]:          0 :     if ( !pBox->IsSelected( pBox->GetHdlEntry() ) )
     675                 :            :     {
     676                 :          0 :         return 0;
     677                 :            :     }
     678                 :            : 
     679                 :          0 :     SvLBoxEntry* pEntry = pBox->GetHdlEntry();
     680                 :            : 
     681                 :          0 :     SFEntry* userData = 0;
     682         [ #  # ]:          0 :     if ( !pEntry )
     683                 :            :     {
     684                 :          0 :         return 0;
     685                 :            :     }
     686                 :          0 :     userData = (SFEntry*)pEntry->GetUserData();
     687                 :            : 
     688                 :          0 :     Reference< browse::XBrowseNode > node;
     689         [ #  # ]:          0 :     if ( userData )
     690                 :            :     {
     691 [ #  # ][ #  # ]:          0 :               node = userData->GetNode();
     692         [ #  # ]:          0 :         CheckButtons( node );
     693                 :            :     }
     694                 :            : 
     695                 :          0 :     return 0;
     696                 :            : }
     697                 :            : 
     698                 :          0 : IMPL_LINK( SvxScriptOrgDialog, ButtonHdl, Button *, pButton )
     699                 :            : {
     700         [ #  # ]:          0 :     if ( pButton == &aCloseButton )
     701                 :            :     {
     702                 :          0 :         StoreCurrentSelection();
     703                 :          0 :         EndDialog( 0 );
     704                 :            :     }
     705 [ #  # ][ #  # ]:          0 :     if ( pButton == &aEditButton ||
         [ #  # ][ #  # ]
                 [ #  # ]
     706                 :            :             pButton == &aCreateButton ||
     707                 :            :             pButton == &aDelButton ||
     708                 :            :             pButton == &aRunButton ||
     709                 :            :             pButton == &aRenameButton )
     710                 :            : 
     711                 :            :     {
     712         [ #  # ]:          0 :         if ( aScriptsBox.IsSelected( aScriptsBox.GetHdlEntry() ) )
     713                 :            :         {
     714                 :          0 :             SvLBoxEntry* pEntry = aScriptsBox.GetHdlEntry();
     715                 :          0 :             SFEntry* userData = 0;
     716         [ #  # ]:          0 :             if ( !pEntry )
     717                 :            :             {
     718                 :          0 :                 return 0;
     719                 :            :             }
     720                 :          0 :             userData = (SFEntry*)pEntry->GetUserData();
     721         [ #  # ]:          0 :             if ( userData )
     722                 :            :             {
     723                 :          0 :                 Reference< browse::XBrowseNode > node;
     724                 :          0 :                 Reference< XModel > xModel;
     725                 :            : 
     726 [ #  # ][ #  # ]:          0 :                 node = userData->GetNode();
     727 [ #  # ][ #  # ]:          0 :                 xModel = userData->GetModel();
     728                 :            : 
     729         [ #  # ]:          0 :                 if ( !node.is() )
     730                 :            :                 {
     731                 :          0 :                     return 0;
     732                 :            :                 }
     733                 :            : 
     734         [ #  # ]:          0 :                 if ( pButton == &aRunButton )
     735                 :            :                 {
     736                 :          0 :                     ::rtl::OUString tmpString;
     737         [ #  # ]:          0 :                     Reference< beans::XPropertySet > xProp( node, UNO_QUERY );
     738                 :          0 :                     Reference< provider::XScriptProvider > mspNode;
     739         [ #  # ]:          0 :                     if( !xProp.is() )
     740                 :            :                     {
     741                 :          0 :                         return 0;
     742                 :            :                     }
     743                 :            : 
     744         [ #  # ]:          0 :                     if ( xModel.is() )
     745                 :            :                     {
     746         [ #  # ]:          0 :                         Reference< XEmbeddedScripts >  xEmbeddedScripts( xModel, UNO_QUERY);
     747         [ #  # ]:          0 :                         if( !xEmbeddedScripts.is() )
     748                 :            :                         {
     749                 :          0 :                             return 0;
     750                 :            :                         }
     751                 :            : 
     752 [ #  # ][ #  # ]:          0 :                         if (!xEmbeddedScripts->getAllowMacroExecution())
                 [ #  # ]
     753                 :            :                         {
     754                 :            :                             // Please FIXME: Show a message box if AllowMacroExecution is false
     755                 :          0 :                             return 0;
     756         [ #  # ]:          0 :                         }
     757                 :            :                     }
     758                 :            : 
     759                 :            : 
     760         [ #  # ]:          0 :                     SvLBoxEntry* pParent = aScriptsBox.GetParent( pEntry );
     761 [ #  # ][ #  # ]:          0 :                     while ( pParent && !mspNode.is() )
                 [ #  # ]
     762                 :            :                     {
     763                 :          0 :                         SFEntry* mspUserData = (SFEntry*)pParent->GetUserData();
     764 [ #  # ][ #  # ]:          0 :                         mspNode.set( mspUserData->GetNode() , UNO_QUERY );
     765         [ #  # ]:          0 :                         pParent = aScriptsBox.GetParent( pParent );
     766                 :            :                     }
     767 [ #  # ][ #  # ]:          0 :                     xProp->getPropertyValue( rtl::OUString("URI" ) ) >>= tmpString;
     768         [ #  # ]:          0 :                     const String scriptURL( tmpString );
     769                 :            : 
     770         [ #  # ]:          0 :                     if ( mspNode.is() )
     771                 :            :                     {
     772                 :            :                         try
     773                 :            :                         {
     774                 :            :                             Reference< provider::XScript > xScript(
     775 [ #  # ][ #  # ]:          0 :                             mspNode->getScript( scriptURL ), UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     776                 :            : 
     777         [ #  # ]:          0 :                             const Sequence< Any > args(0);
     778                 :          0 :                             Any aRet;
     779         [ #  # ]:          0 :                             Sequence< sal_Int16 > outIndex;
     780         [ #  # ]:          0 :                             Sequence< Any > outArgs( 0 );
     781 [ #  # ][ #  # ]:          0 :                             aRet = xScript->invoke( args, outIndex, outArgs );
         [ #  # ][ #  # ]
                 [ #  # ]
     782                 :            :                         }
     783         [ #  # ]:          0 :                         catch ( reflection::InvocationTargetException& ite )
     784                 :            :                         {
     785         [ #  # ]:          0 :                             ::com::sun::star::uno::Any a = makeAny(ite);
     786         [ #  # ]:          0 :                             ShowErrorDialog(a);
     787                 :            :                         }
     788         [ #  # ]:          0 :                         catch ( provider::ScriptFrameworkErrorException& ite )
     789                 :            :                         {
     790         [ #  # ]:          0 :                             ::com::sun::star::uno::Any a = makeAny(ite);
     791         [ #  # ]:          0 :                             ShowErrorDialog(a);
     792                 :            :                         }
     793         [ #  # ]:          0 :                         catch ( RuntimeException& re )
     794                 :            :                         {
     795         [ #  # ]:          0 :                             ::com::sun::star::uno::Any a = makeAny(re);
     796         [ #  # ]:          0 :                             ShowErrorDialog(a);
     797                 :            :                         }
     798   [ #  #  #  #  :          0 :                         catch ( Exception& e )
                #  #  # ]
     799                 :            :                         {
     800         [ #  # ]:          0 :                             ::com::sun::star::uno::Any a = makeAny(e);
     801         [ #  # ]:          0 :                             ShowErrorDialog(a);
     802                 :            :                         }
     803                 :            :                     }
     804         [ #  # ]:          0 :                     StoreCurrentSelection();
     805 [ #  # ][ #  # ]:          0 :                     EndDialog( 0 );
         [ #  # ][ #  # ]
                 [ #  # ]
     806                 :            :                 }
     807         [ #  # ]:          0 :                 else if ( pButton == &aEditButton )
     808                 :            :                 {
     809         [ #  # ]:          0 :                     Reference< script::XInvocation > xInv( node, UNO_QUERY );
     810         [ #  # ]:          0 :                     if ( xInv.is() )
     811                 :            :                     {
     812         [ #  # ]:          0 :                         StoreCurrentSelection();
     813         [ #  # ]:          0 :                         EndDialog( 0 );
     814         [ #  # ]:          0 :                         Sequence< Any > args(0);
     815         [ #  # ]:          0 :                         Sequence< Any > outArgs( 0 );
     816         [ #  # ]:          0 :                         Sequence< sal_Int16 > outIndex;
     817                 :            :                         try
     818                 :            :                         {
     819                 :            :                             // ISSUE need code to run script here
     820 [ #  # ][ #  # ]:          0 :                             xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Editable" ) ), args, outIndex, outArgs );
         [ #  # ][ #  # ]
     821                 :            :                         }
     822         [ #  # ]:          0 :                         catch( Exception& e )
     823                 :            :                         {
     824                 :            :                             OSL_TRACE("Caught exception trying to invoke %s", ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
     825                 :            : 
     826 [ #  # ][ #  # ]:          0 :                         }
                 [ #  # ]
     827                 :          0 :                     }
     828                 :            :                 }
     829         [ #  # ]:          0 :                 else if ( pButton == &aCreateButton )
     830                 :            :                 {
     831         [ #  # ]:          0 :                     createEntry( pEntry );
     832                 :            :                 }
     833         [ #  # ]:          0 :                 else if ( pButton == &aDelButton )
     834                 :            :                 {
     835         [ #  # ]:          0 :                     deleteEntry( pEntry );
     836                 :            :                 }
     837         [ #  # ]:          0 :                 else if ( pButton == &aRenameButton )
     838                 :            :                 {
     839         [ #  # ]:          0 :                     renameEntry( pEntry );
     840 [ #  # ][ #  # ]:          0 :                 }
     841                 :            :             }
     842                 :            :         }
     843                 :            :     }
     844                 :          0 :     return 0;
     845                 :            : }
     846                 :            : 
     847                 :          0 : Reference< browse::XBrowseNode > SvxScriptOrgDialog::getBrowseNode( SvLBoxEntry* pEntry )
     848                 :            : {
     849                 :          0 :     Reference< browse::XBrowseNode > node;
     850         [ #  # ]:          0 :     if ( pEntry )
     851                 :            :     {
     852                 :          0 :         SFEntry* userData = (SFEntry*)pEntry->GetUserData();
     853         [ #  # ]:          0 :         if ( userData )
     854                 :            :         {
     855 [ #  # ][ #  # ]:          0 :             node = userData->GetNode();
     856                 :            :         }
     857                 :            :     }
     858                 :            : 
     859                 :          0 :     return node;
     860                 :            : }
     861                 :            : 
     862                 :          0 : Reference< XModel > SvxScriptOrgDialog::getModel( SvLBoxEntry* pEntry )
     863                 :            : {
     864                 :          0 :     Reference< XModel > model;
     865         [ #  # ]:          0 :     if ( pEntry )
     866                 :            :     {
     867                 :          0 :         SFEntry* userData = (SFEntry*)pEntry->GetUserData();
     868         [ #  # ]:          0 :         if ( userData )
     869                 :            :         {
     870 [ #  # ][ #  # ]:          0 :             model = userData->GetModel();
     871                 :            :         }
     872                 :            :     }
     873                 :            : 
     874                 :          0 :     return model;
     875                 :            : }
     876                 :            : 
     877                 :          0 : void SvxScriptOrgDialog::createEntry( SvLBoxEntry* pEntry )
     878                 :            : {
     879                 :            : 
     880                 :          0 :     Reference< browse::XBrowseNode >  aChildNode;
     881         [ #  # ]:          0 :     Reference< browse::XBrowseNode > node = getBrowseNode( pEntry );
     882         [ #  # ]:          0 :     Reference< script::XInvocation > xInv( node, UNO_QUERY );
     883                 :            : 
     884         [ #  # ]:          0 :     if ( xInv.is() )
     885                 :            :     {
     886                 :          0 :         ::rtl::OUString aNewName;
     887                 :          0 :         ::rtl::OUString aNewStdName;
     888                 :          0 :         sal_uInt16 nMode = INPUTMODE_NEWLIB;
     889 [ #  # ][ #  # ]:          0 :         if( aScriptsBox.GetModel()->GetDepth( pEntry ) == 0 )
     890                 :            :         {
     891         [ #  # ]:          0 :             aNewStdName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Library") ) ;
     892                 :            :         }
     893                 :            :         else
     894                 :            :         {
     895         [ #  # ]:          0 :             aNewStdName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Macro") ) ;
     896                 :          0 :             nMode = INPUTMODE_NEWMACRO;
     897                 :            :         }
     898                 :            :         //do we need L10N for this? ie somethng like:
     899                 :            :         //String aNewStdName( ResId( STR_STDMODULENAME ) );
     900                 :          0 :         sal_Bool bValid = sal_False;
     901                 :          0 :         sal_uInt16 i = 1;
     902                 :            : 
     903         [ #  # ]:          0 :         Sequence< Reference< browse::XBrowseNode > > childNodes;
     904                 :            :         // no children => ok to create Parcel1 or Script1 without checking
     905                 :            :         try
     906                 :            :         {
     907 [ #  # ][ #  # ]:          0 :             if( node->hasChildNodes() == sal_False )
                 [ #  # ]
     908                 :            :             {
     909                 :          0 :                 aNewName = aNewStdName;
     910 [ #  # ][ #  # ]:          0 :                 aNewName += String::CreateFromInt32( i );
                 [ #  # ]
     911                 :          0 :                 bValid = sal_True;
     912                 :            :             }
     913                 :            :             else
     914                 :            :             {
     915 [ #  # ][ #  # ]:          0 :                 childNodes = node->getChildNodes();
         [ #  # ][ #  # ]
                 [ #  # ]
     916                 :            :             }
     917                 :            :         }
     918         [ #  # ]:          0 :         catch ( Exception& )
     919                 :            :         {
     920                 :            :             // ignore, will continue on with empty sequence
     921                 :            :         }
     922                 :            : 
     923                 :          0 :         ::rtl::OUString extn;
     924         [ #  # ]:          0 :         while ( !bValid )
     925                 :            :         {
     926                 :          0 :             aNewName = aNewStdName;
     927 [ #  # ][ #  # ]:          0 :             aNewName += String::CreateFromInt32( i );
                 [ #  # ]
     928                 :          0 :             sal_Bool bFound = sal_False;
     929         [ #  # ]:          0 :             if(childNodes.getLength() > 0 )
     930                 :            :             {
     931 [ #  # ][ #  # ]:          0 :                 ::rtl::OUString nodeName = childNodes[0]->getName();
                 [ #  # ]
     932                 :          0 :                 sal_Int32 extnPos = nodeName.lastIndexOf( '.' );
     933         [ #  # ]:          0 :                 if(extnPos>0)
     934                 :          0 :                     extn = nodeName.copy(extnPos);
     935                 :            :             }
     936         [ #  # ]:          0 :             for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
     937                 :            :             {
     938 [ #  # ][ #  # ]:          0 :                 if ( (aNewName+extn).equals( childNodes[index]->getName() ) )
         [ #  # ][ #  # ]
     939                 :            :                 {
     940                 :          0 :                     bFound = sal_True;
     941                 :          0 :                     break;
     942                 :            :                 }
     943                 :            :             }
     944         [ #  # ]:          0 :             if( bFound )
     945                 :            :             {
     946                 :          0 :                 i++;
     947                 :            :             }
     948                 :            :             else
     949                 :            :             {
     950                 :          0 :                 bValid = sal_True;
     951                 :            :             }
     952                 :            :         }
     953                 :            : 
     954                 :            :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     955 [ #  # ][ #  # ]:          0 :         std::auto_ptr< InputDialog > xNewDlg( new InputDialog( static_cast<Window*>(this), nMode ) );
     956                 :            :         SAL_WNODEPRECATED_DECLARATIONS_POP
     957 [ #  # ][ #  # ]:          0 :         xNewDlg->SetObjectName( aNewName );
                 [ #  # ]
     958                 :            : 
     959         [ #  # ]:          0 :         do
     960                 :            :         {
     961 [ #  # ][ #  # ]:          0 :             if ( xNewDlg->Execute() && xNewDlg->GetObjectName().Len() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     962                 :            :             {
     963 [ #  # ][ #  # ]:          0 :                 ::rtl::OUString aUserSuppliedName = xNewDlg->GetObjectName();
                 [ #  # ]
     964                 :          0 :                 bValid = sal_True;
     965         [ #  # ]:          0 :                 for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
     966                 :            :                 {
     967 [ #  # ][ #  # ]:          0 :                     if ( (aUserSuppliedName+extn).equals( childNodes[index]->getName() ) )
         [ #  # ][ #  # ]
     968                 :            :                     {
     969                 :          0 :                         bValid = sal_False;
     970         [ #  # ]:          0 :                         String aError( m_createErrStr );
     971         [ #  # ]:          0 :                         aError.Append( m_createDupStr );
     972         [ #  # ]:          0 :                         ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, aError );
     973         [ #  # ]:          0 :                         aErrorBox.SetText( m_createErrTitleStr );
     974         [ #  # ]:          0 :                         aErrorBox.Execute();
     975 [ #  # ][ #  # ]:          0 :                         xNewDlg->SetObjectName( aNewName );
                 [ #  # ]
     976 [ #  # ][ #  # ]:          0 :                         break;
     977                 :            :                     }
     978                 :            :                 }
     979         [ #  # ]:          0 :                 if( bValid )
     980                 :          0 :                     aNewName = aUserSuppliedName;
     981                 :            :             }
     982                 :            :             else
     983                 :            :             {
     984                 :            :                 // user hit cancel or hit OK with nothing in the editbox
     985                 :            : 
     986                 :          0 :                 return;
     987                 :            :             }
     988                 :            :         }
     989                 :          0 :         while ( !bValid );
     990                 :            : 
     991                 :            :         // open up parent node (which ensures it's loaded)
     992         [ #  # ]:          0 :         aScriptsBox.RequestingChildren( pEntry );
     993                 :            : 
     994         [ #  # ]:          0 :         Sequence< Any > args( 1 );
     995 [ #  # ][ #  # ]:          0 :         args[ 0 ] <<= aNewName;
     996         [ #  # ]:          0 :         Sequence< Any > outArgs( 0 );
     997         [ #  # ]:          0 :         Sequence< sal_Int16 > outIndex;
     998                 :            :         try
     999                 :            :         {
    1000                 :          0 :             Any aResult;
    1001 [ #  # ][ #  # ]:          0 :             aResult = xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Creatable") ), args, outIndex, outArgs );
                 [ #  # ]
    1002         [ #  # ]:          0 :             Reference< browse::XBrowseNode > newNode( aResult, UNO_QUERY );
    1003 [ #  # ][ #  # ]:          0 :             aChildNode = newNode;
    1004                 :            : 
    1005                 :            :         }
    1006         [ #  # ]:          0 :         catch( Exception& e )
    1007                 :            :         {
    1008                 :            :             OSL_TRACE("Caught exception trying to Create %s",
    1009                 :            :                 ::rtl::OUStringToOString(
    1010                 :            :                     e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
    1011 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1012                 :            :     }
    1013         [ #  # ]:          0 :     if ( aChildNode.is() )
    1014                 :            :     {
    1015 [ #  # ][ #  # ]:          0 :         String aChildName = aChildNode->getName();
                 [ #  # ]
    1016                 :          0 :         SvLBoxEntry* pNewEntry = NULL;
    1017                 :            : 
    1018                 :            : 
    1019         [ #  # ]:          0 :         ::rtl::OUString name( aChildName );
    1020         [ #  # ]:          0 :         Reference<XModel> xDocumentModel = getModel( pEntry );
    1021                 :            : 
    1022                 :            :         // ISSUE do we need to remove all entries for parent
    1023                 :            :         // to achieve sort? Just need to determine position
    1024                 :            :         // SvTreeListBox::InsertEntry can take position arg
    1025                 :            :         // -- Basic doesn't do this on create.
    1026                 :            :         // Suppose we could avoid this too. -> created nodes are
    1027                 :            :         // not in alphabetical order
    1028 [ #  # ][ #  # ]:          0 :         if ( aChildNode->getType() == browse::BrowseNodeTypes::SCRIPT )
                 [ #  # ]
    1029                 :            :         {
    1030                 :            :             SAL_WNODEPRECATED_DECLARATIONS_PUSH
    1031                 :            :             pNewEntry = aScriptsBox.insertEntry( aChildName,
    1032 [ #  # ][ #  # ]:          0 :                     IMG_MACRO, pEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_METHOD, aChildNode,xDocumentModel ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1033                 :            :             SAL_WNODEPRECATED_DECLARATIONS_POP
    1034                 :            : 
    1035                 :            :         }
    1036                 :            :         else
    1037                 :            :         {
    1038                 :            :             SAL_WNODEPRECATED_DECLARATIONS_PUSH
    1039                 :            :             pNewEntry = aScriptsBox.insertEntry( aChildName,
    1040 [ #  # ][ #  # ]:          0 :                 IMG_LIB, pEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SCRIPTCONTAINER, aChildNode,xDocumentModel ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1041                 :            :             SAL_WNODEPRECATED_DECLARATIONS_POP
    1042                 :            : 
    1043                 :            :             // If the Parent is not loaded then set to
    1044                 :            :             // loaded, this will prevent RequestingChildren ( called
    1045                 :            :             // from vcl via RequestingChildren ) from
    1046                 :            :             // creating new ( duplicate ) children
    1047                 :          0 :             SFEntry* userData = (SFEntry*)pEntry->GetUserData();
    1048 [ #  # ][ #  # ]:          0 :             if ( userData &&  !userData->isLoaded() )
                 [ #  # ]
    1049                 :            :             {
    1050                 :          0 :                 userData->setLoaded();
    1051                 :            :             }
    1052                 :            :         }
    1053         [ #  # ]:          0 :         aScriptsBox.SetCurEntry( pNewEntry );
    1054 [ #  # ][ #  # ]:          0 :         aScriptsBox.Select( aScriptsBox.GetCurEntry() );
                 [ #  # ]
    1055                 :            : 
    1056                 :            :     }
    1057                 :            :     else
    1058                 :            :     {
    1059                 :            :         //ISSUE L10N & message from exception?
    1060         [ #  # ]:          0 :         String aError( m_createErrStr );
    1061         [ #  # ]:          0 :         ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, aError );
    1062         [ #  # ]:          0 :         aErrorBox.SetText( m_createErrTitleStr );
    1063 [ #  # ][ #  # ]:          0 :         aErrorBox.Execute();
                 [ #  # ]
    1064 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
    1065                 :            : }
    1066                 :            : 
    1067                 :          0 : void SvxScriptOrgDialog::renameEntry( SvLBoxEntry* pEntry )
    1068                 :            : {
    1069                 :            : 
    1070                 :          0 :     Reference< browse::XBrowseNode >  aChildNode;
    1071         [ #  # ]:          0 :     Reference< browse::XBrowseNode > node = getBrowseNode( pEntry );
    1072         [ #  # ]:          0 :     Reference< script::XInvocation > xInv( node, UNO_QUERY );
    1073                 :            : 
    1074         [ #  # ]:          0 :     if ( xInv.is() )
    1075                 :            :     {
    1076 [ #  # ][ #  # ]:          0 :         ::rtl::OUString aNewName = node->getName();
    1077                 :          0 :         sal_Int32 extnPos = aNewName.lastIndexOf( '.' );
    1078                 :          0 :         ::rtl::OUString extn;
    1079         [ #  # ]:          0 :         if(extnPos>0)
    1080                 :            :         {
    1081                 :          0 :             extn = aNewName.copy(extnPos);
    1082                 :          0 :             aNewName = aNewName.copy(0,extnPos);
    1083                 :            :         }
    1084                 :          0 :         sal_uInt16 nMode = INPUTMODE_RENAME;
    1085                 :            : 
    1086                 :            :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
    1087 [ #  # ][ #  # ]:          0 :         std::auto_ptr< InputDialog > xNewDlg( new InputDialog( static_cast<Window*>(this), nMode ) );
    1088                 :            :         SAL_WNODEPRECATED_DECLARATIONS_POP
    1089 [ #  # ][ #  # ]:          0 :         xNewDlg->SetObjectName( aNewName );
                 [ #  # ]
    1090                 :            : 
    1091                 :            :         sal_Bool bValid;
    1092         [ #  # ]:          0 :         do
    1093                 :            :         {
    1094 [ #  # ][ #  # ]:          0 :             if ( xNewDlg->Execute() && xNewDlg->GetObjectName().Len() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1095                 :            :             {
    1096 [ #  # ][ #  # ]:          0 :                 ::rtl::OUString aUserSuppliedName = xNewDlg->GetObjectName();
                 [ #  # ]
    1097                 :          0 :                 bValid = sal_True;
    1098         [ #  # ]:          0 :                 if( bValid )
    1099                 :          0 :                     aNewName = aUserSuppliedName;
    1100                 :            :             }
    1101                 :            :             else
    1102                 :            :             {
    1103                 :            :                 // user hit cancel or hit OK with nothing in the editbox
    1104                 :          0 :                 return;
    1105                 :            :             }
    1106                 :            :         }
    1107                 :          0 :         while ( !bValid );
    1108                 :            : 
    1109         [ #  # ]:          0 :         Sequence< Any > args( 1 );
    1110 [ #  # ][ #  # ]:          0 :         args[ 0 ] <<= aNewName;
    1111         [ #  # ]:          0 :         Sequence< Any > outArgs( 0 );
    1112         [ #  # ]:          0 :         Sequence< sal_Int16 > outIndex;
    1113                 :            :         try
    1114                 :            :         {
    1115                 :          0 :             Any aResult;
    1116 [ #  # ][ #  # ]:          0 :             aResult = xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Renamable") ), args, outIndex, outArgs );
                 [ #  # ]
    1117         [ #  # ]:          0 :             Reference< browse::XBrowseNode > newNode( aResult, UNO_QUERY );
    1118 [ #  # ][ #  # ]:          0 :             aChildNode = newNode;
    1119                 :            : 
    1120                 :            :         }
    1121         [ #  # ]:          0 :         catch( Exception& e )
    1122                 :            :         {
    1123                 :            :             OSL_TRACE("Caught exception trying to Rename %s",
    1124                 :            :                 ::rtl::OUStringToOString(
    1125                 :            :                     e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
    1126 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1127                 :            :     }
    1128         [ #  # ]:          0 :     if ( aChildNode.is() )
    1129                 :            :     {
    1130 [ #  # ][ #  # ]:          0 :         aScriptsBox.SetEntryText( pEntry, aChildNode->getName() );
         [ #  # ][ #  # ]
                 [ #  # ]
    1131         [ #  # ]:          0 :         aScriptsBox.SetCurEntry( pEntry );
    1132 [ #  # ][ #  # ]:          0 :         aScriptsBox.Select( aScriptsBox.GetCurEntry() );
    1133                 :            : 
    1134                 :            :     }
    1135                 :            :     else
    1136                 :            :     {
    1137                 :            :         //ISSUE L10N & message from exception?
    1138         [ #  # ]:          0 :         String aError( m_renameErrStr );
    1139         [ #  # ]:          0 :         ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, aError );
    1140         [ #  # ]:          0 :         aErrorBox.SetText( m_renameErrTitleStr );
    1141 [ #  # ][ #  # ]:          0 :         aErrorBox.Execute();
                 [ #  # ]
    1142 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
    1143                 :            : }
    1144                 :          0 : void SvxScriptOrgDialog::deleteEntry( SvLBoxEntry* pEntry )
    1145                 :            : {
    1146                 :          0 :     sal_Bool result = sal_False;
    1147         [ #  # ]:          0 :     Reference< browse::XBrowseNode > node = getBrowseNode( pEntry );
    1148                 :            :     // ISSUE L10N string & can we centre list?
    1149         [ #  # ]:          0 :     String aQuery( m_delQueryStr );
    1150 [ #  # ][ #  # ]:          0 :     aQuery.Append( getListOfChildren( node, 0 ) );
                 [ #  # ]
    1151         [ #  # ]:          0 :     QueryBox aQueryBox( static_cast<Window*>(this), WB_YES_NO | WB_DEF_YES, aQuery );
    1152         [ #  # ]:          0 :     aQueryBox.SetText( m_delQueryTitleStr );
    1153 [ #  # ][ #  # ]:          0 :     if ( aQueryBox.Execute() == RET_NO )
    1154                 :            :     {
    1155                 :          0 :         return;
    1156                 :            :     }
    1157                 :            : 
    1158         [ #  # ]:          0 :     Reference< script::XInvocation > xInv( node, UNO_QUERY );
    1159         [ #  # ]:          0 :     if ( xInv.is() )
    1160                 :            :     {
    1161         [ #  # ]:          0 :         Sequence< Any > args( 0 );
    1162         [ #  # ]:          0 :         Sequence< Any > outArgs( 0 );
    1163         [ #  # ]:          0 :         Sequence< sal_Int16 > outIndex;
    1164                 :            :         try
    1165                 :            :         {
    1166                 :          0 :             Any aResult;
    1167 [ #  # ][ #  # ]:          0 :             aResult = xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Deletable") ), args, outIndex, outArgs );
                 [ #  # ]
    1168         [ #  # ]:          0 :             aResult >>= result; // or do we just assume true if no exception ?
    1169                 :            :         }
    1170         [ #  # ]:          0 :         catch( Exception& e )
    1171                 :            :         {
    1172                 :            :             OSL_TRACE("Caught exception trying to delete %s",
    1173                 :            :                 ::rtl::OUStringToOString(
    1174                 :            :                     e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
    1175 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
    1176                 :            :     }
    1177                 :            : 
    1178         [ #  # ]:          0 :     if ( result == sal_True )
    1179                 :            :     {
    1180         [ #  # ]:          0 :         aScriptsBox.deleteTree( pEntry );
    1181         [ #  # ]:          0 :         aScriptsBox.GetModel()->Remove( pEntry );
    1182                 :            :     }
    1183                 :            :     else
    1184                 :            :     {
    1185                 :            :         //ISSUE L10N & message from exception?
    1186         [ #  # ]:          0 :         ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, m_delErrStr );
    1187         [ #  # ]:          0 :         aErrorBox.SetText( m_delErrTitleStr );
    1188 [ #  # ][ #  # ]:          0 :         aErrorBox.Execute();
    1189 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
                 [ #  # ]
    1190                 :            : 
    1191                 :            : }
    1192                 :            : 
    1193                 :          0 : sal_Bool SvxScriptOrgDialog::getBoolProperty( Reference< beans::XPropertySet >& xProps,
    1194                 :            :                 ::rtl::OUString& propName )
    1195                 :            : {
    1196                 :          0 :     sal_Bool result = false;
    1197                 :            :     try
    1198                 :            :     {
    1199                 :          0 :         sal_Bool bTemp = sal_False;
    1200 [ #  # ][ #  # ]:          0 :         xProps->getPropertyValue( propName ) >>= bTemp;
    1201                 :          0 :         result = ( bTemp == sal_True );
    1202                 :            :     }
    1203                 :          0 :     catch ( Exception& )
    1204                 :            :     {
    1205                 :          0 :         return result;
    1206                 :            :     }
    1207         [ #  # ]:          0 :     return result;
    1208                 :            : }
    1209                 :            : 
    1210                 :          0 : String SvxScriptOrgDialog::getListOfChildren( Reference< browse::XBrowseNode > node, int depth )
    1211                 :            : {
    1212                 :          0 :     String result;
    1213 [ #  # ][ #  # ]:          0 :     result.Append( rtl::OUString( "\n" ) );
                 [ #  # ]
    1214         [ #  # ]:          0 :     for( int i=0;i<=depth;i++ )
    1215                 :            :     {
    1216 [ #  # ][ #  # ]:          0 :         result.Append( rtl::OUString( "\t" ) );
                 [ #  # ]
    1217                 :            :     }
    1218 [ #  # ][ #  # ]:          0 :     result.Append( String( node->getName() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1219                 :            : 
    1220                 :            :     try
    1221                 :            :     {
    1222 [ #  # ][ #  # ]:          0 :         if ( node->hasChildNodes() == sal_True )
                 [ #  # ]
    1223                 :            :         {
    1224                 :            :             Sequence< Reference< browse::XBrowseNode > > children
    1225 [ #  # ][ #  # ]:          0 :                 = node->getChildNodes();
    1226         [ #  # ]:          0 :             for ( sal_Int32 n = 0; n < children.getLength(); n++ )
    1227                 :            :             {
    1228 [ #  # ][ #  # ]:          0 :                 result.Append( getListOfChildren( children[ n ] , depth+1 ) );
         [ #  # ][ #  # ]
    1229 [ #  # ][ #  # ]:          0 :             }
    1230                 :            :         }
    1231                 :            :     }
    1232         [ #  # ]:          0 :     catch ( Exception& )
    1233                 :            :     {
    1234                 :            :         // ignore, will return an empty string
    1235                 :            :     }
    1236                 :            : 
    1237                 :          0 :     return result;
    1238                 :            : }
    1239                 :            : 
    1240         [ +  - ]:          3 : Selection_hash SvxScriptOrgDialog::m_lastSelection;
    1241                 :            : 
    1242                 :          0 : void SvxScriptOrgDialog::StoreCurrentSelection()
    1243                 :            : {
    1244         [ #  # ]:          0 :     String aDescription;
    1245 [ #  # ][ #  # ]:          0 :     if ( aScriptsBox.IsSelected( aScriptsBox.GetHdlEntry() ) )
    1246                 :            :     {
    1247                 :          0 :         SvLBoxEntry* pEntry = aScriptsBox.GetHdlEntry();
    1248         [ #  # ]:          0 :         while( pEntry )
    1249                 :            :         {
    1250 [ #  # ][ #  # ]:          0 :             aDescription.Insert( aScriptsBox.GetEntryText( pEntry ), 0 );
                 [ #  # ]
    1251         [ #  # ]:          0 :             pEntry = aScriptsBox.GetParent( pEntry );
    1252         [ #  # ]:          0 :             if ( pEntry )
    1253         [ #  # ]:          0 :                 aDescription.Insert( ';', 0 );
    1254                 :            :         }
    1255         [ #  # ]:          0 :         ::rtl::OUString sDesc( aDescription );
    1256         [ #  # ]:          0 :         m_lastSelection[ m_sLanguage ] = sDesc;
    1257         [ #  # ]:          0 :     }
    1258                 :          0 : }
    1259                 :            : 
    1260                 :          0 : void SvxScriptOrgDialog::RestorePreviousSelection()
    1261                 :            : {
    1262 [ #  # ][ #  # ]:          0 :     String aStoredEntry = String( m_lastSelection[ m_sLanguage ] );
    1263         [ #  # ]:          0 :     if( aStoredEntry.Len() <= 0 )
    1264                 :          0 :         return;
    1265                 :          0 :     SvLBoxEntry* pEntry = 0;
    1266                 :          0 :     sal_uInt16 nIndex = 0;
    1267         [ #  # ]:          0 :     while ( nIndex != STRING_NOTFOUND )
    1268                 :            :     {
    1269         [ #  # ]:          0 :         String aTmp( aStoredEntry.GetToken( 0, ';', nIndex ) );
    1270         [ #  # ]:          0 :         SvLBoxEntry* pTmpEntry = aScriptsBox.FirstChild( pEntry );
    1271         [ #  # ]:          0 :         ::rtl::OUString debugStr(aTmp);
    1272         [ #  # ]:          0 :         while ( pTmpEntry )
    1273                 :            :         {
    1274 [ #  # ][ #  # ]:          0 :             debugStr = ::rtl::OUString(aScriptsBox.GetEntryText( pTmpEntry ));
                 [ #  # ]
    1275 [ #  # ][ #  # ]:          0 :             if ( aScriptsBox.GetEntryText( pTmpEntry ) == aTmp )
         [ #  # ][ #  # ]
    1276                 :            :             {
    1277                 :          0 :                 pEntry = pTmpEntry;
    1278                 :          0 :                 break;
    1279                 :            :             }
    1280         [ #  # ]:          0 :             pTmpEntry = aScriptsBox.NextSibling( pTmpEntry );
    1281                 :            :         }
    1282         [ #  # ]:          0 :         if ( !pTmpEntry )
    1283                 :            :             break;
    1284 [ #  # ][ #  # ]:          0 :         aScriptsBox.RequestingChildren( pEntry );
    1285 [ #  # ][ #  # ]:          0 :     }
    1286 [ #  # ][ #  # ]:          0 :     aScriptsBox.SetCurEntry( pEntry );
                 [ #  # ]
    1287                 :            : }
    1288                 :            : 
    1289                 :          9 : ::rtl::OUString ReplaceString(
    1290                 :            :     const ::rtl::OUString& source,
    1291                 :            :     const ::rtl::OUString& token,
    1292                 :            :     const ::rtl::OUString& value )
    1293                 :            : {
    1294                 :          9 :     sal_Int32 pos = source.indexOf( token );
    1295                 :            : 
    1296 [ +  - ][ +  + ]:          9 :     if ( pos != -1 && !value.isEmpty() )
                 [ +  + ]
    1297                 :            :     {
    1298                 :          6 :         return source.replaceAt( pos, token.getLength(), value );
    1299                 :            :     }
    1300                 :            :     else
    1301                 :            :     {
    1302                 :          9 :         return source;
    1303                 :            :     }
    1304                 :            : }
    1305                 :            : 
    1306                 :          3 : ::rtl::OUString FormatErrorString(
    1307                 :            :     const ::rtl::OUString& unformatted,
    1308                 :            :     const ::rtl::OUString& language,
    1309                 :            :     const ::rtl::OUString& script,
    1310                 :            :     const ::rtl::OUString& line,
    1311                 :            :     const ::rtl::OUString& type,
    1312                 :            :     const ::rtl::OUString& message )
    1313                 :            : {
    1314                 :          3 :     ::rtl::OUString result = unformatted.copy( 0 );
    1315                 :            : 
    1316                 :            :     result = ReplaceString(
    1317         [ +  - ]:          3 :         result, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%LANGUAGENAME") ), language );
    1318                 :            :     result = ReplaceString(
    1319         [ +  - ]:          3 :         result, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%SCRIPTNAME") ), script );
    1320                 :            :     result = ReplaceString(
    1321         [ +  - ]:          3 :         result, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%LINENUMBER") ), line );
    1322                 :            : 
    1323         [ -  + ]:          3 :     if ( !type.isEmpty() )
    1324                 :            :     {
    1325         [ #  # ]:          0 :         result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n\n") );
    1326 [ #  # ][ #  # ]:          0 :         result += ::rtl::OUString(String(CUI_RES(RID_SVXSTR_ERROR_TYPE_LABEL)));
         [ #  # ][ #  # ]
    1327         [ #  # ]:          0 :         result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ") );
    1328                 :          0 :         result += type;
    1329                 :            :     }
    1330                 :            : 
    1331         [ +  - ]:          3 :     if ( !message.isEmpty() )
    1332                 :            :     {
    1333         [ +  - ]:          3 :         result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n\n") );
    1334 [ +  - ][ +  - ]:          3 :         result += ::rtl::OUString(String(CUI_RES(RID_SVXSTR_ERROR_MESSAGE_LABEL)));
         [ +  - ][ +  - ]
    1335         [ +  - ]:          3 :         result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ") );
    1336                 :          3 :         result += message;
    1337                 :            :     }
    1338                 :            : 
    1339                 :          3 :     return result;
    1340                 :            : }
    1341                 :            : 
    1342                 :          0 : ::rtl::OUString GetErrorMessage(
    1343                 :            :     const provider::ScriptErrorRaisedException& eScriptError )
    1344                 :            : {
    1345 [ #  # ][ #  # ]:          0 :     ::rtl::OUString unformatted = String( CUI_RES( RID_SVXSTR_ERROR_AT_LINE ) );
         [ #  # ][ #  # ]
    1346                 :            : 
    1347         [ #  # ]:          0 :     ::rtl::OUString unknown( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") );
    1348                 :          0 :     ::rtl::OUString language = unknown;
    1349                 :          0 :     ::rtl::OUString script = unknown;
    1350                 :          0 :     ::rtl::OUString line = unknown;
    1351                 :          0 :     ::rtl::OUString type = ::rtl::OUString();
    1352                 :          0 :     ::rtl::OUString message = eScriptError.Message;
    1353                 :            : 
    1354         [ #  # ]:          0 :         if ( !eScriptError.language.isEmpty() )
    1355                 :            :         {
    1356                 :          0 :             language = eScriptError.language;
    1357                 :            :         }
    1358                 :            : 
    1359         [ #  # ]:          0 :         if ( !eScriptError.scriptName.isEmpty() )
    1360                 :            :         {
    1361                 :          0 :             script = eScriptError.scriptName;
    1362                 :            :         }
    1363                 :            : 
    1364         [ #  # ]:          0 :         if ( !eScriptError.Message.isEmpty() )
    1365                 :            :         {
    1366                 :          0 :             message = eScriptError.Message;
    1367                 :            :         }
    1368         [ #  # ]:          0 :         if ( eScriptError.lineNum != -1 )
    1369                 :            :         {
    1370                 :          0 :             line = ::rtl::OUString::valueOf( eScriptError.lineNum );
    1371                 :            :             unformatted = String(
    1372 [ #  # ][ #  # ]:          0 :                 CUI_RES( RID_SVXSTR_ERROR_AT_LINE ) );
         [ #  # ][ #  # ]
    1373                 :            :         }
    1374                 :            :         else
    1375                 :            :         {
    1376                 :            :             unformatted = String(
    1377 [ #  # ][ #  # ]:          0 :                 CUI_RES( RID_SVXSTR_ERROR_RUNNING ) );
         [ #  # ][ #  # ]
    1378                 :            :         }
    1379                 :            : 
    1380                 :            :     return FormatErrorString(
    1381         [ #  # ]:          0 :         unformatted, language, script, line, type, message );
    1382                 :            : }
    1383                 :            : 
    1384                 :          0 : ::rtl::OUString GetErrorMessage(
    1385                 :            :     const provider::ScriptExceptionRaisedException& eScriptException )
    1386                 :            : {
    1387                 :            :     ::rtl::OUString unformatted =
    1388 [ #  # ][ #  # ]:          0 :           String( CUI_RES( RID_SVXSTR_EXCEPTION_AT_LINE ) );
         [ #  # ][ #  # ]
    1389                 :            : 
    1390         [ #  # ]:          0 :     ::rtl::OUString unknown( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") );
    1391                 :          0 :     ::rtl::OUString language = unknown;
    1392                 :          0 :     ::rtl::OUString script = unknown;
    1393                 :          0 :     ::rtl::OUString line = unknown;
    1394                 :          0 :     ::rtl::OUString type = unknown;
    1395                 :          0 :     ::rtl::OUString message = eScriptException.Message;
    1396                 :            : 
    1397         [ #  # ]:          0 :     if ( !eScriptException.language.isEmpty() )
    1398                 :            :     {
    1399                 :          0 :         language = eScriptException.language;
    1400                 :            :     }
    1401         [ #  # ]:          0 :     if ( !eScriptException.scriptName.isEmpty() )
    1402                 :            :     {
    1403                 :          0 :         script = eScriptException.scriptName;
    1404                 :            :     }
    1405                 :            : 
    1406         [ #  # ]:          0 :     if ( !eScriptException.Message.isEmpty() )
    1407                 :            :     {
    1408                 :          0 :         message = eScriptException.Message;
    1409                 :            :     }
    1410                 :            : 
    1411         [ #  # ]:          0 :     if ( eScriptException.lineNum != -1 )
    1412                 :            :     {
    1413                 :          0 :         line = ::rtl::OUString::valueOf( eScriptException.lineNum );
    1414                 :            :         unformatted = String(
    1415 [ #  # ][ #  # ]:          0 :             CUI_RES( RID_SVXSTR_EXCEPTION_AT_LINE ) );
         [ #  # ][ #  # ]
    1416                 :            :     }
    1417                 :            :     else
    1418                 :            :     {
    1419                 :            :         unformatted = String(
    1420 [ #  # ][ #  # ]:          0 :             CUI_RES( RID_SVXSTR_EXCEPTION_RUNNING ) );
         [ #  # ][ #  # ]
    1421                 :            :     }
    1422                 :            : 
    1423         [ #  # ]:          0 :     if ( !eScriptException.exceptionType.isEmpty() )
    1424                 :            :     {
    1425                 :          0 :         type = eScriptException.exceptionType;
    1426                 :            :     }
    1427                 :            : 
    1428                 :            :     return FormatErrorString(
    1429         [ #  # ]:          0 :         unformatted, language, script, line, type, message );
    1430                 :            : 
    1431                 :            : }
    1432                 :          3 : ::rtl::OUString GetErrorMessage(
    1433                 :            :     const provider::ScriptFrameworkErrorException& sError )
    1434                 :            : {
    1435                 :            :     ::rtl::OUString unformatted = String(
    1436 [ +  - ][ +  - ]:          3 :         CUI_RES( RID_SVXSTR_FRAMEWORK_ERROR_RUNNING ) );
         [ +  - ][ +  - ]
    1437                 :            : 
    1438         [ +  - ]:          3 :     ::rtl::OUString language( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") );
    1439                 :            : 
    1440         [ +  - ]:          3 :     ::rtl::OUString script( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") );
    1441                 :            : 
    1442                 :          3 :     ::rtl::OUString message;
    1443                 :            : 
    1444         [ +  - ]:          3 :     if ( !sError.scriptName.isEmpty() )
    1445                 :            :     {
    1446                 :          3 :         script = sError.scriptName;
    1447                 :            :     }
    1448         [ +  - ]:          3 :     if ( !sError.language.isEmpty() )
    1449                 :            :     {
    1450                 :          3 :         language = sError.language;
    1451                 :            :     }
    1452         [ -  + ]:          3 :     if ( sError.errorType == provider::ScriptFrameworkErrorType::NOTSUPPORTED )
    1453                 :            :     {
    1454                 :            :         message = String(
    1455 [ #  # ][ #  # ]:          0 :             CUI_RES(  RID_SVXSTR_ERROR_LANG_NOT_SUPPORTED ) );
         [ #  # ][ #  # ]
    1456                 :            :         message =  ReplaceString(
    1457         [ #  # ]:          0 :             message, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%LANGUAGENAME") ), language );
    1458                 :            : 
    1459                 :            :     }
    1460                 :            :     else
    1461                 :            :     {
    1462                 :          3 :         message = sError.Message;
    1463                 :            :     }
    1464                 :            :     return FormatErrorString(
    1465         [ +  - ]:          3 :         unformatted, language, script, ::rtl::OUString(), ::rtl::OUString(), message );
    1466                 :            : }
    1467                 :            : 
    1468                 :          0 : ::rtl::OUString GetErrorMessage( const RuntimeException& re )
    1469                 :            : {
    1470         [ #  # ]:          0 :     Type t = ::getCppuType( &re );
    1471                 :          0 :     ::rtl::OUString message = t.getTypeName();
    1472                 :          0 :     message += re.Message;
    1473                 :            : 
    1474                 :          0 :     return message;
    1475                 :            : }
    1476                 :            : 
    1477                 :          0 : ::rtl::OUString GetErrorMessage( const Exception& e )
    1478                 :            : {
    1479         [ #  # ]:          0 :     Type t = ::getCppuType( &e );
    1480                 :          0 :     ::rtl::OUString message = t.getTypeName();
    1481                 :          0 :     message += e.Message;
    1482                 :            : 
    1483                 :          0 :     return message;
    1484                 :            : }
    1485                 :            : 
    1486                 :          3 : ::rtl::OUString GetErrorMessage( const com::sun::star::uno::Any& aException )
    1487                 :            : {
    1488         [ -  + ]:          6 :     if ( aException.getValueType() ==
    1489         [ +  - ]:          6 :          ::getCppuType( (const reflection::InvocationTargetException* ) NULL ) )
    1490                 :            :     {
    1491         [ #  # ]:          0 :         reflection::InvocationTargetException ite;
    1492         [ #  # ]:          0 :         aException >>= ite;
    1493 [ #  # ][ #  # ]:          0 :         if ( ite.TargetException.getValueType() == ::getCppuType( ( const provider::ScriptErrorRaisedException* ) NULL ) )
    1494                 :            :         {
    1495                 :            :             // Error raised by script
    1496         [ #  # ]:          0 :             provider::ScriptErrorRaisedException scriptError;
    1497         [ #  # ]:          0 :             ite.TargetException >>= scriptError;
    1498 [ #  # ][ #  # ]:          0 :             return GetErrorMessage( scriptError );
    1499                 :            :         }
    1500 [ #  # ][ #  # ]:          0 :         else if ( ite.TargetException.getValueType() == ::getCppuType( ( const provider::ScriptExceptionRaisedException* ) NULL ) )
    1501                 :            :         {
    1502                 :            :             // Exception raised by script
    1503         [ #  # ]:          0 :             provider::ScriptExceptionRaisedException scriptException;
    1504         [ #  # ]:          0 :             ite.TargetException >>= scriptException;
    1505 [ #  # ][ #  # ]:          0 :             return GetErrorMessage( scriptException );
    1506                 :            :         }
    1507                 :            :         else
    1508                 :            :         {
    1509                 :            :             // Unknown error, shouldn't happen
    1510                 :            :             // OSL_ASSERT(...)
    1511 [ #  # ][ #  # ]:          0 :         }
    1512                 :            : 
    1513                 :            :     }
    1514 [ +  - ][ +  - ]:          3 :     else if ( aException.getValueType() == ::getCppuType( ( const provider::ScriptFrameworkErrorException* ) NULL ) )
    1515                 :            :     {
    1516                 :            :         // A Script Framework error has occurred
    1517         [ +  - ]:          3 :         provider::ScriptFrameworkErrorException sfe;
    1518         [ +  - ]:          3 :         aException >>= sfe;
    1519 [ +  - ][ +  - ]:          3 :         return GetErrorMessage( sfe );
    1520                 :            : 
    1521                 :            :     }
    1522                 :            :     // unknown exception
    1523         [ #  # ]:          0 :     Exception e;
    1524         [ #  # ]:          0 :     RuntimeException rte;
    1525 [ #  # ][ #  # ]:          0 :     if ( aException >>= rte )
    1526                 :            :     {
    1527         [ #  # ]:          0 :         return GetErrorMessage( rte );
    1528                 :            :     }
    1529                 :            : 
    1530         [ #  # ]:          0 :     aException >>= e;
    1531 [ #  # ][ #  # ]:          3 :     return GetErrorMessage( e );
                 [ #  # ]
    1532                 :            : 
    1533                 :            : }
    1534                 :            : 
    1535                 :          3 : SvxScriptErrorDialog::SvxScriptErrorDialog(
    1536                 :            :     Window* , ::com::sun::star::uno::Any aException )
    1537                 :          3 :     : m_sMessage()
    1538                 :            : {
    1539         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    1540 [ +  - ][ +  - ]:          3 :     m_sMessage = GetErrorMessage( aException );
    1541                 :          3 : }
    1542                 :            : 
    1543                 :          3 : SvxScriptErrorDialog::~SvxScriptErrorDialog()
    1544                 :            : {
    1545         [ -  + ]:          6 : }
    1546                 :            : 
    1547                 :          3 : short SvxScriptErrorDialog::Execute()
    1548                 :            : {
    1549                 :            :     // Show Error dialog asynchronously
    1550                 :            :     //
    1551                 :            :     // Pass a copy of the message to the ShowDialog method as the
    1552                 :            :     // SvxScriptErrorDialog may be deleted before ShowDialog is called
    1553                 :            :     Application::PostUserEvent(
    1554                 :            :         LINK( this, SvxScriptErrorDialog, ShowDialog ),
    1555         [ +  - ]:          3 :         new rtl::OUString( m_sMessage ) );
    1556                 :            : 
    1557                 :          3 :     return 0;
    1558                 :            : }
    1559                 :            : 
    1560                 :          0 : IMPL_LINK( SvxScriptErrorDialog, ShowDialog, ::rtl::OUString*, pMessage )
    1561                 :            : {
    1562                 :          0 :     ::rtl::OUString message;
    1563                 :            : 
    1564 [ #  # ][ #  # ]:          0 :     if ( pMessage && !pMessage->isEmpty() )
                 [ #  # ]
    1565                 :            :     {
    1566                 :          0 :         message = *pMessage;
    1567                 :            :     }
    1568                 :            :     else
    1569                 :            :     {
    1570 [ #  # ][ #  # ]:          0 :         message = String( CUI_RES( RID_SVXSTR_ERROR_TITLE ) );
         [ #  # ][ #  # ]
    1571                 :            :     }
    1572                 :            : 
    1573 [ #  # ][ #  # ]:          0 :     MessBox* pBox = new WarningBox( NULL, WB_OK, message );
         [ #  # ][ #  # ]
    1574 [ #  # ][ #  # ]:          0 :     pBox->SetText( CUI_RES( RID_SVXSTR_ERROR_TITLE ) );
         [ #  # ][ #  # ]
    1575         [ #  # ]:          0 :     pBox->Execute();
    1576                 :            : 
    1577 [ #  # ][ #  # ]:          0 :     delete pBox;
    1578         [ #  # ]:          0 :     delete pMessage;
    1579                 :            : 
    1580                 :          0 :     return 0;
    1581 [ +  - ][ +  - ]:          9 : }
    1582                 :            : 
    1583                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10