1*353d8f4dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*353d8f4dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*353d8f4dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*353d8f4dSAndrew Rist * distributed with this work for additional information 6*353d8f4dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*353d8f4dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*353d8f4dSAndrew Rist * "License"); you may not use this file except in compliance 9*353d8f4dSAndrew Rist * with the License. You may obtain a copy of the License at 10*353d8f4dSAndrew Rist * 11*353d8f4dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*353d8f4dSAndrew Rist * 13*353d8f4dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*353d8f4dSAndrew Rist * software distributed under the License is distributed on an 15*353d8f4dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*353d8f4dSAndrew Rist * KIND, either express or implied. See the License for the 17*353d8f4dSAndrew Rist * specific language governing permissions and limitations 18*353d8f4dSAndrew Rist * under the License. 19*353d8f4dSAndrew Rist * 20*353d8f4dSAndrew Rist *************************************************************/ 21*353d8f4dSAndrew Rist 22*353d8f4dSAndrew Rist 23cdf0e10cSrcweir #ifndef _SFXTABDLG_HXX 24cdf0e10cSrcweir #define _SFXTABDLG_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "sal/config.h" 27cdf0e10cSrcweir #include "sfx2/dllapi.h" 28cdf0e10cSrcweir #include "sal/types.h" 29cdf0e10cSrcweir #include <vcl/tabdlg.hxx> 30cdf0e10cSrcweir #include <vcl/button.hxx> 31cdf0e10cSrcweir #include <vcl/tabctrl.hxx> 32cdf0e10cSrcweir #include <vcl/tabpage.hxx> 33cdf0e10cSrcweir #include <svl/itempool.hxx> 34cdf0e10cSrcweir #include <svl/itemset.hxx> 35cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 36cdf0e10cSrcweir 37cdf0e10cSrcweir #if ENABLE_LAYOUT 38cdf0e10cSrcweir #include <layout/layout.hxx> 39cdf0e10cSrcweir namespace layout { class SfxTabDialog; class SfxTabDialogController; } 40cdf0e10cSrcweir #endif /* ENABLE_LAYOUT */ 41cdf0e10cSrcweir 42cdf0e10cSrcweir class SfxPoolItem; 43cdf0e10cSrcweir class SfxTabDialog; 44cdf0e10cSrcweir class SfxViewFrame; 45cdf0e10cSrcweir class SfxTabPage; 46cdf0e10cSrcweir class SfxBindings; 47cdf0e10cSrcweir 48cdf0e10cSrcweir #ifndef ENABLE_LAYOUT_SFX_TABDIALOG 49cdf0e10cSrcweir #define ENABLE_LAYOUT_SFX_TABDIALOG 0 50cdf0e10cSrcweir #define NAMESPACE_LAYOUT_SFX_TABDIALOG 51cdf0e10cSrcweir #define END_NAMESPACE_LAYOUT_SFX_TABDIALOG 52cdf0e10cSrcweir #define LAYOUT_NS_SFX_TABDIALOG 53cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT_SFX_TABDIALOG*/ 54cdf0e10cSrcweir 55cdf0e10cSrcweir typedef SfxTabPage* (*CreateTabPage)(Window *pParent, const SfxItemSet &rAttrSet); 56cdf0e10cSrcweir typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Wert 57cdf0e10cSrcweir struct TabPageImpl; 58cdf0e10cSrcweir class SfxUs_Impl; 59cdf0e10cSrcweir 60cdf0e10cSrcweir #if ENABLE_LAYOUT_SFX_TABDIALOG 61cdf0e10cSrcweir #include <layout/layout-pre.hxx> 62cdf0e10cSrcweir #undef SfxTabDialog 63cdf0e10cSrcweir #undef SfxTabPage 64cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ 65cdf0e10cSrcweir 66cdf0e10cSrcweir NAMESPACE_LAYOUT_SFX_TABDIALOG 67cdf0e10cSrcweir 68cdf0e10cSrcweir struct TabDlg_Impl; 69cdf0e10cSrcweir 70cdf0e10cSrcweir #define ID_TABCONTROL 1 71cdf0e10cSrcweir #define RET_USER 100 72cdf0e10cSrcweir #define RET_USER_CANCEL 101 73cdf0e10cSrcweir 74cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxTabDialogItem: public SfxSetItem 75cdf0e10cSrcweir { 76cdf0e10cSrcweir public: 77cdf0e10cSrcweir TYPEINFO(); 78cdf0e10cSrcweir SfxTabDialogItem( sal_uInt16 nId, const SfxItemSet& rItemSet ); 79cdf0e10cSrcweir SfxTabDialogItem(const SfxTabDialogItem& rAttr, SfxItemPool* pItemPool=NULL); 80cdf0e10cSrcweir virtual SfxPoolItem* Clone(SfxItemPool* pToPool) const; 81cdf0e10cSrcweir virtual SfxPoolItem* Create(SvStream& rStream, sal_uInt16 nVersion) const; 82cdf0e10cSrcweir }; 83cdf0e10cSrcweir 84cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxTabDialog : public TabDialog 85cdf0e10cSrcweir { 86cdf0e10cSrcweir private: 87cdf0e10cSrcweir friend class SfxTabPage; 88cdf0e10cSrcweir friend class SfxTabDialogController; 89cdf0e10cSrcweir 90cdf0e10cSrcweir SfxViewFrame* pFrame; 91cdf0e10cSrcweir 92cdf0e10cSrcweir TabControl aTabCtrl; 93cdf0e10cSrcweir OKButton aOKBtn; 94cdf0e10cSrcweir PushButton* pUserBtn; 95cdf0e10cSrcweir CancelButton aCancelBtn; 96cdf0e10cSrcweir HelpButton aHelpBtn; 97cdf0e10cSrcweir PushButton aResetBtn; 98cdf0e10cSrcweir PushButton aBaseFmtBtn; 99cdf0e10cSrcweir 100cdf0e10cSrcweir const SfxItemSet* pSet; 101cdf0e10cSrcweir SfxItemSet* pOutSet; 102cdf0e10cSrcweir TabDlg_Impl* pImpl; 103cdf0e10cSrcweir sal_uInt16* pRanges; 104cdf0e10cSrcweir sal_uInt32 nResId; 105cdf0e10cSrcweir sal_uInt16 nAppPageId; 106cdf0e10cSrcweir sal_Bool bItemsReset; 107cdf0e10cSrcweir sal_Bool bFmt; 108cdf0e10cSrcweir 109cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE 110cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * ); 111cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * ); 112cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( OkHdl, Button * ); 113cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( ResetHdl, Button * ); 114cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( BaseFmtHdl, Button * ); 115cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( UserHdl, Button * ); 116cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( CancelHdl, Button * ); 117cdf0e10cSrcweir SAL_DLLPRIVATE void Init_Impl(sal_Bool, const String *); 118cdf0e10cSrcweir //#endif 119cdf0e10cSrcweir 120cdf0e10cSrcweir protected: 121cdf0e10cSrcweir virtual short Ok(); 122cdf0e10cSrcweir // wird im Sfx gel"oscht! 123cdf0e10cSrcweir virtual SfxItemSet* CreateInputItemSet( sal_uInt16 nId ); 124cdf0e10cSrcweir // wird *nicht* im Sfx gel"oscht! 125cdf0e10cSrcweir virtual const SfxItemSet* GetRefreshedSet(); 126cdf0e10cSrcweir virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); 127cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 128cdf0e10cSrcweir 129cdf0e10cSrcweir SfxItemSet* pExampleSet; 130cdf0e10cSrcweir SfxItemSet* GetInputSetImpl(); 131cdf0e10cSrcweir SfxTabPage* GetTabPage( sal_uInt16 nPageId ) const; 132cdf0e10cSrcweir 133cdf0e10cSrcweir sal_Bool IsInOK() const; 134cdf0e10cSrcweir /** prepare to leace the current page. Calls the DeactivatePage method of the current page, (if necessary), 135cdf0e10cSrcweir handles the item sets to copy. 136cdf0e10cSrcweir @return sal_True if it is allowed to leave the current page, sal_False otherwise 137cdf0e10cSrcweir */ 138cdf0e10cSrcweir bool PrepareLeaveCurrentPage(); 139cdf0e10cSrcweir 140cdf0e10cSrcweir public: 141cdf0e10cSrcweir SfxTabDialog( Window* pParent, const ResId &rResId, sal_uInt16 nSetId, SfxBindings& rBindings, 142cdf0e10cSrcweir sal_Bool bEditFmt = sal_False, const String *pUserButtonText = 0 ); 143cdf0e10cSrcweir SfxTabDialog( Window* pParent, const ResId &rResId, const SfxItemSet * = 0, 144cdf0e10cSrcweir sal_Bool bEditFmt = sal_False, const String *pUserButtonText = 0 ); 145cdf0e10cSrcweir SfxTabDialog( SfxViewFrame *pViewFrame, Window* pParent, const ResId &rResId, 146cdf0e10cSrcweir const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False, 147cdf0e10cSrcweir const String *pUserButtonText = 0 ); 148cdf0e10cSrcweir ~SfxTabDialog(); 149cdf0e10cSrcweir 150cdf0e10cSrcweir void AddTabPage( sal_uInt16 nId, 151cdf0e10cSrcweir CreateTabPage pCreateFunc, // != 0 152cdf0e10cSrcweir GetTabPageRanges pRangesFunc, // darf 0 sein 153cdf0e10cSrcweir sal_Bool bItemsOnDemand = sal_False); 154cdf0e10cSrcweir void AddTabPage( sal_uInt16 nId, 155cdf0e10cSrcweir const String &rRiderText, 156cdf0e10cSrcweir CreateTabPage pCreateFunc, // != 0 157cdf0e10cSrcweir GetTabPageRanges pRangesFunc, // darf 0 sein 158cdf0e10cSrcweir sal_Bool bItemsOnDemand = sal_False, 159cdf0e10cSrcweir sal_uInt16 nPos = TAB_APPEND); 160cdf0e10cSrcweir void AddTabPage( sal_uInt16 nId, 161cdf0e10cSrcweir const Bitmap &rRiderBitmap, 162cdf0e10cSrcweir CreateTabPage pCreateFunc, // != 0 163cdf0e10cSrcweir GetTabPageRanges pRangesFunc, // darf 0 sein 164cdf0e10cSrcweir sal_Bool bItemsOnDemand = sal_False, 165cdf0e10cSrcweir sal_uInt16 nPos = TAB_APPEND); 166cdf0e10cSrcweir 167cdf0e10cSrcweir void AddTabPage( sal_uInt16 nId, 168cdf0e10cSrcweir sal_Bool bItemsOnDemand = sal_False); 169cdf0e10cSrcweir void AddTabPage( sal_uInt16 nId, 170cdf0e10cSrcweir const String &rRiderText, 171cdf0e10cSrcweir sal_Bool bItemsOnDemand = sal_False, 172cdf0e10cSrcweir sal_uInt16 nPos = TAB_APPEND); 173cdf0e10cSrcweir void AddTabPage( sal_uInt16 nId, 174cdf0e10cSrcweir const Bitmap &rRiderBitmap, 175cdf0e10cSrcweir sal_Bool bItemsOnDemand = sal_False, 176cdf0e10cSrcweir sal_uInt16 nPos = TAB_APPEND); 177cdf0e10cSrcweir 178cdf0e10cSrcweir void RemoveTabPage( sal_uInt16 nId ); 179cdf0e10cSrcweir SetCurPageId(sal_uInt16 nId)180cdf0e10cSrcweir void SetCurPageId( sal_uInt16 nId ) { nAppPageId = nId; } GetCurPageId() const181cdf0e10cSrcweir sal_uInt16 GetCurPageId() const 182cdf0e10cSrcweir { return aTabCtrl.GetCurPageId(); } 183cdf0e10cSrcweir void ShowPage( sal_uInt16 nId ); 184cdf0e10cSrcweir 185cdf0e10cSrcweir // liefert ggf. per Map konvertierte lokale Slots 186cdf0e10cSrcweir const sal_uInt16* GetInputRanges( const SfxItemPool& ); 187cdf0e10cSrcweir void SetInputSet( const SfxItemSet* pInSet ); GetOutputItemSet() const188cdf0e10cSrcweir const SfxItemSet* GetOutputItemSet() const { return pOutSet; } 189cdf0e10cSrcweir const SfxItemSet* GetOutputItemSet( sal_uInt16 nId ) const; 190cdf0e10cSrcweir int FillOutputItemSet(); IsFormat() const191cdf0e10cSrcweir sal_Bool IsFormat() const { return bFmt; } 192cdf0e10cSrcweir GetOKButton() const193cdf0e10cSrcweir const OKButton& GetOKButton() const { return aOKBtn; } GetOKButton()194cdf0e10cSrcweir OKButton& GetOKButton() { return aOKBtn; } GetCancelButton() const195cdf0e10cSrcweir const CancelButton& GetCancelButton() const { return aCancelBtn; } GetCancelButton()196cdf0e10cSrcweir CancelButton& GetCancelButton() { return aCancelBtn; } GetHelpButton() const197cdf0e10cSrcweir const HelpButton& GetHelpButton() const { return aHelpBtn; } GetHelpButton()198cdf0e10cSrcweir HelpButton& GetHelpButton() { return aHelpBtn; } GetResetButton() const199cdf0e10cSrcweir const PushButton& GetResetButton() const { return aResetBtn; } GetResetButton()200cdf0e10cSrcweir PushButton& GetResetButton() { return aResetBtn; } 201cdf0e10cSrcweir 202cdf0e10cSrcweir const PushButton* GetApplyButton() const; 203cdf0e10cSrcweir PushButton* GetApplyButton(); 204cdf0e10cSrcweir GetUserButton() const205cdf0e10cSrcweir const PushButton* GetUserButton() const { return pUserBtn; } GetUserButton()206cdf0e10cSrcweir PushButton* GetUserButton() { return pUserBtn; } 207cdf0e10cSrcweir void RemoveResetButton(); 208cdf0e10cSrcweir 209cdf0e10cSrcweir short Execute(); 210cdf0e10cSrcweir void StartExecuteModal( const Link& rEndDialogHdl ); 211cdf0e10cSrcweir void Start( sal_Bool bShow = sal_True ); 212cdf0e10cSrcweir 213cdf0e10cSrcweir #if !ENABLE_LAYOUT_SFX_TABDIALOG GetExampleSet() const214cdf0e10cSrcweir const SfxItemSet* GetExampleSet() const { return pExampleSet; } 215cdf0e10cSrcweir #else /* ENABLE_LAYOUT_SFX_TABDIALOG */ GetExampleSet() const216cdf0e10cSrcweir SfxItemSet* GetExampleSet() const { return 0; } 217cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ GetViewFrame() const218cdf0e10cSrcweir SfxViewFrame* GetViewFrame() const { return pFrame; } 219cdf0e10cSrcweir 220cdf0e10cSrcweir void EnableApplyButton(sal_Bool bEnable = sal_True); 221cdf0e10cSrcweir sal_Bool IsApplyButtonEnabled() const; 222cdf0e10cSrcweir void SetApplyHandler(const Link& _rHdl); 223cdf0e10cSrcweir Link GetApplyHandler() const; 224cdf0e10cSrcweir 225cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE 226cdf0e10cSrcweir SAL_DLLPRIVATE void Start_Impl(); OK_Impl()227cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool OK_Impl() { return PrepareLeaveCurrentPage(); } 228cdf0e10cSrcweir //#endif 229cdf0e10cSrcweir }; 230cdf0e10cSrcweir 231cdf0e10cSrcweir END_NAMESPACE_LAYOUT_SFX_TABDIALOG 232cdf0e10cSrcweir 233cdf0e10cSrcweir #if ENABLE_LAYOUT_SFX_TABDIALOG 234cdf0e10cSrcweir #include <layout/layout-post.hxx> 235cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ 236cdf0e10cSrcweir 237cdf0e10cSrcweir #if !ENABLE_LAYOUT_SFX_TABDIALOG 238cdf0e10cSrcweir 239cdf0e10cSrcweir namespace sfx { class ItemConnectionBase; } 240cdf0e10cSrcweir 241cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxTabPage: public TabPage 242cdf0e10cSrcweir { 243cdf0e10cSrcweir friend class SfxTabDialog; 244cdf0e10cSrcweir #if ENABLE_LAYOUT 245cdf0e10cSrcweir friend class layout::SfxTabDialog; 246cdf0e10cSrcweir #endif 247cdf0e10cSrcweir 248cdf0e10cSrcweir private: 249cdf0e10cSrcweir const SfxItemSet* pSet; 250cdf0e10cSrcweir String aUserString; 251cdf0e10cSrcweir sal_Bool bHasExchangeSupport; 252cdf0e10cSrcweir SfxTabDialog* pTabDlg; 253cdf0e10cSrcweir TabPageImpl* pImpl; 254cdf0e10cSrcweir SetTabDialog(SfxTabDialog * pNew)255cdf0e10cSrcweir SAL_DLLPRIVATE void SetTabDialog( SfxTabDialog* pNew ) { pTabDlg = pNew; } SetInputSet(const SfxItemSet * pNew)256cdf0e10cSrcweir SAL_DLLPRIVATE void SetInputSet( const SfxItemSet* pNew ) { pSet = pNew; } 257cdf0e10cSrcweir 258cdf0e10cSrcweir protected: 259cdf0e10cSrcweir SfxTabPage( Window *pParent, const ResId &, const SfxItemSet &rAttrSet ); 260cdf0e10cSrcweir SfxTabPage( Window *pParent, WinBits nStyle, const SfxItemSet &rAttrSet ); 261cdf0e10cSrcweir GetSlot(sal_uInt16 nWhich) const262cdf0e10cSrcweir sal_uInt16 GetSlot( sal_uInt16 nWhich ) const 263cdf0e10cSrcweir { return pSet->GetPool()->GetSlotId( nWhich ); } GetWhich(sal_uInt16 nSlot,sal_Bool bDeep=sal_True) const264cdf0e10cSrcweir sal_uInt16 GetWhich( sal_uInt16 nSlot, sal_Bool bDeep = sal_True ) const 265cdf0e10cSrcweir { return pSet->GetPool()->GetWhich( nSlot, bDeep ); } 266cdf0e10cSrcweir const SfxPoolItem* GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, sal_Bool bDeep = sal_True ); 267cdf0e10cSrcweir const SfxPoolItem* GetExchangeItem( const SfxItemSet& rSet, sal_uInt16 nSlot ); GetTabDialog() const268cdf0e10cSrcweir SfxTabDialog* GetTabDialog() const { return pTabDlg; } 269cdf0e10cSrcweir 270cdf0e10cSrcweir void AddItemConnection( sfx::ItemConnectionBase* pConnection ); 271cdf0e10cSrcweir 272cdf0e10cSrcweir public: 273cdf0e10cSrcweir virtual ~SfxTabPage(); 274cdf0e10cSrcweir GetItemSet() const275cdf0e10cSrcweir const SfxItemSet& GetItemSet() const { return *pSet; } 276cdf0e10cSrcweir 277cdf0e10cSrcweir virtual sal_Bool FillItemSet( SfxItemSet& ); 278cdf0e10cSrcweir virtual void Reset( const SfxItemSet& ); 279cdf0e10cSrcweir HasExchangeSupport() const280cdf0e10cSrcweir sal_Bool HasExchangeSupport() const 281cdf0e10cSrcweir { return bHasExchangeSupport; } SetExchangeSupport(sal_Bool bNew=sal_True)282cdf0e10cSrcweir void SetExchangeSupport( sal_Bool bNew = sal_True ) 283cdf0e10cSrcweir { bHasExchangeSupport = bNew; } 284cdf0e10cSrcweir 285cdf0e10cSrcweir enum sfxpg { 286cdf0e10cSrcweir KEEP_PAGE = 0x0000, // Fehlerbehandlung; Seite nicht wechseln 287cdf0e10cSrcweir // 2. F"ullen eines ItemSets f"ur die Aktualilsierung 288cdf0e10cSrcweir // "ubergeordneter Beispiele; dieser Pointer kann immer 289cdf0e10cSrcweir // NULL sein!! 290cdf0e10cSrcweir LEAVE_PAGE = 0x0001, 291cdf0e10cSrcweir // Set aktualisieren und andere Page aktualisieren 292cdf0e10cSrcweir REFRESH_SET = 0x0002 293cdf0e10cSrcweir }; 294cdf0e10cSrcweir 295cdf0e10cSrcweir using TabPage::ActivatePage; 296cdf0e10cSrcweir using TabPage::DeactivatePage; 297cdf0e10cSrcweir virtual void ActivatePage( const SfxItemSet& ); 298cdf0e10cSrcweir virtual int DeactivatePage( SfxItemSet* pSet = 0 ); SetUserData(const String & rString)299cdf0e10cSrcweir void SetUserData(const String& rString) 300cdf0e10cSrcweir { aUserString = rString; } GetUserData()301cdf0e10cSrcweir String GetUserData() { return aUserString; } 302cdf0e10cSrcweir virtual void FillUserData(); 303cdf0e10cSrcweir virtual sal_Bool IsReadOnly() const; 304cdf0e10cSrcweir virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001 305cdf0e10cSrcweir static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, sal_Bool bDeep = sal_True ); 306cdf0e10cSrcweir 307cdf0e10cSrcweir void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); 308cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame(); 309cdf0e10cSrcweir }; 310cdf0e10cSrcweir 311cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */ 312cdf0e10cSrcweir 313cdf0e10cSrcweir #endif 314cdf0e10cSrcweir 315