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

Generated by: LCOV version 1.11