LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/inc/taskpane - TaskPaneControlFactory.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 6 0.0 %
Date: 2012-12-27 Functions: 0 16 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 SD_TASKPANE_CONTROL_FACTORY_HXX
      21             : #define SD_TASKPANE_CONTROL_FACTORY_HXX
      22             : 
      23             : #include "taskpane/TaskPaneTreeNode.hxx"
      24             : 
      25             : #include <memory>
      26             : 
      27             : namespace sd { namespace toolpanel {
      28             : class TreeNode;
      29             : } }
      30             : 
      31             : 
      32             : 
      33             : 
      34             : namespace sd { namespace toolpanel {
      35             : 
      36             : /** A simple factory base class defines the interface that is used by
      37             :     some of the control containers of the task pane to create controls on
      38             :     demand when they are about to be displayed for the first time.
      39             : 
      40             :     It provides the InternalCreateControl() method as hook that can be
      41             :     overloaded by derived classes to provide a new control.
      42             : */
      43             : class ControlFactory
      44             : {
      45             : public:
      46             :     ControlFactory (void);
      47             :     virtual ~ControlFactory (void);
      48             : 
      49             :     /** creates a tree node which acts as root of an own tree
      50             : 
      51             :         Derived classes should overload InternalCreateControl.
      52             :     */
      53             :     ::std::auto_ptr<TreeNode> CreateControl( ::Window& i_rParent );
      54             : 
      55             : protected:
      56             :     virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) = 0;
      57             : };
      58             : 
      59             : 
      60             : 
      61             : /** A simple helper class that realizes a ControlFactory that is able to create root controls, providing
      62             :     the to-be-created control with an additional parameter.
      63             : */
      64             : template<class ControlType, class ArgumentType>
      65           0 : class RootControlFactoryWithArg
      66             :     : public ControlFactory
      67             : {
      68             : public:
      69           0 :     RootControlFactoryWithArg (ArgumentType& rArgument)
      70           0 :         : mrArgument(rArgument)
      71           0 :     {}
      72             : 
      73             : protected:
      74           0 :     virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
      75             :     {
      76           0 :         return new ControlType( i_rParent, mrArgument );
      77             :     }
      78             : 
      79             : private:
      80             :     ArgumentType& mrArgument;
      81             : };
      82             : 
      83             : 
      84             : } } // end of namespace ::sd::toolpanel
      85             : 
      86             : #endif
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10