LCOV - code coverage report
Current view: top level - dbaccess/source/ui/uno - ColumnControl.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 63 0.0 %
Date: 2014-04-14 Functions: 0 10 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 "ColumnControl.hxx"
      21             : #include "ColumnPeer.hxx"
      22             : #include "dbustrings.hrc"
      23             : #include "apitools.hxx"
      24             : #include <com/sun/star/awt/PosSize.hpp>
      25             : #include "dbu_reghelper.hxx"
      26             : #include <comphelper/processfactory.hxx>
      27             : 
      28           0 : extern "C" void SAL_CALL createRegistryInfo_OColumnControl()
      29             : {
      30           0 :     static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OColumnControl> aAutoRegistration;
      31           0 : }
      32             : 
      33             : namespace dbaui
      34             : {
      35             : using namespace ::com::sun::star::uno;
      36             : using namespace ::com::sun::star::awt;
      37             : using namespace ::com::sun::star::beans;
      38             : using namespace ::com::sun::star::lang;
      39             : using namespace ::com::sun::star::sdbc;
      40             : 
      41           0 : OColumnControl::OColumnControl(const Reference<XComponentContext>& rxContext)
      42           0 :     :UnoControl(), m_xContext(rxContext)
      43             : {
      44           0 : }
      45             : 
      46           0 : IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(OColumnControl, SERVICE_CONTROLDEFAULT)
      47           0 : IMPLEMENT_SERVICE_INFO_SUPPORTS(OColumnControl)
      48           0 : IMPLEMENT_SERVICE_INFO_GETSUPPORTED2_STATIC(OColumnControl, "com.sun.star.awt.UnoControl","com.sun.star.sdb.ColumnDescriptorControl")
      49             : 
      50           0 : Reference< XInterface > SAL_CALL OColumnControl::Create(const Reference< XMultiServiceFactory >& _rxORB)
      51             : {
      52           0 :     return static_cast< XServiceInfo* >(new OColumnControl(comphelper::getComponentContext(_rxORB)));
      53             : }
      54             : 
      55           0 : OUString OColumnControl::GetComponentServiceName()
      56             : {
      57           0 :     return OUString("com.sun.star.sdb.ColumnDescriptorControl");
      58             : }
      59             : 
      60           0 : void SAL_CALL OColumnControl::createPeer(const Reference< XToolkit >& /*rToolkit*/, const Reference< XWindowPeer >& rParentPeer) throw( RuntimeException, std::exception )
      61             : {
      62           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
      63           0 :     if ( !getPeer().is() )
      64             :     {
      65           0 :         mbCreatingPeer = true;
      66             : 
      67           0 :         Window* pParentWin = NULL;
      68           0 :         if (rParentPeer.is())
      69             :         {
      70           0 :             VCLXWindow* pParent = VCLXWindow::GetImplementation(rParentPeer);
      71           0 :             if (pParent)
      72           0 :                 pParentWin = pParent->GetWindow();
      73             :         }
      74             : 
      75           0 :         OColumnPeer* pPeer = new OColumnPeer( pParentWin, m_xContext );
      76             :         OSL_ENSURE(pPeer != NULL, "FmXGridControl::createPeer : imp_CreatePeer didn't return a peer !");
      77           0 :         setPeer( pPeer );
      78             : 
      79           0 :         UnoControlComponentInfos aComponentInfos(maComponentInfos);
      80           0 :         Reference< XGraphics > xGraphics( mxGraphics );
      81           0 :         Reference< XView >  xV(getPeer(), UNO_QUERY);
      82           0 :         Reference< XWindow >    xW(getPeer(), UNO_QUERY);
      83             : 
      84           0 :         aGuard.clear();
      85             : 
      86           0 :         updateFromModel();
      87             : 
      88           0 :         xV->setZoom( aComponentInfos.nZoomX, aComponentInfos.nZoomY );
      89           0 :         setPosSize( aComponentInfos.nX, aComponentInfos.nY, aComponentInfos.nWidth, aComponentInfos.nHeight, ::com::sun::star::awt::PosSize::POSSIZE );
      90             : 
      91           0 :         Reference<XPropertySet> xProp(getModel(), UNO_QUERY);
      92           0 :         if ( xProp.is() )
      93             :         {
      94           0 :             Reference<XConnection> xCon(xProp->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY);
      95           0 :             pPeer->setConnection(xCon);
      96           0 :             Reference<XPropertySet> xColumn(xProp->getPropertyValue(PROPERTY_COLUMN),UNO_QUERY);
      97           0 :             pPeer->setColumn(xColumn);
      98           0 :             sal_Int32 nWidth = 50;
      99           0 :             xProp->getPropertyValue(PROPERTY_EDIT_WIDTH) >>= nWidth;
     100           0 :             pPeer->setEditWidth(nWidth);
     101             :         }
     102             : 
     103           0 :         if (aComponentInfos.bVisible)
     104           0 :             xW->setVisible(sal_True);
     105             : 
     106           0 :         if (!aComponentInfos.bEnable)
     107           0 :             xW->setEnable(sal_False);
     108             : 
     109           0 :         if (maWindowListeners.getLength())
     110           0 :             xW->addWindowListener( &maWindowListeners );
     111             : 
     112           0 :         if (maFocusListeners.getLength())
     113           0 :             xW->addFocusListener( &maFocusListeners );
     114             : 
     115           0 :         if (maKeyListeners.getLength())
     116           0 :             xW->addKeyListener( &maKeyListeners );
     117             : 
     118           0 :         if (maMouseListeners.getLength())
     119           0 :             xW->addMouseListener( &maMouseListeners );
     120             : 
     121           0 :         if (maMouseMotionListeners.getLength())
     122           0 :             xW->addMouseMotionListener( &maMouseMotionListeners );
     123             : 
     124           0 :         if (maPaintListeners.getLength())
     125           0 :             xW->addPaintListener( &maPaintListeners );
     126             : 
     127           0 :         Reference< ::com::sun::star::awt::XView >  xPeerView(getPeer(), UNO_QUERY);
     128           0 :         xPeerView->setZoom( maComponentInfos.nZoomX, maComponentInfos.nZoomY );
     129           0 :         xPeerView->setGraphics( xGraphics );
     130             : 
     131           0 :         mbCreatingPeer = false;
     132           0 :     }
     133           0 : }
     134             : 
     135             : }   // namespace dbaui
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10