LCOV - code coverage report
Current view: top level - include/sfx2 - tabdlg.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 28 0.0 %
Date: 2014-04-14 Functions: 0 18 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             : #ifndef INCLUDED_SFX2_TABDLG_HXX
      20             : #define INCLUDED_SFX2_TABDLG_HXX
      21             : 
      22             : #include <sal/config.h>
      23             : #include <sfx2/dllapi.h>
      24             : #include <sal/types.h>
      25             : #include <vcl/button.hxx>
      26             : #include <vcl/layout.hxx>
      27             : #include <vcl/tabctrl.hxx>
      28             : #include <vcl/tabdlg.hxx>
      29             : #include <vcl/tabpage.hxx>
      30             : #include <svl/itempool.hxx>
      31             : #include <svl/itemset.hxx>
      32             : #include <com/sun/star/frame/XFrame.hpp>
      33             : 
      34             : class SfxPoolItem;
      35             : class SfxTabDialog;
      36             : class SfxViewFrame;
      37             : class SfxTabPage;
      38             : class SfxBindings;
      39             : 
      40             : typedef SfxTabPage* (*CreateTabPage)(Window *pParent, const SfxItemSet &rAttrSet);
      41             : typedef sal_uInt16*     (*GetTabPageRanges)(); // provides international Which-value
      42             : struct TabPageImpl;
      43             : 
      44             : struct TabDlg_Impl;
      45             : 
      46             : #define ID_TABCONTROL   1
      47             : #define RET_USER        100
      48             : #define RET_USER_CANCEL 101
      49             : 
      50           0 : class SFX2_DLLPUBLIC SfxTabDialogItem: public SfxSetItem
      51             : {
      52             : public:
      53             :     TYPEINFO_OVERRIDE();
      54             :                             SfxTabDialogItem( sal_uInt16 nId, const SfxItemSet& rItemSet );
      55             :                             SfxTabDialogItem(const SfxTabDialogItem& rAttr, SfxItemPool* pItemPool=NULL);
      56             :     virtual SfxPoolItem*    Clone(SfxItemPool* pToPool) const SAL_OVERRIDE;
      57             :     virtual SfxPoolItem*    Create(SvStream& rStream, sal_uInt16 nVersion) const SAL_OVERRIDE;
      58             : };
      59             : 
      60             : class SFX2_DLLPUBLIC SfxTabDialog : public TabDialog
      61             : {
      62             : private:
      63             : friend class SfxTabPage;
      64             : friend class SfxTabDialogController;
      65             : 
      66             :     SfxViewFrame*   pFrame;
      67             : 
      68             :     VclBox *m_pBox;
      69             :     TabControl *m_pTabCtrl;
      70             : 
      71             :     PushButton* m_pOKBtn;
      72             :     PushButton* m_pApplyBtn;
      73             :     PushButton* m_pUserBtn;
      74             :     CancelButton* m_pCancelBtn;
      75             :     HelpButton* m_pHelpBtn;
      76             :     PushButton* m_pResetBtn;
      77             :     PushButton* m_pBaseFmtBtn;
      78             : 
      79             :     bool m_bOwnsVBox;
      80             :     bool m_bOwnsTabCtrl;
      81             :     bool m_bOwnsActionArea;
      82             :     bool m_bOwnsOKBtn;
      83             :     bool m_bOwnsApplyBtn;
      84             :     bool m_bOwnsUserBtn;
      85             :     bool m_bOwnsCancelBtn;
      86             :     bool m_bOwnsHelpBtn;
      87             :     bool m_bOwnsResetBtn;
      88             :     bool m_bOwnsBaseFmtBtn;
      89             : 
      90             :     const SfxItemSet*   pSet;
      91             :     SfxItemSet*         pOutSet;
      92             :     TabDlg_Impl*        pImpl;
      93             :     sal_uInt16*         pRanges;
      94             :     sal_uInt16          nAppPageId;
      95             :     bool                bItemsReset;
      96             :     bool                bStandardPushed;
      97             : 
      98             :     DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * );
      99             :     DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * );
     100             :     DECL_DLLPRIVATE_LINK(OkHdl, void *);
     101             :     DECL_DLLPRIVATE_LINK(ResetHdl, void *);
     102             :     DECL_DLLPRIVATE_LINK(BaseFmtHdl, void *);
     103             :     DECL_DLLPRIVATE_LINK(UserHdl, void *);
     104             :     DECL_DLLPRIVATE_LINK(CancelHdl, void *);
     105             :     SAL_DLLPRIVATE void Init_Impl(bool bFmtFlag, const OUString* pUserButtonText, const ResId* pResId);
     106             : 
     107             : protected:
     108             :     virtual short               Ok();
     109             :     // Is deleted in Sfx!
     110             :     virtual SfxItemSet*         CreateInputItemSet( sal_uInt16 nId );
     111             :     // Is not deleted in Sfx!
     112             :     virtual const SfxItemSet*   GetRefreshedSet();
     113             :     virtual void                PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
     114             : 
     115             :     VclButtonBox*   m_pActionArea;
     116             :     SfxItemSet*     pExampleSet;
     117             :     SfxItemSet*     GetInputSetImpl();
     118             :     SfxTabPage*     GetTabPage( sal_uInt16 nPageId ) const;
     119             : 
     120             :     /** prepare to leace the current page. Calls the DeactivatePage method of the current page, (if necessary),
     121             :         handles the item sets to copy.
     122             :         @return sal_True if it is allowed to leave the current page, sal_False otherwise
     123             :     */
     124             :     bool PrepareLeaveCurrentPage();
     125             : 
     126             :     /** save the position of the TabDialog and which tab page is the currently active one
     127             :      */
     128             :     void SavePosAndId();
     129             : 
     130             : public:
     131             :     SfxTabDialog(Window* pParent,
     132             :                  const OString& rID, const OUString& rUIXMLDescription,
     133             :                  const SfxItemSet * = 0, bool bEditFmt = false);
     134             :     SfxTabDialog(SfxViewFrame *pViewFrame, Window* pParent,
     135             :                  const OString& rID, const OUString& rUIXMLDescription,
     136             :                  const SfxItemSet * = 0, bool bEditFmt = false);
     137             :     virtual ~SfxTabDialog();
     138             : 
     139             :     sal_uInt16          AddTabPage( const OString& rName,           // Name of the label for the page in the notebook .ui
     140             :                                     CreateTabPage pCreateFunc,      // != 0
     141             :                                     GetTabPageRanges pRangesFunc,   // can be 0
     142             :                                     bool bItemsOnDemand = false);
     143             : 
     144             :     sal_uInt16          AddTabPage ( const OString &rName,          // Name of the label for the page in the notebook .ui
     145             :                                      sal_uInt16 nPageCreateId );    // Identifier of the Factory Method to create the page
     146             : 
     147             :     void                AddTabPage( sal_uInt16 nId,
     148             :                                     const OUString &rRiderText,
     149             :                                     CreateTabPage pCreateFunc,      // != 0
     150             :                                     GetTabPageRanges pRangesFunc,   // can be 0
     151             :                                     bool bItemsOnDemand = false,
     152             :                                     sal_uInt16 nPos = TAB_APPEND);
     153             :     void                AddTabPage( sal_uInt16 nId,
     154             :                                     const Bitmap &rRiderBitmap,
     155             :                                     CreateTabPage pCreateFunc,      // != 0
     156             :                                     GetTabPageRanges pRangesFunc,   // can be 0
     157             :                                     bool bItemsOnDemand = false,
     158             :                                     sal_uInt16 nPos = TAB_APPEND);
     159             : 
     160             :     void                AddTabPage( sal_uInt16 nId,
     161             :                                     const OUString &rRiderText,
     162             :                                     bool bItemsOnDemand = false,
     163             :                                     sal_uInt16 nPos = TAB_APPEND);
     164             :     void                AddTabPage( sal_uInt16 nId,
     165             :                                     const Bitmap &rRiderBitmap,
     166             :                                     bool bItemsOnDemand = false,
     167             :                                     sal_uInt16 nPos = TAB_APPEND);
     168             : 
     169             :     void                RemoveTabPage( const OString& rName ); // Name of the label for the page in the notebook .ui
     170             :     void                RemoveTabPage( sal_uInt16 nId );
     171             : 
     172           0 :     void                SetCurPageId(sal_uInt16 nId)
     173             :     {
     174           0 :         nAppPageId = nId;
     175           0 :     }
     176           0 :     void                SetCurPageId(const OString& rName)
     177             :     {
     178           0 :         nAppPageId = m_pTabCtrl->GetPageId(rName);
     179           0 :     }
     180           0 :     sal_uInt16          GetCurPageId() const
     181             :     {
     182           0 :         return m_pTabCtrl->GetCurPageId();
     183             :     }
     184             : 
     185           0 :     SfxTabPage* GetCurTabPage() const
     186             :     {
     187           0 :         return GetTabPage(m_pTabCtrl->GetCurPageId());
     188             :     }
     189             : 
     190           0 :     OUString            GetPageText( sal_uInt16 nPageId ) const
     191             :     {
     192           0 :         return m_pTabCtrl->GetPageText(nPageId);
     193             :     }
     194             : 
     195             :     void                ShowPage( sal_uInt16 nId );
     196             : 
     197             :     // may provide local slots converted by Map
     198             :     const sal_uInt16*       GetInputRanges( const SfxItemPool& );
     199             :     void                SetInputSet( const SfxItemSet* pInSet );
     200           0 :     const SfxItemSet*   GetOutputItemSet() const { return pOutSet; }
     201             : 
     202             :     const PushButton&   GetOKButton() const { return *m_pOKBtn; }
     203           0 :     PushButton&         GetOKButton() { return *m_pOKBtn; }
     204             :     const CancelButton& GetCancelButton() const { return *m_pCancelBtn; }
     205           0 :     CancelButton&       GetCancelButton() { return *m_pCancelBtn; }
     206             :     const HelpButton&   GetHelpButton() const { return *m_pHelpBtn; }
     207             :     HelpButton&         GetHelpButton() { return *m_pHelpBtn; }
     208             : 
     209             :     const PushButton*   GetUserButton() const { return m_pUserBtn; }
     210           0 :     PushButton*         GetUserButton() { return m_pUserBtn; }
     211             :     void                RemoveResetButton();
     212             :     void                RemoveStandardButton();
     213             : 
     214             :     short               Execute() SAL_OVERRIDE;
     215             :     void                StartExecuteModal( const Link& rEndDialogHdl ) SAL_OVERRIDE;
     216             :     void                Start( bool bShow = true );
     217             : 
     218           0 :     const SfxItemSet*   GetExampleSet() const { return pExampleSet; }
     219             :     SfxViewFrame*       GetViewFrame() const { return pFrame; }
     220             : 
     221             :     void                SetApplyHandler(const Link& _rHdl);
     222             : 
     223             :     SAL_DLLPRIVATE void Start_Impl();
     224             : 
     225             :     //calls Ok without closing dialog
     226             :     bool Apply();
     227             : };
     228             : 
     229             : namespace sfx { class ItemConnectionBase; }
     230             : 
     231             : class SFX2_DLLPUBLIC SfxTabPage: public TabPage
     232             : {
     233             : friend class SfxTabDialog;
     234             : 
     235             : private:
     236             :     const SfxItemSet*   pSet;
     237             :     OUString            aUserString;
     238             :     bool                bHasExchangeSupport;
     239             :     TabPageImpl*        pImpl;
     240             : 
     241             :     SAL_DLLPRIVATE void SetInputSet( const SfxItemSet* pNew ) { pSet = pNew; }
     242             : 
     243             : protected:
     244             :     SfxTabPage( Window *pParent, const ResId &, const SfxItemSet &rAttrSet );
     245             :     SfxTabPage(Window *pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet &rAttrSet);
     246             : 
     247             :     sal_uInt16              GetSlot( sal_uInt16 nWhich ) const
     248             :                             { return pSet->GetPool()->GetSlotId( nWhich ); }
     249           0 :     sal_uInt16              GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const
     250           0 :                             { return pSet->GetPool()->GetWhich( nSlot, bDeep ); }
     251             :     const SfxPoolItem*  GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true );
     252             :     SfxTabDialog*       GetTabDialog() const;
     253             : 
     254             :     void                AddItemConnection( sfx::ItemConnectionBase* pConnection );
     255             : 
     256             : public:
     257             :     virtual             ~SfxTabPage();
     258             : 
     259           0 :     const SfxItemSet&   GetItemSet() const { return *pSet; }
     260             : 
     261             :     virtual bool        FillItemSet( SfxItemSet& );
     262             :     virtual void        Reset( const SfxItemSet& );
     263             : 
     264           0 :     bool                HasExchangeSupport() const
     265           0 :                             { return bHasExchangeSupport; }
     266           0 :     void                SetExchangeSupport( bool bNew = true )
     267           0 :                             { bHasExchangeSupport = bNew; }
     268             : 
     269             :     enum sfxpg {
     270             :       KEEP_PAGE = 0x0000,      // Error handling; page does not change
     271             :         // 2. Fill an itemset for update
     272             :         // parent examples, this pointer can be NULL all the time!
     273             :         LEAVE_PAGE = 0x0001,
     274             :         // Set, refresh and update other Page
     275             :         REFRESH_SET = 0x0002
     276             :     };
     277             : 
     278             :         using TabPage::ActivatePage;
     279             :         using TabPage::DeactivatePage;
     280             :     virtual void            ActivatePage( const SfxItemSet& );
     281             :     virtual int             DeactivatePage( SfxItemSet* pSet = 0 );
     282           0 :     void                    SetUserData(const OUString& rString)
     283           0 :                               { aUserString = rString; }
     284           0 :     OUString                GetUserData() { return aUserString; }
     285             :     virtual void            FillUserData();
     286             :     virtual bool            IsReadOnly() const;
     287             :     virtual void PageCreated (SfxAllItemSet aSet);
     288             :     static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true );
     289             : 
     290             :     void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
     291             :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame();
     292             : };
     293             : 
     294             : #endif
     295             : 
     296             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10