LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - handlerhelper.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 2 0.0 %
Date: 2014-11-03 Functions: 0 1 0.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             : #ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_HANDLERHELPER_HXX
      21             : #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_HANDLERHELPER_HXX
      22             : 
      23             : #include <com/sun/star/beans/Property.hpp>
      24             : #include <com/sun/star/uno/XComponentContext.hpp>
      25             : #include <com/sun/star/script/XTypeConverter.hpp>
      26             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      27             : #include <com/sun/star/inspection/XPropertyControlFactory.hpp>
      28             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      29             : #include <com/sun/star/beans/Optional.hpp>
      30             : 
      31             : #include <vector>
      32             : 
      33             : namespace vcl { class Window; }
      34             : namespace com { namespace sun { namespace star {
      35             :     namespace inspection {
      36             :         struct LineDescriptor;
      37             :     }
      38             : } } }
      39             : 
      40             : namespace pcr
      41             : {
      42             : 
      43             : 
      44             : 
      45             :     //= PropertyHandlerHelper
      46             : 
      47             :     class PropertyHandlerHelper
      48             :     {
      49             :     public:
      50             :         /** helper for implementing XPropertyHandler::describePropertyLine in a generic way
      51             :         */
      52             :         static  void describePropertyLine(
      53             :                 const ::com::sun::star::beans::Property& _rProperty,
      54             :                 ::com::sun::star::inspection::LineDescriptor& /* [out] */ _out_rDescriptor,
      55             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory
      56             :             );
      57             : 
      58             :         /** helper for implementing XPropertyHandler::convertToPropertyValue
      59             :         */
      60             :         static ::com::sun::star::uno::Any convertToPropertyValue(
      61             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
      62             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter >& _rxTypeConverter,
      63             :                 const ::com::sun::star::beans::Property& _rProperty,
      64             :                 const ::com::sun::star::uno::Any& _rControlValue
      65             :             );
      66             : 
      67             :         /// helper for implementing XPropertyHandler::convertToControlValue
      68             :         static ::com::sun::star::uno::Any convertToControlValue(
      69             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
      70             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter >& _rxTypeConverter,
      71             :                 const ::com::sun::star::uno::Any& _rPropertyValue,
      72             :                 const ::com::sun::star::uno::Type& _rControlValueType
      73             :             );
      74             : 
      75             :         /** creates an <member scope="com::sun::star::inspection">PropertyControlType::ListBox</member>-type control
      76             :             and fills it with initial values
      77             : 
      78             :             @param _rxControlFactory
      79             :                 A control factory. Must not be <NULL/>.
      80             : 
      81             :             @param  _rInitialListEntries
      82             :                 the initial values of the control
      83             : 
      84             :             @param _bReadOnlyControl
      85             :                 determines whether the control should be read-only
      86             : 
      87             :             @param _bSorted
      88             :                 determines whether the list entries should be sorted
      89             : 
      90             :             @return
      91             :                 the newly created control
      92             :         */
      93             :         static ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
      94             :             createListBoxControl(
      95             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory,
      96             :                 const ::std::vector< OUString >& _rInitialListEntries,
      97             :                 bool _bReadOnlyControl,
      98             :                 bool _bSorted
      99             :             );
     100             : 
     101             :         /** creates an <member scope="com::sun::star::inspection">PropertyControlType::ComboBox</member>-type control
     102             :             and fills it with initial values
     103             : 
     104             :             @param _rxControlFactory
     105             :                 A control factory. Must not be <NULL/>.
     106             : 
     107             :             @param  _rInitialListEntries
     108             :                 the initial values of the control
     109             : 
     110             :             @param _bReadOnlyControl
     111             :                 determines whether the control should be read-only
     112             : 
     113             :             @param _bSorted
     114             :                 determines whether the list entries should be sorted
     115             : 
     116             :             @return
     117             :                 the newly created control
     118             :         */
     119             :         static ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
     120             :             createComboBoxControl(
     121             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory,
     122             :                 const ::std::vector< OUString >& _rInitialListEntries,
     123             :                 bool _bReadOnlyControl,
     124             :                 bool _bSorted
     125             :             );
     126             : 
     127             :         /** creates an <member scope="com::sun::star::inspection">PropertyControlType::NumericField</member>-type control
     128             :             and initializes it
     129             : 
     130             :             @param _rxControlFactory
     131             :                 A control factory. Must not be <NULL/>.
     132             :             @param _nDigits
     133             :                 number of decimal digits for the control
     134             :                 (<member scope="com::sun::star::inspection">XNumericControl::DecimalDigits</member>)
     135             :             @param _rMinValue
     136             :                 minimum value which can be entered in the control
     137             :                 (<member scope="com::sun::star::inspection">XNumericControl::MinValue</member>)
     138             :             @param _rMaxValue
     139             :                 maximum value which can be entered in the control
     140             :                 (<member scope="com::sun::star::inspection">XNumericControl::MaxValue</member>)
     141             :             @param _bReadOnlyControl
     142             :                 determines whether the control should be read-only
     143             : 
     144             :             @return
     145             :                 the newly created control
     146             :         */
     147             :         static ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
     148             :             createNumericControl(
     149             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory,
     150             :                 sal_Int16 _nDigits,
     151             :                 const ::com::sun::star::beans::Optional< double >& _rMinValue,
     152             :                 const ::com::sun::star::beans::Optional< double >& _rMaxValue,
     153             :                 bool _bReadOnlyControl
     154             :             );
     155             : 
     156             :         /** marks the document passed in our UNO context as modified
     157             : 
     158             :             The method looks up a value called "ContextDocument" in the given UNO component context,
     159             :             queries it for the ->com::sun::star::util::XModifiable interface, and calls its
     160             :             setModified method. If either of those steps fails, this is asserted in a non-product
     161             :             version, and silently ignore otherwise.
     162             : 
     163             :             @param _rContext
     164             :                 the component context which was used to create the component calling this method
     165             :         */
     166             :         static void setContextDocumentModified(
     167             :                 const css::uno::Reference< css::uno::XComponentContext > & _rContext
     168             :             );
     169             : 
     170             :         static css::uno::Reference< css::uno::XInterface > getContextDocument( const css::uno::Reference<css::uno::XComponentContext> & _rContext );
     171             : 
     172             :         static css::uno::Reference< css::uno::XInterface > getContextDocument_throw( const css::uno::Reference<css::uno::XComponentContext> & _rContext ) throw (css::uno::RuntimeException);
     173             : 
     174             :         /** gets the window of the ObjectInspector in which an property handler lives
     175             : 
     176             :             The method looks up a value called "DialogParentWindow" in the given UNO copmonent context,
     177             :             queries it for XWindow, and returns the respective vcl::Window*. If either of those steps fails,
     178             :             this is asserted in a non-product version, and silently ignore otherwise.
     179             : 
     180             :             @param  _rContext
     181             :                 the component context which was used to create the component calling this method
     182             :         */
     183             :         static vcl::Window* getDialogParentWindow( const css::uno::Reference< css::uno::XComponentContext > & _rContext );
     184             : 
     185             : 
     186             :         /** determines whether given PropertyAttributes require a to-be-created
     187             :             <type scope="com::sun::star::inspection">XPropertyControl</type> to be read-only
     188             : 
     189             :             @param  _nPropertyAttributes
     190             :                 the attributes of the property which should be reflected by a to-be-created
     191             :                 <type scope="com::sun::star::inspection">XPropertyControl</type>
     192             :         */
     193           0 :         inline static bool requiresReadOnlyControl( sal_Int16 _nPropertyAttributes )
     194             :         {
     195           0 :             return ( _nPropertyAttributes & ::com::sun::star::beans::PropertyAttribute::READONLY ) != 0;
     196             :         }
     197             : 
     198             :     private:
     199             :         PropertyHandlerHelper();                                            // never implemented
     200             :         PropertyHandlerHelper( const PropertyHandlerHelper& );              // never implemented
     201             :         PropertyHandlerHelper& operator=( const PropertyHandlerHelper& );   // never implemented
     202             :     };
     203             : 
     204             : 
     205             : } // namespace pcr
     206             : 
     207             : 
     208             : #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_HANDLERHELPER_HXX
     209             : 
     210             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10