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

Generated by: LCOV version 1.10