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

Generated by: LCOV version 1.11