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

Generated by: LCOV version 1.11