LCOV - code coverage report
Current view: top level - basctl/source/basicide - basides3.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 58 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <baside2.hxx>
      22             : #include <baside3.hxx>
      23             : #include <localizationmgr.hxx>
      24             : #include <dlgedview.hxx>
      25             : #include <xmlscript/xmldlg_imexp.hxx>
      26             : #include <sfx2/dispatch.hxx>
      27             : #include <sfx2/request.hxx>
      28             : #include <tools/diagnose_ex.h>
      29             : 
      30             : namespace basctl
      31             : {
      32             : 
      33             : using namespace comphelper;
      34             : using namespace ::com::sun::star;
      35             : using namespace ::com::sun::star::uno;
      36             : using namespace ::com::sun::star::io;
      37             : 
      38           0 : VclPtr<DialogWindow> Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName )
      39             : {
      40           0 :     bCreatingWindow = true;
      41             : 
      42           0 :     sal_uLong nKey = 0;
      43           0 :     VclPtr<DialogWindow> pWin;
      44           0 :     OUString aLibName( rLibName );
      45           0 :     OUString aDlgName( rDlgName );
      46             : 
      47           0 :     if ( aLibName.isEmpty() )
      48           0 :         aLibName = "Standard" ;
      49             : 
      50           0 :     rDocument.getOrCreateLibrary( E_DIALOGS, aLibName );
      51             : 
      52           0 :     if ( aDlgName.isEmpty() )
      53           0 :         aDlgName = rDocument.createObjectName( E_DIALOGS, aLibName );
      54             : 
      55             :     // maybe there's a suspended one?
      56           0 :     pWin = FindDlgWin( rDocument, aLibName, aDlgName, false, true );
      57             : 
      58           0 :     if ( !pWin )
      59             :     {
      60             :         try
      61             :         {
      62           0 :             Reference< io::XInputStreamProvider > xISP;
      63           0 :             if ( rDocument.hasDialog( aLibName, aDlgName ) )
      64           0 :                 rDocument.getDialog( aLibName, aDlgName, xISP );
      65             :             else
      66           0 :                 rDocument.createDialog( aLibName, aDlgName, xISP );
      67             : 
      68           0 :             if ( xISP.is() )
      69             :             {
      70             :                 // create dialog model
      71           0 :                 Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
      72           0 :                 Reference< container::XNameContainer > xDialogModel( xContext->getServiceManager()->createInstanceWithContext
      73           0 :                     ( "com.sun.star.awt.UnoControlDialogModel", xContext ), UNO_QUERY );
      74           0 :                 Reference< XInputStream > xInput( xISP->createInputStream() );
      75           0 :                 ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
      76           0 :                 LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );
      77             : 
      78             :                 // new dialog window
      79           0 :                 if (!pDialogLayout)
      80           0 :                     pDialogLayout.reset(VclPtr<DialogWindowLayout>::Create(&GetViewFrame()->GetWindow(), *aObjectCatalog.get()));
      81           0 :                 pWin = VclPtr<DialogWindow>::Create(pDialogLayout.get(), rDocument, aLibName, aDlgName, xDialogModel);
      82           0 :                 nKey = InsertWindowInTable( pWin );
      83           0 :             }
      84             :         }
      85           0 :         catch (const uno::Exception& )
      86             :         {
      87             :             DBG_UNHANDLED_EXCEPTION();
      88             :         }
      89             :     }
      90             :     else
      91             :     {
      92           0 :         pWin->SetStatus( pWin->GetStatus() & ~BASWIN_SUSPENDED );
      93           0 :         nKey = GetWindowId( pWin );
      94             :         DBG_ASSERT( nKey, "CreateDlgWin: Kein Key - Fenster nicht gefunden!" );
      95             :     }
      96             : 
      97           0 :     if( pWin )
      98             :     {
      99           0 :         pWin->GrabScrollBars( aHScrollBar.get(), aVScrollBar.get() );
     100           0 :         pTabBar->InsertPage( (sal_uInt16)nKey, aDlgName );
     101           0 :         pTabBar->Sort();
     102           0 :         if ( !pCurWin )
     103           0 :             SetCurWindow( pWin, false, false );
     104             :     }
     105             : 
     106           0 :     bCreatingWindow = false;
     107           0 :     return pWin;
     108             : }
     109             : 
     110           0 : VclPtr<DialogWindow> Shell::FindDlgWin (
     111             :     ScriptDocument const& rDocument,
     112             :     OUString const& rLibName, OUString const& rName,
     113             :     bool bCreateIfNotExist, bool bFindSuspended
     114             : )
     115             : {
     116           0 :     if (BaseWindow* pWin = FindWindow(rDocument, rLibName, rName, TYPE_DIALOG, bFindSuspended))
     117           0 :         return static_cast<DialogWindow*>(pWin);
     118           0 :     return bCreateIfNotExist ? CreateDlgWin(rDocument, rLibName, rName) : 0;
     119             : }
     120             : 
     121           0 : sal_uInt16 Shell::GetWindowId(const BaseWindow* pWin) const
     122             : {
     123           0 :     for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
     124           0 :         if ( it->second == pWin )
     125           0 :             return it->first;
     126           0 :     return 0;
     127             : }
     128             : 
     129           0 : SdrView* Shell::GetCurDlgView() const
     130             : {
     131           0 :     if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin.get()))
     132           0 :         return &pDCurWin->GetView();
     133             :     else
     134           0 :         return 0;
     135             : }
     136             : 
     137             : // only if dialogue window above:
     138           0 : void Shell::ExecuteDialog( SfxRequest& rReq )
     139             : {
     140           0 :     if (pCurWin && (dynamic_cast<DialogWindow*>(pCurWin.get()) || rReq.GetSlot() == SID_IMPORT_DIALOG))
     141           0 :         pCurWin->ExecuteCommand(rReq);
     142           0 : }
     143             : 
     144           0 : } // namespace basctl
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11