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_svx.hxx" 30*cdf0e10cSrcweir #include "fmvwimp.hxx" 31*cdf0e10cSrcweir #include <svx/fmshell.hxx> 32*cdf0e10cSrcweir #include "svx/fmtools.hxx" 33*cdf0e10cSrcweir #include "fmservs.hxx" 34*cdf0e10cSrcweir #ifndef _SVX_FMPROP_HRC 35*cdf0e10cSrcweir #include "fmprop.hrc" 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #include "fmpgeimp.hxx" 38*cdf0e10cSrcweir #include "fmitems.hxx" 39*cdf0e10cSrcweir #include "fmundo.hxx" 40*cdf0e10cSrcweir #include <vcl/waitobj.hxx> 41*cdf0e10cSrcweir #include <com/sun/star/form/XLoadable.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 43*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDDB_PRIVILEGE_HPP_ 44*cdf0e10cSrcweir #include <com/sun/star/sdbcx/Privilege.hpp> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertySet.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/beans/XFastPropertySet.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 51*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 52*cdf0e10cSrcweir #include <com/sun/star/awt/XTabControllerModel.hpp> 53*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 54*cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 55*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 56*cdf0e10cSrcweir #include <svl/whiter.hxx> 57*cdf0e10cSrcweir #include <sfx2/app.hxx> 58*cdf0e10cSrcweir #include <svl/intitem.hxx> 59*cdf0e10cSrcweir #include <svl/visitem.hxx> 60*cdf0e10cSrcweir #include <unotools/moduleoptions.hxx> 61*cdf0e10cSrcweir #include <sfx2/objface.hxx> 62*cdf0e10cSrcweir #include <sfx2/request.hxx> 63*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 64*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 65*cdf0e10cSrcweir #include <svx/svdobj.hxx> 66*cdf0e10cSrcweir #include <svx/fmpage.hxx> 67*cdf0e10cSrcweir #include "svx/svditer.hxx" 68*cdf0e10cSrcweir #include "fmobj.hxx" 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC 71*cdf0e10cSrcweir #include <svx/svxids.hrc> 72*cdf0e10cSrcweir #endif 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir #ifndef _SVX_FMRESIDS_HRC 75*cdf0e10cSrcweir #include "svx/fmresids.hrc" 76*cdf0e10cSrcweir #endif 77*cdf0e10cSrcweir #include "fmexch.hxx" 78*cdf0e10cSrcweir #include <svx/fmglob.hxx> 79*cdf0e10cSrcweir #include <svl/eitem.hxx> 80*cdf0e10cSrcweir #include <tools/shl.hxx> 81*cdf0e10cSrcweir #include <tools/diagnose_ex.h> 82*cdf0e10cSrcweir #include <svx/svdpage.hxx> 83*cdf0e10cSrcweir #include <svx/fmmodel.hxx> 84*cdf0e10cSrcweir #include <svx/dialmgr.hxx> 85*cdf0e10cSrcweir #include "fmshimp.hxx" 86*cdf0e10cSrcweir #include <svx/svdpagv.hxx> 87*cdf0e10cSrcweir #include <sfx2/objitem.hxx> 88*cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 89*cdf0e10cSrcweir #include <vcl/sound.hxx> 90*cdf0e10cSrcweir #include "fmexpl.hxx" 91*cdf0e10cSrcweir #include "formcontrolling.hxx" 92*cdf0e10cSrcweir #include <svl/numuno.hxx> 93*cdf0e10cSrcweir #include <connectivity/dbtools.hxx> 94*cdf0e10cSrcweir #include <comphelper/types.hxx> 95*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 96*cdf0e10cSrcweir #include "fmdocumentclassification.hxx" 97*cdf0e10cSrcweir #include "formtoolbars.hxx" 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001 100*cdf0e10cSrcweir #include <svx/dialogs.hrc> //CHINA001 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir #include "svx/sdrobjectfilter.hxx" 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir #define HANDLE_SQL_ERRORS( action, successflag, context, message ) \ 105*cdf0e10cSrcweir try \ 106*cdf0e10cSrcweir { \ 107*cdf0e10cSrcweir successflag = sal_False; \ 108*cdf0e10cSrcweir action; \ 109*cdf0e10cSrcweir successflag = sal_True; \ 110*cdf0e10cSrcweir } \ 111*cdf0e10cSrcweir catch(::com::sun::star::sdbc::SQLException& e) \ 112*cdf0e10cSrcweir { \ 113*cdf0e10cSrcweir ::com::sun::star::sdb::SQLContext eExtendedInfo = \ 114*cdf0e10cSrcweir GetImpl()->prependContextInfo(e, Reference< XInterface > (), context, ::rtl::OUString()); \ 115*cdf0e10cSrcweir displayException(eExtendedInfo); \ 116*cdf0e10cSrcweir } \ 117*cdf0e10cSrcweir catch(Exception&) \ 118*cdf0e10cSrcweir { \ 119*cdf0e10cSrcweir DBG_ERROR(message); \ 120*cdf0e10cSrcweir } \ 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir #define DO_SAFE_WITH_ERROR( action, message ) try { action; } catch(Exception&) { DBG_ERROR(message); } 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir #define FmFormShell 126*cdf0e10cSrcweir #include "svxslots.hxx" 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC 129*cdf0e10cSrcweir #include <svx/svxids.hrc> 130*cdf0e10cSrcweir #endif 131*cdf0e10cSrcweir #include "tbxform.hxx" 132*cdf0e10cSrcweir #include <comphelper/property.hxx> 133*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir // wird fuer Invalidate verwendet -> mitpflegen 136*cdf0e10cSrcweir // aufsteigend sortieren !!!!!! 137*cdf0e10cSrcweir sal_uInt16 ControllerSlotMap[] = // slots des Controllers 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir SID_FM_CONFIG, 140*cdf0e10cSrcweir SID_FM_PUSHBUTTON, 141*cdf0e10cSrcweir SID_FM_RADIOBUTTON, 142*cdf0e10cSrcweir SID_FM_CHECKBOX, 143*cdf0e10cSrcweir SID_FM_FIXEDTEXT, 144*cdf0e10cSrcweir SID_FM_GROUPBOX, 145*cdf0e10cSrcweir SID_FM_EDIT, 146*cdf0e10cSrcweir SID_FM_LISTBOX, 147*cdf0e10cSrcweir SID_FM_COMBOBOX, 148*cdf0e10cSrcweir SID_FM_DBGRID, 149*cdf0e10cSrcweir SID_FM_IMAGEBUTTON, 150*cdf0e10cSrcweir SID_FM_FILECONTROL, 151*cdf0e10cSrcweir SID_FM_NAVIGATIONBAR, 152*cdf0e10cSrcweir SID_FM_CTL_PROPERTIES, 153*cdf0e10cSrcweir SID_FM_PROPERTIES, 154*cdf0e10cSrcweir SID_FM_TAB_DIALOG, 155*cdf0e10cSrcweir SID_FM_ADD_FIELD, 156*cdf0e10cSrcweir SID_FM_DESIGN_MODE, 157*cdf0e10cSrcweir SID_FM_SHOW_FMEXPLORER, 158*cdf0e10cSrcweir SID_FM_SHOW_PROPERTIES, 159*cdf0e10cSrcweir SID_FM_FMEXPLORER_CONTROL, 160*cdf0e10cSrcweir SID_FM_DATEFIELD, 161*cdf0e10cSrcweir SID_FM_TIMEFIELD, 162*cdf0e10cSrcweir SID_FM_NUMERICFIELD, 163*cdf0e10cSrcweir SID_FM_CURRENCYFIELD, 164*cdf0e10cSrcweir SID_FM_PATTERNFIELD, 165*cdf0e10cSrcweir SID_FM_OPEN_READONLY, 166*cdf0e10cSrcweir SID_FM_IMAGECONTROL, 167*cdf0e10cSrcweir SID_FM_USE_WIZARDS, 168*cdf0e10cSrcweir SID_FM_FORMATTEDFIELD, 169*cdf0e10cSrcweir SID_FM_FILTER_NAVIGATOR, 170*cdf0e10cSrcweir SID_FM_AUTOCONTROLFOCUS, 171*cdf0e10cSrcweir SID_FM_SCROLLBAR, 172*cdf0e10cSrcweir SID_FM_SPINBUTTON, 173*cdf0e10cSrcweir SID_FM_SHOW_DATANAVIGATOR, 174*cdf0e10cSrcweir SID_FM_DATANAVIGATOR_CONTROL, 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir 0 177*cdf0e10cSrcweir }; 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 180*cdf0e10cSrcweir using namespace ::com::sun::star::awt; 181*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 182*cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx; 183*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 184*cdf0e10cSrcweir using namespace ::com::sun::star::form; 185*cdf0e10cSrcweir using namespace ::com::sun::star::form::runtime; 186*cdf0e10cSrcweir using namespace ::com::sun::star::frame; 187*cdf0e10cSrcweir using namespace ::svxform; 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir //======================================================================== 190*cdf0e10cSrcweir // class FmDesignModeChangedHint 191*cdf0e10cSrcweir //======================================================================== 192*cdf0e10cSrcweir TYPEINIT1( FmDesignModeChangedHint, SfxHint ); 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir //------------------------------------------------------------------------ 195*cdf0e10cSrcweir FmDesignModeChangedHint::FmDesignModeChangedHint( sal_Bool bDesMode ) 196*cdf0e10cSrcweir :m_bDesignMode( bDesMode ) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir //------------------------------------------------------------------------ 201*cdf0e10cSrcweir FmDesignModeChangedHint::~FmDesignModeChangedHint() 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir //======================================================================== 206*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_SHOW_DATABASEBAR = 0x00000001; 207*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_SHOW_FIELD = 0x00000002; 208*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_SHOW_PROPERTIES = 0x00000004; 209*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_SHOW_EXPLORER = 0x00000008; 210*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_SHOW_FILTERBAR = 0x00000010; 211*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_SHOW_FILTERNAVIGATOR = 0x00000020; 212*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR = 0x00000040; 213*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_TB_CONTROLS = 0x00000080; 214*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_TB_MORECONTROLS = 0x00000100; 215*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_TB_FORMDESIGN = 0x00000200; 216*cdf0e10cSrcweir const sal_uInt32 FM_UI_FEATURE_SHOW_DATANAVIGATOR = 0x00000400; 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir SFX_IMPL_INTERFACE(FmFormShell, SfxShell, SVX_RES(RID_STR_FORMSHELL)) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_NAVIGATION|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_READONLYDOC, 221*cdf0e10cSrcweir SVX_RES(RID_SVXTBX_FORM_NAVIGATION), 222*cdf0e10cSrcweir FM_UI_FEATURE_SHOW_DATABASEBAR ); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_NAVIGATION|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_READONLYDOC, 225*cdf0e10cSrcweir SVX_RES(RID_SVXTBX_FORM_FILTER), 226*cdf0e10cSrcweir FM_UI_FEATURE_SHOW_FILTERBAR ); 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_READONLYDOC, 229*cdf0e10cSrcweir SVX_RES( RID_SVXTBX_TEXT_CONTROL_ATTRIBUTES ), 230*cdf0e10cSrcweir FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR ); 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_ADD_FIELD, FM_UI_FEATURE_SHOW_FIELD); 233*cdf0e10cSrcweir SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_SHOW_PROPERTIES, FM_UI_FEATURE_SHOW_PROPERTIES); 234*cdf0e10cSrcweir SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_SHOW_FMEXPLORER, FM_UI_FEATURE_SHOW_EXPLORER); 235*cdf0e10cSrcweir SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_FILTER_NAVIGATOR, FM_UI_FEATURE_SHOW_FILTERNAVIGATOR); 236*cdf0e10cSrcweir SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_SHOW_DATANAVIGATOR, FM_UI_FEATURE_SHOW_DATANAVIGATOR); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD, 239*cdf0e10cSrcweir SVX_RES( RID_SVXTBX_CONTROLS ), 240*cdf0e10cSrcweir FM_UI_FEATURE_TB_CONTROLS ); 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD, 243*cdf0e10cSrcweir SVX_RES( RID_SVXTBX_MORECONTROLS ), 244*cdf0e10cSrcweir FM_UI_FEATURE_TB_MORECONTROLS ); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD, 247*cdf0e10cSrcweir SVX_RES( RID_SVXTBX_FORMDESIGN ), 248*cdf0e10cSrcweir FM_UI_FEATURE_TB_FORMDESIGN ); 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir //======================================================================== 252*cdf0e10cSrcweir TYPEINIT1(FmFormShell,SfxShell) 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir //------------------------------------------------------------------------ 255*cdf0e10cSrcweir FmFormShell::FmFormShell( SfxViewShell* _pParent, FmFormView* pView ) 256*cdf0e10cSrcweir :SfxShell(_pParent) 257*cdf0e10cSrcweir ,m_pImpl(new FmXFormShell(*this, _pParent->GetViewFrame())) 258*cdf0e10cSrcweir ,m_pFormView( pView ) 259*cdf0e10cSrcweir ,m_pFormModel( NULL ) 260*cdf0e10cSrcweir ,m_pParentShell(_pParent) 261*cdf0e10cSrcweir ,m_nLastSlot( 0 ) 262*cdf0e10cSrcweir ,m_bDesignMode( sal_True ) 263*cdf0e10cSrcweir ,m_bHasForms(sal_False) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir m_pImpl->acquire(); 266*cdf0e10cSrcweir SetPool( &SFX_APP()->GetPool() ); 267*cdf0e10cSrcweir SetName( String::CreateFromAscii( "Form" ) ); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir SetView(m_pFormView); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir //------------------------------------------------------------------------ 273*cdf0e10cSrcweir FmFormShell::~FmFormShell() 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir if ( m_pFormView ) 276*cdf0e10cSrcweir SetView( NULL ); 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir m_pImpl->dispose(); 279*cdf0e10cSrcweir m_pImpl->release(); 280*cdf0e10cSrcweir m_pImpl = NULL; 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir //------------------------------------------------------------------------ 284*cdf0e10cSrcweir void FmFormShell::NotifyMarkListChanged(FmFormView* pWhichView) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir FmNavViewMarksChanged aChangeNotification(pWhichView); 287*cdf0e10cSrcweir Broadcast(aChangeNotification); 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir //------------------------------------------------------------------------ 291*cdf0e10cSrcweir sal_uInt16 FmFormShell::PrepareClose(sal_Bool bUI, sal_Bool /*bForBrowsing*/) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir if ( GetImpl()->didPrepareClose() ) 294*cdf0e10cSrcweir // we already did a PrepareClose for the current modifications of the current form 295*cdf0e10cSrcweir // 2002-11-12 #104702# - fs@openoffice.org 296*cdf0e10cSrcweir return sal_True; 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir sal_Bool bResult = sal_True; 299*cdf0e10cSrcweir // Save the data records, not in DesignMode and FilterMode 300*cdf0e10cSrcweir if (!m_bDesignMode && !GetImpl()->isInFilterMode() && 301*cdf0e10cSrcweir m_pFormView && m_pFormView->GetActualOutDev() && 302*cdf0e10cSrcweir m_pFormView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir SdrPageView* pCurPageView = m_pFormView->GetSdrPageView(); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir // sal_uInt16 nPos = pCurPageView ? pCurPageView->GetWinList().Find((OutputDevice*)m_pFormView->GetActualOutDev()) : SDRPAGEVIEWWIN_NOTFOUND; 307*cdf0e10cSrcweir SdrPageWindow* pWindow = pCurPageView ? pCurPageView->FindPageWindow(*((OutputDevice*)m_pFormView->GetActualOutDev())) : 0L; 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir if(pWindow) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir // Zunaechst werden die aktuellen Inhalte der Controls gespeichert 312*cdf0e10cSrcweir // Wenn alles glatt gelaufen ist, werden die modifizierten Datensaetze gespeichert 313*cdf0e10cSrcweir if ( GetImpl()->getActiveController().is() ) 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir const ::svx::ControllerFeatures& rController = GetImpl()->getActiveControllerFeatures(); 316*cdf0e10cSrcweir if ( rController->commitCurrentControl() ) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir sal_Bool bModified = rController->isModifiedRow(); 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir if ( bModified && bUI ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir QueryBox aQry(NULL, SVX_RES(RID_QRY_SAVEMODIFIED)); 323*cdf0e10cSrcweir switch (aQry.Execute()) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir case RET_NO: 326*cdf0e10cSrcweir bModified = sal_False; 327*cdf0e10cSrcweir GetImpl()->didPrepareClose( sal_True ); 328*cdf0e10cSrcweir break; 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir case RET_CANCEL: 331*cdf0e10cSrcweir return sal_False; 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir case RET_NEWTASK: 334*cdf0e10cSrcweir return RET_NEWTASK; 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir if ( bModified ) 338*cdf0e10cSrcweir bResult = rController->commitCurrentRecord( ); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir return bResult; 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir //------------------------------------------------------------------------ 348*cdf0e10cSrcweir void FmFormShell::impl_setDesignMode(sal_Bool bDesign) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir if (m_pFormView) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir if (!bDesign) 353*cdf0e10cSrcweir m_nLastSlot = SID_FM_DESIGN_MODE; 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir GetImpl()->SetDesignMode(bDesign); 356*cdf0e10cSrcweir // mein m_bDesignMode wird auch von der Impl gesetzt ... 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir else 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir m_bHasForms = sal_False; 361*cdf0e10cSrcweir m_bDesignMode = bDesign; 362*cdf0e10cSrcweir UIFeatureChanged(); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetBindings().Invalidate(ControllerSlotMap); 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir //------------------------------------------------------------------------ 369*cdf0e10cSrcweir sal_Bool FmFormShell::HasUIFeature( sal_uInt32 nFeature ) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir sal_Bool bResult = sal_False; 372*cdf0e10cSrcweir if ((nFeature & FM_UI_FEATURE_SHOW_DATABASEBAR) == FM_UI_FEATURE_SHOW_DATABASEBAR) 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir // nur wenn auch formulare verfuegbar 375*cdf0e10cSrcweir bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && !GetImpl()->isInFilterMode(); 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir else if ((nFeature & FM_UI_FEATURE_SHOW_FILTERBAR) == FM_UI_FEATURE_SHOW_FILTERBAR) 378*cdf0e10cSrcweir { 379*cdf0e10cSrcweir // nur wenn auch formulare verfuegbar 380*cdf0e10cSrcweir bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && GetImpl()->isInFilterMode(); 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir else if ((nFeature & FM_UI_FEATURE_SHOW_FILTERNAVIGATOR) == FM_UI_FEATURE_SHOW_FILTERNAVIGATOR) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && GetImpl()->isInFilterMode(); 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir else if ((nFeature & FM_UI_FEATURE_SHOW_FIELD) == FM_UI_FEATURE_SHOW_FIELD) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir bResult = m_bDesignMode && m_pFormView && m_bHasForms; 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir else if ((nFeature & FM_UI_FEATURE_SHOW_PROPERTIES) == FM_UI_FEATURE_SHOW_PROPERTIES) 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir bResult = m_bDesignMode && m_pFormView && m_bHasForms; 393*cdf0e10cSrcweir } 394*cdf0e10cSrcweir else if ((nFeature & FM_UI_FEATURE_SHOW_EXPLORER) == FM_UI_FEATURE_SHOW_EXPLORER) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir bResult = m_bDesignMode; // OJ #101593# && m_pFormView && m_bHasForms; 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir else if ( ( nFeature & FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR ) == FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR ) 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir bResult = !GetImpl()->IsReadonlyDoc() && m_pImpl->IsActiveControl( true ); 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir else if ((nFeature & FM_UI_FEATURE_SHOW_DATANAVIGATOR) == FM_UI_FEATURE_SHOW_DATANAVIGATOR) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir bResult = GetImpl()->isEnhancedForm(); 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir else if ( ( ( nFeature & FM_UI_FEATURE_TB_CONTROLS ) == FM_UI_FEATURE_TB_CONTROLS ) 407*cdf0e10cSrcweir || ( ( nFeature & FM_UI_FEATURE_TB_MORECONTROLS ) == FM_UI_FEATURE_TB_MORECONTROLS ) 408*cdf0e10cSrcweir || ( ( nFeature & FM_UI_FEATURE_TB_FORMDESIGN ) == FM_UI_FEATURE_TB_FORMDESIGN ) 409*cdf0e10cSrcweir ) 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir bResult = sal_True; 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir return bResult; 415*cdf0e10cSrcweir } 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir //------------------------------------------------------------------------ 418*cdf0e10cSrcweir void FmFormShell::Execute(SfxRequest &rReq) 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 423*cdf0e10cSrcweir // MasterSlot setzen 424*cdf0e10cSrcweir switch( nSlot ) 425*cdf0e10cSrcweir { 426*cdf0e10cSrcweir case SID_FM_PUSHBUTTON: 427*cdf0e10cSrcweir case SID_FM_RADIOBUTTON: 428*cdf0e10cSrcweir case SID_FM_CHECKBOX: 429*cdf0e10cSrcweir case SID_FM_FIXEDTEXT: 430*cdf0e10cSrcweir case SID_FM_GROUPBOX: 431*cdf0e10cSrcweir case SID_FM_LISTBOX: 432*cdf0e10cSrcweir case SID_FM_COMBOBOX: 433*cdf0e10cSrcweir case SID_FM_NAVIGATIONBAR: 434*cdf0e10cSrcweir case SID_FM_EDIT: 435*cdf0e10cSrcweir case SID_FM_DBGRID: 436*cdf0e10cSrcweir case SID_FM_IMAGEBUTTON: 437*cdf0e10cSrcweir case SID_FM_IMAGECONTROL: 438*cdf0e10cSrcweir case SID_FM_FILECONTROL: 439*cdf0e10cSrcweir case SID_FM_DATEFIELD: 440*cdf0e10cSrcweir case SID_FM_TIMEFIELD: 441*cdf0e10cSrcweir case SID_FM_NUMERICFIELD: 442*cdf0e10cSrcweir case SID_FM_CURRENCYFIELD: 443*cdf0e10cSrcweir case SID_FM_PATTERNFIELD: 444*cdf0e10cSrcweir case SID_FM_FORMATTEDFIELD: 445*cdf0e10cSrcweir case SID_FM_SCROLLBAR: 446*cdf0e10cSrcweir case SID_FM_SPINBUTTON: 447*cdf0e10cSrcweir m_nLastSlot = nSlot; 448*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_FM_CONFIG ); 449*cdf0e10cSrcweir break; 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 453*cdf0e10cSrcweir // Identifier und Inventor des Uno-Controls setzen 454*cdf0e10cSrcweir sal_uInt16 nIdentifier = 0; 455*cdf0e10cSrcweir switch( nSlot ) 456*cdf0e10cSrcweir { 457*cdf0e10cSrcweir case SID_FM_CHECKBOX: 458*cdf0e10cSrcweir nIdentifier = OBJ_FM_CHECKBOX; 459*cdf0e10cSrcweir break; 460*cdf0e10cSrcweir case SID_FM_PUSHBUTTON: 461*cdf0e10cSrcweir nIdentifier = OBJ_FM_BUTTON; 462*cdf0e10cSrcweir break; 463*cdf0e10cSrcweir case SID_FM_FIXEDTEXT: 464*cdf0e10cSrcweir nIdentifier = OBJ_FM_FIXEDTEXT; 465*cdf0e10cSrcweir break; 466*cdf0e10cSrcweir case SID_FM_LISTBOX: 467*cdf0e10cSrcweir nIdentifier = OBJ_FM_LISTBOX; 468*cdf0e10cSrcweir break; 469*cdf0e10cSrcweir case SID_FM_EDIT: 470*cdf0e10cSrcweir nIdentifier = OBJ_FM_EDIT; 471*cdf0e10cSrcweir break; 472*cdf0e10cSrcweir case SID_FM_RADIOBUTTON: 473*cdf0e10cSrcweir nIdentifier = OBJ_FM_RADIOBUTTON; 474*cdf0e10cSrcweir break; 475*cdf0e10cSrcweir case SID_FM_GROUPBOX: 476*cdf0e10cSrcweir nIdentifier = OBJ_FM_GROUPBOX; 477*cdf0e10cSrcweir break; 478*cdf0e10cSrcweir case SID_FM_COMBOBOX: 479*cdf0e10cSrcweir nIdentifier = OBJ_FM_COMBOBOX; 480*cdf0e10cSrcweir break; 481*cdf0e10cSrcweir case SID_FM_NAVIGATIONBAR: 482*cdf0e10cSrcweir nIdentifier = OBJ_FM_NAVIGATIONBAR; 483*cdf0e10cSrcweir break; 484*cdf0e10cSrcweir case SID_FM_DBGRID: 485*cdf0e10cSrcweir nIdentifier = OBJ_FM_GRID; 486*cdf0e10cSrcweir break; 487*cdf0e10cSrcweir case SID_FM_IMAGEBUTTON: 488*cdf0e10cSrcweir nIdentifier = OBJ_FM_IMAGEBUTTON; 489*cdf0e10cSrcweir break; 490*cdf0e10cSrcweir case SID_FM_IMAGECONTROL: 491*cdf0e10cSrcweir nIdentifier = OBJ_FM_IMAGECONTROL; 492*cdf0e10cSrcweir break; 493*cdf0e10cSrcweir case SID_FM_FILECONTROL: 494*cdf0e10cSrcweir nIdentifier = OBJ_FM_FILECONTROL; 495*cdf0e10cSrcweir break; 496*cdf0e10cSrcweir case SID_FM_DATEFIELD: 497*cdf0e10cSrcweir nIdentifier = OBJ_FM_DATEFIELD; 498*cdf0e10cSrcweir break; 499*cdf0e10cSrcweir case SID_FM_TIMEFIELD: 500*cdf0e10cSrcweir nIdentifier = OBJ_FM_TIMEFIELD; 501*cdf0e10cSrcweir break; 502*cdf0e10cSrcweir case SID_FM_NUMERICFIELD: 503*cdf0e10cSrcweir nIdentifier = OBJ_FM_NUMERICFIELD; 504*cdf0e10cSrcweir break; 505*cdf0e10cSrcweir case SID_FM_CURRENCYFIELD: 506*cdf0e10cSrcweir nIdentifier = OBJ_FM_CURRENCYFIELD; 507*cdf0e10cSrcweir break; 508*cdf0e10cSrcweir case SID_FM_PATTERNFIELD: 509*cdf0e10cSrcweir nIdentifier = OBJ_FM_PATTERNFIELD; 510*cdf0e10cSrcweir break; 511*cdf0e10cSrcweir case SID_FM_FORMATTEDFIELD: 512*cdf0e10cSrcweir nIdentifier = OBJ_FM_FORMATTEDFIELD; 513*cdf0e10cSrcweir break; 514*cdf0e10cSrcweir case SID_FM_SCROLLBAR: 515*cdf0e10cSrcweir nIdentifier = OBJ_FM_SCROLLBAR; 516*cdf0e10cSrcweir break; 517*cdf0e10cSrcweir case SID_FM_SPINBUTTON: 518*cdf0e10cSrcweir nIdentifier = OBJ_FM_SPINBUTTON; 519*cdf0e10cSrcweir break; 520*cdf0e10cSrcweir } 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir switch ( nSlot ) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir case SID_FM_CHECKBOX: 525*cdf0e10cSrcweir case SID_FM_PUSHBUTTON: 526*cdf0e10cSrcweir case SID_FM_FIXEDTEXT: 527*cdf0e10cSrcweir case SID_FM_LISTBOX: 528*cdf0e10cSrcweir case SID_FM_EDIT: 529*cdf0e10cSrcweir case SID_FM_RADIOBUTTON: 530*cdf0e10cSrcweir case SID_FM_COMBOBOX: 531*cdf0e10cSrcweir case SID_FM_NAVIGATIONBAR: 532*cdf0e10cSrcweir case SID_FM_GROUPBOX: 533*cdf0e10cSrcweir case SID_FM_DBGRID: 534*cdf0e10cSrcweir case SID_FM_IMAGEBUTTON: 535*cdf0e10cSrcweir case SID_FM_IMAGECONTROL: 536*cdf0e10cSrcweir case SID_FM_FILECONTROL: 537*cdf0e10cSrcweir case SID_FM_DATEFIELD: 538*cdf0e10cSrcweir case SID_FM_TIMEFIELD: 539*cdf0e10cSrcweir case SID_FM_NUMERICFIELD: 540*cdf0e10cSrcweir case SID_FM_CURRENCYFIELD: 541*cdf0e10cSrcweir case SID_FM_PATTERNFIELD: 542*cdf0e10cSrcweir case SID_FM_FORMATTEDFIELD: 543*cdf0e10cSrcweir case SID_FM_SCROLLBAR: 544*cdf0e10cSrcweir case SID_FM_SPINBUTTON: 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_TOGGLECONTROLFOCUS, sal_False ); 547*cdf0e10cSrcweir if ( pGrabFocusItem && pGrabFocusItem->GetValue() ) 548*cdf0e10cSrcweir { // see below 549*cdf0e10cSrcweir SfxViewShell* pShell = GetViewShell(); 550*cdf0e10cSrcweir Window* pShellWnd = pShell ? pShell->GetWindow() : NULL; 551*cdf0e10cSrcweir if ( pShellWnd ) 552*cdf0e10cSrcweir pShellWnd->GrabFocus(); 553*cdf0e10cSrcweir break; 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir SfxUInt16Item aIdentifierItem( SID_FM_CONTROL_IDENTIFIER, nIdentifier ); 557*cdf0e10cSrcweir SfxUInt32Item aInventorItem( SID_FM_CONTROL_INVENTOR, FmFormInventor ); 558*cdf0e10cSrcweir const SfxPoolItem* pArgs[] = 559*cdf0e10cSrcweir { 560*cdf0e10cSrcweir &aIdentifierItem, &aInventorItem, NULL 561*cdf0e10cSrcweir }; 562*cdf0e10cSrcweir const SfxPoolItem* pInternalArgs[] = 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir NULL 565*cdf0e10cSrcweir }; 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( SID_FM_CREATE_CONTROL, SFX_CALLMODE_ASYNCHRON, 568*cdf0e10cSrcweir pArgs, rReq.GetModifier(), pInternalArgs ); 569*cdf0e10cSrcweir 570*cdf0e10cSrcweir if ( rReq.GetModifier() & KEY_MOD1 ) 571*cdf0e10cSrcweir { 572*cdf0e10cSrcweir // #99013# if selected with control key, return focus to current view 573*cdf0e10cSrcweir // do this asynchron, so that the creation can be finished first 574*cdf0e10cSrcweir // reusing the SID_FM_TOGGLECONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another 575*cdf0e10cSrcweir // name, so I do not really have a big problem with this .... 576*cdf0e10cSrcweir SfxBoolItem aGrabFocusIndicatorItem( SID_FM_TOGGLECONTROLFOCUS, sal_True ); 577*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( nSlot, SFX_CALLMODE_ASYNCHRON, 578*cdf0e10cSrcweir &aGrabFocusIndicatorItem, NULL ); 579*cdf0e10cSrcweir } 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir rReq.Done(); 582*cdf0e10cSrcweir } break; 583*cdf0e10cSrcweir } 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir // Individuelle Aktionen 586*cdf0e10cSrcweir switch( nSlot ) 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir case SID_FM_MORE_CONTROLS: 589*cdf0e10cSrcweir case SID_FM_FORM_DESIGN_TOOLS: 590*cdf0e10cSrcweir { 591*cdf0e10cSrcweir FormToolboxes aToolboxAccess( GetImpl()->getHostFrame() ); 592*cdf0e10cSrcweir aToolboxAccess.toggleToolbox( nSlot ); 593*cdf0e10cSrcweir rReq.Done(); 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir break; 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir case SID_FM_TOGGLECONTROLFOCUS: 598*cdf0e10cSrcweir { 599*cdf0e10cSrcweir FmFormView* pFormView = GetFormView(); 600*cdf0e10cSrcweir if ( !pFormView ) 601*cdf0e10cSrcweir break; 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir // if we execute this ourself, then either the application does not implement an own handling for this, 604*cdf0e10cSrcweir // of we're on the top of the dispatcher stack, which means a control has the focus. 605*cdf0e10cSrcweir // In the latter case, we put the focus to the document window, otherwise, we focus the first control 606*cdf0e10cSrcweir const bool bHasControlFocus = GetImpl()->HasControlFocus(); 607*cdf0e10cSrcweir if ( bHasControlFocus ) 608*cdf0e10cSrcweir { 609*cdf0e10cSrcweir const OutputDevice* pDevice = GetCurrentViewDevice(); 610*cdf0e10cSrcweir Window* pWindow = dynamic_cast< Window* >( const_cast< OutputDevice* >( pDevice ) ); 611*cdf0e10cSrcweir if ( pWindow ) 612*cdf0e10cSrcweir pWindow->GrabFocus(); 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir else 615*cdf0e10cSrcweir { 616*cdf0e10cSrcweir pFormView->GrabFirstControlFocus( ); 617*cdf0e10cSrcweir } 618*cdf0e10cSrcweir } 619*cdf0e10cSrcweir break; 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir case SID_FM_VIEW_AS_GRID: 622*cdf0e10cSrcweir GetImpl()->CreateExternalView(); 623*cdf0e10cSrcweir break; 624*cdf0e10cSrcweir case SID_FM_CONVERTTO_EDIT : 625*cdf0e10cSrcweir case SID_FM_CONVERTTO_BUTTON : 626*cdf0e10cSrcweir case SID_FM_CONVERTTO_FIXEDTEXT : 627*cdf0e10cSrcweir case SID_FM_CONVERTTO_LISTBOX : 628*cdf0e10cSrcweir case SID_FM_CONVERTTO_CHECKBOX : 629*cdf0e10cSrcweir case SID_FM_CONVERTTO_RADIOBUTTON : 630*cdf0e10cSrcweir case SID_FM_CONVERTTO_GROUPBOX : 631*cdf0e10cSrcweir case SID_FM_CONVERTTO_COMBOBOX : 632*cdf0e10cSrcweir case SID_FM_CONVERTTO_IMAGEBUTTON : 633*cdf0e10cSrcweir case SID_FM_CONVERTTO_FILECONTROL : 634*cdf0e10cSrcweir case SID_FM_CONVERTTO_DATE : 635*cdf0e10cSrcweir case SID_FM_CONVERTTO_TIME : 636*cdf0e10cSrcweir case SID_FM_CONVERTTO_NUMERIC : 637*cdf0e10cSrcweir case SID_FM_CONVERTTO_CURRENCY : 638*cdf0e10cSrcweir case SID_FM_CONVERTTO_PATTERN : 639*cdf0e10cSrcweir case SID_FM_CONVERTTO_IMAGECONTROL : 640*cdf0e10cSrcweir case SID_FM_CONVERTTO_FORMATTED : 641*cdf0e10cSrcweir case SID_FM_CONVERTTO_SCROLLBAR : 642*cdf0e10cSrcweir case SID_FM_CONVERTTO_SPINBUTTON : 643*cdf0e10cSrcweir case SID_FM_CONVERTTO_NAVIGATIONBAR : 644*cdf0e10cSrcweir GetImpl()->executeControlConversionSlot( nSlot ); 645*cdf0e10cSrcweir // nach dem Konvertieren die Selektion neu bestimmern, da sich ja das selektierte Objekt 646*cdf0e10cSrcweir // geaendert hat 647*cdf0e10cSrcweir GetImpl()->SetSelection(GetFormView()->GetMarkedObjectList()); 648*cdf0e10cSrcweir break; 649*cdf0e10cSrcweir case SID_FM_LEAVE_CREATE: 650*cdf0e10cSrcweir m_nLastSlot = 0; 651*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_FM_CONFIG ); 652*cdf0e10cSrcweir rReq.Done(); 653*cdf0e10cSrcweir break; 654*cdf0e10cSrcweir case SID_FM_SHOW_PROPERTY_BROWSER: 655*cdf0e10cSrcweir { 656*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pShowItem, SfxBoolItem, SID_FM_SHOW_PROPERTIES, sal_False ); 657*cdf0e10cSrcweir sal_Bool bShow = sal_True; 658*cdf0e10cSrcweir if ( pShowItem ) 659*cdf0e10cSrcweir bShow = pShowItem->GetValue(); 660*cdf0e10cSrcweir GetImpl()->ShowSelectionProperties( bShow ); 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir rReq.Done(); 663*cdf0e10cSrcweir } break; 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir case SID_FM_PROPERTIES: 666*cdf0e10cSrcweir { 667*cdf0e10cSrcweir // PropertyBrowser anzeigen 668*cdf0e10cSrcweir SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nSlot, sal_False); 669*cdf0e10cSrcweir sal_Bool bShow = pShowItem ? pShowItem->GetValue() : sal_True; 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir InterfaceBag aOnlyTheForm; 672*cdf0e10cSrcweir aOnlyTheForm.insert( Reference< XInterface >( GetImpl()->getCurrentForm(), UNO_QUERY ) ); 673*cdf0e10cSrcweir GetImpl()->setCurrentSelection( aOnlyTheForm ); 674*cdf0e10cSrcweir 675*cdf0e10cSrcweir GetImpl()->ShowSelectionProperties( bShow ); 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir rReq.Done(); 678*cdf0e10cSrcweir } break; 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir case SID_FM_CTL_PROPERTIES: 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nSlot, sal_False); 683*cdf0e10cSrcweir sal_Bool bShow = pShowItem ? pShowItem->GetValue() : sal_True; 684*cdf0e10cSrcweir 685*cdf0e10cSrcweir OSL_ENSURE( GetImpl()->onlyControlsAreMarked(), "FmFormShell::Execute: ControlProperties should be disabled!" ); 686*cdf0e10cSrcweir if ( bShow ) 687*cdf0e10cSrcweir GetImpl()->selectLastMarkedControls(); 688*cdf0e10cSrcweir GetImpl()->ShowSelectionProperties( bShow ); 689*cdf0e10cSrcweir 690*cdf0e10cSrcweir rReq.Done(); 691*cdf0e10cSrcweir } break; 692*cdf0e10cSrcweir case SID_FM_SHOW_PROPERTIES: 693*cdf0e10cSrcweir case SID_FM_ADD_FIELD: 694*cdf0e10cSrcweir case SID_FM_FILTER_NAVIGATOR: 695*cdf0e10cSrcweir case SID_FM_SHOW_DATANAVIGATOR : 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->ChildWindowExecute( rReq ); 698*cdf0e10cSrcweir rReq.Done(); 699*cdf0e10cSrcweir } break; 700*cdf0e10cSrcweir case SID_FM_SHOW_FMEXPLORER: 701*cdf0e10cSrcweir { 702*cdf0e10cSrcweir if (!m_pFormView) // setzen der ::com::sun::star::sdbcx::View Forcieren 703*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_CREATE_SW_DRAWVIEW); 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->ChildWindowExecute(rReq); 706*cdf0e10cSrcweir rReq.Done(); 707*cdf0e10cSrcweir } 708*cdf0e10cSrcweir break; 709*cdf0e10cSrcweir 710*cdf0e10cSrcweir case SID_FM_TAB_DIALOG: 711*cdf0e10cSrcweir { 712*cdf0e10cSrcweir GetImpl()->ExecuteTabOrderDialog( Reference< XTabControllerModel >( GetImpl()->getCurrentForm(), UNO_QUERY ) ); 713*cdf0e10cSrcweir rReq.Done(); 714*cdf0e10cSrcweir } 715*cdf0e10cSrcweir break; 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir case SID_FM_DESIGN_MODE: 718*cdf0e10cSrcweir { 719*cdf0e10cSrcweir SFX_REQUEST_ARG(rReq, pDesignItem, SfxBoolItem, nSlot, sal_False); 720*cdf0e10cSrcweir sal_Bool bDesignMode = pDesignItem ? pDesignItem->GetValue() : !m_bDesignMode; 721*cdf0e10cSrcweir SetDesignMode( bDesignMode ); 722*cdf0e10cSrcweir if ( m_bDesignMode == bDesignMode ) 723*cdf0e10cSrcweir rReq.Done(); 724*cdf0e10cSrcweir 725*cdf0e10cSrcweir m_nLastSlot = SID_FM_DESIGN_MODE; 726*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_FM_CONFIG ); 727*cdf0e10cSrcweir } 728*cdf0e10cSrcweir break; 729*cdf0e10cSrcweir 730*cdf0e10cSrcweir case SID_FM_AUTOCONTROLFOCUS: 731*cdf0e10cSrcweir { 732*cdf0e10cSrcweir FmFormModel* pModel = GetFormModel(); 733*cdf0e10cSrcweir DBG_ASSERT(pModel, "FmFormShell::Execute : invalid call !"); 734*cdf0e10cSrcweir // should have been disabled in GetState if we don't have a FormModel 735*cdf0e10cSrcweir pModel->SetAutoControlFocus( !pModel->GetAutoControlFocus() ); 736*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_AUTOCONTROLFOCUS); 737*cdf0e10cSrcweir } 738*cdf0e10cSrcweir break; 739*cdf0e10cSrcweir case SID_FM_OPEN_READONLY: 740*cdf0e10cSrcweir { 741*cdf0e10cSrcweir FmFormModel* pModel = GetFormModel(); 742*cdf0e10cSrcweir DBG_ASSERT(pModel, "FmFormShell::Execute : invalid call !"); 743*cdf0e10cSrcweir // should have been disabled in GetState if we don't have a FormModel 744*cdf0e10cSrcweir pModel->SetOpenInDesignMode( !pModel->GetOpenInDesignMode() ); 745*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_OPEN_READONLY); 746*cdf0e10cSrcweir } 747*cdf0e10cSrcweir break; 748*cdf0e10cSrcweir case SID_FM_USE_WIZARDS: 749*cdf0e10cSrcweir { 750*cdf0e10cSrcweir GetImpl()->SetWizardUsing(!GetImpl()->GetWizardUsing()); 751*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_USE_WIZARDS); 752*cdf0e10cSrcweir } 753*cdf0e10cSrcweir break; 754*cdf0e10cSrcweir case SID_FM_SEARCH: 755*cdf0e10cSrcweir { 756*cdf0e10cSrcweir const ::svx::ControllerFeatures& rController = GetImpl()->getActiveControllerFeatures(); 757*cdf0e10cSrcweir if ( rController->commitCurrentControl() && rController->commitCurrentRecord() ) 758*cdf0e10cSrcweir GetImpl()->ExecuteSearch(); 759*cdf0e10cSrcweir rReq.Done(); 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir break; 762*cdf0e10cSrcweir 763*cdf0e10cSrcweir case SID_FM_RECORD_FIRST: 764*cdf0e10cSrcweir case SID_FM_RECORD_PREV: 765*cdf0e10cSrcweir case SID_FM_RECORD_NEXT: 766*cdf0e10cSrcweir case SID_FM_RECORD_LAST: 767*cdf0e10cSrcweir case SID_FM_RECORD_NEW: 768*cdf0e10cSrcweir case SID_FM_REFRESH: 769*cdf0e10cSrcweir case SID_FM_REFRESH_FORM_CONTROL: 770*cdf0e10cSrcweir case SID_FM_RECORD_DELETE: 771*cdf0e10cSrcweir case SID_FM_RECORD_UNDO: 772*cdf0e10cSrcweir case SID_FM_RECORD_SAVE: 773*cdf0e10cSrcweir case SID_FM_REMOVE_FILTER_SORT: 774*cdf0e10cSrcweir case SID_FM_SORTDOWN: 775*cdf0e10cSrcweir case SID_FM_SORTUP: 776*cdf0e10cSrcweir case SID_FM_AUTOFILTER: 777*cdf0e10cSrcweir case SID_FM_ORDERCRIT: 778*cdf0e10cSrcweir case SID_FM_FORM_FILTERED: 779*cdf0e10cSrcweir { 780*cdf0e10cSrcweir GetImpl()->ExecuteFormSlot( nSlot ); 781*cdf0e10cSrcweir rReq.Done(); 782*cdf0e10cSrcweir } 783*cdf0e10cSrcweir break; 784*cdf0e10cSrcweir 785*cdf0e10cSrcweir case SID_FM_RECORD_ABSOLUTE: 786*cdf0e10cSrcweir { 787*cdf0e10cSrcweir const ::svx::ControllerFeatures& rController = GetImpl()->getNavControllerFeatures(); 788*cdf0e10cSrcweir sal_Int32 nRecord = -1; 789*cdf0e10cSrcweir 790*cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 791*cdf0e10cSrcweir if ( pArgs ) 792*cdf0e10cSrcweir { 793*cdf0e10cSrcweir const SfxPoolItem* pItem; 794*cdf0e10cSrcweir if ( ( pArgs->GetItemState( FN_PARAM_1, sal_True, &pItem ) ) == SFX_ITEM_SET ) 795*cdf0e10cSrcweir { 796*cdf0e10cSrcweir const SfxInt32Item* pTypedItem = PTR_CAST( SfxInt32Item, pItem ); 797*cdf0e10cSrcweir if ( pTypedItem ) 798*cdf0e10cSrcweir nRecord = Max( pTypedItem->GetValue(), sal_Int32(0) ); 799*cdf0e10cSrcweir } 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir else 802*cdf0e10cSrcweir { 803*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 804*cdf0e10cSrcweir DBG_ASSERT( pFact, "no dialog factory!" ); 805*cdf0e10cSrcweir if ( pFact ) 806*cdf0e10cSrcweir { 807*cdf0e10cSrcweir ::std::auto_ptr< AbstractFmInputRecordNoDialog > dlg( pFact->CreateFmInputRecordNoDialog( NULL ) ); 808*cdf0e10cSrcweir DBG_ASSERT( dlg.get(), "Dialogdiet fail!" ); 809*cdf0e10cSrcweir dlg->SetValue( rController->getCursor()->getRow() ); 810*cdf0e10cSrcweir if ( dlg->Execute() == RET_OK ) 811*cdf0e10cSrcweir nRecord = dlg->GetValue(); 812*cdf0e10cSrcweir 813*cdf0e10cSrcweir rReq.AppendItem( SfxInt32Item( FN_PARAM_1, nRecord ) ); 814*cdf0e10cSrcweir } 815*cdf0e10cSrcweir } 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir if ( nRecord != -1 ) 818*cdf0e10cSrcweir rController->execute( nSlot, ::rtl::OUString::createFromAscii( "Position" ), makeAny( (sal_Int32)nRecord ) ); 819*cdf0e10cSrcweir 820*cdf0e10cSrcweir rReq.Done(); 821*cdf0e10cSrcweir } break; 822*cdf0e10cSrcweir case SID_FM_FILTER_EXECUTE: 823*cdf0e10cSrcweir case SID_FM_FILTER_EXIT: 824*cdf0e10cSrcweir { 825*cdf0e10cSrcweir sal_Bool bCancelled = ( SID_FM_FILTER_EXIT == nSlot ); 826*cdf0e10cSrcweir sal_Bool bReopenNavigator = sal_False; 827*cdf0e10cSrcweir 828*cdf0e10cSrcweir if ( !bCancelled ) 829*cdf0e10cSrcweir { 830*cdf0e10cSrcweir // if the filter navigator is still open, we need to close it, so it can possibly 831*cdf0e10cSrcweir // commit it's most recent changes 832*cdf0e10cSrcweir if ( GetViewShell() && GetViewShell()->GetViewFrame() ) 833*cdf0e10cSrcweir if ( GetViewShell()->GetViewFrame()->HasChildWindow( SID_FM_FILTER_NAVIGATOR ) ) 834*cdf0e10cSrcweir { 835*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->ToggleChildWindow( SID_FM_FILTER_NAVIGATOR ); 836*cdf0e10cSrcweir bReopenNavigator = sal_True; 837*cdf0e10cSrcweir } 838*cdf0e10cSrcweir 839*cdf0e10cSrcweir Reference< runtime::XFormController > xController( GetImpl()->getActiveController() ); 840*cdf0e10cSrcweir 841*cdf0e10cSrcweir if ( GetViewShell()->GetViewFrame()->HasChildWindow( SID_FM_FILTER_NAVIGATOR ) 842*cdf0e10cSrcweir // closing the window was denied, for instance because of a invalid criterion 843*cdf0e10cSrcweir 844*cdf0e10cSrcweir || ( xController.is() 845*cdf0e10cSrcweir && !GetImpl()->getActiveControllerFeatures()->commitCurrentControl( ) 846*cdf0e10cSrcweir ) 847*cdf0e10cSrcweir // committing the controller was denied 848*cdf0e10cSrcweir ) 849*cdf0e10cSrcweir { 850*cdf0e10cSrcweir rReq.Done(); 851*cdf0e10cSrcweir break; 852*cdf0e10cSrcweir } 853*cdf0e10cSrcweir } 854*cdf0e10cSrcweir 855*cdf0e10cSrcweir GetImpl()->stopFiltering( !bCancelled ); 856*cdf0e10cSrcweir rReq.Done(); 857*cdf0e10cSrcweir 858*cdf0e10cSrcweir if ( bReopenNavigator ) 859*cdf0e10cSrcweir // we closed the navigator only to implicitly commit it (as we do not have another 860*cdf0e10cSrcweir // direct wire to it), but to the user, it should look it it was always open 861*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->ToggleChildWindow( SID_FM_FILTER_NAVIGATOR ); 862*cdf0e10cSrcweir } 863*cdf0e10cSrcweir break; 864*cdf0e10cSrcweir 865*cdf0e10cSrcweir case SID_FM_FILTER_START: 866*cdf0e10cSrcweir { 867*cdf0e10cSrcweir GetImpl()->startFiltering(); 868*cdf0e10cSrcweir rReq.Done(); 869*cdf0e10cSrcweir 870*cdf0e10cSrcweir // initially open the filter navigator, the whole form based filter is pretty useless without it 871*cdf0e10cSrcweir SfxBoolItem aIdentifierItem( SID_FM_FILTER_NAVIGATOR, sal_True ); 872*cdf0e10cSrcweir GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( SID_FM_FILTER_NAVIGATOR, SFX_CALLMODE_ASYNCHRON, 873*cdf0e10cSrcweir &aIdentifierItem, NULL ); 874*cdf0e10cSrcweir } break; 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir } 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir //------------------------------------------------------------------------ 879*cdf0e10cSrcweir void FmFormShell::GetState(SfxItemSet &rSet) 880*cdf0e10cSrcweir { 881*cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 882*cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 883*cdf0e10cSrcweir while ( nWhich ) 884*cdf0e10cSrcweir { 885*cdf0e10cSrcweir switch( nWhich ) 886*cdf0e10cSrcweir { 887*cdf0e10cSrcweir case SID_FM_MORE_CONTROLS: 888*cdf0e10cSrcweir case SID_FM_FORM_DESIGN_TOOLS: 889*cdf0e10cSrcweir { 890*cdf0e10cSrcweir FormToolboxes aToolboxAccess( GetImpl()->getHostFrame() ); 891*cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, aToolboxAccess.isToolboxVisible( nWhich ) ) ); 892*cdf0e10cSrcweir } 893*cdf0e10cSrcweir break; 894*cdf0e10cSrcweir 895*cdf0e10cSrcweir case SID_FM_FILTER_EXECUTE: 896*cdf0e10cSrcweir case SID_FM_FILTER_EXIT: 897*cdf0e10cSrcweir if (!GetImpl()->isInFilterMode()) 898*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 899*cdf0e10cSrcweir break; 900*cdf0e10cSrcweir 901*cdf0e10cSrcweir case SID_FM_USE_WIZARDS: 902*cdf0e10cSrcweir if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) 903*cdf0e10cSrcweir rSet.Put( SfxVisibilityItem( nWhich, sal_False ) ); 904*cdf0e10cSrcweir else if (!GetFormModel()) 905*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 906*cdf0e10cSrcweir else 907*cdf0e10cSrcweir rSet.Put( SfxBoolItem(nWhich, GetImpl()->GetWizardUsing() ) ); 908*cdf0e10cSrcweir break; 909*cdf0e10cSrcweir case SID_FM_AUTOCONTROLFOCUS: 910*cdf0e10cSrcweir if (!GetFormModel()) 911*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 912*cdf0e10cSrcweir else 913*cdf0e10cSrcweir rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetAutoControlFocus() ) ); 914*cdf0e10cSrcweir break; 915*cdf0e10cSrcweir case SID_FM_OPEN_READONLY: 916*cdf0e10cSrcweir if (!GetFormModel()) 917*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 918*cdf0e10cSrcweir else 919*cdf0e10cSrcweir rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetOpenInDesignMode() ) ); 920*cdf0e10cSrcweir break; 921*cdf0e10cSrcweir 922*cdf0e10cSrcweir case SID_FM_NAVIGATIONBAR: 923*cdf0e10cSrcweir case SID_FM_DBGRID: 924*cdf0e10cSrcweir if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) 925*cdf0e10cSrcweir { 926*cdf0e10cSrcweir rSet.Put( SfxVisibilityItem( nWhich, sal_False ) ); 927*cdf0e10cSrcweir break; 928*cdf0e10cSrcweir } 929*cdf0e10cSrcweir // NO break! 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir case SID_FM_SCROLLBAR: 932*cdf0e10cSrcweir case SID_FM_IMAGECONTROL: 933*cdf0e10cSrcweir case SID_FM_FILECONTROL: 934*cdf0e10cSrcweir case SID_FM_CURRENCYFIELD: 935*cdf0e10cSrcweir case SID_FM_PATTERNFIELD: 936*cdf0e10cSrcweir case SID_FM_IMAGEBUTTON: 937*cdf0e10cSrcweir case SID_FM_RADIOBUTTON: 938*cdf0e10cSrcweir case SID_FM_COMBOBOX: 939*cdf0e10cSrcweir case SID_FM_GROUPBOX: 940*cdf0e10cSrcweir case SID_FM_CHECKBOX: 941*cdf0e10cSrcweir case SID_FM_PUSHBUTTON: 942*cdf0e10cSrcweir case SID_FM_FIXEDTEXT: 943*cdf0e10cSrcweir case SID_FM_LISTBOX: 944*cdf0e10cSrcweir case SID_FM_EDIT: 945*cdf0e10cSrcweir case SID_FM_DATEFIELD: 946*cdf0e10cSrcweir case SID_FM_TIMEFIELD: 947*cdf0e10cSrcweir case SID_FM_NUMERICFIELD: 948*cdf0e10cSrcweir case SID_FM_FORMATTEDFIELD: 949*cdf0e10cSrcweir case SID_FM_SPINBUTTON: 950*cdf0e10cSrcweir if (!m_bDesignMode) 951*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 952*cdf0e10cSrcweir else 953*cdf0e10cSrcweir { 954*cdf0e10cSrcweir sal_Bool bLayerLocked = sal_False; 955*cdf0e10cSrcweir if (m_pFormView) 956*cdf0e10cSrcweir { 957*cdf0e10cSrcweir // Ist der ::com::sun::star::drawing::Layer gelocked, so m???ssen die Slots disabled werden. #36897 958*cdf0e10cSrcweir SdrPageView* pPV = m_pFormView->GetSdrPageView(); 959*cdf0e10cSrcweir if (pPV != NULL) 960*cdf0e10cSrcweir bLayerLocked = pPV->IsLayerLocked(m_pFormView->GetActiveLayer()); 961*cdf0e10cSrcweir } 962*cdf0e10cSrcweir if (bLayerLocked) 963*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 964*cdf0e10cSrcweir else 965*cdf0e10cSrcweir rSet.Put( SfxBoolItem(nWhich, (nWhich==m_nLastSlot)) ); 966*cdf0e10cSrcweir } 967*cdf0e10cSrcweir break; 968*cdf0e10cSrcweir case SID_FM_FILTER_NAVIGATOR_CONTROL: 969*cdf0e10cSrcweir { 970*cdf0e10cSrcweir if (GetImpl()->isInFilterMode()) 971*cdf0e10cSrcweir rSet.Put(SfxObjectItem(nWhich, this)); 972*cdf0e10cSrcweir else 973*cdf0e10cSrcweir rSet.Put(SfxObjectItem(nWhich)); 974*cdf0e10cSrcweir } break; 975*cdf0e10cSrcweir case SID_FM_FIELDS_CONTROL: 976*cdf0e10cSrcweir case SID_FM_PROPERTY_CONTROL: 977*cdf0e10cSrcweir { 978*cdf0e10cSrcweir if (!m_bDesignMode || !m_pFormView || !m_bHasForms) 979*cdf0e10cSrcweir rSet.Put(SfxObjectItem(nWhich)); 980*cdf0e10cSrcweir else 981*cdf0e10cSrcweir rSet.Put(SfxObjectItem(nWhich, this)); 982*cdf0e10cSrcweir 983*cdf0e10cSrcweir } break; 984*cdf0e10cSrcweir case SID_FM_FMEXPLORER_CONTROL: 985*cdf0e10cSrcweir case SID_FM_DATANAVIGATOR_CONTROL : 986*cdf0e10cSrcweir { 987*cdf0e10cSrcweir if (!m_bDesignMode || !m_pFormView) 988*cdf0e10cSrcweir rSet.Put(SfxObjectItem(nWhich)); 989*cdf0e10cSrcweir else 990*cdf0e10cSrcweir rSet.Put(SfxObjectItem(nWhich, this)); 991*cdf0e10cSrcweir 992*cdf0e10cSrcweir } break; 993*cdf0e10cSrcweir case SID_FM_ADD_FIELD: 994*cdf0e10cSrcweir case SID_FM_SHOW_FMEXPLORER: 995*cdf0e10cSrcweir case SID_FM_SHOW_PROPERTIES: 996*cdf0e10cSrcweir case SID_FM_FILTER_NAVIGATOR: 997*cdf0e10cSrcweir case SID_FM_SHOW_DATANAVIGATOR: 998*cdf0e10cSrcweir { 999*cdf0e10cSrcweir if ( GetViewShell()->GetViewFrame()->KnowsChildWindow(nWhich) ) 1000*cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, GetViewShell()->GetViewFrame()->HasChildWindow(nWhich)) ); 1001*cdf0e10cSrcweir else 1002*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1003*cdf0e10cSrcweir } break; 1004*cdf0e10cSrcweir 1005*cdf0e10cSrcweir case SID_FM_SHOW_PROPERTY_BROWSER: 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir rSet.Put(SfxBoolItem(GetImpl()->IsPropBrwOpen())); 1008*cdf0e10cSrcweir } 1009*cdf0e10cSrcweir break; 1010*cdf0e10cSrcweir 1011*cdf0e10cSrcweir case SID_FM_CTL_PROPERTIES: 1012*cdf0e10cSrcweir { 1013*cdf0e10cSrcweir // der Impl eventuell die Moeglichjkeit geben, ihre an der aktuellen MarkList ausgerichteten Objekte 1014*cdf0e10cSrcweir // auf den neuesten Stand zu bringen 1015*cdf0e10cSrcweir if (GetImpl()->IsSelectionUpdatePending()) 1016*cdf0e10cSrcweir GetImpl()->ForceUpdateSelection(sal_False); 1017*cdf0e10cSrcweir 1018*cdf0e10cSrcweir if ( !m_pFormView || !m_bDesignMode || !GetImpl()->onlyControlsAreMarked() ) 1019*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1020*cdf0e10cSrcweir else 1021*cdf0e10cSrcweir { 1022*cdf0e10cSrcweir sal_Bool bChecked = GetImpl()->IsPropBrwOpen() && !GetImpl()->isSolelySelected( GetImpl()->getCurrentForm() ); 1023*cdf0e10cSrcweir // if the property browser is open, and only controls are marked, and the current selection 1024*cdf0e10cSrcweir // does not consist of only the current form, then the current selection is the (composition of) 1025*cdf0e10cSrcweir // the currently marked controls 1026*cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bChecked ) ); 1027*cdf0e10cSrcweir } 1028*cdf0e10cSrcweir } break; 1029*cdf0e10cSrcweir 1030*cdf0e10cSrcweir case SID_FM_PROPERTIES: 1031*cdf0e10cSrcweir { 1032*cdf0e10cSrcweir // der Impl eventuell die Moeglichjkeit geben, ihre an der aktuellen MarkList ausgerichteten Objekte 1033*cdf0e10cSrcweir // auf den neuesten Stand zu bringen 1034*cdf0e10cSrcweir if (GetImpl()->IsSelectionUpdatePending()) 1035*cdf0e10cSrcweir GetImpl()->ForceUpdateSelection(sal_False); 1036*cdf0e10cSrcweir 1037*cdf0e10cSrcweir if ( !m_pFormView || !m_bDesignMode || !GetImpl()->getCurrentForm().is() ) 1038*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1039*cdf0e10cSrcweir else 1040*cdf0e10cSrcweir { 1041*cdf0e10cSrcweir sal_Bool bChecked = GetImpl()->IsPropBrwOpen() && GetImpl()->isSolelySelected( GetImpl()->getCurrentForm() ); 1042*cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, bChecked)); 1043*cdf0e10cSrcweir } 1044*cdf0e10cSrcweir } break; 1045*cdf0e10cSrcweir case SID_FM_TAB_DIALOG: 1046*cdf0e10cSrcweir // der Impl eventuell die Moeglichjkeit geben, ihre an der aktuellen MarkList ausgerichteten Objekte 1047*cdf0e10cSrcweir // auf den neuesten Stand zu bringen 1048*cdf0e10cSrcweir if (GetImpl()->IsSelectionUpdatePending()) 1049*cdf0e10cSrcweir GetImpl()->ForceUpdateSelection(sal_False); 1050*cdf0e10cSrcweir 1051*cdf0e10cSrcweir if (!m_pFormView || !m_bDesignMode || !GetImpl()->getCurrentForm().is() ) 1052*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1053*cdf0e10cSrcweir break; 1054*cdf0e10cSrcweir case SID_FM_CONFIG: 1055*cdf0e10cSrcweir rSet.Put(SfxUInt16Item(nWhich, m_nLastSlot)); 1056*cdf0e10cSrcweir break; 1057*cdf0e10cSrcweir case SID_FM_DESIGN_MODE: 1058*cdf0e10cSrcweir if (!m_pFormView || GetImpl()->IsReadonlyDoc() ) 1059*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1060*cdf0e10cSrcweir else 1061*cdf0e10cSrcweir rSet.Put( SfxBoolItem(nWhich, m_bDesignMode) ); 1062*cdf0e10cSrcweir break; 1063*cdf0e10cSrcweir case SID_FM_SEARCH: 1064*cdf0e10cSrcweir case SID_FM_RECORD_FIRST: 1065*cdf0e10cSrcweir case SID_FM_RECORD_NEXT: 1066*cdf0e10cSrcweir case SID_FM_RECORD_PREV: 1067*cdf0e10cSrcweir case SID_FM_RECORD_LAST: 1068*cdf0e10cSrcweir case SID_FM_RECORD_NEW: 1069*cdf0e10cSrcweir case SID_FM_RECORD_DELETE: 1070*cdf0e10cSrcweir case SID_FM_RECORD_ABSOLUTE: 1071*cdf0e10cSrcweir case SID_FM_RECORD_TOTAL: 1072*cdf0e10cSrcweir case SID_FM_RECORD_SAVE: 1073*cdf0e10cSrcweir case SID_FM_RECORD_UNDO: 1074*cdf0e10cSrcweir case SID_FM_FORM_FILTERED: 1075*cdf0e10cSrcweir case SID_FM_REMOVE_FILTER_SORT: 1076*cdf0e10cSrcweir case SID_FM_SORTUP: 1077*cdf0e10cSrcweir case SID_FM_SORTDOWN: 1078*cdf0e10cSrcweir case SID_FM_ORDERCRIT: 1079*cdf0e10cSrcweir case SID_FM_FILTER_START: 1080*cdf0e10cSrcweir case SID_FM_AUTOFILTER: 1081*cdf0e10cSrcweir case SID_FM_REFRESH: 1082*cdf0e10cSrcweir case SID_FM_REFRESH_FORM_CONTROL: 1083*cdf0e10cSrcweir case SID_FM_VIEW_AS_GRID: 1084*cdf0e10cSrcweir GetFormState(rSet,nWhich); 1085*cdf0e10cSrcweir break; 1086*cdf0e10cSrcweir 1087*cdf0e10cSrcweir case SID_FM_CHANGECONTROLTYPE: 1088*cdf0e10cSrcweir { 1089*cdf0e10cSrcweir if ( !m_pFormView || !m_bDesignMode ) 1090*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1091*cdf0e10cSrcweir else 1092*cdf0e10cSrcweir { 1093*cdf0e10cSrcweir if ( !GetImpl()->canConvertCurrentSelectionToControl( OBJ_FM_FIXEDTEXT ) ) 1094*cdf0e10cSrcweir // if it cannot be converted to a fixed text, it is no single control 1095*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1096*cdf0e10cSrcweir } 1097*cdf0e10cSrcweir } break; 1098*cdf0e10cSrcweir 1099*cdf0e10cSrcweir case SID_FM_CONVERTTO_FILECONTROL : 1100*cdf0e10cSrcweir case SID_FM_CONVERTTO_CURRENCY : 1101*cdf0e10cSrcweir case SID_FM_CONVERTTO_PATTERN : 1102*cdf0e10cSrcweir case SID_FM_CONVERTTO_IMAGECONTROL : 1103*cdf0e10cSrcweir case SID_FM_CONVERTTO_SCROLLBAR : 1104*cdf0e10cSrcweir case SID_FM_CONVERTTO_NAVIGATIONBAR : 1105*cdf0e10cSrcweir case SID_FM_CONVERTTO_IMAGEBUTTON : 1106*cdf0e10cSrcweir case SID_FM_CONVERTTO_EDIT : 1107*cdf0e10cSrcweir case SID_FM_CONVERTTO_BUTTON : 1108*cdf0e10cSrcweir case SID_FM_CONVERTTO_FIXEDTEXT : 1109*cdf0e10cSrcweir case SID_FM_CONVERTTO_LISTBOX : 1110*cdf0e10cSrcweir case SID_FM_CONVERTTO_CHECKBOX : 1111*cdf0e10cSrcweir case SID_FM_CONVERTTO_RADIOBUTTON : 1112*cdf0e10cSrcweir case SID_FM_CONVERTTO_GROUPBOX : 1113*cdf0e10cSrcweir case SID_FM_CONVERTTO_COMBOBOX : 1114*cdf0e10cSrcweir case SID_FM_CONVERTTO_DATE : 1115*cdf0e10cSrcweir case SID_FM_CONVERTTO_TIME : 1116*cdf0e10cSrcweir case SID_FM_CONVERTTO_NUMERIC : 1117*cdf0e10cSrcweir case SID_FM_CONVERTTO_FORMATTED : 1118*cdf0e10cSrcweir case SID_FM_CONVERTTO_SPINBUTTON : 1119*cdf0e10cSrcweir { 1120*cdf0e10cSrcweir if ( !m_pFormView || !m_bDesignMode || !GetImpl()->canConvertCurrentSelectionToControl( nWhich ) ) 1121*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1122*cdf0e10cSrcweir else 1123*cdf0e10cSrcweir { 1124*cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, sal_False ) ); 1125*cdf0e10cSrcweir // just to have a defined state (available and not checked) 1126*cdf0e10cSrcweir } 1127*cdf0e10cSrcweir } 1128*cdf0e10cSrcweir break; 1129*cdf0e10cSrcweir } 1130*cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1131*cdf0e10cSrcweir } 1132*cdf0e10cSrcweir } 1133*cdf0e10cSrcweir 1134*cdf0e10cSrcweir //------------------------------------------------------------------------ 1135*cdf0e10cSrcweir void FmFormShell::GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich) 1136*cdf0e10cSrcweir { 1137*cdf0e10cSrcweir if ( !GetImpl()->getNavController().is() 1138*cdf0e10cSrcweir || !isRowSetAlive(GetImpl()->getNavController()->getModel()) 1139*cdf0e10cSrcweir || !m_pFormView 1140*cdf0e10cSrcweir || m_bDesignMode 1141*cdf0e10cSrcweir || !GetImpl()->getActiveForm().is() 1142*cdf0e10cSrcweir || GetImpl()->isInFilterMode() 1143*cdf0e10cSrcweir ) 1144*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1145*cdf0e10cSrcweir else 1146*cdf0e10cSrcweir { 1147*cdf0e10cSrcweir sal_Bool bEnable = sal_False; 1148*cdf0e10cSrcweir try 1149*cdf0e10cSrcweir { 1150*cdf0e10cSrcweir switch (nWhich) 1151*cdf0e10cSrcweir { 1152*cdf0e10cSrcweir case SID_FM_VIEW_AS_GRID: 1153*cdf0e10cSrcweir if (GetImpl()->getHostFrame().is() && GetImpl()->getNavController().is()) 1154*cdf0e10cSrcweir { 1155*cdf0e10cSrcweir bEnable = sal_True; 1156*cdf0e10cSrcweir sal_Bool bDisplayingCurrent = 1157*cdf0e10cSrcweir GetImpl()->getInternalForm( 1158*cdf0e10cSrcweir Reference< XForm >( GetImpl()->getNavController()->getModel(), UNO_QUERY ) 1159*cdf0e10cSrcweir ) == GetImpl()->getExternallyDisplayedForm(); 1160*cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, bDisplayingCurrent)); 1161*cdf0e10cSrcweir } 1162*cdf0e10cSrcweir break; 1163*cdf0e10cSrcweir 1164*cdf0e10cSrcweir case SID_FM_SEARCH: 1165*cdf0e10cSrcweir { 1166*cdf0e10cSrcweir Reference< ::com::sun::star::beans::XPropertySet > xNavSet(GetImpl()->getActiveForm(), UNO_QUERY); 1167*cdf0e10cSrcweir sal_Int32 nCount = ::comphelper::getINT32(xNavSet->getPropertyValue(FM_PROP_ROWCOUNT)); 1168*cdf0e10cSrcweir bEnable = nCount != 0; 1169*cdf0e10cSrcweir } break; 1170*cdf0e10cSrcweir case SID_FM_RECORD_ABSOLUTE: 1171*cdf0e10cSrcweir case SID_FM_RECORD_TOTAL: 1172*cdf0e10cSrcweir { 1173*cdf0e10cSrcweir FeatureState aState; 1174*cdf0e10cSrcweir GetImpl()->getNavControllerFeatures()->getState( nWhich, aState ); 1175*cdf0e10cSrcweir if ( SID_FM_RECORD_ABSOLUTE == nWhich ) 1176*cdf0e10cSrcweir { 1177*cdf0e10cSrcweir sal_Int32 nPosition = 0; 1178*cdf0e10cSrcweir aState.State >>= nPosition; 1179*cdf0e10cSrcweir rSet.Put( SfxInt32Item( nWhich, nPosition ) ); 1180*cdf0e10cSrcweir } 1181*cdf0e10cSrcweir else if ( SID_FM_RECORD_TOTAL == nWhich ) 1182*cdf0e10cSrcweir { 1183*cdf0e10cSrcweir ::rtl::OUString sTotalCount; 1184*cdf0e10cSrcweir aState.State >>= sTotalCount; 1185*cdf0e10cSrcweir rSet.Put( SfxStringItem( nWhich, sTotalCount ) ); 1186*cdf0e10cSrcweir } 1187*cdf0e10cSrcweir bEnable = aState.Enabled; 1188*cdf0e10cSrcweir } 1189*cdf0e10cSrcweir break; 1190*cdf0e10cSrcweir 1191*cdf0e10cSrcweir // first, prev, next, last, and absolute affect the nav controller, not the 1192*cdf0e10cSrcweir // active controller 1193*cdf0e10cSrcweir case SID_FM_RECORD_FIRST: 1194*cdf0e10cSrcweir case SID_FM_RECORD_PREV: 1195*cdf0e10cSrcweir case SID_FM_RECORD_NEXT: 1196*cdf0e10cSrcweir case SID_FM_RECORD_LAST: 1197*cdf0e10cSrcweir case SID_FM_RECORD_NEW: 1198*cdf0e10cSrcweir case SID_FM_RECORD_SAVE: 1199*cdf0e10cSrcweir case SID_FM_RECORD_UNDO: 1200*cdf0e10cSrcweir case SID_FM_RECORD_DELETE: 1201*cdf0e10cSrcweir case SID_FM_REFRESH: 1202*cdf0e10cSrcweir case SID_FM_REFRESH_FORM_CONTROL: 1203*cdf0e10cSrcweir case SID_FM_REMOVE_FILTER_SORT: 1204*cdf0e10cSrcweir case SID_FM_SORTUP: 1205*cdf0e10cSrcweir case SID_FM_SORTDOWN: 1206*cdf0e10cSrcweir case SID_FM_AUTOFILTER: 1207*cdf0e10cSrcweir case SID_FM_ORDERCRIT: 1208*cdf0e10cSrcweir bEnable = GetImpl()->IsFormSlotEnabled( nWhich ); 1209*cdf0e10cSrcweir break; 1210*cdf0e10cSrcweir 1211*cdf0e10cSrcweir case SID_FM_FORM_FILTERED: 1212*cdf0e10cSrcweir { 1213*cdf0e10cSrcweir FeatureState aState; 1214*cdf0e10cSrcweir bEnable = GetImpl()->IsFormSlotEnabled( nWhich, &aState ); 1215*cdf0e10cSrcweir 1216*cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, ::comphelper::getBOOL( aState.State ) ) ); 1217*cdf0e10cSrcweir } 1218*cdf0e10cSrcweir break; 1219*cdf0e10cSrcweir 1220*cdf0e10cSrcweir case SID_FM_FILTER_START: 1221*cdf0e10cSrcweir bEnable = GetImpl()->getActiveControllerFeatures()->canDoFormFilter(); 1222*cdf0e10cSrcweir break; 1223*cdf0e10cSrcweir } 1224*cdf0e10cSrcweir } 1225*cdf0e10cSrcweir catch( const Exception& ) 1226*cdf0e10cSrcweir { 1227*cdf0e10cSrcweir DBG_ERROR( "FmFormShell::GetFormState: caught an exception while determining the state!" ); 1228*cdf0e10cSrcweir } 1229*cdf0e10cSrcweir if (!bEnable) 1230*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1231*cdf0e10cSrcweir } 1232*cdf0e10cSrcweir } 1233*cdf0e10cSrcweir 1234*cdf0e10cSrcweir //------------------------------------------------------------------------ 1235*cdf0e10cSrcweir FmFormPage* FmFormShell::GetCurPage() const 1236*cdf0e10cSrcweir { 1237*cdf0e10cSrcweir FmFormPage* pP = NULL; 1238*cdf0e10cSrcweir if (m_pFormView && m_pFormView->GetSdrPageView()) 1239*cdf0e10cSrcweir pP = PTR_CAST(FmFormPage,m_pFormView->GetSdrPageView()->GetPage()); 1240*cdf0e10cSrcweir return pP; 1241*cdf0e10cSrcweir } 1242*cdf0e10cSrcweir 1243*cdf0e10cSrcweir //------------------------------------------------------------------------ 1244*cdf0e10cSrcweir void FmFormShell::SetView( FmFormView* _pView ) 1245*cdf0e10cSrcweir { 1246*cdf0e10cSrcweir if ( m_pFormView ) 1247*cdf0e10cSrcweir { 1248*cdf0e10cSrcweir if ( IsActive() ) 1249*cdf0e10cSrcweir GetImpl()->viewDeactivated( *m_pFormView ); 1250*cdf0e10cSrcweir 1251*cdf0e10cSrcweir m_pFormView->SetFormShell( NULL, FmFormView::FormShellAccess() ); 1252*cdf0e10cSrcweir m_pFormView = NULL; 1253*cdf0e10cSrcweir m_pFormModel = NULL; 1254*cdf0e10cSrcweir } 1255*cdf0e10cSrcweir 1256*cdf0e10cSrcweir if ( !_pView ) 1257*cdf0e10cSrcweir return; 1258*cdf0e10cSrcweir 1259*cdf0e10cSrcweir m_pFormView = _pView; 1260*cdf0e10cSrcweir m_pFormView->SetFormShell( this, FmFormView::FormShellAccess() ); 1261*cdf0e10cSrcweir m_pFormModel = (FmFormModel*)m_pFormView->GetModel(); 1262*cdf0e10cSrcweir 1263*cdf0e10cSrcweir impl_setDesignMode( m_pFormView->IsDesignMode() ); 1264*cdf0e10cSrcweir 1265*cdf0e10cSrcweir // We activate our view if we are activated ourself, but sometimes the Activate precedes the SetView. 1266*cdf0e10cSrcweir // But here we know both the view and our activation state so we at least are able to pass the latter 1267*cdf0e10cSrcweir // to the former. 1268*cdf0e10cSrcweir // FS - 30.06.99 - 67308 1269*cdf0e10cSrcweir if ( IsActive() ) 1270*cdf0e10cSrcweir GetImpl()->viewActivated( *m_pFormView ); 1271*cdf0e10cSrcweir } 1272*cdf0e10cSrcweir 1273*cdf0e10cSrcweir //------------------------------------------------------------------------ 1274*cdf0e10cSrcweir void FmFormShell::DetermineForms(sal_Bool bInvalidate) 1275*cdf0e10cSrcweir { 1276*cdf0e10cSrcweir // Existieren Formulare auf der aktuellen Page 1277*cdf0e10cSrcweir sal_Bool bForms = GetImpl()->hasForms(); 1278*cdf0e10cSrcweir if (bForms != m_bHasForms) 1279*cdf0e10cSrcweir { 1280*cdf0e10cSrcweir m_bHasForms = bForms; 1281*cdf0e10cSrcweir if (bInvalidate) 1282*cdf0e10cSrcweir UIFeatureChanged(); 1283*cdf0e10cSrcweir } 1284*cdf0e10cSrcweir } 1285*cdf0e10cSrcweir 1286*cdf0e10cSrcweir //------------------------------------------------------------------------ 1287*cdf0e10cSrcweir sal_Bool FmFormShell::GetY2KState(sal_uInt16& nReturn) 1288*cdf0e10cSrcweir { 1289*cdf0e10cSrcweir return GetImpl()->GetY2KState(nReturn); 1290*cdf0e10cSrcweir } 1291*cdf0e10cSrcweir 1292*cdf0e10cSrcweir //------------------------------------------------------------------------ 1293*cdf0e10cSrcweir void FmFormShell::SetY2KState(sal_uInt16 n) 1294*cdf0e10cSrcweir { 1295*cdf0e10cSrcweir GetImpl()->SetY2KState(n); 1296*cdf0e10cSrcweir } 1297*cdf0e10cSrcweir 1298*cdf0e10cSrcweir //------------------------------------------------------------------------ 1299*cdf0e10cSrcweir void FmFormShell::Activate(sal_Bool bMDI) 1300*cdf0e10cSrcweir { 1301*cdf0e10cSrcweir SfxShell::Activate(bMDI); 1302*cdf0e10cSrcweir 1303*cdf0e10cSrcweir if ( m_pFormView ) 1304*cdf0e10cSrcweir GetImpl()->viewActivated( *m_pFormView, sal_True ); 1305*cdf0e10cSrcweir } 1306*cdf0e10cSrcweir 1307*cdf0e10cSrcweir //------------------------------------------------------------------------ 1308*cdf0e10cSrcweir void FmFormShell::Deactivate(sal_Bool bMDI) 1309*cdf0e10cSrcweir { 1310*cdf0e10cSrcweir SfxShell::Deactivate(bMDI); 1311*cdf0e10cSrcweir 1312*cdf0e10cSrcweir if ( m_pFormView ) 1313*cdf0e10cSrcweir GetImpl()->viewDeactivated( *m_pFormView, sal_False ); 1314*cdf0e10cSrcweir } 1315*cdf0e10cSrcweir 1316*cdf0e10cSrcweir //------------------------------------------------------------------------ 1317*cdf0e10cSrcweir void FmFormShell::ExecuteTextAttribute( SfxRequest& _rReq ) 1318*cdf0e10cSrcweir { 1319*cdf0e10cSrcweir m_pImpl->ExecuteTextAttribute( _rReq ); 1320*cdf0e10cSrcweir } 1321*cdf0e10cSrcweir 1322*cdf0e10cSrcweir //------------------------------------------------------------------------ 1323*cdf0e10cSrcweir void FmFormShell::GetTextAttributeState( SfxItemSet& _rSet ) 1324*cdf0e10cSrcweir { 1325*cdf0e10cSrcweir m_pImpl->GetTextAttributeState( _rSet ); 1326*cdf0e10cSrcweir } 1327*cdf0e10cSrcweir 1328*cdf0e10cSrcweir //------------------------------------------------------------------------ 1329*cdf0e10cSrcweir bool FmFormShell::IsActiveControl() const 1330*cdf0e10cSrcweir { 1331*cdf0e10cSrcweir return m_pImpl->IsActiveControl(); 1332*cdf0e10cSrcweir } 1333*cdf0e10cSrcweir 1334*cdf0e10cSrcweir //------------------------------------------------------------------------ 1335*cdf0e10cSrcweir void FmFormShell::ForgetActiveControl() 1336*cdf0e10cSrcweir { 1337*cdf0e10cSrcweir m_pImpl->ForgetActiveControl(); 1338*cdf0e10cSrcweir } 1339*cdf0e10cSrcweir 1340*cdf0e10cSrcweir //------------------------------------------------------------------------ 1341*cdf0e10cSrcweir void FmFormShell::SetControlActivationHandler( const Link& _rHdl ) 1342*cdf0e10cSrcweir { 1343*cdf0e10cSrcweir m_pImpl->SetControlActivationHandler( _rHdl ); 1344*cdf0e10cSrcweir } 1345*cdf0e10cSrcweir 1346*cdf0e10cSrcweir //------------------------------------------------------------------------ 1347*cdf0e10cSrcweir namespace 1348*cdf0e10cSrcweir { 1349*cdf0e10cSrcweir SdrUnoObj* lcl_findUnoObject( const SdrObjList& _rObjList, const Reference< XControlModel >& _rxModel ) 1350*cdf0e10cSrcweir { 1351*cdf0e10cSrcweir SdrObjListIter aIter( _rObjList ); 1352*cdf0e10cSrcweir while ( aIter.IsMore() ) 1353*cdf0e10cSrcweir { 1354*cdf0e10cSrcweir SdrObject* pObject = aIter.Next(); 1355*cdf0e10cSrcweir SdrUnoObj* pUnoObject = pObject ? PTR_CAST( SdrUnoObj, pObject ) : NULL; 1356*cdf0e10cSrcweir if ( !pUnoObject ) 1357*cdf0e10cSrcweir continue; 1358*cdf0e10cSrcweir 1359*cdf0e10cSrcweir Reference< XControlModel > xControlModel = pUnoObject->GetUnoControlModel(); 1360*cdf0e10cSrcweir if ( !xControlModel.is() ) 1361*cdf0e10cSrcweir continue; 1362*cdf0e10cSrcweir 1363*cdf0e10cSrcweir if ( _rxModel == xControlModel ) 1364*cdf0e10cSrcweir return pUnoObject; 1365*cdf0e10cSrcweir } 1366*cdf0e10cSrcweir return NULL; 1367*cdf0e10cSrcweir } 1368*cdf0e10cSrcweir } 1369*cdf0e10cSrcweir 1370*cdf0e10cSrcweir //------------------------------------------------------------------------ 1371*cdf0e10cSrcweir void FmFormShell::ToggleControlFocus( const SdrUnoObj& i_rUnoObject, const SdrView& i_rView, OutputDevice& i_rDevice ) const 1372*cdf0e10cSrcweir { 1373*cdf0e10cSrcweir try 1374*cdf0e10cSrcweir { 1375*cdf0e10cSrcweir // check if the focus currently is in a control 1376*cdf0e10cSrcweir // Well, okay, do it the other way 'round: Check whether the current control of the active controller 1377*cdf0e10cSrcweir // actually has the focus. This should be equivalent. 1378*cdf0e10cSrcweir const bool bHasControlFocus = GetImpl()->HasControlFocus(); 1379*cdf0e10cSrcweir 1380*cdf0e10cSrcweir if ( bHasControlFocus ) 1381*cdf0e10cSrcweir { 1382*cdf0e10cSrcweir Window* pWindow( dynamic_cast< Window* >( &i_rDevice ) ); 1383*cdf0e10cSrcweir OSL_ENSURE( pWindow, "FmFormShell::ToggleControlFocus: I need a Window, really!" ); 1384*cdf0e10cSrcweir if ( pWindow ) 1385*cdf0e10cSrcweir pWindow->GrabFocus(); 1386*cdf0e10cSrcweir } 1387*cdf0e10cSrcweir else 1388*cdf0e10cSrcweir { 1389*cdf0e10cSrcweir Reference< XControl > xControl; 1390*cdf0e10cSrcweir GetFormControl( i_rUnoObject.GetUnoControlModel(), i_rView, i_rDevice, xControl ); 1391*cdf0e10cSrcweir Reference< XWindow > xControlWindow( xControl, UNO_QUERY ); 1392*cdf0e10cSrcweir if ( xControlWindow.is() ) 1393*cdf0e10cSrcweir xControlWindow->setFocus(); 1394*cdf0e10cSrcweir } 1395*cdf0e10cSrcweir } 1396*cdf0e10cSrcweir catch( const Exception& ) 1397*cdf0e10cSrcweir { 1398*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1399*cdf0e10cSrcweir } 1400*cdf0e10cSrcweir } 1401*cdf0e10cSrcweir 1402*cdf0e10cSrcweir //------------------------------------------------------------------------ 1403*cdf0e10cSrcweir namespace 1404*cdf0e10cSrcweir { 1405*cdf0e10cSrcweir class FocusableControlsFilter : public ::svx::ISdrObjectFilter 1406*cdf0e10cSrcweir { 1407*cdf0e10cSrcweir public: 1408*cdf0e10cSrcweir FocusableControlsFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) 1409*cdf0e10cSrcweir :m_rView( i_rView ) 1410*cdf0e10cSrcweir ,m_rDevice( i_rDevice ) 1411*cdf0e10cSrcweir { 1412*cdf0e10cSrcweir } 1413*cdf0e10cSrcweir 1414*cdf0e10cSrcweir public: 1415*cdf0e10cSrcweir virtual bool includeObject( const SdrObject& i_rObject ) const 1416*cdf0e10cSrcweir { 1417*cdf0e10cSrcweir const SdrUnoObj* pUnoObj = dynamic_cast< const SdrUnoObj* >( &i_rObject ); 1418*cdf0e10cSrcweir if ( !pUnoObj ) 1419*cdf0e10cSrcweir return false; 1420*cdf0e10cSrcweir 1421*cdf0e10cSrcweir Reference< XControl > xControl = pUnoObj->GetUnoControl( m_rView, m_rDevice ); 1422*cdf0e10cSrcweir return FmXFormView::isFocusable( xControl ); 1423*cdf0e10cSrcweir } 1424*cdf0e10cSrcweir 1425*cdf0e10cSrcweir private: 1426*cdf0e10cSrcweir const SdrView& m_rView; 1427*cdf0e10cSrcweir const OutputDevice& m_rDevice; 1428*cdf0e10cSrcweir }; 1429*cdf0e10cSrcweir } 1430*cdf0e10cSrcweir 1431*cdf0e10cSrcweir //------------------------------------------------------------------------ 1432*cdf0e10cSrcweir ::std::auto_ptr< ::svx::ISdrObjectFilter > FmFormShell::CreateFocusableControlFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) const 1433*cdf0e10cSrcweir { 1434*cdf0e10cSrcweir ::std::auto_ptr< ::svx::ISdrObjectFilter > pFilter; 1435*cdf0e10cSrcweir 1436*cdf0e10cSrcweir if ( !i_rView.IsDesignMode() ) 1437*cdf0e10cSrcweir pFilter.reset( new FocusableControlsFilter( i_rView, i_rDevice ) ); 1438*cdf0e10cSrcweir 1439*cdf0e10cSrcweir return pFilter; 1440*cdf0e10cSrcweir } 1441*cdf0e10cSrcweir 1442*cdf0e10cSrcweir //------------------------------------------------------------------------ 1443*cdf0e10cSrcweir SdrUnoObj* FmFormShell::GetFormControl( const Reference< XControlModel >& _rxModel, const SdrView& _rView, const OutputDevice& _rDevice, Reference< XControl >& _out_rxControl ) const 1444*cdf0e10cSrcweir { 1445*cdf0e10cSrcweir if ( !_rxModel.is() ) 1446*cdf0e10cSrcweir return NULL; 1447*cdf0e10cSrcweir 1448*cdf0e10cSrcweir // we can only retrieve controls for SdrObjects which belong to page which is actually displayed in the given view 1449*cdf0e10cSrcweir SdrPageView* pPageView = _rView.GetSdrPageView(); 1450*cdf0e10cSrcweir SdrPage* pPage = pPageView ? pPageView->GetPage() : NULL; 1451*cdf0e10cSrcweir OSL_ENSURE( pPage, "FmFormShell::GetFormControl: no page displayed in the given view!" ); 1452*cdf0e10cSrcweir if ( !pPage ) 1453*cdf0e10cSrcweir return NULL; 1454*cdf0e10cSrcweir 1455*cdf0e10cSrcweir SdrUnoObj* pUnoObject = lcl_findUnoObject( *pPage, _rxModel ); 1456*cdf0e10cSrcweir if ( pUnoObject ) 1457*cdf0e10cSrcweir { 1458*cdf0e10cSrcweir _out_rxControl = pUnoObject->GetUnoControl( _rView, _rDevice ); 1459*cdf0e10cSrcweir return pUnoObject; 1460*cdf0e10cSrcweir } 1461*cdf0e10cSrcweir 1462*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1463*cdf0e10cSrcweir // perhaps we are fed with a control model which lives on a page other than the one displayed 1464*cdf0e10cSrcweir // in the given view. This is worth being reported as error, in non-product builds. 1465*cdf0e10cSrcweir FmFormModel* pModel = GetFormModel(); 1466*cdf0e10cSrcweir if ( pModel ) 1467*cdf0e10cSrcweir { 1468*cdf0e10cSrcweir sal_uInt16 pageCount = pModel->GetPageCount(); 1469*cdf0e10cSrcweir for ( sal_uInt16 page = 0; page < pageCount; ++page ) 1470*cdf0e10cSrcweir { 1471*cdf0e10cSrcweir pPage = pModel->GetPage( page ); 1472*cdf0e10cSrcweir OSL_ENSURE( pPage, "FmFormShell::GetFormControl: NULL page encountered!" ); 1473*cdf0e10cSrcweir if ( !pPage ) 1474*cdf0e10cSrcweir continue; 1475*cdf0e10cSrcweir 1476*cdf0e10cSrcweir pUnoObject = lcl_findUnoObject( *pPage, _rxModel ); 1477*cdf0e10cSrcweir OSL_ENSURE( !pUnoObject, "FmFormShell::GetFormControl: the given control model belongs to a wrong page (displayed elsewhere)!" ); 1478*cdf0e10cSrcweir } 1479*cdf0e10cSrcweir } 1480*cdf0e10cSrcweir #endif 1481*cdf0e10cSrcweir 1482*cdf0e10cSrcweir return NULL; 1483*cdf0e10cSrcweir } 1484*cdf0e10cSrcweir 1485*cdf0e10cSrcweir //------------------------------------------------------------------------ 1486*cdf0e10cSrcweir Reference< runtime::XFormController > FmFormShell::GetFormController( const Reference< XForm >& _rxForm, const SdrView& _rView, const OutputDevice& _rDevice ) const 1487*cdf0e10cSrcweir { 1488*cdf0e10cSrcweir const FmFormView* pFormView = dynamic_cast< const FmFormView* >( &_rView ); 1489*cdf0e10cSrcweir if ( !pFormView ) 1490*cdf0e10cSrcweir return NULL; 1491*cdf0e10cSrcweir 1492*cdf0e10cSrcweir return pFormView->GetFormController( _rxForm, _rDevice ); 1493*cdf0e10cSrcweir } 1494*cdf0e10cSrcweir 1495*cdf0e10cSrcweir //------------------------------------------------------------------------ 1496*cdf0e10cSrcweir void FmFormShell::SetDesignMode( sal_Bool _bDesignMode ) 1497*cdf0e10cSrcweir { 1498*cdf0e10cSrcweir if ( _bDesignMode == m_bDesignMode ) 1499*cdf0e10cSrcweir return; 1500*cdf0e10cSrcweir 1501*cdf0e10cSrcweir FmFormModel* pModel = GetFormModel(); 1502*cdf0e10cSrcweir if (pModel) 1503*cdf0e10cSrcweir // fuer die Zeit des Uebergangs das Undo-Environment ausschalten, das sichert, dass man dort auch nicht-transiente 1504*cdf0e10cSrcweir // Properties mal eben aendern kann (sollte allerdings mit Vorsicht genossen und beim Rueckschalten des Modes 1505*cdf0e10cSrcweir // auch immer wieder rueckgaegig gemacht werden. Ein Beispiel ist das Setzen der maximalen Text-Laenge durch das 1506*cdf0e10cSrcweir // OEditModel an seinem Control.) 1507*cdf0e10cSrcweir pModel->GetUndoEnv().Lock(); 1508*cdf0e10cSrcweir 1509*cdf0e10cSrcweir // dann die eigentliche Umschaltung 1510*cdf0e10cSrcweir if ( m_bDesignMode || PrepareClose( sal_True ) ) 1511*cdf0e10cSrcweir impl_setDesignMode(!m_bDesignMode ); 1512*cdf0e10cSrcweir 1513*cdf0e10cSrcweir // und mein Undo-Environment wieder an 1514*cdf0e10cSrcweir if ( pModel ) 1515*cdf0e10cSrcweir pModel->GetUndoEnv().UnLock(); 1516*cdf0e10cSrcweir } 1517