LCOV - code coverage report
Current view: top level - include/svx - orienthelper.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 3 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_SVX_ORIENTHELPER_HXX
      21             : #define INCLUDED_SVX_ORIENTHELPER_HXX
      22             : 
      23             : #include <memory>
      24             : #include <vcl/window.hxx>
      25             : #include <sfx2/itemconnect.hxx>
      26             : #include <svx/svxdllapi.h>
      27             : 
      28             : class NumericField;
      29             : class CheckBox;
      30             : 
      31             : namespace svx {
      32             : 
      33             : class DialControl;
      34             : 
      35             : 
      36             : 
      37             : struct OrientationHelper_Impl;
      38             : 
      39             : /** A helper class that manages a DialControl and a "Stacked text" check box.
      40             : 
      41             :     This helper remembers a DialControl for entering a rotation angle, and a
      42             :     check box for stacked text, that enables/disables other controls dependent
      43             :     on its state.
      44             : 
      45             :     It is possible to register more controls that have to be enabled/disabled
      46             :     together with this helper object (optionally dependent on the stacked text
      47             :     check box), using the function AddDependentWindow(). All registered windows
      48             :     are handled on a call of Enable(), or Show(), or on changing the state of
      49             :     the "Stacked text" check box.
      50             : 
      51             :     Note: The member function SetStackedState() should be used instead of
      52             :     direct modifications of the "Stacked text" check box. Otherwise the update
      53             :     mechanism of registered controls will not work.
      54             :  */
      55             : class SVX_DLLPUBLIC OrientationHelper
      56             : {
      57             : public:
      58             :     /** @param rNfRotation  A numeric field that will be connected to the DialControl. */
      59             :     explicit            OrientationHelper(
      60             :                             DialControl& rCtrlDial,
      61             :                             NumericField& rNfRotation,
      62             :                             CheckBox& rCbStacked );
      63             : 
      64             :     virtual             ~OrientationHelper();
      65             : 
      66             :     /** Registers the passed window to be enabled/disabled on call of Enable().
      67             :         @param eDisableIfStacked
      68             :         TRISTATE_TRUE:    Window always disabled, if stacked text is turned on.
      69             :         TRISTATE_FALSE:  Window always disabled, if stacked text is turned off.
      70             :         TRISTATE_INDET: Window will be enabled/disabled independent from stacked text. */
      71             :     void                AddDependentWindow( Window& rWindow, TriState eDisableIfStacked = TRISTATE_INDET );
      72             : 
      73             :     /** Enables or disables the dial control and all dependent windows. */
      74             :     void                Enable( bool bEnable = true );
      75             :     /** Disables the dial control and all dependent windows. */
      76             :     inline void         Disable() { Enable( false ); }
      77             : 
      78             :     /** Shows or hides the dial control and all dependent windows. */
      79             :     void                Show( bool bShow = true );
      80             :     /** Hides the dial control and all dependent windows. */
      81           0 :     inline void         Hide() { Show( false ); }
      82             : 
      83             :     /** Sets the "stacked" check box to the passed state and updates dependent controls. */
      84             :     void                SetStackedState( TriState eState );
      85             :     /** Returns the state of the "stacked" check box. */
      86             :     TriState            GetStackedState() const;
      87             : 
      88             :     /** Enables/disables the "don't know" state of the "Stacked text" check box. */
      89             :     void                EnableStackedTriState( bool bEnable = true );
      90             : 
      91             : private:
      92             :     std::auto_ptr< OrientationHelper_Impl > mpImpl;
      93             : };
      94             : 
      95             : 
      96             : 
      97             : /** Wrapper for usage of the stacked attribute of an OrientationHelper in item connections. */
      98           0 : class SVX_DLLPUBLIC OrientStackedWrapper : public sfx::SingleControlWrapper< OrientationHelper, bool >
      99             : {
     100             : public:
     101             :     explicit            OrientStackedWrapper( OrientationHelper& rOrientHlp );
     102             : 
     103             :     virtual bool        IsControlDontKnow() const SAL_OVERRIDE;
     104             :     virtual void        SetControlDontKnow( bool bSet ) SAL_OVERRIDE;
     105             : 
     106             :     virtual bool        GetControlValue() const SAL_OVERRIDE;
     107             :     virtual void        SetControlValue( bool bValue ) SAL_OVERRIDE;
     108             : };
     109             : 
     110             : 
     111             : 
     112             : /** An item<->control connection for the stacked attribute of an OrientationHelper. */
     113             : typedef sfx::ItemControlConnection< sfx::BoolItemWrapper, OrientStackedWrapper > OrientStackedConnection;
     114             : 
     115             : 
     116             : 
     117             : } // namespace
     118             : 
     119             : #endif
     120             : 
     121             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10