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

Generated by: LCOV version 1.11