LCOV - code coverage report
Current view: top level - sw/source/ui/dbui - dbtablepreviewdialog.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 40 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 6 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 <unomid.h>
      27             : 
      28             : using namespace ::com::sun::star;
      29             : using namespace ::com::sun::star::uno;
      30             : using namespace ::com::sun::star::frame;
      31             : using namespace ::com::sun::star::beans;
      32             : using namespace ::com::sun::star::lang;
      33             : using namespace ::com::sun::star::util;
      34             : 
      35           0 : SwDBTablePreviewDialog::SwDBTablePreviewDialog(vcl::Window* pParent, uno::Sequence< beans::PropertyValue>& rValues ) :
      36           0 :     SfxModalDialog(pParent, "TablePreviewDialog", "modules/swriter/ui/tablepreviewdialog.ui")
      37             : {
      38           0 :     get(m_pDescriptionFI, "description");
      39           0 :     get(m_pBeamerWIN, "beamer");
      40           0 :     Size aSize(LogicToPixel(Size(338, 150), MAP_APPFONT));
      41           0 :     m_pBeamerWIN->set_width_request(aSize.Width());
      42           0 :     m_pBeamerWIN->set_height_request(aSize.Height());
      43             : 
      44           0 :     const beans::PropertyValue* pValues = rValues.getConstArray();
      45           0 :     for(sal_Int32 nValue = 0; nValue < rValues.getLength(); ++nValue        )
      46             :     {
      47           0 :         if ( pValues[nValue].Name == "Command" )
      48             :         {
      49           0 :             OUString sDescription = m_pDescriptionFI->GetText();
      50           0 :             OUString sTemp;
      51           0 :             pValues[nValue].Value >>= sTemp;
      52           0 :             m_pDescriptionFI->SetText(sDescription.replaceFirst("%1", sTemp));
      53           0 :             break;
      54             :         }
      55             :     }
      56             : 
      57             :     try
      58             :     {
      59             :         // create a frame wrapper for myself
      60           0 :         m_xFrame = frame::Frame::create( comphelper::getProcessComponentContext() );
      61             :         // m_xFrame takes ownership of m_pBeamerWIN
      62           0 :         m_pUIBuilder->drop_ownership(m_pBeamerWIN);
      63           0 :         m_xFrame->initialize( VCLUnoHelper::GetInterface( m_pBeamerWIN ) );
      64             :     }
      65           0 :     catch (uno::Exception const &)
      66             :     {
      67           0 :         m_xFrame.clear();
      68             :     }
      69           0 :     if(m_xFrame.is())
      70             :     {
      71           0 :         util::URL aURL;
      72           0 :         aURL.Complete = ".component:DB/DataSourceBrowser";
      73           0 :         uno::Reference<frame::XDispatch> xD = m_xFrame->queryDispatch(aURL, "", 0x0C);
      74           0 :         if(xD.is())
      75             :         {
      76           0 :             xD->dispatch(aURL, rValues);
      77           0 :             m_pBeamerWIN->Show();
      78           0 :         }
      79             :     }
      80           0 : }
      81             : 
      82           0 : SwDBTablePreviewDialog::~SwDBTablePreviewDialog()
      83             : {
      84           0 :     disposeOnce();
      85           0 : }
      86             : 
      87           0 : void SwDBTablePreviewDialog::dispose()
      88             : {
      89           0 :     if(m_xFrame.is())
      90             :     {
      91           0 :         m_xFrame->setComponent(NULL, NULL);
      92           0 :         m_xFrame->dispose();
      93             :     }
      94           0 :     m_pDescriptionFI.clear();
      95           0 :     m_pBeamerWIN.clear();
      96           0 :     SfxModalDialog::dispose();
      97           0 : }
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11