LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/dbui - dbtablepreviewdialog.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-12-27 Functions: 0 3 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             : #include <swtypes.hxx>
      21             : #include <dbtablepreviewdialog.hxx>
      22             : #include <comphelper/processfactory.hxx>
      23             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      24             : #include <com/sun/star/frame/XDispatchProvider.hpp>
      25             : #include <com/sun/star/frame/XFrame.hpp>
      26             : #include <toolkit/unohlp.hxx>
      27             : 
      28             : #include <dbui.hrc>
      29             : #include <dbtablepreviewdialog.hrc>
      30             : #include <unomid.h>
      31             : 
      32             : using namespace ::com::sun::star;
      33             : using namespace ::com::sun::star::uno;
      34             : using namespace ::com::sun::star::frame;
      35             : using namespace ::com::sun::star::beans;
      36             : using namespace ::com::sun::star::lang;
      37             : using namespace ::com::sun::star::util;
      38             : using namespace ::rtl;
      39             : 
      40           0 : SwDBTablePreviewDialog::SwDBTablePreviewDialog(Window* pParent, uno::Sequence< beans::PropertyValue>& rValues ) :
      41             :     SfxModalDialog(pParent, SW_RES(DLG_MM_DBTABLEPREVIEWDIALOG)),
      42             : #ifdef MSC
      43             : #pragma warning (disable : 4355)
      44             : #endif
      45             :     m_aDescriptionFI( this, SW_RES(        FI_DESCRIPTION)),
      46           0 :     m_pBeamerWIN( new Window(this, SW_RES( WIN_BEAMER ))),
      47           0 :     m_aOK( this, SW_RES(                   PB_OK  ))
      48             : #ifdef MSC
      49             : #pragma warning (default : 4355)
      50             : #endif
      51             : {
      52           0 :     FreeResource();
      53           0 :     const beans::PropertyValue* pValues = rValues.getConstArray();
      54           0 :     for(sal_Int32 nValue = 0; nValue < rValues.getLength(); ++nValue        )
      55             :     {
      56           0 :         if ( pValues[nValue].Name == "Command" )
      57             :         {
      58           0 :             String sDescription = m_aDescriptionFI.GetText();
      59           0 :             OUString sTemp;
      60           0 :             pValues[nValue].Value >>= sTemp;
      61           0 :             sDescription.SearchAndReplaceAscii("%1", sTemp);
      62           0 :             m_aDescriptionFI.SetText(sDescription);
      63           0 :             break;
      64             :         }
      65             :     }
      66             : 
      67             :     try
      68             :     {
      69             :         // create a frame wrapper for myself
      70             :         uno::Reference< lang::XMultiServiceFactory >
      71           0 :                                     xMgr = comphelper::getProcessServiceFactory();
      72           0 :         m_xFrame = uno::Reference< frame::XFrame >(xMgr->createInstance("com.sun.star.frame.Frame"), uno::UNO_QUERY);
      73           0 :         if(m_xFrame.is())
      74             :         {
      75           0 :             m_xFrame->initialize( VCLUnoHelper::GetInterface ( m_pBeamerWIN ) );
      76           0 :         }
      77             :     }
      78           0 :     catch (uno::Exception const &)
      79             :     {
      80           0 :         m_xFrame.clear();
      81             :     }
      82           0 :     if(m_xFrame.is())
      83             :     {
      84           0 :         uno::Reference<frame::XDispatchProvider> xDP(m_xFrame, uno::UNO_QUERY);
      85           0 :         util::URL aURL;
      86           0 :         aURL.Complete = ".component:DB/DataSourceBrowser";
      87           0 :         uno::Reference<frame::XDispatch> xD = xDP->queryDispatch(aURL, "", 0x0C);
      88           0 :         if(xD.is())
      89             :         {
      90           0 :             xD->dispatch(aURL, rValues);
      91           0 :             m_pBeamerWIN->Show();
      92           0 :         }
      93             :     }
      94           0 : }
      95             : 
      96           0 : SwDBTablePreviewDialog::~SwDBTablePreviewDialog()
      97             : {
      98           0 :     if(m_xFrame.is())
      99             :     {
     100           0 :         m_xFrame->setComponent(NULL, NULL);
     101           0 :         m_xFrame->dispose();
     102             :     }
     103             :     else
     104           0 :         delete m_pBeamerWIN;
     105           0 : }
     106             : 
     107             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10