LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - controlfontdialog.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 10 64 15.6 %
Date: 2014-11-03 Functions: 5 19 26.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             : 
      21             : #include "controlfontdialog.hxx"
      22             : #include <cppuhelper/typeprovider.hxx>
      23             : #include "fontdialog.hxx"
      24             : #include "formstrings.hxx"
      25             : #include "pcrcommon.hxx"
      26             : #include "pcrservices.hxx"
      27             : 
      28           4 : extern "C" void SAL_CALL createRegistryInfo_OControlFontDialog()
      29             : {
      30           4 :     ::pcr::OAutoRegistration< ::pcr::OControlFontDialog > aAutoRegistration;
      31           4 : }
      32             : 
      33             : 
      34             : namespace pcr
      35             : {
      36             : 
      37             : 
      38             :     using namespace ::com::sun::star::uno;
      39             :     using namespace ::com::sun::star::lang;
      40             :     using namespace ::com::sun::star::beans;
      41             : 
      42             : 
      43             :     //= OControlFontDialog
      44             : 
      45             : 
      46           0 :     OControlFontDialog::OControlFontDialog(const Reference< XComponentContext >& _rxContext )
      47             :         :OGenericUnoDialog( _rxContext )
      48             :         ,m_pFontItems(NULL)
      49             :         ,m_pItemPool(NULL)
      50           0 :         ,m_pItemPoolDefaults(NULL)
      51             :     {
      52             :         registerProperty(PROPERTY_INTROSPECTEDOBJECT, OWN_PROPERTY_ID_INTROSPECTEDOBJECT,
      53             :             PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT,
      54           0 :             &m_xControlModel, ::getCppuType(&m_xControlModel));
      55           0 :     }
      56             : 
      57             : 
      58           0 :     OControlFontDialog::~OControlFontDialog()
      59             :     {
      60           0 :         if (m_pDialog)
      61             :         {
      62           0 :             ::osl::MutexGuard aGuard(m_aMutex);
      63           0 :             if (m_pDialog)
      64           0 :                 destroyDialog();
      65             :         }
      66           0 :     }
      67             : 
      68             : 
      69           0 :     Sequence<sal_Int8> SAL_CALL OControlFontDialog::getImplementationId(  ) throw(RuntimeException, std::exception)
      70             :     {
      71           0 :         return css::uno::Sequence<sal_Int8>();
      72             :     }
      73             : 
      74             : 
      75           0 :     Reference< XInterface > SAL_CALL OControlFontDialog::Create( const Reference< XComponentContext >& _rxContext )
      76             :     {
      77           0 :         return *( new OControlFontDialog( _rxContext ) );
      78             :     }
      79             : 
      80             : 
      81           0 :     OUString SAL_CALL OControlFontDialog::getImplementationName() throw(RuntimeException, std::exception)
      82             :     {
      83           0 :         return getImplementationName_static();
      84             :     }
      85             : 
      86             : 
      87           4 :     OUString OControlFontDialog::getImplementationName_static() throw(RuntimeException)
      88             :     {
      89           4 :         return OUString("org.openoffice.comp.form.ui.OControlFontDialog");
      90             :     }
      91             : 
      92             : 
      93           0 :     ::comphelper::StringSequence SAL_CALL OControlFontDialog::getSupportedServiceNames() throw(RuntimeException, std::exception)
      94             :     {
      95           0 :         return getSupportedServiceNames_static();
      96             :     }
      97             : 
      98             : 
      99           4 :     ::comphelper::StringSequence OControlFontDialog::getSupportedServiceNames_static() throw(RuntimeException)
     100             :     {
     101           4 :         ::comphelper::StringSequence aSupported(1);
     102           4 :         aSupported[0] = "com.sun.star.form.ControlFontDialog";
     103           4 :         return aSupported;
     104             :     }
     105             : 
     106           0 :     void OControlFontDialog::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException, std::exception)
     107             :     {
     108           0 :         Reference<XPropertySet> xGridModel;
     109           0 :         if (aArguments.getLength() == 1 && (aArguments[0] >>= xGridModel))
     110             :         {
     111           0 :             PropertyValue aArg;
     112           0 :             aArg.Name = "IntrospectedObject";
     113           0 :             aArg.Value <<= xGridModel;
     114           0 :             Sequence< Any > aNewArguments(1);
     115           0 :             aNewArguments[0] <<= aArg;
     116           0 :             OControlFontDialog_DBase::initialize(aNewArguments);
     117             :         }
     118             :         else
     119           0 :             OControlFontDialog_DBase::initialize(aArguments);
     120           0 :     }
     121             : 
     122             : 
     123           0 :     Reference<XPropertySetInfo>  SAL_CALL OControlFontDialog::getPropertySetInfo() throw(RuntimeException, std::exception)
     124             :     {
     125           0 :         Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
     126           0 :         return xInfo;
     127             :     }
     128             : 
     129             : 
     130           0 :     ::cppu::IPropertyArrayHelper& OControlFontDialog::getInfoHelper()
     131             :     {
     132           0 :         return *const_cast<OControlFontDialog*>(this)->getArrayHelper();
     133             :     }
     134             : 
     135             : 
     136           0 :     ::cppu::IPropertyArrayHelper* OControlFontDialog::createArrayHelper( ) const
     137             :     {
     138           0 :         Sequence< Property > aProps;
     139           0 :         describeProperties(aProps);
     140           0 :         return new ::cppu::OPropertyArrayHelper(aProps);
     141             :     }
     142             : 
     143             : 
     144           0 :     Dialog* OControlFontDialog::createDialog(vcl::Window* _pParent)
     145             :     {
     146           0 :         ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults);
     147             : 
     148             :         OSL_ENSURE(m_xControlModel.is(), "OControlFontDialog::createDialog: no introspectee set!");
     149           0 :         if (m_xControlModel.is())
     150           0 :             ControlCharacterDialog::translatePropertiesToItems(m_xControlModel, m_pFontItems);
     151             :         // TODO: we need a mechanism to prevent that somebody creates us, sets an introspectee, executes us,
     152             :         // sets a new introspectee and re-executes us. In this case, the dialog returned here (upon the first
     153             :         // execute) will be re-used upon the second execute, and thus it won't be initialized correctly.
     154             : 
     155           0 :         ControlCharacterDialog* pDialog = new ControlCharacterDialog(_pParent, *m_pFontItems);
     156           0 :         return pDialog;
     157             :     }
     158             : 
     159             : 
     160           0 :     void OControlFontDialog::destroyDialog()
     161             :     {
     162           0 :         OGenericUnoDialog::destroyDialog();
     163           0 :         ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults);
     164           0 :     }
     165             : 
     166             : 
     167           0 :     void OControlFontDialog::executedDialog(sal_Int16 _nExecutionResult)
     168             :     {
     169             :         OSL_ENSURE(m_pDialog, "OControlFontDialog::executedDialog: no dialog anymore?!!");
     170           0 :         if (m_pDialog && (sal_True == _nExecutionResult) && m_xControlModel.is())
     171             :         {
     172           0 :             const SfxItemSet* pOutput = static_cast<ControlCharacterDialog*>(m_pDialog)->GetOutputItemSet();
     173           0 :             if (pOutput)
     174           0 :                 ControlCharacterDialog::translateItemsToProperties( *pOutput, m_xControlModel );
     175             :         }
     176           0 :     }
     177             : 
     178             : 
     179          12 : }   // namespace pcr
     180             : 
     181             : 
     182             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10