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