LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/vcl - tabctrl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 6 33.3 %
Date: 2012-08-25 Functions: 1 4 25.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SV_TABCTRL_HXX
      30                 :            : #define _SV_TABCTRL_HXX
      31                 :            : 
      32                 :            : #include "tools/solar.h"
      33                 :            : #include "vcl/dllapi.h"
      34                 :            : #include "vcl/ctrl.hxx"
      35                 :            : 
      36                 :            : struct ImplTabItem;
      37                 :            : struct ImplTabCtrlData;
      38                 :            : class TabPage;
      39                 :            : class PushButton;
      40                 :            : class ListBox;
      41                 :            : 
      42                 :            : // --------------------
      43                 :            : // - TabControl-Types -
      44                 :            : // --------------------
      45                 :            : 
      46                 :            : #ifndef TAB_APPEND
      47                 :            : #define TAB_APPEND          ((sal_uInt16)0xFFFF)
      48                 :            : #define TAB_PAGE_NOTFOUND   ((sal_uInt16)0xFFFF)
      49                 :            : #endif /* !TAB_APPEND */
      50                 :            : 
      51                 :            : // --------------
      52                 :            : // - TabControl -
      53                 :            : // --------------
      54                 :            : 
      55                 :            : class VCL_DLLPUBLIC TabControl : public Control
      56                 :            : {
      57                 :            : private:
      58                 :            :     ImplTabCtrlData*    mpTabCtrlData;
      59                 :            :     long                mnLastWidth;
      60                 :            :     long                mnLastHeight;
      61                 :            :     long                mnBtnSize;
      62                 :            :     long                mnMaxPageWidth;
      63                 :            :     sal_uInt16              mnActPageId;
      64                 :            :     sal_uInt16              mnCurPageId;
      65                 :            :     sal_Bool                mbFormat;
      66                 :            :     sal_Bool                mbRestoreHelpId;
      67                 :            :     sal_Bool                mbRestoreUnqId;
      68                 :            :     sal_Bool                mbSmallInvalidate;
      69                 :            :     Link                maActivateHdl;
      70                 :            :     Link                maDeactivateHdl;
      71                 :            : 
      72                 :            :     using Control::ImplInitSettings;
      73                 :            :     SAL_DLLPRIVATE void         ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
      74                 :            :     SAL_DLLPRIVATE ImplTabItem* ImplGetItem( sal_uInt16 nId ) const;
      75                 :            :     SAL_DLLPRIVATE Size         ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth );
      76                 :            :     SAL_DLLPRIVATE Rectangle    ImplGetTabRect( sal_uInt16 nPos, long nWidth = -1, long nHeight = -1 );
      77                 :            :     SAL_DLLPRIVATE void         ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId );
      78                 :            :     SAL_DLLPRIVATE sal_Bool         ImplPosCurTabPage();
      79                 :            :     SAL_DLLPRIVATE void         ImplActivateTabPage( sal_Bool bNext );
      80                 :            :     SAL_DLLPRIVATE void         ImplShowFocus();
      81                 :            :     SAL_DLLPRIVATE void         ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bool bLayout = false, bool bFirstInGroup = false, bool bLastInGroup = false, bool bIsCurrentItem = false );
      82                 :            :     SAL_DLLPRIVATE void         ImplPaint( const Rectangle& rRect, bool bLayout = false );
      83                 :            :     SAL_DLLPRIVATE void         ImplFreeLayoutData();
      84                 :            :     SAL_DLLPRIVATE long         ImplHandleKeyEvent( const KeyEvent& rKeyEvent );
      85                 :            : 
      86                 :            :     DECL_DLLPRIVATE_LINK(       ImplListBoxSelectHdl, void* );
      87                 :            :     DECL_DLLPRIVATE_LINK(       ImplWindowEventListener, VclSimpleEvent* );
      88                 :            : 
      89                 :            : 
      90                 :            : protected:
      91                 :            :     using Window::ImplInit;
      92                 :            :     SAL_DLLPRIVATE void         ImplInit( Window* pParent, WinBits nStyle );
      93                 :            :     SAL_DLLPRIVATE WinBits      ImplInitStyle( WinBits nStyle );
      94                 :            :     SAL_DLLPRIVATE void         ImplLoadRes( const ResId& rResId );
      95                 :            : 
      96                 :            :     virtual void                FillLayoutData() const;
      97                 :            :     virtual const Font&         GetCanonicalFont( const StyleSettings& _rStyle ) const;
      98                 :            :     virtual const Color&        GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
      99                 :            :     SAL_DLLPRIVATE Rectangle*   ImplFindPartRect( const Point& rPt );
     100                 :            : 
     101                 :            : public:
     102                 :            :                         TabControl( Window* pParent,
     103                 :            :                                     WinBits nStyle = WB_STDTABCONTROL );
     104                 :            :                         TabControl( Window* pParent, const ResId& rResId );
     105                 :            :                         ~TabControl();
     106                 :            : 
     107                 :            :     virtual void        MouseButtonDown( const MouseEvent& rMEvt );
     108                 :            :     virtual void        KeyInput( const KeyEvent& rKEvt );
     109                 :            :     virtual void        Paint( const Rectangle& rRect );
     110                 :            :     virtual void        Resize();
     111                 :            :     virtual void        GetFocus();
     112                 :            :     virtual void        LoseFocus();
     113                 :            :     virtual void        RequestHelp( const HelpEvent& rHEvt );
     114                 :            :     virtual void        Command( const CommandEvent& rCEvt );
     115                 :            :     virtual long        Notify( NotifyEvent& rNEvt );
     116                 :            :     virtual void        StateChanged( StateChangedType nType );
     117                 :            :     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
     118                 :            :     virtual long        PreNotify( NotifyEvent& rNEvt );
     119                 :            : 
     120                 :            :     virtual void        ActivatePage();
     121                 :            :     virtual long        DeactivatePage();
     122                 :            : 
     123                 :            :     virtual Size GetOptimalSize(WindowSizeType eType) const;
     124                 :            :     void                SetMinimumSizePixel( const Size& );
     125                 :            : 
     126                 :            :     void                SetTabPageSizePixel( const Size& rSize );
     127                 :            :     Size                GetTabPageSizePixel() const;
     128                 :            : 
     129                 :            :     //  pixel offset for the tab items, default is (0,0)
     130                 :            :     void                SetItemsOffset( const Point& rOffs );
     131                 :            :     Point               GetItemsOffset() const;
     132                 :            : 
     133                 :            :     void                InsertPage( const ResId& rResId,
     134                 :            :                                     sal_uInt16 nPos = TAB_APPEND );
     135                 :            :     void                InsertPage( sal_uInt16 nPageId, const XubString& rText,
     136                 :            :                                     sal_uInt16 nPos = TAB_APPEND );
     137                 :            :     void                RemovePage( sal_uInt16 nPageId );
     138                 :            :     void                Clear();
     139                 :            :     void                EnablePage( sal_uInt16 nPageId, bool bEnable = true );
     140                 :            : 
     141                 :            :     sal_uInt16              GetPageCount() const;
     142                 :            :     sal_uInt16              GetPageId( sal_uInt16 nPos ) const;
     143                 :            :     sal_uInt16              GetPagePos( sal_uInt16 nPageId ) const;
     144                 :            :     sal_uInt16              GetPageId( const Point& rPos ) const;
     145                 :            : 
     146                 :            :     void                SetCurPageId( sal_uInt16 nPageId );
     147                 :            :     sal_uInt16              GetCurPageId() const;
     148                 :            : 
     149                 :            :     void                SelectTabPage( sal_uInt16 nPageId );
     150                 :            : 
     151                 :            :     void                SetMaxPageWidth( long nMaxWidth ) { mnMaxPageWidth = nMaxWidth; }
     152                 :            :     long                GetMaxPageWidth() const { return mnMaxPageWidth; }
     153                 :            :     void                ResetMaxPageWidth() { SetMaxPageWidth( 0 ); }
     154                 :            :     sal_Bool                IsMaxPageWidth() const { return mnMaxPageWidth != 0; }
     155                 :            : 
     156                 :            :     void                SetTabPage( sal_uInt16 nPageId, TabPage* pPage );
     157                 :            :     TabPage*            GetTabPage( sal_uInt16 nPageId ) const;
     158                 :            : 
     159                 :            :     void                SetPageText( sal_uInt16 nPageId, const XubString& rText );
     160                 :            :     XubString           GetPageText( sal_uInt16 nPageId ) const;
     161                 :            : 
     162                 :            :     void                SetHelpText( sal_uInt16 nPageId, const XubString& rText );
     163                 :            :     const XubString&    GetHelpText( sal_uInt16 nPageId ) const;
     164                 :            : 
     165                 :            :     rtl::OString        GetHelpId( sal_uInt16 nPageId ) const;
     166                 :            : 
     167                 :            :     void                SetPageImage( sal_uInt16 nPageId, const Image& rImage );
     168                 :            : 
     169                 :            :     void                SetHelpText( const XubString& rText )
     170                 :            :                             { Control::SetHelpText( rText ); }
     171                 :            :     const XubString&    GetHelpText() const
     172                 :            :                             { return Control::GetHelpText(); }
     173                 :            : 
     174                 :          0 :     void                SetHelpId( const rtl::OString& rId )
     175                 :          0 :                             { Control::SetHelpId( rId ); }
     176                 :         26 :     const rtl::OString& GetHelpId() const
     177                 :         26 :                             { return Control::GetHelpId(); }
     178                 :            : 
     179                 :          0 :     void                SetActivatePageHdl( const Link& rLink ) { maActivateHdl = rLink; }
     180                 :            :     const Link&         GetActivatePageHdl() const { return maActivateHdl; }
     181                 :          0 :     void                SetDeactivatePageHdl( const Link& rLink ) { maDeactivateHdl = rLink; }
     182                 :            :     const Link&         GetDeactivatePageHdl() const { return maDeactivateHdl; }
     183                 :            : 
     184                 :            :     // returns (control relative) bounding rectangle for the
     185                 :            :     // character at index nIndex relative to the text of page nPageId
     186                 :            :     using Control::GetCharacterBounds;
     187                 :            :     Rectangle GetCharacterBounds( sal_uInt16 nPageId, long nIndex ) const;
     188                 :            : 
     189                 :            :     // returns the index relative to the text of page nPageId (also returned)
     190                 :            :     // at position rPoint (control relative)
     191                 :            :     using Control::GetIndexForPoint;
     192                 :            :     long GetIndexForPoint( const Point& rPoint, sal_uInt16& rPageId ) const;
     193                 :            : 
     194                 :            :     // returns the rectangle of the tab for page nPageId
     195                 :            :     Rectangle GetTabBounds( sal_uInt16 nPageId ) const;
     196                 :            : };
     197                 :            : 
     198                 :            : #endif  // _SV_TABCTRL_HXX
     199                 :            : 
     200                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10