LCOV - code coverage report
Current view: top level - svx/source/form - fmshell.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 565 0.0 %
Date: 2014-04-14 Functions: 0 51 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10