LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - browserview.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 22 46 47.8 %
Date: 2014-11-03 Functions: 7 12 58.3 %
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 "browserview.hxx"
      21             : #include "propertyeditor.hxx"
      22             : #include "propctrlr.hrc"
      23             : #include <boost/scoped_ptr.hpp>
      24             : 
      25             : namespace pcr
      26             : {
      27             :     using namespace ::com::sun::star::uno;
      28             :     using namespace ::com::sun::star::lang;
      29             : 
      30             :     //= class OPropertyBrowserView
      31             : 
      32             : 
      33           4 :     OPropertyBrowserView::OPropertyBrowserView(vcl::Window* _pParent, WinBits nBits)
      34             :                   :Window(_pParent, nBits | WB_3DLOOK)
      35           4 :                   ,m_nActivePage(0)
      36             :     {
      37           4 :         m_pPropBox = new OPropertyEditor( this );
      38           4 :         m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
      39           4 :         m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
      40             : 
      41           4 :         m_pPropBox->Show();
      42           4 :     }
      43             : 
      44             : 
      45           0 :     IMPL_LINK_NOARG(OPropertyBrowserView, OnPageActivation)
      46             :     {
      47           0 :         m_nActivePage = m_pPropBox->GetCurPage();
      48           0 :         if (m_aPageActivationHandler.IsSet())
      49           0 :             m_aPageActivationHandler.Call(NULL);
      50           0 :         return 0L;
      51             :     }
      52             : 
      53             : 
      54          12 :     OPropertyBrowserView::~OPropertyBrowserView()
      55             :     {
      56           4 :         if(m_pPropBox)
      57             :         {
      58           4 :             sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
      59           4 :             if (nTmpPage)
      60           0 :                 m_nActivePage = nTmpPage;
      61           4 :             boost::scoped_ptr<vcl::Window> aTemp(m_pPropBox);
      62           4 :             m_pPropBox = NULL;
      63             :         }
      64             : 
      65           8 :     }
      66             : 
      67             : 
      68           0 :     void OPropertyBrowserView::activatePage(sal_uInt16 _nPage)
      69             :     {
      70           0 :         m_nActivePage = _nPage;
      71           0 :         getPropertyBox().SetPage(m_nActivePage);
      72           0 :     }
      73             : 
      74             : 
      75           0 :     void OPropertyBrowserView::GetFocus()
      76             :     {
      77           0 :         if (m_pPropBox)
      78           0 :             m_pPropBox->GrabFocus();
      79             :         else
      80           0 :             Window::GetFocus();
      81           0 :     }
      82             : 
      83             : 
      84           8 :     bool OPropertyBrowserView::Notify( NotifyEvent& _rNEvt )
      85             :     {
      86           8 :         if ( EVENT_KEYINPUT == _rNEvt.GetType() )
      87             :         {
      88           0 :             sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
      89             : 
      90           0 :             if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) )
      91             :                 // silence this, we don't want to propagate this outside the property
      92             :                 // browser, as it will probably do harm there
      93             :                 // #i63285#
      94           0 :                 return true;
      95             :         }
      96           8 :         return Window::Notify( _rNEvt );
      97             :     }
      98             : 
      99             : 
     100           4 :     void OPropertyBrowserView::Resize()
     101             :     {
     102           4 :         Size aSize = GetOutputSizePixel();
     103           4 :         m_pPropBox->SetSizePixel(aSize);
     104           4 :     }
     105             : 
     106             :     // #95343# ---------------------------------------------------------------
     107           0 :     ::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize()
     108             :     {
     109           0 :         Size aSize = GetOutputSizePixel();
     110           0 :         if( m_pPropBox )
     111             :         {
     112           0 :             aSize.setHeight( m_pPropBox->getMinimumHeight() );
     113           0 :             aSize.setWidth( m_pPropBox->getMinimumWidth() );
     114             :         }
     115           0 :         return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() );
     116             :     }
     117             : 
     118             : 
     119          12 : } // namespace pcr
     120             : 
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10