LCOV - code coverage report
Current view: top level - sw/source/ui/dbui - dbtablepreviewdialog.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 31 0.0 %
Date: 2014-04-14 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/frame/Frame.hpp>
      24             : #include <toolkit/helper/vclunohelper.hxx>
      25             : 
      26             : #include <dbui.hrc>
      27             : #include <dbtablepreviewdialog.hrc>
      28             : #include <unomid.h>
      29             : 
      30             : using namespace ::com::sun::star;
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::com::sun::star::frame;
      33             : using namespace ::com::sun::star::beans;
      34             : using namespace ::com::sun::star::lang;
      35             : using namespace ::com::sun::star::util;
      36             : using namespace ::rtl;
      37             : 
      38           0 : SwDBTablePreviewDialog::SwDBTablePreviewDialog(Window* pParent, uno::Sequence< beans::PropertyValue>& rValues ) :
      39             :     SfxModalDialog(pParent, SW_RES(DLG_MM_DBTABLEPREVIEWDIALOG)),
      40             :     m_aDescriptionFI( this, SW_RES(        FI_DESCRIPTION)),
      41           0 :     m_pBeamerWIN( new Window(this, SW_RES( WIN_BEAMER ))),
      42           0 :     m_aOK( this, SW_RES(                   PB_OK  ))
      43             : {
      44           0 :     FreeResource();
      45           0 :     const beans::PropertyValue* pValues = rValues.getConstArray();
      46           0 :     for(sal_Int32 nValue = 0; nValue < rValues.getLength(); ++nValue        )
      47             :     {
      48           0 :         if ( pValues[nValue].Name == "Command" )
      49             :         {
      50           0 :             OUString sDescription = m_aDescriptionFI.GetText();
      51           0 :             OUString sTemp;
      52           0 :             pValues[nValue].Value >>= sTemp;
      53           0 :             m_aDescriptionFI.SetText(sDescription.replaceFirst("%1", sTemp));
      54           0 :             break;
      55             :         }
      56             :     }
      57             : 
      58             :     try
      59             :     {
      60             :         // create a frame wrapper for myself
      61           0 :         m_xFrame = frame::Frame::create( comphelper::getProcessComponentContext() );
      62           0 :         m_xFrame->initialize( VCLUnoHelper::GetInterface( m_pBeamerWIN ) );
      63             :     }
      64           0 :     catch (uno::Exception const &)
      65             :     {
      66           0 :         m_xFrame.clear();
      67             :     }
      68           0 :     if(m_xFrame.is())
      69             :     {
      70           0 :         util::URL aURL;
      71           0 :         aURL.Complete = ".component:DB/DataSourceBrowser";
      72           0 :         uno::Reference<frame::XDispatch> xD = m_xFrame->queryDispatch(aURL, "", 0x0C);
      73           0 :         if(xD.is())
      74             :         {
      75           0 :             xD->dispatch(aURL, rValues);
      76           0 :             m_pBeamerWIN->Show();
      77           0 :         }
      78             :     }
      79           0 : }
      80             : 
      81           0 : SwDBTablePreviewDialog::~SwDBTablePreviewDialog()
      82             : {
      83           0 :     if(m_xFrame.is())
      84             :     {
      85           0 :         m_xFrame->setComponent(NULL, NULL);
      86           0 :         m_xFrame->dispose();
      87             :     }
      88             :     else
      89           0 :         delete m_pBeamerWIN;
      90           0 : }
      91             : 
      92             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10