LCOV - code coverage report
Current view: top level - sfx2/source/view - frame.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 269 451 59.6 %
Date: 2012-08-25 Functions: 52 91 57.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 240 703 34.1 %

           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 <com/sun/star/embed/EmbedStates.hpp>
      21                 :            : #include <com/sun/star/uno/Reference.h>
      22                 :            : #include <com/sun/star/awt/XWindow.hpp>
      23                 :            : #include <com/sun/star/util/XURLTransformer.hpp>
      24                 :            : #include <com/sun/star/util/XCloseable.hpp>
      25                 :            : #include <com/sun/star/util/CloseVetoException.hpp>
      26                 :            : #include <com/sun/star/lang/XComponent.hpp>
      27                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      28                 :            : #include <com/sun/star/container/XChild.hpp>
      29                 :            : 
      30                 :            : #include <vcl/menu.hxx>
      31                 :            : #include <svl/intitem.hxx>
      32                 :            : #include <vcl/splitwin.hxx>
      33                 :            : #include <svl/eitem.hxx>
      34                 :            : #include <svl/stritem.hxx>
      35                 :            : #include <toolkit/helper/vclunohelper.hxx>
      36                 :            : #include <com/sun/star/awt/PosSize.hpp>
      37                 :            : #include <comphelper/processfactory.hxx>
      38                 :            : #include <vcl/msgbox.hxx>
      39                 :            : 
      40                 :            : // due to pTopFrames
      41                 :            : #include "appdata.hxx"
      42                 :            : #include <sfx2/app.hxx>
      43                 :            : #include <sfx2/event.hxx>
      44                 :            : #include <sfx2/unoctitm.hxx>
      45                 :            : #include <sfx2/frame.hxx>
      46                 :            : #include "arrdecl.hxx"
      47                 :            : #include <sfx2/objsh.hxx>
      48                 :            : #include <sfx2/dispatch.hxx>
      49                 :            : #include <sfx2/docfile.hxx>
      50                 :            : #include <sfx2/docfilt.hxx>
      51                 :            : #include <sfx2/frmdescr.hxx>
      52                 :            : #include "openflag.hxx"
      53                 :            : #include <sfx2/viewsh.hxx>
      54                 :            : #include <sfx2/viewfrm.hxx>
      55                 :            : #include <sfx2/request.hxx>
      56                 :            : #include <sfx2/fcontnr.hxx>
      57                 :            : #include "impframe.hxx"
      58                 :            : #include <sfx2/appuno.hxx>
      59                 :            : #include "workwin.hxx"
      60                 :            : #include <sfx2/sfxuno.hxx>
      61                 :            : #include <sfx2/msgpool.hxx>
      62                 :            : #include "objshimp.hxx"
      63                 :            : #include <sfx2/ipclient.hxx>
      64                 :            : 
      65                 :            : #ifdef DBG_UTIL
      66                 :            : #include <sfx2/frmhtmlw.hxx>
      67                 :            : #endif
      68                 :            : 
      69                 :            : using namespace com::sun::star;
      70                 :            : 
      71                 :            : static SfxFrameArr_Impl* pFramesArr_Impl=0;
      72                 :            : 
      73                 :            : using namespace ::com::sun::star::uno;
      74                 :            : using namespace ::com::sun::star::util;
      75                 :            : using namespace ::com::sun::star::frame;
      76                 :            : using namespace ::com::sun::star::container;
      77                 :            : 
      78 [ #  # ][ #  # ]:          0 : TYPEINIT1(SfxFrame, SfxListener);
      79 [ #  # ][ #  # ]:          6 : TYPEINIT1_AUTOFACTORY(SfxFrameItem, SfxPoolItem);
                 [ #  # ]
      80 [ +  - ][ #  # ]:      85926 : TYPEINIT1(SfxUsrAnyItem, SfxPoolItem);
      81 [ +  + ][ -  + ]:      34999 : TYPEINIT1_AUTOFACTORY(SfxUnoFrameItem, SfxPoolItem);
                 [ #  # ]
      82                 :            : 
      83                 :       3323 : SvCompatWeakHdl* SfxFrame::GetHdl()
      84                 :            : {
      85                 :       3323 :     return pImp->GetHdl();
      86                 :            : }
      87                 :            : 
      88                 :            : //--------------------------------------------------------------------
      89                 :       1711 : void SfxFrame::Construct_Impl()
      90                 :            : {
      91         [ +  - ]:       1711 :     pImp = new SfxFrame_Impl( this );
      92         [ +  + ]:       1711 :     if ( !pFramesArr_Impl )
      93         [ +  - ]:        113 :         pFramesArr_Impl = new SfxFrameArr_Impl;
      94         [ +  - ]:       1711 :     pFramesArr_Impl->push_back( this );
      95                 :       1711 : }
      96                 :            : 
      97                 :            : //--------------------------------------------------------------------
      98                 :            : 
      99                 :       3240 : SfxFrame::~SfxFrame()
     100                 :            : {
     101         [ +  - ]:       1620 :     RemoveTopFrame_Impl( this );
     102 [ +  - ][ +  - ]:       1620 :     DELETEZ( pWindow );
     103                 :            : 
     104         [ +  - ]:       1620 :     SfxFrameArr_Impl::iterator it = std::find( pFramesArr_Impl->begin(), pFramesArr_Impl->end(), this );
     105 [ +  - ][ +  - ]:       1620 :     if ( it != pFramesArr_Impl->end() )
     106         [ +  - ]:       1620 :         pFramesArr_Impl->erase( it );
     107                 :            : 
     108         [ -  + ]:       1620 :     if ( pParentFrame )
     109                 :            :     {
     110         [ #  # ]:          0 :         pParentFrame->RemoveChildFrame_Impl( this );
     111                 :          0 :         pParentFrame = 0;
     112                 :            :     }
     113                 :            : 
     114 [ +  - ][ +  - ]:       1620 :     delete pImp->pDescr;
     115                 :            : 
     116         [ -  + ]:       1620 :     if ( pChildArr )
     117                 :            :     {
     118                 :            :         DBG_ASSERT( pChildArr->empty(), "Children are not removed!" );
     119         [ #  # ]:          0 :         delete pChildArr;
     120                 :            :     }
     121                 :            : 
     122 [ +  - ][ +  - ]:       1620 :     delete pImp;
     123         [ -  + ]:       3240 : }
     124                 :            : 
     125                 :       1612 : sal_Bool SfxFrame::DoClose()
     126                 :            : {
     127                 :            :     // Actually, one more PrepareClose is still needed!
     128                 :       1612 :     sal_Bool bRet = sal_False;
     129         [ +  - ]:       1612 :     if ( !pImp->bClosing )
     130                 :            :     {
     131                 :       1612 :         pImp->bClosing = sal_True;
     132                 :       1612 :         CancelTransfers();
     133                 :            : 
     134                 :            :         // now close frame; it will be deleted if this call is successful, so don't use any members after that!
     135                 :       1612 :         bRet = sal_True;
     136                 :            :         try
     137                 :            :         {
     138         [ +  - ]:       1612 :             Reference< XCloseable > xCloseable  ( pImp->xFrame, UNO_QUERY );
     139 [ +  - ][ +  - ]:       1612 :             if ( (!GetCurrentDocument() || !GetCurrentDocument()->Get_Impl()->bDisposing ) && xCloseable.is())
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     140 [ +  - ][ +  - ]:       1612 :                 xCloseable->close(sal_True);
     141         [ #  # ]:          0 :             else if ( pImp->xFrame.is() )
     142                 :            :             {
     143                 :          0 :                 Reference < XFrame > xFrame = pImp->xFrame;
     144 [ #  # ][ #  # ]:          0 :                 xFrame->setComponent( Reference < com::sun::star::awt::XWindow >(), Reference < XController >() );
     145 [ #  # ][ #  # ]:          0 :                 xFrame->dispose();
     146                 :            :             }
     147                 :            :             else
     148         [ #  # ]:       1612 :                 bRet = DoClose_Impl();
              [ #  #  # ]
     149                 :            :         }
     150                 :          0 :         catch( ::com::sun::star::util::CloseVetoException& )
     151                 :            :         {
     152                 :          0 :             pImp->bClosing = sal_False;
     153                 :          0 :             bRet = sal_False;
     154                 :            :         }
     155                 :          0 :         catch( ::com::sun::star::lang::DisposedException& )
     156                 :            :         {
     157                 :            :         }
     158                 :            :     }
     159                 :            : 
     160                 :       1612 :     return bRet;
     161                 :            : }
     162                 :            : 
     163                 :       1620 : sal_Bool SfxFrame::DoClose_Impl()
     164                 :            : {
     165                 :       1620 :     sal_Bool bRet = sal_True;
     166                 :       1620 :     SfxBindings* pBindings = NULL;
     167         [ +  - ]:       1620 :     if ( pImp->pCurrentViewFrame )
     168                 :       1620 :         pBindings = &pImp->pCurrentViewFrame->GetBindings();
     169                 :            : 
     170                 :            :     // For internal tasks Controllers and Tools must be cleared
     171         [ +  - ]:       1620 :     if ( pImp->pWorkWin )
     172                 :       1620 :         pImp->pWorkWin->DeleteControllers_Impl();
     173                 :            : 
     174         [ +  - ]:       1620 :     if ( pImp->pCurrentViewFrame )
     175                 :       1620 :         bRet = pImp->pCurrentViewFrame->Close();
     176                 :            : 
     177         [ +  - ]:       1620 :     if ( pImp->bOwnsBindings )
     178         [ +  - ]:       1620 :         DELETEZ( pBindings );
     179                 :            : 
     180                 :       1620 :     bRet = Close();
     181                 :            :     DBG_ASSERT( bRet, "Impossible state: frame closes, but controller refuses!");
     182                 :       1620 :     return bRet;
     183                 :            : }
     184                 :            : 
     185                 :          0 : sal_Bool SfxFrame::DocIsModified_Impl()
     186                 :            : {
     187         [ #  # ]:          0 :     if ( pImp->pCurrentViewFrame && pImp->pCurrentViewFrame->GetObjectShell() &&
           [ #  #  #  # ]
                 [ #  # ]
     188                 :          0 :             pImp->pCurrentViewFrame->GetObjectShell()->IsModified() )
     189                 :          0 :         return sal_True;
     190         [ #  # ]:          0 :     for( sal_uInt16 nPos = GetChildFrameCount(); nPos--; )
     191         [ #  # ]:          0 :         if( (*pChildArr)[ nPos ]->DocIsModified_Impl() )
     192                 :          0 :             return sal_True;
     193                 :          0 :     return sal_False;
     194                 :            : }
     195                 :            : 
     196                 :          4 : sal_uInt16 SfxFrame::PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing )
     197                 :            : {
     198                 :          4 :     sal_uInt16 nRet = RET_OK;
     199                 :            : 
     200                 :            :     // prevent recursive calls
     201         [ +  - ]:          4 :     if( !pImp->bPrepClosing )
     202                 :            :     {
     203                 :          4 :         pImp->bPrepClosing = sal_True;
     204                 :            : 
     205                 :          4 :         SfxObjectShell* pCur = GetCurrentDocument() ;
     206         [ +  - ]:          4 :         if( pCur )
     207                 :            :         {
     208                 :            :             // SFX components have a known behaviour
     209                 :            :             // First check if this frame is the only view to its current document
     210                 :          4 :             int bOther = sal_False;
     211 [ +  - ][ +  + ]:          8 :             for ( const SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pCur );
                 [ +  + ]
     212                 :            :                     !bOther && pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pCur ) )
     213                 :            :             {
     214                 :          4 :                 bOther = ( &pFrame->GetFrame() != this );
     215                 :            :             }
     216                 :            : 
     217 [ +  - ][ +  - ]:          4 :             SFX_APP()->NotifyEvent( SfxViewEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEVIEW ), pCur, GetController() ) );
         [ +  - ][ +  - ]
                 [ +  - ]
     218                 :            : 
     219         [ -  + ]:          4 :             if ( bOther )
     220                 :            :                 // if there are other views only the current view of this frame must be asked
     221                 :          0 :                 nRet = GetCurrentViewFrame()->GetViewShell()->PrepareClose( bUI, bForBrowsing );
     222                 :            :             else
     223                 :            :                 // otherwise ask the document
     224                 :          4 :                 nRet = pCur->PrepareClose( bUI, bForBrowsing );
     225                 :            :         }
     226                 :            : 
     227         [ +  - ]:          4 :         if ( nRet == RET_OK )
     228                 :            :         {
     229                 :            :             // if this frame has child frames, ask them too
     230 [ +  - ][ -  + ]:          4 :             for( sal_uInt16 nPos = GetChildFrameCount(); nRet == RET_OK && nPos--; )
                 [ -  + ]
     231                 :          0 :                 nRet = (*pChildArr)[ nPos ]->PrepareClose_Impl( bUI, bForBrowsing );
     232                 :            :         }
     233                 :            : 
     234                 :          4 :         pImp->bPrepClosing = sal_False;
     235                 :            :     }
     236                 :            : 
     237 [ +  - ][ +  - ]:          4 :     if ( nRet == RET_OK && pImp->pWorkWin )
     238                 :            :         // if closing was accepted by the component the UI subframes must be asked also
     239                 :          4 :         nRet = pImp->pWorkWin->PrepareClose_Impl();
     240                 :            : 
     241                 :          4 :     return nRet;
     242                 :            : }
     243                 :            : 
     244                 :            : //--------------------------------------------------------------------
     245                 :            : 
     246                 :          0 : SfxFrame* SfxFrame::GetChildFrame( sal_uInt16 nPos ) const
     247                 :            : {
     248 [ #  # ][ #  # ]:          0 :     if ( pChildArr && pChildArr->size() > nPos )
                 [ #  # ]
     249                 :            :     {
     250                 :            :         DBG_ASSERT( nPos < pChildArr->size(), "Wrong Index!");
     251                 :          0 :         return (*pChildArr)[nPos];
     252                 :            :     }
     253                 :            : 
     254                 :          0 :     return 0L;
     255                 :            : }
     256                 :            : 
     257                 :          0 : void SfxFrame::RemoveChildFrame_Impl( SfxFrame* pFrame )
     258                 :            : {
     259                 :            :     DBG_ASSERT( pChildArr, "Unknown Frame!");
     260         [ #  # ]:          0 :     SfxFrameArr_Impl::iterator it = std::find( pChildArr->begin(), pChildArr->end(), pFrame );
     261 [ #  # ][ #  # ]:          0 :     if ( it != pChildArr->end() )
     262         [ #  # ]:          0 :         pChildArr->erase( it );
     263                 :          0 : };
     264                 :            : 
     265                 :      16117 : SfxFrame& SfxFrame::GetTopFrame() const
     266                 :            : {
     267                 :      16117 :     const SfxFrame* pParent = this;
     268         [ -  + ]:      16117 :     while ( pParent->pParentFrame )
     269                 :          0 :         pParent = pParent->pParentFrame;
     270                 :      16117 :     return *const_cast< SfxFrame* >( pParent );
     271                 :            : }
     272                 :            : 
     273                 :      89215 : sal_Bool SfxFrame::IsClosing_Impl() const
     274                 :            : {
     275                 :      89215 :     return pImp->bClosing;
     276                 :            : }
     277                 :            : 
     278                 :       1620 : void SfxFrame::SetIsClosing_Impl()
     279                 :            : {
     280                 :       1620 :     pImp->bClosing = sal_True;
     281                 :       1620 : }
     282                 :            : 
     283                 :       1616 : sal_uInt16 SfxFrame::GetChildFrameCount() const
     284                 :            : {
     285         [ -  + ]:       1616 :     return pChildArr ? pChildArr->size() : 0;
     286                 :            : }
     287                 :            : 
     288                 :       1612 : void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ )
     289                 :            : {
     290         [ +  - ]:       1612 :     if( !pImp->bInCancelTransfers )
     291                 :            :     {
     292                 :       1612 :         pImp->bInCancelTransfers = sal_True;
     293         [ +  - ]:       1612 :         SfxObjectShell* pObj = GetCurrentDocument();
     294         [ +  - ]:       1612 :         if( pObj ) //&& !( pObj->Get_Impl()->nLoadedFlags & SFX_LOADED_ALL ))
     295                 :            :         {
     296                 :            :             SfxViewFrame* pFrm;
     297 [ +  - ][ +  - ]:       4802 :             for( pFrm = SfxViewFrame::GetFirst( pObj );
         [ +  + ][ +  + ]
                 [ +  + ]
     298         [ +  - ]:       1596 :                  pFrm && &pFrm->GetFrame() == this;
     299                 :            :                  pFrm = SfxViewFrame::GetNext( *pFrm, pObj ) ) ;
     300                 :            :             // No more Frame in Document -> Cancel
     301         [ +  + ]:       1612 :             if( !pFrm )
     302                 :            :             {
     303         [ +  - ]:       1610 :                 pObj->CancelTransfers();
     304 [ +  - ][ +  - ]:       1610 :                 GetCurrentDocument()->Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) );
         [ +  - ][ +  - ]
     305                 :            :             }
     306                 :            :         }
     307                 :            : 
     308                 :            :         // First stop multiload Frames
     309         [ +  - ]:       1612 :         sal_uInt16 nCount = GetChildFrameCount();
     310         [ -  + ]:       1612 :         for( sal_uInt16 n = 0; n<nCount; n++ )
     311 [ #  # ][ #  # ]:          0 :             GetChildFrame( n )->CancelTransfers();
     312                 :            : 
     313                 :            :         //  Check if StarOne-Loader should be canceled
     314         [ +  - ]:       1612 :         SfxFrameWeak wFrame( this );
     315         [ +  - ]:       1612 :         if (wFrame.Is())
     316         [ +  - ]:       1612 :             pImp->bInCancelTransfers = sal_False;
     317                 :            :     }
     318                 :       1612 : }
     319                 :            : 
     320                 :      64174 : SfxViewFrame* SfxFrame::GetCurrentViewFrame() const
     321                 :            : {
     322                 :      64174 :     return pImp->pCurrentViewFrame;
     323                 :            : }
     324                 :            : 
     325                 :          0 : SfxDispatcher* SfxFrame::GetDispatcher_Impl() const
     326                 :            : {
     327         [ #  # ]:          0 :     if ( pImp->pCurrentViewFrame )
     328                 :          0 :         return pImp->pCurrentViewFrame->GetDispatcher();
     329                 :          0 :     return GetParentFrame()->GetDispatcher_Impl();
     330                 :            : }
     331                 :            : 
     332                 :       8163 : SfxObjectShell* SfxFrame::GetCurrentDocument() const
     333                 :            : {
     334                 :            :     return pImp->pCurrentViewFrame ?
     335                 :       6452 :             pImp->pCurrentViewFrame->GetObjectShell() :
     336         [ +  + ]:       8163 :             NULL;
     337                 :            : }
     338                 :            : 
     339                 :       3331 : void SfxFrame::SetCurrentViewFrame_Impl( SfxViewFrame *pFrame )
     340                 :            : {
     341                 :       3331 :     pImp->pCurrentViewFrame = pFrame;
     342                 :       3331 : }
     343                 :            : 
     344                 :       3331 : sal_uInt32 SfxFrame::GetFrameType() const
     345                 :            : {
     346                 :       3331 :     return pImp->nType;
     347                 :            : }
     348                 :            : 
     349                 :       1711 : void SfxFrame::SetFrameType_Impl( sal_uInt32 n )
     350                 :            : {
     351                 :       1711 :     pImp->nType = n;
     352                 :       1711 : }
     353                 :            : 
     354                 :          2 : void SfxFrame::GetViewData_Impl()
     355                 :            : {
     356                 :            :     // Update all modifiable data between load and unload, the
     357                 :            :     // fixed data is only processed once (after PrepareForDoc_Impl in
     358                 :            :     // updateDescriptor) to save time.
     359                 :            : 
     360                 :          2 :     SfxViewFrame* pViewFrame = GetCurrentViewFrame();
     361 [ +  - ][ +  - ]:          2 :     if( pViewFrame && pViewFrame->GetViewShell() )
                 [ +  - ]
     362                 :            :     {
     363                 :          2 :         const SfxMedium *pMed = GetCurrentDocument()->GetMedium();
     364                 :          2 :         sal_Bool bReadOnly = pMed->GetOpenMode() == SFX_STREAM_READONLY;
     365                 :          2 :         GetDescriptor()->SetReadOnly( bReadOnly );
     366                 :            : 
     367                 :          2 :         SfxItemSet *pSet = GetDescriptor()->GetArgs();
     368                 :          2 :         sal_Bool bGetViewData = sal_False;
     369 [ +  - ][ +  - ]:          2 :         if ( GetController().is() && pSet->GetItemState( SID_VIEW_DATA ) != SFX_ITEM_SET )
         [ +  - ][ +  - ]
           [ +  -  #  # ]
                 [ +  - ]
     370                 :            :         {
     371 [ +  - ][ +  - ]:          2 :             ::com::sun::star::uno::Any aData = GetController()->getViewData();
                 [ +  - ]
     372 [ +  - ][ +  - ]:          2 :             pSet->Put( SfxUsrAnyItem( SID_VIEW_DATA, aData ) );
                 [ +  - ]
     373                 :          2 :             bGetViewData = sal_True;
     374                 :            :         }
     375                 :            : 
     376         [ +  - ]:          2 :         if ( pViewFrame->GetCurViewId() )
     377         [ +  - ]:          2 :             pSet->Put( SfxUInt16Item( SID_VIEW_ID, pViewFrame->GetCurViewId() ) );
     378         [ -  + ]:          2 :         if ( pChildArr )
     379                 :            :         {
     380                 :            :             // For Framesets also the data from the ChildViews hace to be processed
     381                 :          0 :             sal_uInt16 nCount = pChildArr->size();
     382         [ #  # ]:          0 :             for ( sal_uInt16 n=nCount; n>0; n--)
     383                 :            :             {
     384                 :          0 :                 SfxFrame* pFrame = (*pChildArr)[n-1];
     385         [ #  # ]:          0 :                 if ( bGetViewData )
     386                 :          0 :                     pFrame->GetDescriptor()->GetArgs()->ClearItem( SID_VIEW_DATA );
     387                 :          0 :                 pFrame->GetViewData_Impl();
     388                 :            :             }
     389                 :            :         }
     390                 :            :     }
     391                 :          2 : }
     392                 :            : 
     393                 :       1711 : void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc )
     394                 :            : {
     395                 :            :     // For PrepareForDoc_Impl frames, the descriptor of the updated
     396                 :            :     // and new itemset to be initialized. All data fir restoring the view
     397                 :            :     // are thus saved. If the document be replaced, GetViewData_Impl (so)
     398                 :            :     // the latest information hinzugef by "added. All together then the
     399                 :            :     // browser-history saved in. When you activate such frame pick entry
     400                 :            :     // is complete itemsets and the descriptor in the OpenDoc sent;.
     401                 :            :     // Here only the fixed properties identified "other adjustable, the
     402                 :            :     // retrieved by GetViewData (saves time).
     403                 :            : 
     404                 :            :     DBG_ASSERT( pDoc, "NULL-Document inserted ?!" );
     405                 :            : 
     406                 :       1711 :     GetParentFrame();
     407                 :       1711 :     const SfxMedium *pMed = pDoc->GetMedium();
     408 [ +  - ][ +  - ]:       1711 :     GetDescriptor()->SetActualURL( String(pMed->GetOrigURL()) );
         [ +  - ][ +  - ]
                 [ +  - ]
     409                 :            : 
     410 [ +  - ][ +  - ]:       1711 :     SFX_ITEMSET_ARG( pMed->GetItemSet(), pItem, SfxBoolItem, SID_EDITDOC, sal_False );
                 [ +  - ]
     411 [ -  + ][ #  # ]:       1711 :     sal_Bool bEditable = ( !pItem || pItem->GetValue() );
     412                 :            : 
     413 [ +  - ][ +  - ]:       1711 :     GetDescriptor()->SetEditable( bEditable );
     414                 :            : 
     415                 :            :     // Mark FileOpen parameter
     416         [ +  - ]:       1711 :     SfxItemSet* pItemSet = pMed->GetItemSet();
     417 [ +  - ][ +  - ]:       1711 :     String aMedName( pMed->GetName() );
     418                 :            : 
     419         [ +  - ]:       1711 :     const SfxFilter* pFilter = pMed->GetOrigFilter();
     420         [ +  - ]:       1711 :     String aFilter;
     421         [ +  + ]:       1711 :     if ( pFilter )
     422         [ +  - ]:       1709 :         aFilter = pFilter->GetFilterName();
     423                 :            : 
     424 [ +  - ][ +  - ]:       1711 :     SFX_ITEMSET_ARG( pItemSet, pRefererItem, SfxStringItem, SID_REFERER, sal_False);
     425 [ +  - ][ +  - ]:       1711 :     SFX_ITEMSET_ARG( pItemSet, pOptionsItem, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False);
     426 [ +  - ][ +  - ]:       1711 :     SFX_ITEMSET_ARG( pItemSet, pTitle1Item, SfxStringItem, SID_DOCINFO_TITLE, sal_False);
     427                 :            : 
     428 [ +  - ][ +  - ]:       1711 :     SfxItemSet *pSet = GetDescriptor()->GetArgs();
     429                 :            : 
     430                 :            :     // Delete all old Items
     431         [ +  - ]:       1711 :     pSet->ClearItem();
     432                 :            : 
     433         [ +  + ]:       1711 :     if ( pRefererItem )
     434         [ +  - ]:       1097 :         pSet->Put( *pRefererItem );
     435                 :            :     else
     436 [ +  - ][ +  - ]:        614 :         pSet->Put( SfxStringItem( SID_REFERER, String() ) );
         [ +  - ][ +  - ]
                 [ +  - ]
     437                 :            : 
     438         [ -  + ]:       1711 :     if ( pOptionsItem )
     439         [ #  # ]:          0 :         pSet->Put( *pOptionsItem );
     440                 :            : 
     441         [ -  + ]:       1711 :     if ( pTitle1Item )
     442         [ #  # ]:          0 :         pSet->Put( *pTitle1Item );
     443                 :            : 
     444 [ +  - ][ +  - ]:       1711 :     pSet->Put( SfxStringItem( SID_FILTER_NAME, aFilter ));
         [ +  - ][ +  - ]
                 [ +  - ]
     445                 :       1711 : }
     446                 :            : 
     447                 :            : //-------------------------------------------------------------------------
     448                 :            : 
     449                 :       5137 : SfxFrameDescriptor* SfxFrame::GetDescriptor() const
     450                 :            : {
     451                 :            :     // Create a FrameDescriptor On Demand; if there is no TopLevel-Frame
     452                 :            :     // will result in an error, as no valid link is created.
     453                 :            : 
     454         [ +  + ]:       5137 :     if ( !pImp->pDescr )
     455                 :            :     {
     456                 :            :         DBG_ASSERT( !GetParentFrame(), "No TopLevel-Frame, but no Descriptor!" );
     457         [ +  - ]:       1711 :         pImp->pDescr = new SfxFrameDescriptor;
     458         [ -  + ]:       1711 :         if ( GetCurrentDocument() )
     459         [ #  # ]:          0 :             pImp->pDescr->SetURL( GetCurrentDocument()->GetMedium()->GetOrigURL() );
     460                 :            :     }
     461                 :       5137 :     return pImp->pDescr;
     462                 :            : }
     463                 :            : 
     464                 :            : //-------------------------------------------------------------------------
     465                 :            : 
     466                 :          0 : void SfxFrame::GetTargetList( TargetList& rList ) const
     467                 :            : {
     468         [ #  # ]:          0 :     if ( !GetParentFrame() )
     469                 :            :     {
     470                 :            :         // An empty string for 'No Target'
     471 [ #  # ][ #  # ]:          0 :         rList.push_back( new String() );
     472 [ #  # ][ #  # ]:          0 :         rList.push_back( new String( DEFINE_CONST_UNICODE( "_top" ) ) );
     473 [ #  # ][ #  # ]:          0 :         rList.push_back( new String( DEFINE_CONST_UNICODE( "_parent" ) ) );
     474 [ #  # ][ #  # ]:          0 :         rList.push_back( new String( DEFINE_CONST_UNICODE( "_blank" ) ) );
     475 [ #  # ][ #  # ]:          0 :         rList.push_back( new String( DEFINE_CONST_UNICODE( "_self" ) ) );
     476                 :            :     }
     477                 :            : 
     478                 :          0 :     SfxViewFrame* pView = GetCurrentViewFrame();
     479 [ #  # ][ #  # ]:          0 :     if( pView && pView->GetViewShell() && pChildArr )
         [ #  # ][ #  # ]
     480                 :            :     {
     481                 :          0 :         sal_uInt16 nCount = pChildArr->size();
     482         [ #  # ]:          0 :         for ( sal_uInt16 n=0; n<nCount; n++)
     483                 :            :         {
     484                 :          0 :             SfxFrame* pFrame = (*pChildArr)[n];
     485                 :          0 :             pFrame->GetTargetList( rList );
     486                 :            :         }
     487                 :            :     }
     488                 :          0 : }
     489                 :            : 
     490                 :            : //-------------------------------------------------------------------------
     491                 :            : 
     492                 :          0 : sal_Bool SfxFrame::IsParent( SfxFrame *pFrame ) const
     493                 :            : {
     494                 :          0 :     SfxFrame *pParent = pParentFrame;
     495         [ #  # ]:          0 :     while ( pParent )
     496                 :            :     {
     497         [ #  # ]:          0 :         if ( pParent == pFrame )
     498                 :          0 :             return sal_True;
     499                 :          0 :         pParent = pParent->pParentFrame;
     500                 :            :     }
     501                 :            : 
     502                 :          0 :     return sal_False;
     503                 :            : }
     504                 :            : 
     505                 :       1711 : void SfxFrame::InsertTopFrame_Impl( SfxFrame* pFrame )
     506                 :            : {
     507                 :       1711 :     SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames;
     508                 :       1711 :     rArr.push_back( pFrame );
     509                 :       1711 : }
     510                 :            : 
     511                 :       1620 : void SfxFrame::RemoveTopFrame_Impl( SfxFrame* pFrame )
     512                 :            : {
     513         [ +  - ]:       1620 :     SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames;
     514         [ +  - ]:       1620 :     SfxFrameArr_Impl::iterator it = std::find( rArr.begin(), rArr.end(), pFrame );
     515 [ +  - ][ +  - ]:       1620 :     if ( it != rArr.end() )
     516         [ +  - ]:       1620 :         rArr.erase( it );
     517                 :       1620 : }
     518                 :            : 
     519                 :          0 : SfxFrameItem::SfxFrameItem( sal_uInt16 nWhichId, SfxViewFrame *p )
     520 [ #  # ][ #  # ]:          0 :     : SfxPoolItem( nWhichId ), pFrame( p ? &p->GetFrame() : NULL )
                 [ #  # ]
     521                 :            : {
     522         [ #  # ]:          0 :     wFrame = pFrame;
     523                 :          0 : }
     524                 :            : 
     525                 :          0 : SfxFrameItem::SfxFrameItem( sal_uInt16 nWhichId, SfxFrame *p ):
     526                 :            :     SfxPoolItem( nWhichId ),
     527         [ #  # ]:          0 :     pFrame( p ), wFrame( p )
     528                 :            : {
     529                 :          0 : }
     530                 :            : 
     531                 :          0 : SfxFrameItem::SfxFrameItem( SfxFrame *p ):
     532                 :            :     SfxPoolItem( 0 ),
     533         [ #  # ]:          0 :     pFrame( p ), wFrame( p )
     534                 :            : {
     535                 :          0 : }
     536                 :            : 
     537                 :          0 : int SfxFrameItem::operator==( const SfxPoolItem &rItem ) const
     538                 :            : {
     539                 :            :      return ((SfxFrameItem&)rItem).pFrame == pFrame &&
     540 [ #  # ][ #  # ]:          0 :          ((SfxFrameItem&)rItem).wFrame == wFrame;
     541                 :            : }
     542                 :            : 
     543                 :            : //--------------------------------------------------------------------
     544                 :            : 
     545                 :          0 : String SfxFrameItem::GetValueText() const
     546                 :            : {
     547                 :          0 :     return String();
     548                 :            : }
     549                 :            : 
     550                 :          0 : SfxPoolItem* SfxFrameItem::Clone( SfxItemPool *) const
     551                 :            : {
     552         [ #  # ]:          0 :     SfxFrameItem* pNew = new SfxFrameItem( wFrame);
     553                 :          0 :     pNew->SetFramePtr_Impl( pFrame );
     554                 :          0 :     return pNew;
     555                 :            : }
     556                 :            : 
     557                 :          0 : bool SfxFrameItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const
     558                 :            : {
     559         [ #  # ]:          0 :     if ( wFrame )
     560                 :            :     {
     561         [ #  # ]:          0 :         rVal <<= wFrame->GetFrameInterface();
     562                 :          0 :         return sal_True;
     563                 :            :     }
     564                 :            : 
     565                 :          0 :     return sal_False;
     566                 :            : }
     567                 :            : 
     568                 :          0 : bool SfxFrameItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
     569                 :            : {
     570                 :          0 :     Reference < XFrame > xFrame;
     571 [ #  # ][ #  # ]:          0 :     if ( (rVal >>= xFrame) && xFrame.is() )
         [ #  # ][ #  # ]
     572                 :            :     {
     573         [ #  # ]:          0 :         SfxFrame* pFr = SfxFrame::GetFirst();
     574         [ #  # ]:          0 :         while ( pFr )
     575                 :            :         {
     576 [ #  # ][ #  # ]:          0 :             if ( pFr->GetFrameInterface() == xFrame )
                 [ #  # ]
     577                 :            :             {
     578         [ #  # ]:          0 :                 wFrame = pFrame = pFr;
     579                 :          0 :                 return sal_True;
     580                 :            :             }
     581                 :            : 
     582         [ #  # ]:          0 :             pFr = SfxFrame::GetNext( *pFr );
     583                 :            :         }
     584                 :          0 :         return sal_True;
     585                 :            :     }
     586                 :            : 
     587                 :          0 :     return sal_False;
     588                 :            : }
     589                 :            : 
     590                 :            : 
     591                 :      22752 : SfxUsrAnyItem::SfxUsrAnyItem( sal_uInt16 nWhichId, const ::com::sun::star::uno::Any& rAny )
     592                 :      22752 :     : SfxPoolItem( nWhichId )
     593                 :            : {
     594                 :      22752 :     aValue = rAny;
     595                 :      22752 : }
     596                 :            : 
     597                 :          0 : int SfxUsrAnyItem::operator==( const SfxPoolItem& /*rItem*/ ) const
     598                 :            : {
     599                 :          0 :     return sal_False;
     600                 :            : }
     601                 :            : 
     602                 :      12932 : SfxPoolItem* SfxUsrAnyItem::Clone( SfxItemPool *) const
     603                 :            : {
     604         [ +  - ]:      12932 :     return new SfxUsrAnyItem( Which(), aValue );
     605                 :            : }
     606                 :            : 
     607                 :          0 : bool SfxUsrAnyItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
     608                 :            : {
     609                 :          0 :     rVal = aValue;
     610                 :          0 :     return sal_True;
     611                 :            : }
     612                 :            : 
     613                 :          0 : bool SfxUsrAnyItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
     614                 :            : {
     615                 :          0 :     aValue = rVal;
     616                 :          0 :     return sal_True;
     617                 :            : }
     618                 :            : 
     619                 :          0 : SfxUnoFrameItem::SfxUnoFrameItem()
     620                 :            :     : SfxPoolItem()
     621                 :          0 :     , m_xFrame()
     622                 :            : {
     623                 :          0 : }
     624                 :            : 
     625                 :       5187 : SfxUnoFrameItem::SfxUnoFrameItem( sal_uInt16 nWhichId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame )
     626                 :            :     : SfxPoolItem( nWhichId )
     627                 :       5187 :     , m_xFrame( i_rFrame )
     628                 :            : {
     629                 :       5187 : }
     630                 :            : 
     631                 :          0 : int SfxUnoFrameItem::operator==( const SfxPoolItem& i_rItem ) const
     632                 :            : {
     633 [ #  # ][ #  # ]:          0 :     return i_rItem.ISA( SfxUnoFrameItem ) && static_cast< const SfxUnoFrameItem& >( i_rItem ).m_xFrame == m_xFrame;
     634                 :            : }
     635                 :            : 
     636                 :       2717 : SfxPoolItem* SfxUnoFrameItem::Clone( SfxItemPool* ) const
     637                 :            : {
     638         [ +  - ]:       2717 :     return new SfxUnoFrameItem( Which(), m_xFrame );
     639                 :            : }
     640                 :            : 
     641                 :          0 : bool SfxUnoFrameItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
     642                 :            : {
     643                 :          0 :     rVal <<= m_xFrame;
     644                 :          0 :     return sal_True;
     645                 :            : }
     646                 :            : 
     647                 :          0 : bool SfxUnoFrameItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
     648                 :            : {
     649                 :          0 :     return ( rVal >>= m_xFrame );
     650                 :            : }
     651                 :            : 
     652                 :          0 : SfxFrameIterator::SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecur )
     653                 :            :     : pFrame( &rFrame )
     654                 :          0 :     , bRecursive( bRecur )
     655                 :          0 : {}
     656                 :            : 
     657                 :          0 : SfxFrame* SfxFrameIterator::FirstFrame()
     658                 :            : {
     659                 :            :     // GetFirst starts the iteration at the first child frame
     660                 :          0 :     return pFrame->GetChildFrame( 0 );
     661                 :            : }
     662                 :            : 
     663                 :          0 : SfxFrame* SfxFrameIterator::NextFrame( SfxFrame& rPrev )
     664                 :            : {
     665                 :            :     // If recursion is requested testing is done first on Children.
     666                 :          0 :     SfxFrame *pRet = NULL;
     667         [ #  # ]:          0 :     if ( bRecursive )
     668                 :          0 :         pRet = rPrev.GetChildFrame( 0 );
     669         [ #  # ]:          0 :     if ( !pRet )
     670                 :            :     {
     671                 :            :         // In other case continue with the siblings of rPrev
     672                 :          0 :         pRet = NextSibling_Impl( rPrev );
     673                 :            :     }
     674                 :            : 
     675                 :          0 :     return pRet;
     676                 :            : }
     677                 :            : 
     678                 :            : 
     679                 :          0 : SfxFrame* SfxFrameIterator::NextSibling_Impl( SfxFrame& rPrev )
     680                 :            : {
     681                 :          0 :     SfxFrame *pRet = NULL;
     682         [ #  # ]:          0 :     if ( &rPrev != pFrame )
     683                 :            :     {
     684                 :          0 :         SfxFrameArr_Impl& rArr = *rPrev.pParentFrame->pChildArr;
     685         [ #  # ]:          0 :         SfxFrameArr_Impl::iterator it = std::find( rArr.begin(), rArr.end(), &rPrev );
     686 [ #  # ][ #  # ]:          0 :         if ( it != rArr.end() && (++it) != rArr.end() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
     687                 :          0 :             pRet = *it;
     688                 :            : 
     689 [ #  # ][ #  # ]:          0 :         if ( !pRet && rPrev.pParentFrame->pParentFrame )
     690         [ #  # ]:          0 :             pRet = NextSibling_Impl( *rPrev.pParentFrame );
     691                 :            :     }
     692                 :            : 
     693                 :          0 :     return pRet;
     694                 :            : }
     695                 :            : 
     696                 :       4014 : sal_Bool SfxFrame::HasComponent() const
     697                 :            : {
     698                 :       4014 :     return sal_False;
     699                 :            : }
     700                 :            : 
     701                 :       8746 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > SfxFrame::GetController() const
     702                 :            : {
     703 [ +  - ][ +  + ]:       8746 :     if ( pImp->pCurrentViewFrame && pImp->pCurrentViewFrame->GetViewShell() )
                 [ +  + ]
     704                 :       8288 :         return pImp->pCurrentViewFrame->GetViewShell()->GetController();
     705                 :            :     else
     706                 :       8746 :         return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > ();
     707                 :            : }
     708                 :            : 
     709                 :      67596 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >  SfxFrame::GetFrameInterface() const
     710                 :            : {
     711                 :      67596 :     return pImp->xFrame;
     712                 :            : }
     713                 :            : 
     714                 :       3331 : void SfxFrame::SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame )
     715                 :            : {
     716         [ +  - ]:       3331 :     pImp->xFrame = rFrame;
     717                 :       3331 :     com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder;
     718 [ +  - ][ +  - ]:       3331 :     if ( !rFrame.is() && GetCurrentViewFrame() )
         [ +  + ][ +  + ]
     719 [ +  - ][ +  - ]:       3331 :         GetCurrentViewFrame()->GetBindings().SetRecorder_Impl( xRecorder );
     720                 :       3331 : }
     721                 :            : 
     722                 :          2 : void SfxFrame::Appear()
     723                 :            : {
     724         [ +  - ]:          2 :     if ( GetCurrentViewFrame() )
     725                 :            :     {
     726 [ +  - ][ +  - ]:          2 :         GetCurrentViewFrame()->Show();
     727 [ +  - ][ +  - ]:          2 :         GetWindow().Show();
     728 [ +  - ][ +  - ]:          2 :         pImp->xFrame->getContainerWindow()->setVisible( sal_True );
         [ +  - ][ +  - ]
     729         [ -  + ]:          2 :         if ( pParentFrame )
     730         [ #  # ]:          0 :             pParentFrame->Appear();
     731 [ +  - ][ +  - ]:          2 :         Reference < ::com::sun::star::awt::XTopWindow > xTopWindow( pImp->xFrame->getContainerWindow(), UNO_QUERY );
                 [ +  - ]
     732         [ +  - ]:          2 :         if ( xTopWindow.is() )
     733 [ +  - ][ +  - ]:          2 :             xTopWindow->toFront();
     734                 :            :     }
     735                 :          2 : }
     736                 :            : 
     737                 :          0 : void SfxFrame::AppearWithUpdate()
     738                 :            : {
     739                 :          0 :     Appear();
     740         [ #  # ]:          0 :     if ( GetCurrentViewFrame() )
     741                 :          0 :         GetCurrentViewFrame()->GetDispatcher()->Update_Impl( sal_True );
     742                 :          0 : }
     743                 :            : 
     744                 :       1711 : void SfxFrame::SetOwnsBindings_Impl( sal_Bool bSet )
     745                 :            : {
     746                 :       1711 :     pImp->bOwnsBindings = bSet;
     747                 :       1711 : }
     748                 :            : 
     749                 :       7500 : sal_Bool SfxFrame::OwnsBindings_Impl() const
     750                 :            : {
     751                 :       7500 :     return pImp->bOwnsBindings;
     752                 :            : }
     753                 :            : 
     754                 :       8055 : void SfxFrame::SetToolSpaceBorderPixel_Impl( const SvBorder& rBorder )
     755                 :            : {
     756                 :       8055 :     pImp->aBorder = rBorder;
     757                 :       8055 :     SfxViewFrame *pF = GetCurrentViewFrame();
     758         [ +  - ]:       8055 :     if ( pF )
     759                 :            :     {
     760                 :       8055 :         Point aPos ( rBorder.Left(), rBorder.Top() );
     761         [ +  - ]:       8055 :         Size aSize( GetWindow().GetOutputSizePixel() );
     762                 :       8055 :         long nDeltaX = rBorder.Left() + rBorder.Right();
     763         [ +  + ]:       8055 :         if ( aSize.Width() > nDeltaX )
     764                 :       6769 :             aSize.Width() -= nDeltaX;
     765                 :            :         else
     766                 :       1286 :             aSize.Width() = 0;
     767                 :            : 
     768                 :       8055 :         long nDeltaY = rBorder.Top() + rBorder.Bottom();
     769         [ +  + ]:       8055 :         if ( aSize.Height() > nDeltaY )
     770                 :       6769 :             aSize.Height() -= nDeltaY;
     771                 :            :         else
     772                 :       1286 :             aSize.Height() = 0;
     773                 :            : 
     774         [ -  + ]:       8055 :         if ( GetParentFrame() )
     775                 :            :         {
     776 [ #  # ][ #  # ]:          0 :             sal_Bool bHasTools = rBorder.Left() != rBorder.Right() || rBorder.Top() != rBorder.Bottom();
     777 [ #  # ][ #  # ]:          0 :             pF->GetWindow().SetBorderStyle( bHasTools ? WINDOW_BORDER_NORMAL : WINDOW_BORDER_NOBORDER );
                 [ #  # ]
     778                 :            :         }
     779                 :            : 
     780 [ +  - ][ +  - ]:       8055 :         pF->GetWindow().SetPosSizePixel( aPos, aSize );
     781                 :            :     }
     782                 :       8055 : }
     783                 :            : 
     784                 :      12057 : Rectangle SfxFrame::GetTopOuterRectPixel_Impl() const
     785                 :            : {
     786         [ +  - ]:      12057 :     Size aSize( GetWindow().GetOutputSizePixel() );
     787                 :      12057 :     Point aPoint;
     788         [ +  - ]:      12057 :     return ( Rectangle ( aPoint, aSize ) );
     789                 :            : }
     790                 :            : 
     791                 :     182442 : SfxWorkWindow* SfxFrame::GetWorkWindow_Impl() const
     792                 :            : {
     793         [ +  - ]:     182442 :     if ( pImp->pWorkWin )
     794                 :     182442 :         return pImp->pWorkWin;
     795         [ #  # ]:          0 :     else if ( pParentFrame )
     796                 :          0 :         return pParentFrame->GetWorkWindow_Impl();
     797                 :            :     else
     798                 :     182442 :         return NULL;
     799                 :            : }
     800                 :            : 
     801                 :       1711 : void SfxFrame::CreateWorkWindow_Impl()
     802                 :            : {
     803                 :       1711 :     SfxFrame* pFrame = this;
     804                 :            : 
     805         [ -  + ]:       1711 :     if ( IsInPlace() )
     806                 :            :     {
     807                 :            :         // this makes sence only for inplace activated objects
     808                 :            :         try
     809                 :            :         {
     810 [ #  # ][ #  # ]:          0 :             Reference < XChild > xChild( GetCurrentDocument()->GetModel(), UNO_QUERY );
                 [ #  # ]
     811         [ #  # ]:          0 :             if ( xChild.is() )
     812                 :            :             {
     813 [ #  # ][ #  # ]:          0 :                 Reference < XModel > xParent( xChild->getParent(), UNO_QUERY );
                 [ #  # ]
     814         [ #  # ]:          0 :                 if ( xParent.is() )
     815                 :            :                 {
     816 [ #  # ][ #  # ]:          0 :                     Reference< XController > xParentCtrler = xParent->getCurrentController();
     817         [ #  # ]:          0 :                     if ( xParentCtrler.is() )
     818                 :            :                     {
     819 [ #  # ][ #  # ]:          0 :                         Reference < XFrame > xFrame( xParentCtrler->getFrame() );
     820         [ #  # ]:          0 :                         SfxFrame* pFr = SfxFrame::GetFirst();
     821         [ #  # ]:          0 :                         while ( pFr )
     822                 :            :                         {
     823 [ #  # ][ #  # ]:          0 :                             if ( pFr->GetFrameInterface() == xFrame )
                 [ #  # ]
     824                 :            :                             {
     825                 :          0 :                                 pFrame = pFr;
     826                 :          0 :                                 break;
     827                 :            :                             }
     828                 :            : 
     829         [ #  # ]:          0 :                             pFr = SfxFrame::GetNext( *pFr );
     830                 :          0 :                         }
     831                 :          0 :                     }
     832                 :          0 :                 }
     833         [ #  # ]:          0 :             }
     834                 :            :         }
     835                 :          0 :         catch(Exception&)
     836                 :            :         {
     837                 :            :             OSL_FAIL("SfxFrame::CreateWorkWindow_Impl: Exception cachted. Please try to submit a repoducable bug !");
     838                 :            :         }
     839                 :            :     }
     840                 :            : 
     841         [ +  - ]:       1711 :     pImp->pWorkWin = new SfxFrameWorkWin_Impl( &pFrame->GetWindow(), this, pFrame );
     842                 :       1711 : }
     843                 :            : 
     844                 :       1470 : void SfxFrame::GrabFocusOnComponent_Impl()
     845                 :            : {
     846         [ -  + ]:       1470 :     if ( pImp->bReleasingComponent )
     847                 :            :     {
     848                 :          0 :         GetWindow().GrabFocus();
     849                 :       1470 :         return;
     850                 :            :     }
     851                 :            : 
     852                 :       1470 :     Window* pFocusWindow = &GetWindow();
     853 [ +  - ][ +  - ]:       1470 :     if ( GetCurrentViewFrame() && GetCurrentViewFrame()->GetViewShell() && GetCurrentViewFrame()->GetViewShell()->GetWindow() )
         [ +  - ][ +  - ]
     854                 :       1470 :         pFocusWindow = GetCurrentViewFrame()->GetViewShell()->GetWindow();
     855                 :            : 
     856         [ +  + ]:       1470 :     if( !pFocusWindow->HasChildPathFocus() )
     857                 :       1454 :         pFocusWindow->GrabFocus();
     858                 :            : }
     859                 :            : 
     860                 :       1620 : void SfxFrame::ReleasingComponent_Impl( sal_Bool bSet )
     861                 :            : {
     862                 :       1620 :     pImp->bReleasingComponent = bSet;
     863                 :       1620 : }
     864                 :            : 
     865                 :     309629 : sal_Bool SfxFrame::IsInPlace() const
     866                 :            : {
     867                 :     309629 :     return pImp->bInPlace;
     868                 :            : }
     869                 :            : 
     870                 :          0 : void SfxFrame::SetInPlace_Impl( sal_Bool bSet )
     871                 :            : {
     872                 :          0 :     pImp->bInPlace = bSet;
     873                 :          0 : }
     874                 :            : 
     875                 :       4281 : void SfxFrame::Resize()
     876                 :            : {
     877         [ +  + ]:       4281 :     if ( IsClosing_Impl() )
     878                 :       4281 :         return;
     879                 :            : 
     880         [ +  + ]:       4260 :     if ( OwnsBindings_Impl() )
     881                 :            :     {
     882         [ -  + ]:       3855 :         if ( IsInPlace() )
     883                 :            :         {
     884         [ #  # ]:          0 :             SetToolSpaceBorderPixel_Impl( SvBorder() );
     885                 :            :         }
     886                 :            :         else
     887                 :            :         {
     888                 :            :             // check for IPClient that contains UIactive object or object that is currently UI activating
     889                 :       3855 :             SfxWorkWindow *pWork = GetWorkWindow_Impl();
     890         [ +  - ]:       3855 :             SfxInPlaceClient* pClient = GetCurrentViewFrame()->GetViewShell() ? GetCurrentViewFrame()->GetViewShell()->GetUIActiveIPClient_Impl() : 0;
     891         [ +  + ]:       3855 :             if ( pClient )
     892                 :            :             {
     893 [ +  - ][ +  - ]:          2 :                 uno::Reference < lang::XUnoTunnel > xObj( pClient->GetObject()->getComponent(), uno::UNO_QUERY );
         [ +  - ][ +  - ]
     894 [ +  - ][ +  - ]:          2 :                 uno::Sequence < sal_Int8 > aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() );
                 [ +  - ]
     895 [ +  - ][ +  - ]:          2 :                 sal_Int64 nHandle = (xObj.is()? xObj->getSomething( aSeq ): 0);
                 [ +  - ]
     896         [ -  + ]:          2 :                 if ( nHandle )
     897                 :            :                 {
     898                 :          0 :                     SfxObjectShell* pDoc = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle ));
     899 [ #  # ][ #  # ]:          0 :                     pWork = SfxViewFrame::GetFirst( pDoc )->GetFrame().GetWorkWindow_Impl();
                 [ #  # ]
     900         [ +  - ]:          2 :                 }
     901                 :            :             }
     902                 :            : 
     903         [ +  - ]:       3855 :             if ( pWork )
     904                 :            :             {
     905                 :       3855 :                 pWork->ArrangeChildren_Impl();
     906                 :       3855 :                 pWork->ShowChildren_Impl();
     907                 :            :             }
     908                 :            : 
     909                 :            :             // problem in presence of UIActive object: when the window is resized, but the toolspace border
     910                 :            :             // remains the same, setting the toolspace border at the ContainerEnvironment doesn't force a
     911                 :            :             // resize on the IPEnvironment; without that no resize is called for the SfxViewFrame. So always
     912                 :            :             // set the window size of the SfxViewFrame explicit.
     913                 :       3855 :             SetToolSpaceBorderPixel_Impl( pImp->aBorder );
     914                 :            :         }
     915                 :            :     }
     916         [ -  + ]:        405 :     else if ( pImp->pCurrentViewFrame )
     917                 :            :     {
     918         [ #  # ]:          0 :         pImp->pCurrentViewFrame->GetWindow().SetSizePixel( GetWindow().GetOutputSizePixel() );
     919                 :            :     }
     920                 :            : 
     921                 :            : }
     922                 :            : 
     923                 :         32 : SfxFrame* SfxFrame::GetFirst()
     924                 :            : {
     925         [ -  + ]:         32 :     if ( !pFramesArr_Impl )
     926                 :          0 :         return 0;
     927         [ -  + ]:         32 :     return pFramesArr_Impl->empty() ? 0 : pFramesArr_Impl->front();
     928                 :            : }
     929                 :            : 
     930                 :          6 : SfxFrame* SfxFrame::GetNext( SfxFrame& rFrame )
     931                 :            : {
     932         [ +  - ]:          6 :     SfxFrameArr_Impl::iterator it = std::find( pFramesArr_Impl->begin(), pFramesArr_Impl->end(), &rFrame );
     933 [ +  - ][ +  - ]:          6 :     if ( it != pFramesArr_Impl->end() && (++it) != pFramesArr_Impl->end() )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
           [ +  -  #  #  
                   #  # ]
     934                 :          6 :         return *it;
     935                 :            :     else
     936                 :          6 :         return NULL;
     937                 :            : }
     938                 :            : 
     939                 :          0 : const SfxPoolItem* SfxFrame::OpenDocumentSynchron( SfxItemSet& i_rSet, const Reference< XFrame >& i_rTargetFrame )
     940                 :            : {
     941         [ #  # ]:          0 :     i_rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, i_rTargetFrame ) );
     942                 :          0 :     i_rSet.ClearItem( SID_TARGETNAME );
     943                 :          0 :     return SFX_APP()->GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, i_rSet );
     944                 :            : }
     945                 :            : 
     946                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10