LCOV - code coverage report
Current view: top level - UnoControls/source/controls - framecontrol.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 178 0.0 %
Date: 2012-08-25 Functions: 0 30 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include "framecontrol.hxx"
      21                 :            : 
      22                 :            : #include <com/sun/star/frame/XDispatchProvider.hpp>
      23                 :            : #include <com/sun/star/util/URLTransformer.hpp>
      24                 :            : #include <com/sun/star/util/XURLTransformer.hpp>
      25                 :            : #include <com/sun/star/frame/XDispatch.hpp>
      26                 :            : #include <com/sun/star/frame/FrameSearchFlag.hpp>
      27                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      28                 :            : #include <comphelper/componentcontext.hxx>
      29                 :            : #include <cppuhelper/typeprovider.hxx>
      30                 :            : #include <osl/diagnose.h>
      31                 :            : 
      32                 :            : //______________________________________________________________________________________________________________
      33                 :            : //  namespaces
      34                 :            : //______________________________________________________________________________________________________________
      35                 :            : 
      36                 :            : using namespace ::rtl                   ;
      37                 :            : using namespace ::osl                   ;
      38                 :            : using namespace ::cppu                  ;
      39                 :            : using namespace ::com::sun::star::uno   ;
      40                 :            : using namespace ::com::sun::star::lang  ;
      41                 :            : using namespace ::com::sun::star::beans ;
      42                 :            : using namespace ::com::sun::star::awt   ;
      43                 :            : using namespace ::com::sun::star::frame ;
      44                 :            : using namespace ::com::sun::star::util  ;
      45                 :            : 
      46                 :            : namespace unocontrols{
      47                 :            : 
      48                 :            : //______________________________________________________________________________________________________________
      49                 :            : //  construct/destruct
      50                 :            : //______________________________________________________________________________________________________________
      51                 :            : 
      52                 :          0 : FrameControl::FrameControl( const Reference< XMultiServiceFactory >& xFactory )
      53                 :            :     : BaseControl                   ( xFactory                                                                              )
      54                 :            :     , OBroadcastHelper              ( m_aMutex                                                                              )
      55                 :            :     , OPropertySetHelper            ( *(static_cast< OBroadcastHelper * >(this))  )
      56                 :            :     , m_aInterfaceContainer         ( m_aMutex                                                                              )
      57                 :          0 :     , m_aConnectionPointContainer   ( m_aMutex                                                                              )
      58                 :            : {
      59                 :          0 : }
      60                 :            : 
      61                 :          0 : FrameControl::~FrameControl()
      62                 :            : {
      63                 :          0 : }
      64                 :            : 
      65                 :            : //____________________________________________________________________________________________________________
      66                 :            : //  XInterface
      67                 :            : //____________________________________________________________________________________________________________
      68                 :            : 
      69                 :          0 : Any SAL_CALL FrameControl::queryInterface( const Type& rType ) throw( RuntimeException )
      70                 :            : {
      71                 :            :     // Attention:
      72                 :            :     //  Don't use mutex or guard in this method!!! Is a method of XInterface.
      73                 :          0 :     Any aReturn ;
      74                 :          0 :     Reference< XInterface > xDel = BaseControl::impl_getDelegator();
      75                 :          0 :     if ( xDel.is() )
      76                 :            :     {
      77                 :            :         // If an delegator exist, forward question to his queryInterface.
      78                 :            :         // Delegator will ask his own queryAggregation!
      79                 :          0 :         aReturn = xDel->queryInterface( rType );
      80                 :            :     }
      81                 :            :     else
      82                 :            :     {
      83                 :            :         // If an delegator unknown, forward question to own queryAggregation.
      84                 :          0 :         aReturn = queryAggregation( rType );
      85                 :            :     }
      86                 :            : 
      87                 :          0 :     return aReturn ;
      88                 :            : }
      89                 :            : 
      90                 :            : //____________________________________________________________________________________________________________
      91                 :            : //  XInterface
      92                 :            : //____________________________________________________________________________________________________________
      93                 :            : 
      94                 :          0 : void SAL_CALL FrameControl::acquire() throw()
      95                 :            : {
      96                 :            :     // Attention:
      97                 :            :     //  Don't use mutex or guard in this method!!! Is a method of XInterface.
      98                 :            : 
      99                 :            :     // Forward to baseclass
     100                 :          0 :     BaseControl::acquire();
     101                 :          0 : }
     102                 :            : 
     103                 :            : //____________________________________________________________________________________________________________
     104                 :            : //  XInterface
     105                 :            : //____________________________________________________________________________________________________________
     106                 :            : 
     107                 :          0 : void SAL_CALL FrameControl::release() throw()
     108                 :            : {
     109                 :            :     // Attention:
     110                 :            :     //  Don't use mutex or guard in this method!!! Is a method of XInterface.
     111                 :            : 
     112                 :            :     // Forward to baseclass
     113                 :          0 :     BaseControl::release();
     114                 :          0 : }
     115                 :            : 
     116                 :            : //____________________________________________________________________________________________________________
     117                 :            : //  XTypeProvider
     118                 :            : //____________________________________________________________________________________________________________
     119                 :            : 
     120                 :          0 : Sequence< Type > SAL_CALL FrameControl::getTypes() throw( RuntimeException )
     121                 :            : {
     122                 :            :     // Optimize this method !
     123                 :            :     // We initialize a static variable only one time. And we don't must use a mutex at every call!
     124                 :            :     // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
     125                 :            :     static OTypeCollection* pTypeCollection = NULL ;
     126                 :            : 
     127                 :          0 :     if ( pTypeCollection == NULL )
     128                 :            :     {
     129                 :            :         // Ready for multithreading; get global mutex for first call of this method only! see before
     130                 :          0 :         MutexGuard aGuard( Mutex::getGlobalMutex() );
     131                 :            : 
     132                 :            :         // Control these pointer again ... it can be, that another instance will be faster then these!
     133                 :          0 :         if ( pTypeCollection == NULL )
     134                 :            :         {
     135                 :            :             // Create a static typecollection ...
     136                 :          0 :             static OTypeCollection aTypeCollection  (   ::getCppuType(( const Reference< XControlModel              >*)NULL )   ,
     137                 :          0 :                                                           ::getCppuType(( const Reference< XControlContainer            >*)NULL )   ,
     138                 :          0 :                                                           ::getCppuType(( const Reference< XConnectionPointContainer    >*)NULL )   ,
     139                 :            :                                                         BaseControl::getTypes()
     140                 :          0 :                                                     );
     141                 :            :             // ... and set his address to static pointer!
     142                 :          0 :             pTypeCollection = &aTypeCollection ;
     143                 :          0 :         }
     144                 :            :     }
     145                 :            : 
     146                 :          0 :     return pTypeCollection->getTypes();
     147                 :            : }
     148                 :            : 
     149                 :            : //____________________________________________________________________________________________________________
     150                 :            : //  XAggregation
     151                 :            : //____________________________________________________________________________________________________________
     152                 :            : 
     153                 :          0 : Any SAL_CALL FrameControl::queryAggregation( const Type& aType ) throw( RuntimeException )
     154                 :            : {
     155                 :            :     // Ask for my own supported interfaces ...
     156                 :            :     // Attention: XTypeProvider and XInterface are supported by OComponentHelper!
     157                 :            :     Any aReturn ( ::cppu::queryInterface(   aType                                               ,
     158                 :            :                                                static_cast< XControlModel*              > ( this )  ,
     159                 :            :                                                static_cast< XConnectionPointContainer*  > ( this )
     160                 :            :                                         )
     161                 :          0 :                 );
     162                 :            : 
     163                 :            :     // If searched interface not supported by this class ...
     164                 :          0 :     if ( aReturn.hasValue() == sal_False )
     165                 :            :     {
     166                 :            :         // ... ask baseclasses.
     167                 :          0 :         aReturn = OPropertySetHelper::queryInterface( aType );
     168                 :          0 :         if ( aReturn.hasValue() == sal_False )
     169                 :            :         {
     170                 :          0 :             aReturn = BaseControl::queryAggregation( aType );
     171                 :            :         }
     172                 :            :     }
     173                 :            : 
     174                 :          0 :     return aReturn ;
     175                 :            : }
     176                 :            : 
     177                 :            : //____________________________________________________________________________________________________________
     178                 :            : //  XControl
     179                 :            : //____________________________________________________________________________________________________________
     180                 :            : 
     181                 :          0 : void SAL_CALL FrameControl::createPeer( const   Reference< XToolkit >&      xToolkit    ,
     182                 :            :                                         const   Reference< XWindowPeer >&   xParentPeer ) throw( RuntimeException )
     183                 :            : {
     184                 :          0 :     BaseControl::createPeer( xToolkit, xParentPeer );
     185                 :          0 :     if ( impl_getPeerWindow().is() )
     186                 :            :     {
     187                 :          0 :         if( !m_sComponentURL.isEmpty() )
     188                 :            :         {
     189                 :          0 :             impl_createFrame( getPeer(), m_sComponentURL, m_seqLoaderArguments );
     190                 :            :         }
     191                 :            :     }
     192                 :          0 : }
     193                 :            : 
     194                 :            : //____________________________________________________________________________________________________________
     195                 :            : //  XControl
     196                 :            : //____________________________________________________________________________________________________________
     197                 :            : 
     198                 :          0 : sal_Bool SAL_CALL FrameControl::setModel( const Reference< XControlModel >& /*xModel*/ ) throw( RuntimeException )
     199                 :            : {
     200                 :            :     // We have no model.
     201                 :          0 :     return sal_False ;
     202                 :            : }
     203                 :            : 
     204                 :            : //____________________________________________________________________________________________________________
     205                 :            : //  XControl
     206                 :            : //____________________________________________________________________________________________________________
     207                 :            : 
     208                 :          0 : Reference< XControlModel > SAL_CALL FrameControl::getModel() throw( RuntimeException )
     209                 :            : {
     210                 :            :     // We have no model.
     211                 :          0 :     return Reference< XControlModel >();
     212                 :            : }
     213                 :            : 
     214                 :            : //____________________________________________________________________________________________________________
     215                 :            : //  XControl
     216                 :            : //____________________________________________________________________________________________________________
     217                 :            : 
     218                 :          0 : void SAL_CALL FrameControl::dispose() throw( RuntimeException )
     219                 :            : {
     220                 :          0 :     impl_deleteFrame();
     221                 :          0 :     BaseControl::dispose();
     222                 :          0 : }
     223                 :            : 
     224                 :            : //____________________________________________________________________________________________________________
     225                 :            : //  XView
     226                 :            : //____________________________________________________________________________________________________________
     227                 :            : 
     228                 :          0 : sal_Bool SAL_CALL FrameControl::setGraphics( const Reference< XGraphics >& /*xDevice*/ ) throw( RuntimeException )
     229                 :            : {
     230                 :            :     // it is not possible to print this control
     231                 :          0 :     return sal_False ;
     232                 :            : }
     233                 :            : 
     234                 :            : //____________________________________________________________________________________________________________
     235                 :            : //  XView
     236                 :            : //____________________________________________________________________________________________________________
     237                 :            : 
     238                 :          0 : Reference< XGraphics > SAL_CALL FrameControl::getGraphics() throw( RuntimeException )
     239                 :            : {
     240                 :            :     // when its not posible to set graphics ! then its possible to return null
     241                 :          0 :     return Reference< XGraphics >();
     242                 :            : }
     243                 :            : 
     244                 :            : //____________________________________________________________________________________________________________
     245                 :            : //  XConnectionPointContainer
     246                 :            : //____________________________________________________________________________________________________________
     247                 :            : 
     248                 :          0 : Sequence< Type > SAL_CALL FrameControl::getConnectionPointTypes() throw( RuntimeException )
     249                 :            : {
     250                 :            :     // Forwarded to helper class
     251                 :          0 :     return m_aConnectionPointContainer.getConnectionPointTypes();
     252                 :            : }
     253                 :            : 
     254                 :            : //____________________________________________________________________________________________________________
     255                 :            : //  XConnectionPointContainer
     256                 :            : //____________________________________________________________________________________________________________
     257                 :            : 
     258                 :          0 : Reference< XConnectionPoint > SAL_CALL FrameControl::queryConnectionPoint( const Type& aType ) throw( RuntimeException )
     259                 :            : {
     260                 :            :     // Forwarded to helper class
     261                 :          0 :     return m_aConnectionPointContainer.queryConnectionPoint( aType );
     262                 :            : }
     263                 :            : 
     264                 :            : //____________________________________________________________________________________________________________
     265                 :            : //  XConnectionPointContainer
     266                 :            : //____________________________________________________________________________________________________________
     267                 :            : 
     268                 :          0 : void SAL_CALL FrameControl::advise( const   Type&                       aType       ,
     269                 :            :                                     const   Reference< XInterface >&    xListener   ) throw( RuntimeException )
     270                 :            : {
     271                 :            :     // Forwarded to helper class
     272                 :          0 :     m_aConnectionPointContainer.advise( aType, xListener );
     273                 :          0 : }
     274                 :            : 
     275                 :            : //____________________________________________________________________________________________________________
     276                 :            : //  XConnectionPointContainer
     277                 :            : //____________________________________________________________________________________________________________
     278                 :            : 
     279                 :          0 : void SAL_CALL FrameControl::unadvise(   const   Type&                       aType       ,
     280                 :            :                                         const   Reference< XInterface >&    xListener   ) throw( RuntimeException )
     281                 :            : {
     282                 :            :     // Forwarded to helper class
     283                 :          0 :     m_aConnectionPointContainer.unadvise( aType, xListener );
     284                 :          0 : }
     285                 :            : 
     286                 :            : //____________________________________________________________________________________________________________
     287                 :            : //  impl but public method to register service
     288                 :            : //____________________________________________________________________________________________________________
     289                 :            : 
     290                 :          0 : const Sequence< OUString > FrameControl::impl_getStaticSupportedServiceNames()
     291                 :            : {
     292                 :          0 :     MutexGuard aGuard( Mutex::getGlobalMutex() );
     293                 :          0 :     Sequence< OUString > seqServiceNames( 1 );
     294                 :          0 :     seqServiceNames.getArray() [0] = SERVICENAME_FRAMECONTROL;
     295                 :          0 :     return seqServiceNames ;
     296                 :            : }
     297                 :            : 
     298                 :            : //____________________________________________________________________________________________________________
     299                 :            : //  impl but public method to register service
     300                 :            : //____________________________________________________________________________________________________________
     301                 :            : 
     302                 :          0 : const OUString FrameControl::impl_getStaticImplementationName()
     303                 :            : {
     304                 :          0 :     return OUString(IMPLEMENTATIONNAME_FRAMECONTROL);
     305                 :            : }
     306                 :            : 
     307                 :            : //____________________________________________________________________________________________________________
     308                 :            : //  OPropertySetHelper
     309                 :            : //____________________________________________________________________________________________________________
     310                 :            : 
     311                 :          0 : sal_Bool FrameControl::convertFastPropertyValue(        Any&        rConvertedValue ,
     312                 :            :                                                         Any&        rOldValue       ,
     313                 :            :                                                         sal_Int32   nHandle         ,
     314                 :            :                                                 const   Any&        rValue          ) throw( IllegalArgumentException )
     315                 :            : {
     316                 :          0 :     sal_Bool bReturn = sal_False ;
     317                 :          0 :     switch (nHandle)
     318                 :            :     {
     319                 :          0 :         case PROPERTYHANDLE_COMPONENTURL        :       rConvertedValue   = rValue                  ;
     320                 :          0 :                                                         rOldValue       <<= m_sComponentURL         ;
     321                 :          0 :                                                         bReturn           = sal_True                ;
     322                 :          0 :                                                         break ;
     323                 :            : 
     324                 :          0 :         case PROPERTYHANDLE_LOADERARGUMENTS     :       rConvertedValue   = rValue                  ;
     325                 :          0 :                                                         rOldValue       <<= m_seqLoaderArguments    ;
     326                 :          0 :                                                         bReturn           = sal_True                ;
     327                 :          0 :                                                         break ;
     328                 :            :     }
     329                 :            : 
     330                 :          0 :     if ( bReturn == sal_False )
     331                 :            :     {
     332                 :          0 :         throw IllegalArgumentException();
     333                 :            :     }
     334                 :            : 
     335                 :          0 :     return bReturn ;
     336                 :            : }
     337                 :            : 
     338                 :            : //____________________________________________________________________________________________________________
     339                 :            : //  OPropertySetHelper
     340                 :            : //____________________________________________________________________________________________________________
     341                 :            : 
     342                 :          0 : void FrameControl::setFastPropertyValue_NoBroadcast(            sal_Int32   nHandle ,
     343                 :            :                                                         const   Any&        rValue  )
     344                 :            :                                                         throw ( ::com::sun::star::uno::Exception )
     345                 :            : {
     346                 :            :     // this method only set the value
     347                 :          0 :     MutexGuard  aGuard (m_aMutex) ;
     348                 :          0 :     switch (nHandle)
     349                 :            :     {
     350                 :          0 :         case PROPERTYHANDLE_COMPONENTURL        :       rValue >>= m_sComponentURL ;
     351                 :          0 :                                                         if (getPeer().is())
     352                 :            :                                                         {
     353                 :          0 :                                                             impl_createFrame ( getPeer(), m_sComponentURL, m_seqLoaderArguments ) ;
     354                 :            :                                                         }
     355                 :          0 :                                                         break ;
     356                 :            : 
     357                 :          0 :         case PROPERTYHANDLE_LOADERARGUMENTS     :       rValue >>= m_seqLoaderArguments ;
     358                 :          0 :                                                         break ;
     359                 :            : 
     360                 :            :         default :                                       OSL_ENSURE ( nHandle == -1, ERRORTEXT_VOSENSHURE ) ;
     361                 :          0 :     }
     362                 :          0 : }
     363                 :            : 
     364                 :            : //____________________________________________________________________________________________________________
     365                 :            : //  OPropertySetHelper
     366                 :            : //____________________________________________________________________________________________________________
     367                 :            : 
     368                 :          0 : void FrameControl::getFastPropertyValue(    Any&        rRet    ,
     369                 :            :                                             sal_Int32   nHandle ) const
     370                 :            : {
     371                 :          0 :     MutexGuard  aGuard ( Mutex::getGlobalMutex() ) ;
     372                 :            : 
     373                 :          0 :     switch (nHandle)
     374                 :            :     {
     375                 :          0 :         case PROPERTYHANDLE_COMPONENTURL    :       rRet <<= m_sComponentURL ;
     376                 :          0 :                                                     break ;
     377                 :            : 
     378                 :          0 :         case PROPERTYHANDLE_LOADERARGUMENTS :       rRet <<= m_seqLoaderArguments ;
     379                 :          0 :                                                     break ;
     380                 :            : 
     381                 :          0 :         case PROPERTYHANDLE_FRAME           :       rRet <<= m_xFrame ;
     382                 :          0 :                                                        break ;
     383                 :            : 
     384                 :            :         default :                                   OSL_ENSURE ( nHandle == -1, ERRORTEXT_VOSENSHURE ) ;
     385                 :          0 :     }
     386                 :          0 : }
     387                 :            : 
     388                 :            : //____________________________________________________________________________________________________________
     389                 :            : //  OPropertySetHelper
     390                 :            : //____________________________________________________________________________________________________________
     391                 :            : 
     392                 :          0 : IPropertyArrayHelper& FrameControl::getInfoHelper()
     393                 :            : {
     394                 :            :     // Create a table that map names to index values.
     395                 :            :     static OPropertyArrayHelper* pInfo ;
     396                 :            : 
     397                 :          0 :     if (!pInfo)
     398                 :            :     {
     399                 :            :         // global method must be guarded
     400                 :          0 :         MutexGuard  aGuard ( Mutex::getGlobalMutex() ) ;
     401                 :            : 
     402                 :          0 :         if (!pInfo)
     403                 :            :         {
     404                 :          0 :             pInfo = new OPropertyArrayHelper( impl_getStaticPropertyDescriptor(), sal_True );
     405                 :          0 :         }
     406                 :            :     }
     407                 :            : 
     408                 :          0 :     return *pInfo ;
     409                 :            : }
     410                 :            : 
     411                 :            : //____________________________________________________________________________________________________________
     412                 :            : //  OPropertySetHelper
     413                 :            : //____________________________________________________________________________________________________________
     414                 :            : 
     415                 :          0 : Reference< XPropertySetInfo > SAL_CALL FrameControl::getPropertySetInfo() throw( RuntimeException )
     416                 :            : {
     417                 :            :     // Optimize this method !
     418                 :            :     // We initialize a static variable only one time. And we don't must use a mutex at every call!
     419                 :            :     // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
     420                 :            :     static Reference< XPropertySetInfo >* pInfo = (Reference< XPropertySetInfo >*)0 ;
     421                 :          0 :     if ( pInfo == (Reference< XPropertySetInfo >*)0 )
     422                 :            :     {
     423                 :            :         // Ready for multithreading
     424                 :          0 :         MutexGuard aGuard ( Mutex::getGlobalMutex () ) ;
     425                 :            :         // Control this pointer again, another instance can be faster then these!
     426                 :          0 :         if ( pInfo == (Reference< XPropertySetInfo >*)0 )
     427                 :            :         {
     428                 :            :             // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
     429                 :            :             // (Use method "getInfoHelper()".)
     430                 :          0 :             static Reference< XPropertySetInfo > xInfo ( createPropertySetInfo ( getInfoHelper () ) ) ;
     431                 :          0 :             pInfo = &xInfo ;
     432                 :          0 :         }
     433                 :            :     }
     434                 :          0 :     return ( *pInfo ) ;
     435                 :            : }
     436                 :            : 
     437                 :            : //____________________________________________________________________________________________________________
     438                 :            : //  BaseControl
     439                 :            : //____________________________________________________________________________________________________________
     440                 :            : 
     441                 :          0 : WindowDescriptor* FrameControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer )
     442                 :            : {
     443                 :          0 :     WindowDescriptor* pDescriptor   = new WindowDescriptor  ;
     444                 :            : 
     445                 :          0 :     pDescriptor->Type               = WindowClass_CONTAINER ;
     446                 :          0 :     pDescriptor->ParentIndex        = -1                    ;
     447                 :          0 :     pDescriptor->Parent             = xParentPeer           ;
     448                 :          0 :     pDescriptor->Bounds             = getPosSize ()         ;
     449                 :          0 :     pDescriptor->WindowAttributes   = 0                     ;
     450                 :            : 
     451                 :          0 :     return pDescriptor ;
     452                 :            : }
     453                 :            : 
     454                 :            : //____________________________________________________________________________________________________________
     455                 :            : //  private method
     456                 :            : //____________________________________________________________________________________________________________
     457                 :            : 
     458                 :          0 : void FrameControl::impl_createFrame(    const   Reference< XWindowPeer >&   xPeer       ,
     459                 :            :                                         const   OUString&                   rURL        ,
     460                 :            :                                         const   Sequence< PropertyValue >&  rArguments  )
     461                 :            : {
     462                 :          0 :     Reference< XFrame >     xOldFrame   ;
     463                 :          0 :     Reference< XFrame >     xNewFrame   ;
     464                 :            : 
     465                 :            :     {
     466                 :          0 :         MutexGuard  aGuard ( m_aMutex ) ;
     467                 :          0 :         xOldFrame = m_xFrame ;
     468                 :            :     }
     469                 :            : 
     470                 :          0 :     xNewFrame = Reference< XFrame >  ( impl_getMultiServiceFactory()->createInstance ( "com.sun.star.frame.Frame" ), UNO_QUERY ) ;
     471                 :          0 :     Reference< XDispatchProvider >  xDSP ( xNewFrame, UNO_QUERY ) ;
     472                 :            : 
     473                 :          0 :     if (xDSP.is())
     474                 :            :     {
     475                 :          0 :         Reference< XWindow >  xWP ( xPeer, UNO_QUERY ) ;
     476                 :          0 :         xNewFrame->initialize ( xWP ) ;
     477                 :            : 
     478                 :            :         //  option
     479                 :            :         //xFrame->setName( "WhatYouWant" );
     480                 :            : 
     481                 :            :         Reference< XURLTransformer >  xTrans (
     482                 :            :                URLTransformer::create(
     483                 :          0 :                    ::comphelper::ComponentContext( impl_getMultiServiceFactory() ).getUNOContext() ) );
     484                 :            :         // load file
     485                 :          0 :         URL aURL ;
     486                 :            : 
     487                 :          0 :         aURL.Complete = rURL ;
     488                 :          0 :         xTrans->parseStrict( aURL ) ;
     489                 :            : 
     490                 :          0 :         Reference< XDispatch >  xDisp = xDSP->queryDispatch ( aURL, OUString (), FrameSearchFlag::SELF ) ;
     491                 :          0 :         if (xDisp.is())
     492                 :            :         {
     493                 :          0 :             xDisp->dispatch ( aURL, rArguments ) ;
     494                 :          0 :         }
     495                 :            :     }
     496                 :            : 
     497                 :            :     // set the frame
     498                 :            :     {
     499                 :          0 :         MutexGuard aGuard ( m_aMutex ) ;
     500                 :          0 :         m_xFrame = xNewFrame ;
     501                 :            :     }
     502                 :            : 
     503                 :            :     // notify the listeners
     504                 :          0 :     sal_Int32   nFrameId = PROPERTYHANDLE_FRAME ;
     505                 :          0 :     Any aNewFrame ( &xNewFrame, ::getCppuType((const Reference< XFrame >*)0) ) ;
     506                 :          0 :     Any aOldFrame ( &xOldFrame, ::getCppuType((const Reference< XFrame >*)0) ) ;
     507                 :            : 
     508                 :          0 :     fire ( &nFrameId, &aNewFrame, &aOldFrame, 1, sal_False ) ;
     509                 :            : 
     510                 :          0 :     if (xOldFrame.is())
     511                 :            :     {
     512                 :          0 :         xOldFrame->dispose () ;
     513                 :          0 :     }
     514                 :          0 : }
     515                 :            : 
     516                 :            : //____________________________________________________________________________________________________________
     517                 :            : //  private method
     518                 :            : //____________________________________________________________________________________________________________
     519                 :            : 
     520                 :          0 : void FrameControl::impl_deleteFrame()
     521                 :            : {
     522                 :          0 :     Reference< XFrame >  xOldFrame;
     523                 :          0 :     Reference< XFrame >  xNullFrame;
     524                 :            : 
     525                 :            :     {
     526                 :            :         // do not dispose the frame in this guarded section (deadlock?)
     527                 :          0 :         MutexGuard aGuard( m_aMutex );
     528                 :          0 :         xOldFrame = m_xFrame;
     529                 :          0 :         m_xFrame = Reference< XFrame > ();
     530                 :            :     }
     531                 :            : 
     532                 :            :     // notify the listeners
     533                 :          0 :     sal_Int32 nFrameId = PROPERTYHANDLE_FRAME;
     534                 :          0 :     Any aNewFrame( &xNullFrame, ::getCppuType((const Reference< XFrame >*)0) );
     535                 :          0 :     Any aOldFrame( &xOldFrame, ::getCppuType((const Reference< XFrame >*)0) );
     536                 :          0 :     fire( &nFrameId, &aNewFrame, &aOldFrame, 1, sal_False );
     537                 :            : 
     538                 :            :     // dispose the frame
     539                 :          0 :     if( xOldFrame.is() )
     540                 :          0 :         xOldFrame->dispose();
     541                 :          0 : }
     542                 :            : 
     543                 :            : //____________________________________________________________________________________________________________
     544                 :            : //  private method
     545                 :            : //____________________________________________________________________________________________________________
     546                 :            : 
     547                 :          0 : const Sequence< Property > FrameControl::impl_getStaticPropertyDescriptor()
     548                 :            : {
     549                 :            :     // All Properties of this implementation. The array must be sorted!
     550                 :            :     static const Property pPropertys[PROPERTY_COUNT] =
     551                 :            :     {
     552                 :          0 :         Property( PROPERTYNAME_COMPONENTURL, PROPERTYHANDLE_COMPONENTURL, ::getCppuType((const OUString*)0), PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED ),
     553                 :          0 :         Property( PROPERTYNAME_FRAME, PROPERTYHANDLE_FRAME, ::getCppuType((const Reference< XFrame >*)0), PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT   ),
     554                 :          0 :         Property( PROPERTYNAME_LOADERARGUMENTS, PROPERTYHANDLE_LOADERARGUMENTS, ::getCppuType((const Sequence< PropertyValue >*)0), PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED )
     555                 :          0 :     };
     556                 :            : 
     557                 :          0 :     static const Sequence< Property > seqPropertys( pPropertys, PROPERTY_COUNT );
     558                 :            : 
     559                 :          0 :     return seqPropertys ;
     560                 :            : }
     561                 :            : 
     562                 :            : }   // namespace unocontrols
     563                 :            : 
     564                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10