1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sfx2.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <limits.h> 32*cdf0e10cSrcweir #include <stdlib.h> 33*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 34*cdf0e10cSrcweir #include <unotools/viewoptions.hxx> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #define _SVSTDARR_USHORTS 37*cdf0e10cSrcweir #include <svl/svstdarr.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include "appdata.hxx" 40*cdf0e10cSrcweir #include "sfxtypes.hxx" 41*cdf0e10cSrcweir #include <sfx2/minarray.hxx> 42*cdf0e10cSrcweir #include <sfx2/tabdlg.hxx> 43*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 44*cdf0e10cSrcweir #include <sfx2/app.hxx> 45*cdf0e10cSrcweir #include "sfx2/sfxresid.hxx" 46*cdf0e10cSrcweir #include "sfx2/sfxhelp.hxx" 47*cdf0e10cSrcweir #include <sfx2/ctrlitem.hxx> 48*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 49*cdf0e10cSrcweir #include <sfx2/sfxdlg.hxx> 50*cdf0e10cSrcweir #include <sfx2/itemconnect.hxx> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir #include "dialog.hrc" 53*cdf0e10cSrcweir #include "helpid.hrc" 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir #if ENABLE_LAYOUT_SFX_TABDIALOG 56*cdf0e10cSrcweir #undef TabPage 57*cdf0e10cSrcweir #undef SfxTabPage 58*cdf0e10cSrcweir #define SfxTabPage ::SfxTabPage 59*cdf0e10cSrcweir #undef SfxTabDialog 60*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 63*cdf0e10cSrcweir using namespace ::rtl; 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir #define USERITEM_NAME OUString::createFromAscii( "UserItem" ) 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir TYPEINIT1(LAYOUT_NS_SFX_TABDIALOG SfxTabDialogItem,SfxSetItem); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir struct TabPageImpl 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir sal_Bool mbStandard; 72*cdf0e10cSrcweir sfx::ItemConnectionArray maItemConn; 73*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir TabPageImpl() : mbStandard( sal_False ) {} 76*cdf0e10cSrcweir }; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir NAMESPACE_LAYOUT_SFX_TABDIALOG 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir struct Data_Impl 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir sal_uInt16 nId; // Die ID 83*cdf0e10cSrcweir CreateTabPage fnCreatePage; // Pointer auf die Factory 84*cdf0e10cSrcweir GetTabPageRanges fnGetRanges;// Pointer auf die Ranges-Funktion 85*cdf0e10cSrcweir SfxTabPage* pTabPage; // die TabPage selber 86*cdf0e10cSrcweir sal_Bool bOnDemand; // Flag: ItemSet onDemand 87*cdf0e10cSrcweir sal_Bool bRefresh; // Flag: Seite mu\s neu initialisiert werden 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir // Konstruktor 90*cdf0e10cSrcweir Data_Impl( sal_uInt16 Id, CreateTabPage fnPage, 91*cdf0e10cSrcweir GetTabPageRanges fnRanges, sal_Bool bDemand ) : 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir nId ( Id ), 94*cdf0e10cSrcweir fnCreatePage( fnPage ), 95*cdf0e10cSrcweir fnGetRanges ( fnRanges ), 96*cdf0e10cSrcweir pTabPage ( 0 ), 97*cdf0e10cSrcweir bOnDemand ( bDemand ), 98*cdf0e10cSrcweir bRefresh ( sal_False ) 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir if ( !fnCreatePage ) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 103*cdf0e10cSrcweir if ( pFact ) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir fnCreatePage = pFact->GetTabPageCreatorFunc( nId ); 106*cdf0e10cSrcweir fnGetRanges = pFact->GetTabPageRangesFunc( nId ); 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir }; 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir SfxTabDialogItem::SfxTabDialogItem( const SfxTabDialogItem& rAttr, SfxItemPool* pItemPool ) 113*cdf0e10cSrcweir : SfxSetItem( rAttr, pItemPool ) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir SfxTabDialogItem::SfxTabDialogItem( sal_uInt16 nId, const SfxItemSet& rItemSet ) 118*cdf0e10cSrcweir : SfxSetItem( nId, rItemSet ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir SfxPoolItem* __EXPORT SfxTabDialogItem::Clone(SfxItemPool* pToPool) const 123*cdf0e10cSrcweir { 124*cdf0e10cSrcweir return new SfxTabDialogItem( *this, pToPool ); 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir SfxPoolItem* __EXPORT SfxTabDialogItem::Create(SvStream& /*rStream*/, sal_uInt16 /*nVersion*/) const 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir DBG_ERROR( "Use it only in UI!" ); 130*cdf0e10cSrcweir return NULL; 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir class SfxTabDialogController : public SfxControllerItem 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir SfxTabDialog* pDialog; 136*cdf0e10cSrcweir const SfxItemSet* pSet; 137*cdf0e10cSrcweir public: 138*cdf0e10cSrcweir SfxTabDialogController( sal_uInt16 nSlotId, SfxBindings& rBindings, SfxTabDialog* pDlg ) 139*cdf0e10cSrcweir : SfxControllerItem( nSlotId, rBindings ) 140*cdf0e10cSrcweir , pDialog( pDlg ) 141*cdf0e10cSrcweir , pSet( NULL ) 142*cdf0e10cSrcweir {} 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir ~SfxTabDialogController(); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir DECL_LINK( Execute_Impl, void* ); 147*cdf0e10cSrcweir virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 148*cdf0e10cSrcweir }; 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir SfxTabDialogController::~SfxTabDialogController() 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir delete pSet; 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir IMPL_LINK( SfxTabDialogController, Execute_Impl, void*, pVoid ) 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir (void)pVoid; //unused 158*cdf0e10cSrcweir if ( pDialog->OK_Impl() && pDialog->Ok() ) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir const SfxPoolItem* aItems[2]; 161*cdf0e10cSrcweir SfxTabDialogItem aItem( GetId(), *pDialog->GetOutputItemSet() ); 162*cdf0e10cSrcweir aItems[0] = &aItem; 163*cdf0e10cSrcweir aItems[1] = NULL; 164*cdf0e10cSrcweir GetBindings().Execute( GetId(), aItems ); 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir return 0; 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir void SfxTabDialogController::StateChanged( sal_uInt16 /*nSID*/, SfxItemState /*eState*/, const SfxPoolItem* pState ) 171*cdf0e10cSrcweir { 172*cdf0e10cSrcweir const SfxSetItem* pSetItem = PTR_CAST( SfxSetItem, pState ); 173*cdf0e10cSrcweir if ( pSetItem ) 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir pSet = pDialog->pSet = pSetItem->GetItemSet().Clone(); 176*cdf0e10cSrcweir sal_Bool bDialogStarted = sal_False; 177*cdf0e10cSrcweir for ( sal_uInt16 n=0; n<pDialog->aTabCtrl.GetPageCount(); n++ ) 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir sal_uInt16 nPageId = pDialog->aTabCtrl.GetPageId( n ); 180*cdf0e10cSrcweir SfxTabPage* pTabPage = dynamic_cast<SfxTabPage*> (pDialog->aTabCtrl.GetTabPage( nPageId )); 181*cdf0e10cSrcweir if ( pTabPage ) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir pTabPage->Reset( pSetItem->GetItemSet() ); 184*cdf0e10cSrcweir bDialogStarted = sal_True; 185*cdf0e10cSrcweir } 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir if ( bDialogStarted ) 189*cdf0e10cSrcweir pDialog->Show(); 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir else 192*cdf0e10cSrcweir pDialog->Hide(); 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir DECL_PTRARRAY(SfxTabDlgData_Impl, Data_Impl *, 4,4) 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir struct TabDlg_Impl 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir sal_Bool bModified : 1, 200*cdf0e10cSrcweir bModal : 1, 201*cdf0e10cSrcweir bInOK : 1, 202*cdf0e10cSrcweir bHideResetBtn : 1; 203*cdf0e10cSrcweir SfxTabDlgData_Impl* pData; 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir PushButton* pApplyButton; 206*cdf0e10cSrcweir SfxTabDialogController* pController; 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir TabDlg_Impl( sal_uInt8 nCnt ) : 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir bModified ( sal_False ), 211*cdf0e10cSrcweir bModal ( sal_True ), 212*cdf0e10cSrcweir bInOK ( sal_False ), 213*cdf0e10cSrcweir bHideResetBtn ( sal_False ), 214*cdf0e10cSrcweir pData ( new SfxTabDlgData_Impl( nCnt ) ), 215*cdf0e10cSrcweir pApplyButton ( NULL ), 216*cdf0e10cSrcweir pController ( NULL ) 217*cdf0e10cSrcweir {} 218*cdf0e10cSrcweir }; 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir Data_Impl* Find( SfxTabDlgData_Impl& rArr, sal_uInt16 nId, sal_uInt16* pPos = 0 ); 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir Data_Impl* Find( SfxTabDlgData_Impl& rArr, sal_uInt16 nId, sal_uInt16* pPos ) 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir const sal_uInt16 nCount = rArr.Count(); 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; ++i ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir Data_Impl* pObj = rArr[i]; 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir if ( pObj->nId == nId ) 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir if ( pPos ) 233*cdf0e10cSrcweir *pPos = i; 234*cdf0e10cSrcweir return pObj; 235*cdf0e10cSrcweir } 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir return 0; 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir #if !ENABLE_LAYOUT_SFX_TABDIALOG 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir void SfxTabPage::SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir if (pImpl) 245*cdf0e10cSrcweir pImpl->mxFrame = xFrame; 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxTabPage::GetFrame() 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir if (pImpl) 251*cdf0e10cSrcweir return pImpl->mxFrame; 252*cdf0e10cSrcweir return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >(); 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir SfxTabPage::SfxTabPage( Window *pParent, 256*cdf0e10cSrcweir const ResId &rResId, const SfxItemSet &rAttrSet ) : 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir /* [Beschreibung] 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir Konstruktor 261*cdf0e10cSrcweir */ 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir TabPage( pParent, rResId ), 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir pSet ( &rAttrSet ), 266*cdf0e10cSrcweir bHasExchangeSupport ( sal_False ), 267*cdf0e10cSrcweir pTabDlg ( NULL ), 268*cdf0e10cSrcweir pImpl ( new TabPageImpl ) 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir // ----------------------------------------------------------------------- 273*cdf0e10cSrcweir SfxTabPage:: SfxTabPage( Window *pParent, WinBits nStyle, const SfxItemSet &rAttrSet ) : 274*cdf0e10cSrcweir TabPage(pParent, nStyle), 275*cdf0e10cSrcweir pSet ( &rAttrSet ), 276*cdf0e10cSrcweir bHasExchangeSupport ( sal_False ), 277*cdf0e10cSrcweir pTabDlg ( NULL ), 278*cdf0e10cSrcweir pImpl ( new TabPageImpl ) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir // ----------------------------------------------------------------------- 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir SfxTabPage::~SfxTabPage() 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir /* [Beschreibung] 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir Destruktor 288*cdf0e10cSrcweir */ 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir #if !ENABLE_LAYOUT 292*cdf0e10cSrcweir delete pImpl; 293*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT */ 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir // ----------------------------------------------------------------------- 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir sal_Bool SfxTabPage::FillItemSet( SfxItemSet& rSet ) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir return pImpl->maItemConn.DoFillItemSet( rSet, GetItemSet() ); 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir // ----------------------------------------------------------------------- 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir void SfxTabPage::Reset( const SfxItemSet& rSet ) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir pImpl->maItemConn.DoApplyFlags( rSet ); 308*cdf0e10cSrcweir pImpl->maItemConn.DoReset( rSet ); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir // ----------------------------------------------------------------------- 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir void SfxTabPage::ActivatePage( const SfxItemSet& ) 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir /* [Beschreibung] 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir Defaultimplementierung der virtuellen ActivatePage-Methode 318*cdf0e10cSrcweir Diese wird gerufen, wenn eine Seite des Dialogs den Datenaustausch 319*cdf0e10cSrcweir zwischen Pages unterst"utzt. 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir <SfxTabPage::DeactivatePage(SfxItemSet *)> 322*cdf0e10cSrcweir */ 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir } 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir // ----------------------------------------------------------------------- 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir int SfxTabPage::DeactivatePage( SfxItemSet* ) 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir /* [Beschreibung] 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir Defaultimplementierung der virtuellen DeactivatePage-Methode 334*cdf0e10cSrcweir Diese wird vor dem Verlassen einer Seite durch den Sfx gerufen; 335*cdf0e10cSrcweir die Anwendung kann "uber den Returnwert steuern, 336*cdf0e10cSrcweir ob die Seite verlassen werden soll. 337*cdf0e10cSrcweir Falls die Seite "uber bHasExchangeSupport 338*cdf0e10cSrcweir anzeigt, da\s sie einen Datenaustausch zwischen Seiten 339*cdf0e10cSrcweir unterst"utzt, wird ein Pointer auf das Austausch-Set als 340*cdf0e10cSrcweir Parameter "ubergeben. Dieser nimmt die Daten f"ur den Austausch 341*cdf0e10cSrcweir entgegen; das Set steht anschlie\send als Parameter in 342*cdf0e10cSrcweir <SfxTabPage::ActivatePage(const SfxItemSet &)> zur Verf"ugung. 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir [R"uckgabewert] 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir LEAVE_PAGE; Verlassen der Seite erlauben 347*cdf0e10cSrcweir */ 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir return LEAVE_PAGE; 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir // ----------------------------------------------------------------------- 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir void SfxTabPage::FillUserData() 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir /* [Beschreibung] 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir virtuelle Methode, wird von der Basisklasse im Destruktor gerufen 360*cdf0e10cSrcweir um spezielle Informationen der TabPage in der Ini-Datei zu speichern. 361*cdf0e10cSrcweir Beim "Uberladen muss ein String zusammengestellt werden, der mit 362*cdf0e10cSrcweir <SetUserData()> dann weggeschrieben wird. 363*cdf0e10cSrcweir */ 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir // ----------------------------------------------------------------------- 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir sal_Bool SfxTabPage::IsReadOnly() const 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir /* [Description] 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir */ 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir return sal_False; 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir // ----------------------------------------------------------------------- 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir const SfxPoolItem* SfxTabPage::GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, sal_Bool bDeep ) 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir /* [Beschreibung] 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir static Methode: hiermit wird der Code der TabPage-Implementierungen 387*cdf0e10cSrcweir vereinfacht. 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir */ 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir const SfxItemPool* pPool = rSet.GetPool(); 393*cdf0e10cSrcweir sal_uInt16 nWh = pPool->GetWhich( nSlot, bDeep ); 394*cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 395*cdf0e10cSrcweir #ifdef DEBUG 396*cdf0e10cSrcweir SfxItemState eState; 397*cdf0e10cSrcweir eState = 398*cdf0e10cSrcweir #endif 399*cdf0e10cSrcweir rSet.GetItemState( nWh, sal_True, &pItem ); // -Wall required?? 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir if ( !pItem && nWh != nSlot ) 402*cdf0e10cSrcweir pItem = &pPool->GetDefaultItem( nWh ); 403*cdf0e10cSrcweir return pItem; 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir // ----------------------------------------------------------------------- 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir const SfxPoolItem* SfxTabPage::GetOldItem( const SfxItemSet& rSet, 409*cdf0e10cSrcweir sal_uInt16 nSlot, sal_Bool bDeep ) 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir /* [Beschreibung] 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir Diese Methode gibt f"ur Vergleiche den alten Wert eines 414*cdf0e10cSrcweir Attributs zur"uck. 415*cdf0e10cSrcweir */ 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 419*cdf0e10cSrcweir sal_uInt16 nWh = GetWhich( nSlot, bDeep ); 420*cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir if ( pImpl->mbStandard && rOldSet.GetParent() ) 423*cdf0e10cSrcweir pItem = GetItem( *rOldSet.GetParent(), nSlot ); 424*cdf0e10cSrcweir else if ( rSet.GetParent() && 425*cdf0e10cSrcweir SFX_ITEM_DONTCARE == rSet.GetItemState( nWh ) ) 426*cdf0e10cSrcweir pItem = GetItem( *rSet.GetParent(), nSlot ); 427*cdf0e10cSrcweir else 428*cdf0e10cSrcweir pItem = GetItem( rOldSet, nSlot ); 429*cdf0e10cSrcweir return pItem; 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir // ----------------------------------------------------------------------- 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir const SfxPoolItem* SfxTabPage::GetExchangeItem( const SfxItemSet& rSet, 435*cdf0e10cSrcweir sal_uInt16 nSlot ) 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir /* [Beschreibung] 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir Diese Methode gibt f"ur Vergleiche den alten Wert eines 440*cdf0e10cSrcweir Attributs zur"uck. Dabei wird ber"ucksichtigt, ob der Dialog 441*cdf0e10cSrcweir gerade mit OK beendet wurde. 442*cdf0e10cSrcweir */ 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir { 445*cdf0e10cSrcweir if ( pTabDlg && !pTabDlg->IsInOK() && pTabDlg->GetExampleSet() ) 446*cdf0e10cSrcweir return GetItem( *pTabDlg->GetExampleSet(), nSlot ); 447*cdf0e10cSrcweir else 448*cdf0e10cSrcweir return GetOldItem( rSet, nSlot ); 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir // add CHINA001 begin 452*cdf0e10cSrcweir void SfxTabPage::PageCreated( SfxAllItemSet /*aSet*/ ) 453*cdf0e10cSrcweir { 454*cdf0e10cSrcweir DBG_ASSERT(0, "SfxTabPage::PageCreated should not be called"); 455*cdf0e10cSrcweir }//CHINA001 456*cdf0e10cSrcweir // add CHINA001 end 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir // ----------------------------------------------------------------------- 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir void SfxTabPage::AddItemConnection( sfx::ItemConnectionBase* pConnection ) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir pImpl->maItemConn.AddConnection( pConnection ); 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */ 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir #if ENABLE_LAYOUT_SFX_TABDIALOG 468*cdf0e10cSrcweir #undef ResId 469*cdf0e10cSrcweir #define ResId(id, foo) #id 470*cdf0e10cSrcweir #undef TabDialog 471*cdf0e10cSrcweir #define TabDialog(parent, res_id) Dialog (parent, "tab-dialog.xml", "tab-dialog") 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir #define aOKBtn(this) aOKBtn (this, "BTN_OK") 474*cdf0e10cSrcweir #undef PushButton 475*cdf0e10cSrcweir #define PushButton(this) layout::PushButton (this, "BTN_USER") 476*cdf0e10cSrcweir #define aCancelBtn(this) aCancelBtn (this, "BTN_CANCEL") 477*cdf0e10cSrcweir #define aHelpBtn(this) aHelpBtn (this, "BTN_HELP") 478*cdf0e10cSrcweir #define aResetBtn(this) aResetBtn (this, "BTN_RESET") 479*cdf0e10cSrcweir #define aBaseFmtBtn(this) aBaseFmtBtn (this, "BTN_BASEFMT") 480*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir #define INI_LIST(ItemSetPtr) \ 483*cdf0e10cSrcweir aTabCtrl ( this, ResId(ID_TABCONTROL,*rResId.GetResMgr() ) ),\ 484*cdf0e10cSrcweir aOKBtn ( this ),\ 485*cdf0e10cSrcweir pUserBtn ( pUserButtonText? new PushButton(this): 0 ),\ 486*cdf0e10cSrcweir aCancelBtn ( this ),\ 487*cdf0e10cSrcweir aHelpBtn ( this ),\ 488*cdf0e10cSrcweir aResetBtn ( this ),\ 489*cdf0e10cSrcweir aBaseFmtBtn ( this ),\ 490*cdf0e10cSrcweir pSet ( ItemSetPtr ),\ 491*cdf0e10cSrcweir pOutSet ( 0 ),\ 492*cdf0e10cSrcweir pImpl ( new TabDlg_Impl( (sal_uInt8)aTabCtrl.GetPageCount() ) ), \ 493*cdf0e10cSrcweir pRanges ( 0 ), \ 494*cdf0e10cSrcweir nResId ( rResId.GetId() ), \ 495*cdf0e10cSrcweir nAppPageId ( USHRT_MAX ), \ 496*cdf0e10cSrcweir bItemsReset ( sal_False ),\ 497*cdf0e10cSrcweir bFmt ( bEditFmt ),\ 498*cdf0e10cSrcweir pExampleSet ( 0 ) 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir // ----------------------------------------------------------------------- 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir SfxTabDialog::SfxTabDialog 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir /* [Beschreibung] 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir Konstruktor 507*cdf0e10cSrcweir */ 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir ( 510*cdf0e10cSrcweir SfxViewFrame* pViewFrame, // Frame, zu dem der Dialog geh"ort 511*cdf0e10cSrcweir Window* pParent, // Parent-Fenster 512*cdf0e10cSrcweir const ResId& rResId, // ResourceId 513*cdf0e10cSrcweir const SfxItemSet* pItemSet, // Itemset mit den Daten; 514*cdf0e10cSrcweir // kann NULL sein, wenn Pages onDemand 515*cdf0e10cSrcweir sal_Bool bEditFmt, // Flag: es werden Vorlagen bearbeitet 516*cdf0e10cSrcweir // wenn ja -> zus"atzlicher Button f"ur Standard 517*cdf0e10cSrcweir const String* pUserButtonText // Text fuer BenutzerButton; 518*cdf0e10cSrcweir // wenn != 0, wird der UserButton erzeugt 519*cdf0e10cSrcweir ) : 520*cdf0e10cSrcweir TabDialog( pParent, rResId ), 521*cdf0e10cSrcweir pFrame( pViewFrame ), 522*cdf0e10cSrcweir INI_LIST(pItemSet) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir Init_Impl( bFmt, pUserButtonText ); 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir // ----------------------------------------------------------------------- 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir SfxTabDialog::SfxTabDialog 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir /* [Beschreibung] 532*cdf0e10cSrcweir 533*cdf0e10cSrcweir Konstruktor, tempor"ar ohne Frame 534*cdf0e10cSrcweir */ 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir ( 537*cdf0e10cSrcweir Window* pParent, // Parent-Fenster 538*cdf0e10cSrcweir const ResId& rResId, // ResourceId 539*cdf0e10cSrcweir const SfxItemSet* pItemSet, // Itemset mit den Daten; kann NULL sein, 540*cdf0e10cSrcweir // wenn Pages onDemand 541*cdf0e10cSrcweir sal_Bool bEditFmt, // Flag: es werden Vorlagen bearbeitet 542*cdf0e10cSrcweir // wenn ja -> zus"atzlicher Button f"ur Standard 543*cdf0e10cSrcweir const String* pUserButtonText // Text f"ur BenutzerButton; 544*cdf0e10cSrcweir // wenn != 0, wird der UserButton erzeugt 545*cdf0e10cSrcweir ) : 546*cdf0e10cSrcweir TabDialog( pParent, rResId ), 547*cdf0e10cSrcweir pFrame( 0 ), 548*cdf0e10cSrcweir INI_LIST(pItemSet) 549*cdf0e10cSrcweir { 550*cdf0e10cSrcweir Init_Impl( bFmt, pUserButtonText ); 551*cdf0e10cSrcweir DBG_WARNING( "bitte den Ctor mit ViewFrame verwenden" ); 552*cdf0e10cSrcweir } 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir SfxTabDialog::SfxTabDialog 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir /* [Beschreibung] 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir Konstruktor, tempor"ar ohne Frame 559*cdf0e10cSrcweir */ 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir ( 562*cdf0e10cSrcweir Window* pParent, // Parent-Fenster 563*cdf0e10cSrcweir const ResId& rResId, // ResourceId 564*cdf0e10cSrcweir sal_uInt16 nSetId, 565*cdf0e10cSrcweir SfxBindings& rBindings, 566*cdf0e10cSrcweir sal_Bool bEditFmt, // Flag: es werden Vorlagen bearbeitet 567*cdf0e10cSrcweir // wenn ja -> zus"atzlicher Button f"ur Standard 568*cdf0e10cSrcweir const String* pUserButtonText // Text f"ur BenutzerButton; 569*cdf0e10cSrcweir // wenn != 0, wird der UserButton erzeugt 570*cdf0e10cSrcweir ) : 571*cdf0e10cSrcweir TabDialog( pParent, rResId ), 572*cdf0e10cSrcweir pFrame( 0 ), 573*cdf0e10cSrcweir INI_LIST(NULL) 574*cdf0e10cSrcweir { 575*cdf0e10cSrcweir rBindings.ENTERREGISTRATIONS(); 576*cdf0e10cSrcweir pImpl->pController = new SfxTabDialogController( nSetId, rBindings, this ); 577*cdf0e10cSrcweir rBindings.LEAVEREGISTRATIONS(); 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir EnableApplyButton( sal_True ); 580*cdf0e10cSrcweir SetApplyHandler( LINK( pImpl->pController, SfxTabDialogController, Execute_Impl ) ); 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir rBindings.Invalidate( nSetId ); 583*cdf0e10cSrcweir rBindings.Update( nSetId ); 584*cdf0e10cSrcweir DBG_ASSERT( pSet, "No ItemSet!" ); 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir Init_Impl( bFmt, pUserButtonText ); 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir // ----------------------------------------------------------------------- 590*cdf0e10cSrcweir 591*cdf0e10cSrcweir #if ENABLE_LAYOUT_SFX_TABDIALOG 592*cdf0e10cSrcweir #undef ResId 593*cdf0e10cSrcweir #undef TabDialog 594*cdf0e10cSrcweir #undef aOKBtn 595*cdf0e10cSrcweir #undef PushButton 596*cdf0e10cSrcweir #undef aCancelBtn 597*cdf0e10cSrcweir #undef aHelpBtn 598*cdf0e10cSrcweir #undef aResetBtn 599*cdf0e10cSrcweir #undef aBaseFmtBtn 600*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir SfxTabDialog::~SfxTabDialog() 603*cdf0e10cSrcweir { 604*cdf0e10cSrcweir // save settings (screen position and current page) 605*cdf0e10cSrcweir SvtViewOptions aDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) ); 606*cdf0e10cSrcweir #if !ENABLE_LAYOUT_SFX_TABDIALOG 607*cdf0e10cSrcweir aDlgOpt.SetWindowState( OUString::createFromAscii( GetWindowState( WINDOWSTATE_MASK_POS ).GetBuffer() ) ); 608*cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */ 609*cdf0e10cSrcweir aDlgOpt.SetPageID( aTabCtrl.GetCurPageId() ); 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir const sal_uInt16 nCount = pImpl->pData->Count(); 612*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; ++i ) 613*cdf0e10cSrcweir { 614*cdf0e10cSrcweir Data_Impl* pDataObject = pImpl->pData->GetObject(i); 615*cdf0e10cSrcweir 616*cdf0e10cSrcweir if ( pDataObject->pTabPage ) 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir // save settings of all pages (user data) 619*cdf0e10cSrcweir pDataObject->pTabPage->FillUserData(); 620*cdf0e10cSrcweir String aPageData( pDataObject->pTabPage->GetUserData() ); 621*cdf0e10cSrcweir if ( aPageData.Len() ) 622*cdf0e10cSrcweir { 623*cdf0e10cSrcweir // save settings of all pages (user data) 624*cdf0e10cSrcweir SvtViewOptions aPageOpt( E_TABPAGE, String::CreateFromInt32( pDataObject->nId ) ); 625*cdf0e10cSrcweir aPageOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aPageData ) ) ); 626*cdf0e10cSrcweir } 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir if ( pDataObject->bOnDemand ) 629*cdf0e10cSrcweir delete (SfxItemSet*)&pDataObject->pTabPage->GetItemSet(); 630*cdf0e10cSrcweir delete pDataObject->pTabPage; 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir delete pDataObject; 633*cdf0e10cSrcweir } 634*cdf0e10cSrcweir 635*cdf0e10cSrcweir delete pImpl->pController; 636*cdf0e10cSrcweir delete pImpl->pApplyButton; 637*cdf0e10cSrcweir delete pImpl->pData; 638*cdf0e10cSrcweir delete pImpl; 639*cdf0e10cSrcweir delete pUserBtn; 640*cdf0e10cSrcweir delete pOutSet; 641*cdf0e10cSrcweir delete pExampleSet; 642*cdf0e10cSrcweir delete [] pRanges; 643*cdf0e10cSrcweir } 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir // ----------------------------------------------------------------------- 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText ) 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir /* [Beschreibung] 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir interne Initialisierung des Dialogs 652*cdf0e10cSrcweir */ 653*cdf0e10cSrcweir 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir aOKBtn.SetClickHdl( LINK( this, SfxTabDialog, OkHdl ) ); 656*cdf0e10cSrcweir aResetBtn.SetClickHdl( LINK( this, SfxTabDialog, ResetHdl ) ); 657*cdf0e10cSrcweir aResetBtn.SetText( String( SfxResId( STR_RESET ) ) ); 658*cdf0e10cSrcweir aTabCtrl.SetActivatePageHdl( 659*cdf0e10cSrcweir LINK( this, SfxTabDialog, ActivatePageHdl ) ); 660*cdf0e10cSrcweir aTabCtrl.SetDeactivatePageHdl( 661*cdf0e10cSrcweir LINK( this, SfxTabDialog, DeactivatePageHdl ) ); 662*cdf0e10cSrcweir aTabCtrl.Show(); 663*cdf0e10cSrcweir aOKBtn.Show(); 664*cdf0e10cSrcweir aCancelBtn.Show(); 665*cdf0e10cSrcweir aHelpBtn.Show(); 666*cdf0e10cSrcweir aResetBtn.Show(); 667*cdf0e10cSrcweir aResetBtn.SetHelpId( HID_TABDLG_RESET_BTN ); 668*cdf0e10cSrcweir 669*cdf0e10cSrcweir if ( pUserBtn ) 670*cdf0e10cSrcweir { 671*cdf0e10cSrcweir pUserBtn->SetText( *pUserButtonText ); 672*cdf0e10cSrcweir pUserBtn->SetClickHdl( LINK( this, SfxTabDialog, UserHdl ) ); 673*cdf0e10cSrcweir pUserBtn->Show(); 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir /* TODO: Check what is up with bFmt/bFmtFlag. Comment below suggests a 677*cdf0e10cSrcweir different behavior than implemented!! */ 678*cdf0e10cSrcweir if ( bFmtFlag ) 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir String aStd( SfxResId( STR_STANDARD_SHORTCUT ) ); 681*cdf0e10cSrcweir aBaseFmtBtn.SetText( aStd ); 682*cdf0e10cSrcweir aBaseFmtBtn.SetClickHdl( LINK( this, SfxTabDialog, BaseFmtHdl ) ); 683*cdf0e10cSrcweir aBaseFmtBtn.SetHelpId( HID_TABDLG_STANDARD_BTN ); 684*cdf0e10cSrcweir 685*cdf0e10cSrcweir // bFmt = tempor"ares Flag im Ctor() "ubergeben, 686*cdf0e10cSrcweir // wenn bFmt == 2, dann auch sal_True, 687*cdf0e10cSrcweir // zus"atzlich Ausblendung vom StandardButton, 688*cdf0e10cSrcweir // nach der Initialisierung wieder auf sal_True setzen 689*cdf0e10cSrcweir if ( bFmtFlag != 2 ) 690*cdf0e10cSrcweir aBaseFmtBtn.Show(); 691*cdf0e10cSrcweir else 692*cdf0e10cSrcweir bFmtFlag = sal_True; 693*cdf0e10cSrcweir } 694*cdf0e10cSrcweir 695*cdf0e10cSrcweir if ( pSet ) 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir pExampleSet = new SfxItemSet( *pSet ); 698*cdf0e10cSrcweir pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ); 699*cdf0e10cSrcweir } 700*cdf0e10cSrcweir 701*cdf0e10cSrcweir aOKBtn.SetAccessibleRelationMemberOf( &aOKBtn ); 702*cdf0e10cSrcweir aCancelBtn.SetAccessibleRelationMemberOf( &aCancelBtn ); 703*cdf0e10cSrcweir aHelpBtn.SetAccessibleRelationMemberOf( &aHelpBtn ); 704*cdf0e10cSrcweir aResetBtn.SetAccessibleRelationMemberOf( &aResetBtn ); 705*cdf0e10cSrcweir } 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir // ----------------------------------------------------------------------- 708*cdf0e10cSrcweir 709*cdf0e10cSrcweir void SfxTabDialog::RemoveResetButton() 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir aResetBtn.Hide(); 712*cdf0e10cSrcweir pImpl->bHideResetBtn = sal_True; 713*cdf0e10cSrcweir } 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir // ----------------------------------------------------------------------- 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir #if ENABLE_LAYOUT_SFX_TABDIALOG 718*cdf0e10cSrcweir #undef TabDialog 719*cdf0e10cSrcweir #define TabDialog Dialog 720*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir short SfxTabDialog::Execute() 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir if ( !aTabCtrl.GetPageCount() ) 725*cdf0e10cSrcweir return RET_CANCEL; 726*cdf0e10cSrcweir Start_Impl(); 727*cdf0e10cSrcweir return TabDialog::Execute(); 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir 730*cdf0e10cSrcweir // ----------------------------------------------------------------------- 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir void SfxTabDialog::StartExecuteModal( const Link& rEndDialogHdl ) 733*cdf0e10cSrcweir { 734*cdf0e10cSrcweir #if !ENABLE_LAYOUT_SFX_TABDIALOG 735*cdf0e10cSrcweir if ( !aTabCtrl.GetPageCount() ) 736*cdf0e10cSrcweir return; 737*cdf0e10cSrcweir Start_Impl(); 738*cdf0e10cSrcweir TabDialog::StartExecuteModal( rEndDialogHdl ); 739*cdf0e10cSrcweir #else 740*cdf0e10cSrcweir rEndDialogHdl.IsSet(); 741*cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */ 742*cdf0e10cSrcweir } 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir // ----------------------------------------------------------------------- 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir void SfxTabDialog::Start( sal_Bool bShow ) 747*cdf0e10cSrcweir { 748*cdf0e10cSrcweir aCancelBtn.SetClickHdl( LINK( this, SfxTabDialog, CancelHdl ) ); 749*cdf0e10cSrcweir pImpl->bModal = sal_False; 750*cdf0e10cSrcweir Start_Impl(); 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir if ( bShow ) 753*cdf0e10cSrcweir Show(); 754*cdf0e10cSrcweir } 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir // ----------------------------------------------------------------------- 757*cdf0e10cSrcweir 758*cdf0e10cSrcweir void SfxTabDialog::SetApplyHandler(const Link& _rHdl) 759*cdf0e10cSrcweir { 760*cdf0e10cSrcweir DBG_ASSERT( pImpl->pApplyButton, "SfxTabDialog::GetApplyHandler: no apply button enabled!" ); 761*cdf0e10cSrcweir if ( pImpl->pApplyButton ) 762*cdf0e10cSrcweir pImpl->pApplyButton->SetClickHdl( _rHdl ); 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir // ----------------------------------------------------------------------- 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir Link SfxTabDialog::GetApplyHandler() const 768*cdf0e10cSrcweir { 769*cdf0e10cSrcweir DBG_ASSERT( pImpl->pApplyButton, "SfxTabDialog::GetApplyHandler: no button enabled!" ); 770*cdf0e10cSrcweir if ( !pImpl->pApplyButton ) 771*cdf0e10cSrcweir return Link(); 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir return pImpl->pApplyButton->GetClickHdl(); 774*cdf0e10cSrcweir } 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir // ----------------------------------------------------------------------- 777*cdf0e10cSrcweir 778*cdf0e10cSrcweir void SfxTabDialog::EnableApplyButton(sal_Bool bEnable) 779*cdf0e10cSrcweir { 780*cdf0e10cSrcweir if ( IsApplyButtonEnabled() == bEnable ) 781*cdf0e10cSrcweir // nothing to do 782*cdf0e10cSrcweir return; 783*cdf0e10cSrcweir 784*cdf0e10cSrcweir // create or remove the apply button 785*cdf0e10cSrcweir if ( bEnable ) 786*cdf0e10cSrcweir { 787*cdf0e10cSrcweir pImpl->pApplyButton = new PushButton( this ); 788*cdf0e10cSrcweir #if !ENABLE_LAYOUT_SFX_TABDIALOG 789*cdf0e10cSrcweir // in the z-order, the apply button should be behind the ok button, thus appearing at the right side of it 790*cdf0e10cSrcweir pImpl->pApplyButton->SetZOrder(&aOKBtn, WINDOW_ZORDER_BEHIND); 791*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ 792*cdf0e10cSrcweir pImpl->pApplyButton->SetText( String( SfxResId( STR_APPLY ) ) ); 793*cdf0e10cSrcweir pImpl->pApplyButton->Show(); 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir pImpl->pApplyButton->SetHelpId( HID_TABDLG_APPLY_BTN ); 796*cdf0e10cSrcweir } 797*cdf0e10cSrcweir else 798*cdf0e10cSrcweir { 799*cdf0e10cSrcweir delete pImpl->pApplyButton; 800*cdf0e10cSrcweir pImpl->pApplyButton = NULL; 801*cdf0e10cSrcweir } 802*cdf0e10cSrcweir 803*cdf0e10cSrcweir #if !ENABLE_LAYOUT_SFX_TABDIALOG 804*cdf0e10cSrcweir // adjust the layout 805*cdf0e10cSrcweir if (IsReallyShown()) 806*cdf0e10cSrcweir AdjustLayout(); 807*cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */ 808*cdf0e10cSrcweir } 809*cdf0e10cSrcweir 810*cdf0e10cSrcweir // ----------------------------------------------------------------------- 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir sal_Bool SfxTabDialog::IsApplyButtonEnabled() const 813*cdf0e10cSrcweir { 814*cdf0e10cSrcweir return ( NULL != pImpl->pApplyButton ); 815*cdf0e10cSrcweir } 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir // ----------------------------------------------------------------------- 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir const PushButton* SfxTabDialog::GetApplyButton() const 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir return pImpl->pApplyButton; 822*cdf0e10cSrcweir } 823*cdf0e10cSrcweir 824*cdf0e10cSrcweir // ----------------------------------------------------------------------- 825*cdf0e10cSrcweir 826*cdf0e10cSrcweir PushButton* SfxTabDialog::GetApplyButton() 827*cdf0e10cSrcweir { 828*cdf0e10cSrcweir return pImpl->pApplyButton; 829*cdf0e10cSrcweir } 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir // ----------------------------------------------------------------------- 832*cdf0e10cSrcweir 833*cdf0e10cSrcweir void SfxTabDialog::Start_Impl() 834*cdf0e10cSrcweir { 835*cdf0e10cSrcweir DBG_ASSERT( pImpl->pData->Count() == aTabCtrl.GetPageCount(), "not all pages registered" ); 836*cdf0e10cSrcweir sal_uInt16 nActPage = aTabCtrl.GetPageId( 0 ); 837*cdf0e10cSrcweir 838*cdf0e10cSrcweir // load old settings, when exists 839*cdf0e10cSrcweir SvtViewOptions aDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) ); 840*cdf0e10cSrcweir if ( aDlgOpt.Exists() ) 841*cdf0e10cSrcweir { 842*cdf0e10cSrcweir #if !ENABLE_LAYOUT_SFX_TABDIALOG 843*cdf0e10cSrcweir SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) ); 844*cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */ 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir // initiale TabPage aus Programm/Hilfe/Konfig 847*cdf0e10cSrcweir nActPage = (sal_uInt16)aDlgOpt.GetPageID(); 848*cdf0e10cSrcweir 849*cdf0e10cSrcweir if ( USHRT_MAX != nAppPageId ) 850*cdf0e10cSrcweir nActPage = nAppPageId; 851*cdf0e10cSrcweir else 852*cdf0e10cSrcweir { 853*cdf0e10cSrcweir sal_uInt16 nAutoTabPageId = SFX_APP()->Get_Impl()->nAutoTabPageId; 854*cdf0e10cSrcweir if ( nAutoTabPageId ) 855*cdf0e10cSrcweir nActPage = nAutoTabPageId; 856*cdf0e10cSrcweir } 857*cdf0e10cSrcweir 858*cdf0e10cSrcweir if ( TAB_PAGE_NOTFOUND == aTabCtrl.GetPagePos( nActPage ) ) 859*cdf0e10cSrcweir nActPage = aTabCtrl.GetPageId( 0 ); 860*cdf0e10cSrcweir } 861*cdf0e10cSrcweir else if ( USHRT_MAX != nAppPageId && TAB_PAGE_NOTFOUND != aTabCtrl.GetPagePos( nAppPageId ) ) 862*cdf0e10cSrcweir nActPage = nAppPageId; 863*cdf0e10cSrcweir 864*cdf0e10cSrcweir aTabCtrl.SetCurPageId( nActPage ); 865*cdf0e10cSrcweir ActivatePageHdl( &aTabCtrl ); 866*cdf0e10cSrcweir } 867*cdf0e10cSrcweir 868*cdf0e10cSrcweir void SfxTabDialog::AddTabPage( sal_uInt16 nId, sal_Bool bItemsOnDemand ) 869*cdf0e10cSrcweir { 870*cdf0e10cSrcweir AddTabPage( nId, 0, 0, bItemsOnDemand ); 871*cdf0e10cSrcweir } 872*cdf0e10cSrcweir 873*cdf0e10cSrcweir void SfxTabDialog::AddTabPage( sal_uInt16 nId, const String &rRiderText, sal_Bool bItemsOnDemand, sal_uInt16 nPos ) 874*cdf0e10cSrcweir { 875*cdf0e10cSrcweir AddTabPage( nId, rRiderText, 0, 0, bItemsOnDemand, nPos ); 876*cdf0e10cSrcweir } 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir #ifdef SV_HAS_RIDERBITMAPS 879*cdf0e10cSrcweir 880*cdf0e10cSrcweir void SfxTabDialog::AddTabPage( sal_uInt16 nId, const Bitmap &rRiderBitmap, sal_Bool bItemsOnDemand, sal_uInt16 nPos ) 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir AddTabPage( nId, rRiderBitmap, 0, 0, bItemsOnDemand, nPos ); 883*cdf0e10cSrcweir } 884*cdf0e10cSrcweir 885*cdf0e10cSrcweir #endif 886*cdf0e10cSrcweir 887*cdf0e10cSrcweir // ----------------------------------------------------------------------- 888*cdf0e10cSrcweir 889*cdf0e10cSrcweir void SfxTabDialog::AddTabPage 890*cdf0e10cSrcweir 891*cdf0e10cSrcweir /* [Beschreibung] 892*cdf0e10cSrcweir 893*cdf0e10cSrcweir Hinzuf"ugen einer Seite zu dem Dialog. 894*cdf0e10cSrcweir Mu\s korrespondieren zu einem entsprechende Eintrag im 895*cdf0e10cSrcweir TabControl in der Resource des Dialogs. 896*cdf0e10cSrcweir */ 897*cdf0e10cSrcweir 898*cdf0e10cSrcweir ( 899*cdf0e10cSrcweir sal_uInt16 nId, // ID der Seite 900*cdf0e10cSrcweir CreateTabPage pCreateFunc, // Pointer auf die Factory-Methode 901*cdf0e10cSrcweir GetTabPageRanges pRangesFunc, // Pointer auf die Methode f"ur das 902*cdf0e10cSrcweir // Erfragen der Ranges onDemand 903*cdf0e10cSrcweir sal_Bool bItemsOnDemand // gibt an, ob das Set dieser Seite beim 904*cdf0e10cSrcweir // Erzeugen der Seite erfragt wird 905*cdf0e10cSrcweir ) 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir pImpl->pData->Append( 908*cdf0e10cSrcweir new Data_Impl( nId, pCreateFunc, pRangesFunc, bItemsOnDemand ) ); 909*cdf0e10cSrcweir } 910*cdf0e10cSrcweir 911*cdf0e10cSrcweir // ----------------------------------------------------------------------- 912*cdf0e10cSrcweir 913*cdf0e10cSrcweir void SfxTabDialog::AddTabPage 914*cdf0e10cSrcweir 915*cdf0e10cSrcweir /* [Beschreibung] 916*cdf0e10cSrcweir 917*cdf0e10cSrcweir Hinzuf"ugen einer Seite zu dem Dialog. 918*cdf0e10cSrcweir Der Ridertext wird "ubergeben, die Seite hat keine Entsprechung im 919*cdf0e10cSrcweir TabControl in der Resource des Dialogs. 920*cdf0e10cSrcweir */ 921*cdf0e10cSrcweir 922*cdf0e10cSrcweir ( 923*cdf0e10cSrcweir sal_uInt16 nId, 924*cdf0e10cSrcweir const String& rRiderText, 925*cdf0e10cSrcweir CreateTabPage pCreateFunc, 926*cdf0e10cSrcweir GetTabPageRanges pRangesFunc, 927*cdf0e10cSrcweir sal_Bool bItemsOnDemand, 928*cdf0e10cSrcweir sal_uInt16 nPos 929*cdf0e10cSrcweir ) 930*cdf0e10cSrcweir { 931*cdf0e10cSrcweir DBG_ASSERT( TAB_PAGE_NOTFOUND == aTabCtrl.GetPagePos( nId ), 932*cdf0e10cSrcweir "Doppelte Page-Ids in der Tabpage" ); 933*cdf0e10cSrcweir aTabCtrl.InsertPage( nId, rRiderText, nPos ); 934*cdf0e10cSrcweir pImpl->pData->Append( 935*cdf0e10cSrcweir new Data_Impl( nId, pCreateFunc, pRangesFunc, bItemsOnDemand ) ); 936*cdf0e10cSrcweir } 937*cdf0e10cSrcweir 938*cdf0e10cSrcweir // ----------------------------------------------------------------------- 939*cdf0e10cSrcweir #ifdef SV_HAS_RIDERBITMAPS 940*cdf0e10cSrcweir 941*cdf0e10cSrcweir void SfxTabDialog::AddTabPage 942*cdf0e10cSrcweir 943*cdf0e10cSrcweir /* [Beschreibung] 944*cdf0e10cSrcweir 945*cdf0e10cSrcweir Hinzuf"ugen einer Seite zu dem Dialog. 946*cdf0e10cSrcweir Die Riderbitmap wird "ubergeben, die Seite hat keine Entsprechung im 947*cdf0e10cSrcweir TabControl in der Resource des Dialogs. 948*cdf0e10cSrcweir */ 949*cdf0e10cSrcweir 950*cdf0e10cSrcweir ( 951*cdf0e10cSrcweir sal_uInt16 nId, 952*cdf0e10cSrcweir const Bitmap &rRiderBitmap, 953*cdf0e10cSrcweir CreateTabPage pCreateFunc, 954*cdf0e10cSrcweir GetTabPageRanges pRangesFunc, 955*cdf0e10cSrcweir sal_Bool bItemsOnDemand, 956*cdf0e10cSrcweir sal_uInt16 nPos 957*cdf0e10cSrcweir ) 958*cdf0e10cSrcweir { 959*cdf0e10cSrcweir DBG_ASSERT( TAB_PAGE_NOTFOUND == aTabCtrl.GetPagePos( nId ), 960*cdf0e10cSrcweir "Doppelte Page-Ids in der Tabpage" ); 961*cdf0e10cSrcweir aTabCtrl.InsertPage( nId, rRiderBitmap, nPos ); 962*cdf0e10cSrcweir pImpl->pData->Append( 963*cdf0e10cSrcweir new Data_Impl( nId, pCreateFunc, pRangesFunc, bItemsOnDemand ) ); 964*cdf0e10cSrcweir } 965*cdf0e10cSrcweir #endif 966*cdf0e10cSrcweir 967*cdf0e10cSrcweir // ----------------------------------------------------------------------- 968*cdf0e10cSrcweir 969*cdf0e10cSrcweir void SfxTabDialog::RemoveTabPage( sal_uInt16 nId ) 970*cdf0e10cSrcweir 971*cdf0e10cSrcweir /* [Beschreibung] 972*cdf0e10cSrcweir 973*cdf0e10cSrcweir L"oschen der TabPage mit der ID nId 974*cdf0e10cSrcweir */ 975*cdf0e10cSrcweir 976*cdf0e10cSrcweir { 977*cdf0e10cSrcweir sal_uInt16 nPos = 0; 978*cdf0e10cSrcweir aTabCtrl.RemovePage( nId ); 979*cdf0e10cSrcweir Data_Impl* pDataObject = Find( *pImpl->pData, nId, &nPos ); 980*cdf0e10cSrcweir 981*cdf0e10cSrcweir if ( pDataObject ) 982*cdf0e10cSrcweir { 983*cdf0e10cSrcweir if ( pDataObject->pTabPage ) 984*cdf0e10cSrcweir { 985*cdf0e10cSrcweir pDataObject->pTabPage->FillUserData(); 986*cdf0e10cSrcweir String aPageData( pDataObject->pTabPage->GetUserData() ); 987*cdf0e10cSrcweir if ( aPageData.Len() ) 988*cdf0e10cSrcweir { 989*cdf0e10cSrcweir // save settings of this page (user data) 990*cdf0e10cSrcweir SvtViewOptions aPageOpt( E_TABPAGE, String::CreateFromInt32( pDataObject->nId ) ); 991*cdf0e10cSrcweir aPageOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aPageData ) ) ); 992*cdf0e10cSrcweir } 993*cdf0e10cSrcweir 994*cdf0e10cSrcweir if ( pDataObject->bOnDemand ) 995*cdf0e10cSrcweir delete (SfxItemSet*)&pDataObject->pTabPage->GetItemSet(); 996*cdf0e10cSrcweir delete pDataObject->pTabPage; 997*cdf0e10cSrcweir } 998*cdf0e10cSrcweir 999*cdf0e10cSrcweir delete pDataObject; 1000*cdf0e10cSrcweir pImpl->pData->Remove( nPos ); 1001*cdf0e10cSrcweir } 1002*cdf0e10cSrcweir else 1003*cdf0e10cSrcweir { 1004*cdf0e10cSrcweir DBG_WARNINGFILE( "TabPage-Id nicht bekannt" ); 1005*cdf0e10cSrcweir } 1006*cdf0e10cSrcweir } 1007*cdf0e10cSrcweir 1008*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1009*cdf0e10cSrcweir 1010*cdf0e10cSrcweir void SfxTabDialog::PageCreated 1011*cdf0e10cSrcweir 1012*cdf0e10cSrcweir /* [Beschreibung] 1013*cdf0e10cSrcweir 1014*cdf0e10cSrcweir Defaultimplemetierung der virtuellen Methode. 1015*cdf0e10cSrcweir Diese wird unmittelbar nach dem Erzeugen einer Seite gerufen. 1016*cdf0e10cSrcweir Hier kann der Dialog direkt an der TabPage Methoden rufen. 1017*cdf0e10cSrcweir */ 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir ( 1020*cdf0e10cSrcweir sal_uInt16, // Id der erzeugten Seite 1021*cdf0e10cSrcweir SfxTabPage& // Referenz auf die erzeugte Seite 1022*cdf0e10cSrcweir ) 1023*cdf0e10cSrcweir { 1024*cdf0e10cSrcweir } 1025*cdf0e10cSrcweir 1026*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1027*cdf0e10cSrcweir 1028*cdf0e10cSrcweir SfxItemSet* SfxTabDialog::GetInputSetImpl() 1029*cdf0e10cSrcweir 1030*cdf0e10cSrcweir /* [Beschreibung] 1031*cdf0e10cSrcweir 1032*cdf0e10cSrcweir Abgeleitete Klassen legen ggf. fuer den InputSet neuen Speicher an. 1033*cdf0e10cSrcweir Dieser mu\s im Destruktor auch wieder freigegeben werden. Dazu mu\s 1034*cdf0e10cSrcweir diese Methode gerufen werden. 1035*cdf0e10cSrcweir */ 1036*cdf0e10cSrcweir 1037*cdf0e10cSrcweir { 1038*cdf0e10cSrcweir return (SfxItemSet*)pSet; 1039*cdf0e10cSrcweir } 1040*cdf0e10cSrcweir 1041*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1042*cdf0e10cSrcweir 1043*cdf0e10cSrcweir SfxTabPage* SfxTabDialog::GetTabPage( sal_uInt16 nPageId ) const 1044*cdf0e10cSrcweir 1045*cdf0e10cSrcweir /* [Beschreibung] 1046*cdf0e10cSrcweir 1047*cdf0e10cSrcweir TabPage mit der "Ubergebenen Id zur"uckgeben. 1048*cdf0e10cSrcweir */ 1049*cdf0e10cSrcweir 1050*cdf0e10cSrcweir { 1051*cdf0e10cSrcweir sal_uInt16 nPos = 0; 1052*cdf0e10cSrcweir Data_Impl* pDataObject = Find( *pImpl->pData, nPageId, &nPos ); 1053*cdf0e10cSrcweir 1054*cdf0e10cSrcweir if ( pDataObject ) 1055*cdf0e10cSrcweir return pDataObject->pTabPage; 1056*cdf0e10cSrcweir return NULL; 1057*cdf0e10cSrcweir } 1058*cdf0e10cSrcweir 1059*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1060*cdf0e10cSrcweir 1061*cdf0e10cSrcweir sal_Bool SfxTabDialog::IsInOK() const 1062*cdf0e10cSrcweir 1063*cdf0e10cSrcweir /* [Beschreibung] 1064*cdf0e10cSrcweir 1065*cdf0e10cSrcweir */ 1066*cdf0e10cSrcweir 1067*cdf0e10cSrcweir { 1068*cdf0e10cSrcweir return pImpl->bInOK; 1069*cdf0e10cSrcweir } 1070*cdf0e10cSrcweir 1071*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1072*cdf0e10cSrcweir 1073*cdf0e10cSrcweir short SfxTabDialog::Ok() 1074*cdf0e10cSrcweir 1075*cdf0e10cSrcweir /* [Beschreibung] 1076*cdf0e10cSrcweir 1077*cdf0e10cSrcweir Ok-Handler des Dialogs 1078*cdf0e10cSrcweir Das OutputSet wird erstellt und jede Seite wird mit 1079*cdf0e10cSrcweir dem bzw. ihrem speziellen OutputSet durch Aufruf der Methode 1080*cdf0e10cSrcweir <SfxTabPage::FillItemSet(SfxItemSet &)> dazu aufgefordert, 1081*cdf0e10cSrcweir die vom Benuzter eingestellten Daten in das Set zu tun. 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir [R"uckgabewert] 1084*cdf0e10cSrcweir 1085*cdf0e10cSrcweir RET_OK: wenn mindestens eine Seite sal_True als Returnwert von 1086*cdf0e10cSrcweir FillItemSet geliefert hat, sonst RET_CANCEL. 1087*cdf0e10cSrcweir */ 1088*cdf0e10cSrcweir 1089*cdf0e10cSrcweir { 1090*cdf0e10cSrcweir pImpl->bInOK = sal_True; 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir if ( !pOutSet ) 1093*cdf0e10cSrcweir { 1094*cdf0e10cSrcweir if ( !pExampleSet && pSet ) 1095*cdf0e10cSrcweir pOutSet = pSet->Clone( sal_False ); // ohne Items 1096*cdf0e10cSrcweir else if ( pExampleSet ) 1097*cdf0e10cSrcweir pOutSet = new SfxItemSet( *pExampleSet ); 1098*cdf0e10cSrcweir } 1099*cdf0e10cSrcweir sal_Bool bModified = sal_False; 1100*cdf0e10cSrcweir 1101*cdf0e10cSrcweir const sal_uInt16 nCount = pImpl->pData->Count(); 1102*cdf0e10cSrcweir 1103*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; ++i ) 1104*cdf0e10cSrcweir { 1105*cdf0e10cSrcweir Data_Impl* pDataObject = pImpl->pData->GetObject(i); 1106*cdf0e10cSrcweir SfxTabPage* pTabPage = pDataObject->pTabPage; 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir if ( pTabPage ) 1109*cdf0e10cSrcweir { 1110*cdf0e10cSrcweir if ( pDataObject->bOnDemand ) 1111*cdf0e10cSrcweir { 1112*cdf0e10cSrcweir SfxItemSet& rSet = (SfxItemSet&)pTabPage->GetItemSet(); 1113*cdf0e10cSrcweir rSet.ClearItem(); 1114*cdf0e10cSrcweir bModified |= pTabPage->FillItemSet( rSet ); 1115*cdf0e10cSrcweir } 1116*cdf0e10cSrcweir else if ( pSet && !pTabPage->HasExchangeSupport() ) 1117*cdf0e10cSrcweir { 1118*cdf0e10cSrcweir SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() ); 1119*cdf0e10cSrcweir 1120*cdf0e10cSrcweir if ( pTabPage->FillItemSet( aTmp ) ) 1121*cdf0e10cSrcweir { 1122*cdf0e10cSrcweir bModified |= sal_True; 1123*cdf0e10cSrcweir pExampleSet->Put( aTmp ); 1124*cdf0e10cSrcweir pOutSet->Put( aTmp ); 1125*cdf0e10cSrcweir } 1126*cdf0e10cSrcweir } 1127*cdf0e10cSrcweir } 1128*cdf0e10cSrcweir } 1129*cdf0e10cSrcweir 1130*cdf0e10cSrcweir if ( pImpl->bModified || ( pOutSet && pOutSet->Count() > 0 ) ) 1131*cdf0e10cSrcweir bModified |= sal_True; 1132*cdf0e10cSrcweir 1133*cdf0e10cSrcweir if ( bFmt == 2 ) 1134*cdf0e10cSrcweir bModified |= sal_True; 1135*cdf0e10cSrcweir return bModified ? RET_OK : RET_CANCEL; 1136*cdf0e10cSrcweir } 1137*cdf0e10cSrcweir 1138*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1139*cdf0e10cSrcweir 1140*cdf0e10cSrcweir IMPL_LINK( SfxTabDialog, CancelHdl, Button*, pButton ) 1141*cdf0e10cSrcweir { 1142*cdf0e10cSrcweir (void)pButton; //unused 1143*cdf0e10cSrcweir Close(); 1144*cdf0e10cSrcweir return 0; 1145*cdf0e10cSrcweir } 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1148*cdf0e10cSrcweir 1149*cdf0e10cSrcweir SfxItemSet* SfxTabDialog::CreateInputItemSet( sal_uInt16 ) 1150*cdf0e10cSrcweir 1151*cdf0e10cSrcweir /* [Beschreibung] 1152*cdf0e10cSrcweir 1153*cdf0e10cSrcweir Defaultimplemetierung der virtuellen Methode. 1154*cdf0e10cSrcweir Diese wird gerufen, wenn Pages ihre Sets onDenamd anlegen 1155*cdf0e10cSrcweir */ 1156*cdf0e10cSrcweir 1157*cdf0e10cSrcweir { 1158*cdf0e10cSrcweir DBG_WARNINGFILE( "CreateInputItemSet nicht implementiert" ); 1159*cdf0e10cSrcweir return new SfxAllItemSet( SFX_APP()->GetPool() ); 1160*cdf0e10cSrcweir } 1161*cdf0e10cSrcweir 1162*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1163*cdf0e10cSrcweir 1164*cdf0e10cSrcweir const SfxItemSet* SfxTabDialog::GetRefreshedSet() 1165*cdf0e10cSrcweir 1166*cdf0e10cSrcweir /* [Beschreibung] 1167*cdf0e10cSrcweir 1168*cdf0e10cSrcweir Defaultimplemetierung der virtuellen Methode. 1169*cdf0e10cSrcweir Diese wird gerufen, wenn <SfxTabPage::DeactivatePage(SfxItemSet *)> 1170*cdf0e10cSrcweir <SfxTabPage::REFRESH_SET> liefert. 1171*cdf0e10cSrcweir */ 1172*cdf0e10cSrcweir 1173*cdf0e10cSrcweir { 1174*cdf0e10cSrcweir DBG_ERRORFILE( "GetRefreshedSet nicht implementiert" ); 1175*cdf0e10cSrcweir return 0; 1176*cdf0e10cSrcweir } 1177*cdf0e10cSrcweir 1178*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1179*cdf0e10cSrcweir 1180*cdf0e10cSrcweir IMPL_LINK( SfxTabDialog, OkHdl, Button *, EMPTYARG ) 1181*cdf0e10cSrcweir 1182*cdf0e10cSrcweir /* [Beschreibung] 1183*cdf0e10cSrcweir 1184*cdf0e10cSrcweir Handler des Ok-Buttons 1185*cdf0e10cSrcweir Dieser ruft f"ur die aktuelle Seite 1186*cdf0e10cSrcweir <SfxTabPage::DeactivatePage(SfxItemSet *)>. 1187*cdf0e10cSrcweir Liefert diese <SfxTabPage::LEAVE_PAGE>, wird <SfxTabDialog::Ok()> gerufen 1188*cdf0e10cSrcweir und so der Dialog beendet. 1189*cdf0e10cSrcweir */ 1190*cdf0e10cSrcweir 1191*cdf0e10cSrcweir { 1192*cdf0e10cSrcweir pImpl->bInOK = sal_True; 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir if ( OK_Impl() ) 1195*cdf0e10cSrcweir { 1196*cdf0e10cSrcweir if ( pImpl->bModal ) 1197*cdf0e10cSrcweir EndDialog( Ok() ); 1198*cdf0e10cSrcweir else 1199*cdf0e10cSrcweir { 1200*cdf0e10cSrcweir Ok(); 1201*cdf0e10cSrcweir Close(); 1202*cdf0e10cSrcweir } 1203*cdf0e10cSrcweir } 1204*cdf0e10cSrcweir return 0; 1205*cdf0e10cSrcweir } 1206*cdf0e10cSrcweir 1207*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1208*cdf0e10cSrcweir 1209*cdf0e10cSrcweir bool SfxTabDialog::PrepareLeaveCurrentPage() 1210*cdf0e10cSrcweir { 1211*cdf0e10cSrcweir sal_uInt16 const nId = aTabCtrl.GetCurPageId(); 1212*cdf0e10cSrcweir SfxTabPage* pPage = dynamic_cast<SfxTabPage*> (aTabCtrl.GetTabPage( nId )); 1213*cdf0e10cSrcweir bool bEnd = !pPage; 1214*cdf0e10cSrcweir 1215*cdf0e10cSrcweir if ( pPage ) 1216*cdf0e10cSrcweir { 1217*cdf0e10cSrcweir int nRet = SfxTabPage::LEAVE_PAGE; 1218*cdf0e10cSrcweir if ( pSet ) 1219*cdf0e10cSrcweir { 1220*cdf0e10cSrcweir SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() ); 1221*cdf0e10cSrcweir 1222*cdf0e10cSrcweir if ( pPage->HasExchangeSupport() ) 1223*cdf0e10cSrcweir nRet = pPage->DeactivatePage( &aTmp ); 1224*cdf0e10cSrcweir else 1225*cdf0e10cSrcweir nRet = pPage->DeactivatePage( NULL ); 1226*cdf0e10cSrcweir 1227*cdf0e10cSrcweir if ( ( SfxTabPage::LEAVE_PAGE & nRet ) == SfxTabPage::LEAVE_PAGE 1228*cdf0e10cSrcweir && aTmp.Count() ) 1229*cdf0e10cSrcweir { 1230*cdf0e10cSrcweir pExampleSet->Put( aTmp ); 1231*cdf0e10cSrcweir pOutSet->Put( aTmp ); 1232*cdf0e10cSrcweir } 1233*cdf0e10cSrcweir } 1234*cdf0e10cSrcweir else 1235*cdf0e10cSrcweir nRet = pPage->DeactivatePage( NULL ); 1236*cdf0e10cSrcweir bEnd = nRet; 1237*cdf0e10cSrcweir } 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir return bEnd; 1240*cdf0e10cSrcweir } 1241*cdf0e10cSrcweir 1242*cdf0e10cSrcweir 1243*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1244*cdf0e10cSrcweir 1245*cdf0e10cSrcweir IMPL_LINK( SfxTabDialog, UserHdl, Button *, EMPTYARG ) 1246*cdf0e10cSrcweir 1247*cdf0e10cSrcweir /* [Beschreibung] 1248*cdf0e10cSrcweir 1249*cdf0e10cSrcweir Handler des User-Buttons 1250*cdf0e10cSrcweir Dieser ruft f"ur die aktuelle Seite 1251*cdf0e10cSrcweir <SfxTabPage::DeactivatePage(SfxItemSet *)>. 1252*cdf0e10cSrcweir Liefert diese <SfxTabPage::LEAVE_PAGE>, wird <SfxTabDialog::Ok()> gerufen. 1253*cdf0e10cSrcweir Mit dem Return-Wert von <SfxTabDialog::Ok()> wird dann der Dialog beendet. 1254*cdf0e10cSrcweir */ 1255*cdf0e10cSrcweir 1256*cdf0e10cSrcweir { 1257*cdf0e10cSrcweir if ( PrepareLeaveCurrentPage () ) 1258*cdf0e10cSrcweir { 1259*cdf0e10cSrcweir short nRet = Ok(); 1260*cdf0e10cSrcweir 1261*cdf0e10cSrcweir if ( RET_OK == nRet ) 1262*cdf0e10cSrcweir nRet = RET_USER; 1263*cdf0e10cSrcweir else 1264*cdf0e10cSrcweir nRet = RET_USER_CANCEL; 1265*cdf0e10cSrcweir EndDialog( nRet ); 1266*cdf0e10cSrcweir } 1267*cdf0e10cSrcweir return 0; 1268*cdf0e10cSrcweir } 1269*cdf0e10cSrcweir 1270*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1271*cdf0e10cSrcweir 1272*cdf0e10cSrcweir IMPL_LINK( SfxTabDialog, ResetHdl, Button *, EMPTYARG ) 1273*cdf0e10cSrcweir 1274*cdf0e10cSrcweir /* [Beschreibung] 1275*cdf0e10cSrcweir 1276*cdf0e10cSrcweir Handler hinter dem Zur"ucksetzen-Button. 1277*cdf0e10cSrcweir Die aktuelle Page wird mit ihren initialen Daten 1278*cdf0e10cSrcweir neu initialisiert; alle Einstellungen, die der Benutzer 1279*cdf0e10cSrcweir auf dieser Seite get"atigt hat, werden aufgehoben. 1280*cdf0e10cSrcweir */ 1281*cdf0e10cSrcweir 1282*cdf0e10cSrcweir { 1283*cdf0e10cSrcweir const sal_uInt16 nId = aTabCtrl.GetCurPageId(); 1284*cdf0e10cSrcweir Data_Impl* pDataObject = Find( *pImpl->pData, nId ); 1285*cdf0e10cSrcweir DBG_ASSERT( pDataObject, "Id nicht bekannt" ); 1286*cdf0e10cSrcweir 1287*cdf0e10cSrcweir if ( pDataObject->bOnDemand ) 1288*cdf0e10cSrcweir { 1289*cdf0e10cSrcweir // CSet auf AIS hat hier Probleme, daher getrennt 1290*cdf0e10cSrcweir const SfxItemSet* pItemSet = &pDataObject->pTabPage->GetItemSet(); 1291*cdf0e10cSrcweir pDataObject->pTabPage->Reset( *(SfxItemSet*)pItemSet ); 1292*cdf0e10cSrcweir } 1293*cdf0e10cSrcweir else 1294*cdf0e10cSrcweir pDataObject->pTabPage->Reset( *pSet ); 1295*cdf0e10cSrcweir return 0; 1296*cdf0e10cSrcweir } 1297*cdf0e10cSrcweir 1298*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1299*cdf0e10cSrcweir 1300*cdf0e10cSrcweir IMPL_LINK( SfxTabDialog, BaseFmtHdl, Button *, EMPTYARG ) 1301*cdf0e10cSrcweir 1302*cdf0e10cSrcweir /* [Beschreibung] 1303*cdf0e10cSrcweir 1304*cdf0e10cSrcweir Handler hinter dem Standard-Button. 1305*cdf0e10cSrcweir Dieser Button steht beim Bearbeiten von StyleSheets zur Verf"ugung. 1306*cdf0e10cSrcweir Alle in dem bearbeiteten StyleSheet eingestellten Attribute 1307*cdf0e10cSrcweir werden gel"oscht. 1308*cdf0e10cSrcweir */ 1309*cdf0e10cSrcweir 1310*cdf0e10cSrcweir { 1311*cdf0e10cSrcweir const sal_uInt16 nId = aTabCtrl.GetCurPageId(); 1312*cdf0e10cSrcweir Data_Impl* pDataObject = Find( *pImpl->pData, nId ); 1313*cdf0e10cSrcweir DBG_ASSERT( pDataObject, "Id nicht bekannt" ); 1314*cdf0e10cSrcweir bFmt = 2; 1315*cdf0e10cSrcweir 1316*cdf0e10cSrcweir if ( pDataObject->fnGetRanges ) 1317*cdf0e10cSrcweir { 1318*cdf0e10cSrcweir if ( !pExampleSet ) 1319*cdf0e10cSrcweir pExampleSet = new SfxItemSet( *pSet ); 1320*cdf0e10cSrcweir 1321*cdf0e10cSrcweir const SfxItemPool* pPool = pSet->GetPool(); 1322*cdf0e10cSrcweir const sal_uInt16* pTmpRanges = (pDataObject->fnGetRanges)(); 1323*cdf0e10cSrcweir SfxItemSet aTmpSet( *pExampleSet ); 1324*cdf0e10cSrcweir 1325*cdf0e10cSrcweir while ( *pTmpRanges ) 1326*cdf0e10cSrcweir { 1327*cdf0e10cSrcweir const sal_uInt16* pU = pTmpRanges + 1; 1328*cdf0e10cSrcweir 1329*cdf0e10cSrcweir if ( *pTmpRanges == *pU ) 1330*cdf0e10cSrcweir { 1331*cdf0e10cSrcweir // Range mit zwei gleichen Werten -> nur ein Item setzen 1332*cdf0e10cSrcweir sal_uInt16 nWh = pPool->GetWhich( *pTmpRanges ); 1333*cdf0e10cSrcweir pExampleSet->ClearItem( nWh ); 1334*cdf0e10cSrcweir aTmpSet.ClearItem( nWh ); 1335*cdf0e10cSrcweir // am OutSet mit InvalidateItem, 1336*cdf0e10cSrcweir // damit die "Anderung wirksam wird 1337*cdf0e10cSrcweir pOutSet->InvalidateItem( nWh ); 1338*cdf0e10cSrcweir } 1339*cdf0e10cSrcweir else 1340*cdf0e10cSrcweir { 1341*cdf0e10cSrcweir // richtiger Range mit mehreren Werten 1342*cdf0e10cSrcweir sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU; 1343*cdf0e10cSrcweir DBG_ASSERT( nTmp <= nTmpEnd, "Range ist falsch sortiert" ); 1344*cdf0e10cSrcweir 1345*cdf0e10cSrcweir if ( nTmp > nTmpEnd ) 1346*cdf0e10cSrcweir { 1347*cdf0e10cSrcweir // wenn wirklich falsch sortiert, dann neu setzen 1348*cdf0e10cSrcweir sal_uInt16 nTmp1 = nTmp; 1349*cdf0e10cSrcweir nTmp = nTmpEnd; 1350*cdf0e10cSrcweir nTmpEnd = nTmp1; 1351*cdf0e10cSrcweir } 1352*cdf0e10cSrcweir 1353*cdf0e10cSrcweir while ( nTmp <= nTmpEnd ) 1354*cdf0e10cSrcweir { 1355*cdf0e10cSrcweir // "uber den Range iterieren, und die Items setzen 1356*cdf0e10cSrcweir sal_uInt16 nWh = pPool->GetWhich( nTmp ); 1357*cdf0e10cSrcweir pExampleSet->ClearItem( nWh ); 1358*cdf0e10cSrcweir aTmpSet.ClearItem( nWh ); 1359*cdf0e10cSrcweir // am OutSet mit InvalidateItem, 1360*cdf0e10cSrcweir // damit die "Anderung wirksam wird 1361*cdf0e10cSrcweir pOutSet->InvalidateItem( nWh ); 1362*cdf0e10cSrcweir nTmp++; 1363*cdf0e10cSrcweir } 1364*cdf0e10cSrcweir } 1365*cdf0e10cSrcweir // zum n"achsten Paar gehen 1366*cdf0e10cSrcweir pTmpRanges += 2; 1367*cdf0e10cSrcweir } 1368*cdf0e10cSrcweir // alle Items neu gesetzt -> dann an der aktuellen Page Reset() rufen 1369*cdf0e10cSrcweir DBG_ASSERT( pDataObject->pTabPage, "die Page ist weg" ); 1370*cdf0e10cSrcweir pDataObject->pTabPage->Reset( aTmpSet ); 1371*cdf0e10cSrcweir pDataObject->pTabPage->pImpl->mbStandard = sal_True; 1372*cdf0e10cSrcweir } 1373*cdf0e10cSrcweir return 1; 1374*cdf0e10cSrcweir } 1375*cdf0e10cSrcweir 1376*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1377*cdf0e10cSrcweir 1378*cdf0e10cSrcweir #if ENABLE_LAYOUT_SFX_TABDIALOG 1379*cdf0e10cSrcweir #define tabControlWindow pTabCtrl->GetWindow () 1380*cdf0e10cSrcweir #else /* !ENABLE_LAYOUT_SFX_TABDIALOG */ 1381*cdf0e10cSrcweir #define tabControlWindow pTabCtrl 1382*cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */ 1383*cdf0e10cSrcweir 1384*cdf0e10cSrcweir IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl ) 1385*cdf0e10cSrcweir 1386*cdf0e10cSrcweir /* [Beschreibung] 1387*cdf0e10cSrcweir 1388*cdf0e10cSrcweir Handler, der vor dem Umschalten auf eine andere Seite 1389*cdf0e10cSrcweir durch Starview gerufen wird. 1390*cdf0e10cSrcweir Existiert die Seite noch nicht, so wird sie erzeugt und 1391*cdf0e10cSrcweir die virtuelle Methode <SfxTabDialog::PageCreated( sal_uInt16, SfxTabPage &)> 1392*cdf0e10cSrcweir gerufen. Existiert die Seite bereits, so wird ggf. 1393*cdf0e10cSrcweir <SfxTabPage::Reset(const SfxItemSet &)> oder 1394*cdf0e10cSrcweir <SfxTabPage::ActivatePage(const SfxItemSet &)> gerufen. 1395*cdf0e10cSrcweir */ 1396*cdf0e10cSrcweir 1397*cdf0e10cSrcweir { 1398*cdf0e10cSrcweir sal_uInt16 const nId = pTabCtrl->GetCurPageId(); 1399*cdf0e10cSrcweir 1400*cdf0e10cSrcweir DBG_ASSERT( pImpl->pData->Count(), "keine Pages angemeldet" ); 1401*cdf0e10cSrcweir SFX_APP(); 1402*cdf0e10cSrcweir 1403*cdf0e10cSrcweir // Tab Page schon da? 1404*cdf0e10cSrcweir SfxTabPage* pTabPage = dynamic_cast<SfxTabPage*> (pTabCtrl->GetTabPage( nId )); 1405*cdf0e10cSrcweir Data_Impl* pDataObject = Find( *pImpl->pData, nId ); 1406*cdf0e10cSrcweir DBG_ASSERT( pDataObject, "Id nicht bekannt" ); 1407*cdf0e10cSrcweir 1408*cdf0e10cSrcweir // ggf. TabPage erzeugen: 1409*cdf0e10cSrcweir if ( !pTabPage ) 1410*cdf0e10cSrcweir { 1411*cdf0e10cSrcweir #if ENABLE_LAYOUT_SFX_TABDIALOG 1412*cdf0e10cSrcweir if (dynamic_cast<layout SfxTabPage*> (pTabPage)) 1413*cdf0e10cSrcweir layout::TabPage::global_parent = pTabCtrl->GetWindow (); 1414*cdf0e10cSrcweir #endif 1415*cdf0e10cSrcweir const SfxItemSet* pTmpSet = 0; 1416*cdf0e10cSrcweir 1417*cdf0e10cSrcweir if ( pSet ) 1418*cdf0e10cSrcweir { 1419*cdf0e10cSrcweir if ( bItemsReset && pSet->GetParent() ) 1420*cdf0e10cSrcweir pTmpSet = pSet->GetParent(); 1421*cdf0e10cSrcweir else 1422*cdf0e10cSrcweir pTmpSet = pSet; 1423*cdf0e10cSrcweir } 1424*cdf0e10cSrcweir 1425*cdf0e10cSrcweir if ( pTmpSet && !pDataObject->bOnDemand ) 1426*cdf0e10cSrcweir pTabPage = (pDataObject->fnCreatePage)( tabControlWindow, *pTmpSet ); 1427*cdf0e10cSrcweir else 1428*cdf0e10cSrcweir pTabPage = (pDataObject->fnCreatePage) 1429*cdf0e10cSrcweir ( tabControlWindow, *CreateInputItemSet( nId ) ); 1430*cdf0e10cSrcweir DBG_ASSERT( NULL == pDataObject->pTabPage, "create TabPage more than once" ); 1431*cdf0e10cSrcweir pDataObject->pTabPage = pTabPage; 1432*cdf0e10cSrcweir 1433*cdf0e10cSrcweir #if !ENABLE_LAYOUT_SFX_TABDIALOG 1434*cdf0e10cSrcweir pDataObject->pTabPage->SetTabDialog( this ); 1435*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ 1436*cdf0e10cSrcweir SvtViewOptions aPageOpt( E_TABPAGE, String::CreateFromInt32( pDataObject->nId ) ); 1437*cdf0e10cSrcweir String sUserData; 1438*cdf0e10cSrcweir Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME ); 1439*cdf0e10cSrcweir OUString aTemp; 1440*cdf0e10cSrcweir if ( aUserItem >>= aTemp ) 1441*cdf0e10cSrcweir sUserData = String( aTemp ); 1442*cdf0e10cSrcweir pTabPage->SetUserData( sUserData ); 1443*cdf0e10cSrcweir Size aSiz = pTabPage->GetSizePixel(); 1444*cdf0e10cSrcweir 1445*cdf0e10cSrcweir #if ENABLE_LAYOUT 1446*cdf0e10cSrcweir Size optimalSize = pTabPage->GetOptimalSize (WINDOWSIZE_MINIMUM); 1447*cdf0e10cSrcweir #if ENABLE_LAYOUT_SFX_TABDIALOG 1448*cdf0e10cSrcweir if (dynamic_cast<layout SfxTabPage*> (pTabPage)) 1449*cdf0e10cSrcweir { 1450*cdf0e10cSrcweir if (optimalSize.Height () && optimalSize.Width ()) 1451*cdf0e10cSrcweir { 1452*cdf0e10cSrcweir optimalSize.Width () = optimalSize.Width (); 1453*cdf0e10cSrcweir optimalSize.Height () = optimalSize.Height () + 40; 1454*cdf0e10cSrcweir } 1455*cdf0e10cSrcweir } 1456*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ 1457*cdf0e10cSrcweir if (optimalSize.Height () > 0 && optimalSize.Width () > 0 ) 1458*cdf0e10cSrcweir aSiz = optimalSize; 1459*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT */ 1460*cdf0e10cSrcweir 1461*cdf0e10cSrcweir Size aCtrlSiz = pTabCtrl->GetTabPageSizePixel(); 1462*cdf0e10cSrcweir // Gr"o/se am TabControl nur dann setzen, wenn < als TabPage 1463*cdf0e10cSrcweir if ( aCtrlSiz.Width() < aSiz.Width() || 1464*cdf0e10cSrcweir aCtrlSiz.Height() < aSiz.Height() ) 1465*cdf0e10cSrcweir { 1466*cdf0e10cSrcweir pTabCtrl->SetTabPageSizePixel( aSiz ); 1467*cdf0e10cSrcweir } 1468*cdf0e10cSrcweir 1469*cdf0e10cSrcweir PageCreated( nId, *pTabPage ); 1470*cdf0e10cSrcweir 1471*cdf0e10cSrcweir if ( pDataObject->bOnDemand ) 1472*cdf0e10cSrcweir pTabPage->Reset( (SfxItemSet &)pTabPage->GetItemSet() ); 1473*cdf0e10cSrcweir else 1474*cdf0e10cSrcweir pTabPage->Reset( *pSet ); 1475*cdf0e10cSrcweir 1476*cdf0e10cSrcweir pTabCtrl->SetTabPage( nId, pTabPage ); 1477*cdf0e10cSrcweir } 1478*cdf0e10cSrcweir else if ( pDataObject->bRefresh ) 1479*cdf0e10cSrcweir pTabPage->Reset( *pSet ); 1480*cdf0e10cSrcweir pDataObject->bRefresh = sal_False; 1481*cdf0e10cSrcweir 1482*cdf0e10cSrcweir #if ENABLE_LAYOUT_SFX_TABDIALOG 1483*cdf0e10cSrcweir pTabCtrl->GetPagePos (nId); 1484*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT_SFX_TABDIALOG */ 1485*cdf0e10cSrcweir 1486*cdf0e10cSrcweir if ( pExampleSet ) 1487*cdf0e10cSrcweir pTabPage->ActivatePage( *pExampleSet ); 1488*cdf0e10cSrcweir sal_Bool bReadOnly = pTabPage->IsReadOnly(); 1489*cdf0e10cSrcweir ( bReadOnly || pImpl->bHideResetBtn ) ? aResetBtn.Hide() : aResetBtn.Show(); 1490*cdf0e10cSrcweir return 0; 1491*cdf0e10cSrcweir } 1492*cdf0e10cSrcweir 1493*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1494*cdf0e10cSrcweir 1495*cdf0e10cSrcweir IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl ) 1496*cdf0e10cSrcweir 1497*cdf0e10cSrcweir /* [Beschreibung] 1498*cdf0e10cSrcweir 1499*cdf0e10cSrcweir Handler, der vor dem Verlassen einer Seite durch Starview gerufen wird. 1500*cdf0e10cSrcweir 1501*cdf0e10cSrcweir [Querverweise] 1502*cdf0e10cSrcweir 1503*cdf0e10cSrcweir <SfxTabPage::DeactivatePage(SfxItemSet *)> 1504*cdf0e10cSrcweir */ 1505*cdf0e10cSrcweir 1506*cdf0e10cSrcweir { 1507*cdf0e10cSrcweir sal_uInt16 nId = pTabCtrl->GetCurPageId(); 1508*cdf0e10cSrcweir SFX_APP(); 1509*cdf0e10cSrcweir SfxTabPage *pPage = dynamic_cast<SfxTabPage*> (pTabCtrl->GetTabPage( nId )); 1510*cdf0e10cSrcweir DBG_ASSERT( pPage, "keine aktive Page" ); 1511*cdf0e10cSrcweir #ifdef DBG_UTIL 1512*cdf0e10cSrcweir Data_Impl* pDataObject = Find( *pImpl->pData, pTabCtrl->GetCurPageId() ); 1513*cdf0e10cSrcweir DBG_ASSERT( pDataObject, "keine Datenstruktur zur aktuellen Seite" ); 1514*cdf0e10cSrcweir if ( pPage->HasExchangeSupport() && pDataObject->bOnDemand ) 1515*cdf0e10cSrcweir { 1516*cdf0e10cSrcweir DBG_WARNING( "Datenaustausch bei ItemsOnDemand ist nicht gewuenscht!" ); 1517*cdf0e10cSrcweir } 1518*cdf0e10cSrcweir #endif 1519*cdf0e10cSrcweir 1520*cdf0e10cSrcweir int nRet = SfxTabPage::LEAVE_PAGE; 1521*cdf0e10cSrcweir 1522*cdf0e10cSrcweir if ( !pExampleSet && pPage->HasExchangeSupport() && pSet ) 1523*cdf0e10cSrcweir pExampleSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ); 1524*cdf0e10cSrcweir 1525*cdf0e10cSrcweir if ( pSet ) 1526*cdf0e10cSrcweir { 1527*cdf0e10cSrcweir SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() ); 1528*cdf0e10cSrcweir 1529*cdf0e10cSrcweir if ( pPage->HasExchangeSupport() ) 1530*cdf0e10cSrcweir nRet = pPage->DeactivatePage( &aTmp ); 1531*cdf0e10cSrcweir else 1532*cdf0e10cSrcweir nRet = pPage->DeactivatePage( NULL ); 1533*cdf0e10cSrcweir //! else 1534*cdf0e10cSrcweir //! pPage->FillItemSet( aTmp ); 1535*cdf0e10cSrcweir 1536*cdf0e10cSrcweir if ( ( SfxTabPage::LEAVE_PAGE & nRet ) == SfxTabPage::LEAVE_PAGE && 1537*cdf0e10cSrcweir aTmp.Count() ) 1538*cdf0e10cSrcweir { 1539*cdf0e10cSrcweir pExampleSet->Put( aTmp ); 1540*cdf0e10cSrcweir pOutSet->Put( aTmp ); 1541*cdf0e10cSrcweir } 1542*cdf0e10cSrcweir } 1543*cdf0e10cSrcweir else 1544*cdf0e10cSrcweir { 1545*cdf0e10cSrcweir if ( pPage->HasExchangeSupport() ) //!!! 1546*cdf0e10cSrcweir { 1547*cdf0e10cSrcweir if ( !pExampleSet ) 1548*cdf0e10cSrcweir { 1549*cdf0e10cSrcweir SfxItemPool* pPool = pPage->GetItemSet().GetPool(); 1550*cdf0e10cSrcweir pExampleSet = 1551*cdf0e10cSrcweir new SfxItemSet( *pPool, GetInputRanges( *pPool ) ); 1552*cdf0e10cSrcweir } 1553*cdf0e10cSrcweir nRet = pPage->DeactivatePage( pExampleSet ); 1554*cdf0e10cSrcweir } 1555*cdf0e10cSrcweir else 1556*cdf0e10cSrcweir nRet = pPage->DeactivatePage( NULL ); 1557*cdf0e10cSrcweir } 1558*cdf0e10cSrcweir 1559*cdf0e10cSrcweir if ( nRet & SfxTabPage::REFRESH_SET ) 1560*cdf0e10cSrcweir { 1561*cdf0e10cSrcweir pSet = GetRefreshedSet(); 1562*cdf0e10cSrcweir DBG_ASSERT( pSet, "GetRefreshedSet() liefert NULL" ); 1563*cdf0e10cSrcweir // alle Pages als neu zu initialsieren flaggen 1564*cdf0e10cSrcweir const sal_uInt16 nCount = pImpl->pData->Count(); 1565*cdf0e10cSrcweir 1566*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; ++i ) 1567*cdf0e10cSrcweir { 1568*cdf0e10cSrcweir Data_Impl* pObj = (*pImpl->pData)[i]; 1569*cdf0e10cSrcweir 1570*cdf0e10cSrcweir if ( pObj->pTabPage != pPage ) // eigene Page nicht mehr refreshen 1571*cdf0e10cSrcweir pObj->bRefresh = sal_True; 1572*cdf0e10cSrcweir else 1573*cdf0e10cSrcweir pObj->bRefresh = sal_False; 1574*cdf0e10cSrcweir } 1575*cdf0e10cSrcweir } 1576*cdf0e10cSrcweir if ( nRet & SfxTabPage::LEAVE_PAGE ) 1577*cdf0e10cSrcweir return sal_True; 1578*cdf0e10cSrcweir else 1579*cdf0e10cSrcweir return sal_False; 1580*cdf0e10cSrcweir } 1581*cdf0e10cSrcweir 1582*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1583*cdf0e10cSrcweir 1584*cdf0e10cSrcweir const SfxItemSet* SfxTabDialog::GetOutputItemSet 1585*cdf0e10cSrcweir 1586*cdf0e10cSrcweir /* [Beschreibung] 1587*cdf0e10cSrcweir 1588*cdf0e10cSrcweir Liefert die Pages, die ihre Sets onDemand liefern, das OutputItemSet. 1589*cdf0e10cSrcweir 1590*cdf0e10cSrcweir [Querverweise] 1591*cdf0e10cSrcweir 1592*cdf0e10cSrcweir <SfxTabDialog::AddTabPage(sal_uInt16, CreateTabPage, GetTabPageRanges, sal_Bool)> 1593*cdf0e10cSrcweir <SfxTabDialog::AddTabPage(sal_uInt16, const String &, CreateTabPage, GetTabPageRanges, sal_Bool, sal_uInt16)> 1594*cdf0e10cSrcweir <SfxTabDialog::AddTabPage(sal_uInt16, const Bitmap &, CreateTabPage, GetTabPageRanges, sal_Bool, sal_uInt16)> 1595*cdf0e10cSrcweir */ 1596*cdf0e10cSrcweir 1597*cdf0e10cSrcweir ( 1598*cdf0e10cSrcweir sal_uInt16 nId // die Id, unter der die Seite bei AddTabPage() 1599*cdf0e10cSrcweir // hinzugef"ugt wurde. 1600*cdf0e10cSrcweir ) const 1601*cdf0e10cSrcweir { 1602*cdf0e10cSrcweir Data_Impl* pDataObject = Find( *pImpl->pData, nId ); 1603*cdf0e10cSrcweir DBG_ASSERT( pDataObject, "TabPage nicht gefunden" ); 1604*cdf0e10cSrcweir 1605*cdf0e10cSrcweir if ( pDataObject ) 1606*cdf0e10cSrcweir { 1607*cdf0e10cSrcweir if ( !pDataObject->pTabPage ) 1608*cdf0e10cSrcweir return NULL; 1609*cdf0e10cSrcweir 1610*cdf0e10cSrcweir if ( pDataObject->bOnDemand ) 1611*cdf0e10cSrcweir return &pDataObject->pTabPage->GetItemSet(); 1612*cdf0e10cSrcweir // else 1613*cdf0e10cSrcweir return pOutSet; 1614*cdf0e10cSrcweir } 1615*cdf0e10cSrcweir return NULL; 1616*cdf0e10cSrcweir } 1617*cdf0e10cSrcweir 1618*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1619*cdf0e10cSrcweir 1620*cdf0e10cSrcweir int SfxTabDialog::FillOutputItemSet() 1621*cdf0e10cSrcweir { 1622*cdf0e10cSrcweir int nRet = SfxTabPage::LEAVE_PAGE; 1623*cdf0e10cSrcweir if ( OK_Impl() ) 1624*cdf0e10cSrcweir Ok(); 1625*cdf0e10cSrcweir else 1626*cdf0e10cSrcweir nRet = SfxTabPage::KEEP_PAGE; 1627*cdf0e10cSrcweir return nRet; 1628*cdf0e10cSrcweir } 1629*cdf0e10cSrcweir 1630*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1631*cdf0e10cSrcweir 1632*cdf0e10cSrcweir #ifdef WNT 1633*cdf0e10cSrcweir int __cdecl TabDlgCmpUS_Impl( const void* p1, const void* p2 ) 1634*cdf0e10cSrcweir #else 1635*cdf0e10cSrcweir #if defined(OS2) && defined(ICC) 1636*cdf0e10cSrcweir int _Optlink TabDlgCmpUS_Impl( const void* p1, const void* p2 ) 1637*cdf0e10cSrcweir #else 1638*cdf0e10cSrcweir extern "C" int TabDlgCmpUS_Impl( const void* p1, const void* p2 ) 1639*cdf0e10cSrcweir #endif 1640*cdf0e10cSrcweir #endif 1641*cdf0e10cSrcweir 1642*cdf0e10cSrcweir /* [Beschreibung] 1643*cdf0e10cSrcweir 1644*cdf0e10cSrcweir Vergleichsfunktion f"ur qsort 1645*cdf0e10cSrcweir */ 1646*cdf0e10cSrcweir 1647*cdf0e10cSrcweir { 1648*cdf0e10cSrcweir return *(sal_uInt16*)p1 - *(sal_uInt16*)p2; 1649*cdf0e10cSrcweir } 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1652*cdf0e10cSrcweir 1653*cdf0e10cSrcweir void SfxTabDialog::ShowPage( sal_uInt16 nId ) 1654*cdf0e10cSrcweir 1655*cdf0e10cSrcweir /* [Beschreibung] 1656*cdf0e10cSrcweir 1657*cdf0e10cSrcweir Es wird die TabPage mit der "ubergebenen Id aktiviert. 1658*cdf0e10cSrcweir */ 1659*cdf0e10cSrcweir 1660*cdf0e10cSrcweir { 1661*cdf0e10cSrcweir aTabCtrl.SetCurPageId( nId ); 1662*cdf0e10cSrcweir ActivatePageHdl( &aTabCtrl ); 1663*cdf0e10cSrcweir } 1664*cdf0e10cSrcweir 1665*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1666*cdf0e10cSrcweir 1667*cdf0e10cSrcweir const sal_uInt16* SfxTabDialog::GetInputRanges( const SfxItemPool& rPool ) 1668*cdf0e10cSrcweir 1669*cdf0e10cSrcweir /* [Beschreibung] 1670*cdf0e10cSrcweir 1671*cdf0e10cSrcweir Bildet das Set "uber die Ranges aller Seiten des Dialogs. 1672*cdf0e10cSrcweir Die Pages m"ussen die statische Methode f"ur das Erfragen ihrer 1673*cdf0e10cSrcweir Ranges bei AddTabPage angegeben haben, liefern also ihre Sets onDemand. 1674*cdf0e10cSrcweir 1675*cdf0e10cSrcweir [Querverweise] 1676*cdf0e10cSrcweir 1677*cdf0e10cSrcweir <SfxTabDialog::AddTabPage(sal_uInt16, CreateTabPage, GetTabPageRanges, sal_Bool)> 1678*cdf0e10cSrcweir <SfxTabDialog::AddTabPage(sal_uInt16, const String &, CreateTabPage, GetTabPageRanges, sal_Bool, sal_uInt16)> 1679*cdf0e10cSrcweir <SfxTabDialog::AddTabPage(sal_uInt16, const Bitmap &, CreateTabPage, GetTabPageRanges, sal_Bool, sal_uInt16)> 1680*cdf0e10cSrcweir 1681*cdf0e10cSrcweir [R"uckgabewert] 1682*cdf0e10cSrcweir 1683*cdf0e10cSrcweir Pointer auf nullterminiertes Array von USHORTs 1684*cdf0e10cSrcweir Dieses Array geh"ort dem Dialog und wird beim 1685*cdf0e10cSrcweir Zerst"oren des Dialogs gel"oscht. 1686*cdf0e10cSrcweir */ 1687*cdf0e10cSrcweir 1688*cdf0e10cSrcweir { 1689*cdf0e10cSrcweir if ( pSet ) 1690*cdf0e10cSrcweir { 1691*cdf0e10cSrcweir DBG_ERRORFILE( "Set bereits vorhanden!" ); 1692*cdf0e10cSrcweir return pSet->GetRanges(); 1693*cdf0e10cSrcweir } 1694*cdf0e10cSrcweir 1695*cdf0e10cSrcweir if ( pRanges ) 1696*cdf0e10cSrcweir return pRanges; 1697*cdf0e10cSrcweir SvUShorts aUS( 16, 16 ); 1698*cdf0e10cSrcweir sal_uInt16 nCount = pImpl->pData->Count(); 1699*cdf0e10cSrcweir 1700*cdf0e10cSrcweir sal_uInt16 i; 1701*cdf0e10cSrcweir for ( i = 0; i < nCount; ++i ) 1702*cdf0e10cSrcweir { 1703*cdf0e10cSrcweir Data_Impl* pDataObject = pImpl->pData->GetObject(i); 1704*cdf0e10cSrcweir 1705*cdf0e10cSrcweir if ( pDataObject->fnGetRanges ) 1706*cdf0e10cSrcweir { 1707*cdf0e10cSrcweir const sal_uInt16* pTmpRanges = (pDataObject->fnGetRanges)(); 1708*cdf0e10cSrcweir const sal_uInt16* pIter = pTmpRanges; 1709*cdf0e10cSrcweir 1710*cdf0e10cSrcweir sal_uInt16 nLen; 1711*cdf0e10cSrcweir for( nLen = 0; *pIter; ++nLen, ++pIter ) 1712*cdf0e10cSrcweir ; 1713*cdf0e10cSrcweir aUS.Insert( pTmpRanges, nLen, aUS.Count() ); 1714*cdf0e10cSrcweir } 1715*cdf0e10cSrcweir } 1716*cdf0e10cSrcweir 1717*cdf0e10cSrcweir //! Doppelte Ids entfernen? 1718*cdf0e10cSrcweir #ifndef TF_POOLABLE 1719*cdf0e10cSrcweir if ( rPool.HasMap() ) 1720*cdf0e10cSrcweir #endif 1721*cdf0e10cSrcweir { 1722*cdf0e10cSrcweir nCount = aUS.Count(); 1723*cdf0e10cSrcweir 1724*cdf0e10cSrcweir for ( i = 0; i < nCount; ++i ) 1725*cdf0e10cSrcweir aUS[i] = rPool.GetWhich( aUS[i] ); 1726*cdf0e10cSrcweir } 1727*cdf0e10cSrcweir 1728*cdf0e10cSrcweir // sortieren 1729*cdf0e10cSrcweir if ( aUS.Count() > 1 ) 1730*cdf0e10cSrcweir qsort( (void*)aUS.GetData(), 1731*cdf0e10cSrcweir aUS.Count(), sizeof(sal_uInt16), TabDlgCmpUS_Impl ); 1732*cdf0e10cSrcweir 1733*cdf0e10cSrcweir // Ranges erzeugen 1734*cdf0e10cSrcweir //!! Auskommentiert, da fehlerhaft 1735*cdf0e10cSrcweir /* 1736*cdf0e10cSrcweir pRanges = new sal_uInt16[aUS.Count() * 2 + 1]; 1737*cdf0e10cSrcweir int j = 0; 1738*cdf0e10cSrcweir i = 0; 1739*cdf0e10cSrcweir 1740*cdf0e10cSrcweir while ( i < aUS.Count() ) 1741*cdf0e10cSrcweir { 1742*cdf0e10cSrcweir pRanges[j++] = aUS[i]; 1743*cdf0e10cSrcweir // aufeinanderfolgende Zahlen 1744*cdf0e10cSrcweir for( ; i < aUS.Count()-1; ++i ) 1745*cdf0e10cSrcweir if ( aUS[i] + 1 != aUS[i+1] ) 1746*cdf0e10cSrcweir break; 1747*cdf0e10cSrcweir pRanges[j++] = aUS[i++]; 1748*cdf0e10cSrcweir } 1749*cdf0e10cSrcweir pRanges[j] = 0; // terminierende NULL 1750*cdf0e10cSrcweir */ 1751*cdf0e10cSrcweir 1752*cdf0e10cSrcweir pRanges = new sal_uInt16[aUS.Count() + 1]; 1753*cdf0e10cSrcweir memcpy(pRanges, aUS.GetData(), sizeof(sal_uInt16) * aUS.Count()); 1754*cdf0e10cSrcweir pRanges[aUS.Count()] = 0; 1755*cdf0e10cSrcweir return pRanges; 1756*cdf0e10cSrcweir } 1757*cdf0e10cSrcweir 1758*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1759*cdf0e10cSrcweir 1760*cdf0e10cSrcweir void SfxTabDialog::SetInputSet( const SfxItemSet* pInSet ) 1761*cdf0e10cSrcweir 1762*cdf0e10cSrcweir /* [Beschreibung] 1763*cdf0e10cSrcweir 1764*cdf0e10cSrcweir Mit dieser Methode kann nachtr"aglich der Input-Set initial oder 1765*cdf0e10cSrcweir neu gesetzt werden. 1766*cdf0e10cSrcweir */ 1767*cdf0e10cSrcweir 1768*cdf0e10cSrcweir { 1769*cdf0e10cSrcweir bool bSet = ( pSet != NULL ); 1770*cdf0e10cSrcweir 1771*cdf0e10cSrcweir pSet = pInSet; 1772*cdf0e10cSrcweir 1773*cdf0e10cSrcweir if ( !bSet && !pExampleSet && !pOutSet ) 1774*cdf0e10cSrcweir { 1775*cdf0e10cSrcweir pExampleSet = new SfxItemSet( *pSet ); 1776*cdf0e10cSrcweir pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ); 1777*cdf0e10cSrcweir } 1778*cdf0e10cSrcweir } 1779*cdf0e10cSrcweir 1780*cdf0e10cSrcweir long SfxTabDialog::Notify( NotifyEvent& rNEvt ) 1781*cdf0e10cSrcweir { 1782*cdf0e10cSrcweir if ( rNEvt.GetType() == EVENT_GETFOCUS ) 1783*cdf0e10cSrcweir { 1784*cdf0e10cSrcweir SfxViewFrame* pViewFrame = GetViewFrame() ? GetViewFrame() : SfxViewFrame::Current(); 1785*cdf0e10cSrcweir if ( pViewFrame ) 1786*cdf0e10cSrcweir { 1787*cdf0e10cSrcweir Window* pWindow = rNEvt.GetWindow(); 1788*cdf0e10cSrcweir rtl::OString sHelpId; 1789*cdf0e10cSrcweir while ( !sHelpId.getLength() && pWindow ) 1790*cdf0e10cSrcweir { 1791*cdf0e10cSrcweir sHelpId = pWindow->GetHelpId(); 1792*cdf0e10cSrcweir pWindow = pWindow->GetParent(); 1793*cdf0e10cSrcweir } 1794*cdf0e10cSrcweir 1795*cdf0e10cSrcweir if ( sHelpId.getLength() ) 1796*cdf0e10cSrcweir SfxHelp::OpenHelpAgent( &pViewFrame->GetFrame(), sHelpId ); 1797*cdf0e10cSrcweir } 1798*cdf0e10cSrcweir } 1799*cdf0e10cSrcweir 1800*cdf0e10cSrcweir return TabDialog::Notify( rNEvt ); 1801*cdf0e10cSrcweir } 1802*cdf0e10cSrcweir 1803*cdf0e10cSrcweir END_NAMESPACE_LAYOUT_SFX_TABDIALOG 1804