LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/toolpanel - tabbargeometry.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 6 0.0 %
Date: 2012-12-27 Functions: 0 6 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 TABBARGEOMETRY_HXX
      21             : #define TABBARGEOMETRY_HXX
      22             : 
      23             : #include "svtools/toolpanel/tabalignment.hxx"
      24             : 
      25             : #include "tabitemdescriptor.hxx"
      26             : 
      27             : #include <tools/gen.hxx>
      28             : #include <tools/svborder.hxx>
      29             : 
      30             : //......................................................................................................................
      31             : namespace svt
      32             : {
      33             : //......................................................................................................................
      34             : 
      35             :     //==================================================================================================================
      36             :     //= NormalizedArea
      37             :     //==================================================================================================================
      38             :     /** a rectangle which automatically translates between unrotated and rotated geometry.
      39             : 
      40             :         It can be operated as if it were an unrotated area, but is able to provide corrdinates of rotated objects,
      41             :         relative to its playground.
      42             :     */
      43             :     class NormalizedArea
      44             :     {
      45             :     public:
      46             :         NormalizedArea();
      47             :         NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical );
      48             : 
      49             :         /** transforms a rectangle, relative to our playground, into a coordinate system defined by the given alignment
      50             :             @param i_rArea
      51             :                 the area which is to be transformed.
      52             :         */
      53             :         Rectangle   getTransformed(
      54             :                         const Rectangle& i_rArea,
      55             :                         const TabAlignment i_eTargetAlignment
      56             :                     ) const;
      57             : 
      58             :         /** normalizes an already transformed rectangle
      59             :             @param i_rArea
      60             :                 the area which is to be normalized.
      61             :         */
      62             :         Rectangle   getNormalized(
      63             :                         const Rectangle& i_rArea,
      64             :                         const TabAlignment i_eTargetAlignment
      65             :                     ) const;
      66             : 
      67             : 
      68           0 :         Size        getReferenceSize() const { return m_aReference.GetSize(); }
      69             :         const Rectangle&
      70             :                     getReference() const { return m_aReference; }
      71             : 
      72             :     private:
      73             :         // the normalized reference area
      74             :         Rectangle   m_aReference;
      75             :     };
      76             : 
      77             :     //==================================================================================================================
      78             :     //= TabBarGeometry
      79             :     //==================================================================================================================
      80             :     class TabBarGeometry
      81             :     {
      82             :     public:
      83             :         TabBarGeometry( const TabItemContent i_eItemContent );
      84             :         ~TabBarGeometry();
      85             : 
      86             :         // retrieves the rectangle to be occupied by the button for scrolling backward through the items
      87           0 :         const Rectangle&    getButtonBackRect() const { return m_aButtonBackRect; }
      88             :         // retrieves the rectangle to be occupied by the items
      89           0 :         const Rectangle&    getItemsRect() const { return m_aItemsRect; }
      90             :         // retrieves the rectangle to be occupied by the button for scrolling forward through the items
      91           0 :         const Rectangle&    getButtonForwardRect() const { return m_aButtonForwardRect; }
      92             : 
      93             :         inline TabItemContent
      94           0 :                             getItemContent() const { return m_eTabItemContent; }
      95           0 :         inline void         setItemContent( const TabItemContent i_eItemContent ) { m_eTabItemContent = i_eItemContent; }
      96             : 
      97             :         /** adjusts the sizes of the buttons and the item's playground, plus the sizes of the items
      98             :         */
      99             :         void    relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems );
     100             : 
     101             :         /** calculates the optimal size of the tab bar, depending on the item's sizes
     102             :         */
     103             :         Size    getOptimalSize( ItemDescriptors& io_rItems, const bool i_bMinimalSize ) const;
     104             : 
     105             :         /** retrieves the position where the first item should start, relative to the item rect
     106             :         */
     107             :         Point   getFirstItemPosition() const;
     108             : 
     109             :     private:
     110             :         bool    impl_fitItems( ItemDescriptors& io_rItems ) const;
     111             : 
     112             :     private:
     113             :         /// specifies the content to be displayed in the tab items
     114             :         TabItemContent      m_eTabItemContent;
     115             :         /// specifies the inset to be used in the items area, depends on the actual alignment
     116             :         SvBorder            m_aItemsInset;
     117             :         // the (logical) rectangle to be used for the "back" button, empty if the button is not needed
     118             :         Rectangle           m_aButtonBackRect;
     119             :         // the (logical) rectangle to be used for the items
     120             :         Rectangle           m_aItemsRect;
     121             :         // the (logical) rectangle to be used for the "forward" button, empty if the button is not needed
     122             :         Rectangle           m_aButtonForwardRect;
     123             :     };
     124             : 
     125             : //......................................................................................................................
     126             : } // namespace svt
     127             : //......................................................................................................................
     128             : 
     129             : #endif // TABBARGEOMETRY_HXX
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10