LCOV - code coverage report
Current view: top level - svx/source/inc - fmvwimp.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 6 0.0 %
Date: 2014-04-14 Functions: 0 6 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             : #ifndef INCLUDED_SVX_SOURCE_INC_FMVWIMP_HXX
      20             : #define INCLUDED_SVX_SOURCE_INC_FMVWIMP_HXX
      21             : 
      22             : #include <sal/config.h>
      23             : 
      24             : #include <map>
      25             : 
      26             : #include "svx/svdmark.hxx"
      27             : #include "fmdocumentclassification.hxx"
      28             : 
      29             : #include <com/sun/star/form/XForm.hpp>
      30             : #include <com/sun/star/container/XIndexAccess.hpp>
      31             : #include <com/sun/star/container/XEnumeration.hpp>
      32             : #include <com/sun/star/form/runtime/XFormController.hpp>
      33             : #include <com/sun/star/form/runtime/XFormControllerContext.hpp>
      34             : #include <com/sun/star/container/XContainerListener.hpp>
      35             : #include <com/sun/star/container/ContainerEvent.hpp>
      36             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      37             : #include <com/sun/star/awt/XFocusListener.hpp>
      38             : #include <com/sun/star/sdb/SQLErrorEvent.hpp>
      39             : #include <com/sun/star/sdbc/XDataSource.hpp>
      40             : #include <com/sun/star/uno/XComponentContext.hpp>
      41             : 
      42             : #include <comphelper/stl_types.hxx>
      43             : #include <tools/link.hxx>
      44             : #include <cppuhelper/implbase2.hxx>
      45             : #include <cppuhelper/implbase3.hxx>
      46             : #include <comphelper/uno3.hxx>
      47             : #include <rtl/ref.hxx>
      48             : 
      49             : class SdrPageWindow;
      50             : 
      51             : class SdrObject;
      52             : class FmFormObj;
      53             : class FmFormModel;
      54             : class FmFormView;
      55             : class FmFormShell;
      56             : class Window;
      57             : class OutputDevice;
      58             : class SdrUnoObj;
      59             : 
      60             : namespace com { namespace sun { namespace star {
      61             :     namespace awt {
      62             :         class XControl;
      63             :         class XWindow;
      64             :     }
      65             :     namespace beans {
      66             :         class XPropertySet;
      67             :     }
      68             :     namespace util {
      69             :         class XNumberFormats;
      70             :     }
      71             : }}}
      72             : 
      73             : class FmXFormView;
      74             : 
      75             : namespace svx {
      76             :     class ODataAccessDescriptor;
      77             :     struct OXFormsDescriptor;
      78             : }
      79             : 
      80             : 
      81             : // FormViewPageWindowAdapter
      82             : 
      83             : typedef ::cppu::WeakImplHelper2 <   ::com::sun::star::container::XIndexAccess
      84             :                                 ,   ::com::sun::star::form::runtime::XFormControllerContext
      85             :                                 >   FormViewPageWindowAdapter_Base;
      86             : 
      87             : class FormViewPageWindowAdapter : public FormViewPageWindowAdapter_Base
      88             : {
      89             :     friend class FmXFormView;
      90             : 
      91             :     ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > >   m_aControllerList;
      92             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >                            m_xControlContainer;
      93             :     css::uno::Reference<css::uno::XComponentContext>                                                        m_xContext;
      94             :     FmXFormView*                m_pViewImpl;
      95             :     Window*                     m_pWindow;
      96             : 
      97             : protected:
      98             :     virtual ~FormViewPageWindowAdapter();
      99             : 
     100             : public:
     101             :     FormViewPageWindowAdapter(  const css::uno::Reference<css::uno::XComponentContext>& _rContext,
     102             :         const SdrPageWindow&, FmXFormView* pView);
     103             :         //const SdrPageViewWinRec*, FmXFormView* pView);
     104             : 
     105             :     // XElementAccess
     106             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     107             :     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     108             : 
     109             :     // XEnumerationAccess
     110             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >  SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException);
     111             : 
     112             :     // XIndexAccess
     113             :     virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     114             :     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _Index) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             : 
     116             :     // XFormControllerContext
     117             :     virtual void SAL_CALL makeVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _Control ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     118             : 
     119           0 :     const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > >& GetList() {return m_aControllerList;}
     120             : 
     121             : protected:
     122             :     ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >  getController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm ) const;
     123             :     void setController(
     124             :             const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm,
     125             :             const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxParentController );
     126           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >  getControlContainer() const { return m_xControlContainer; }
     127             :     void updateTabOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm );
     128             :     void dispose();
     129           0 :     Window* getWindow() const {return m_pWindow;}
     130             : };
     131             : 
     132             : typedef ::rtl::Reference< FormViewPageWindowAdapter >   PFormViewPageWindowAdapter;
     133             : typedef ::std::vector< PFormViewPageWindowAdapter >     PageWindowAdapterList;
     134             : typedef ::std::set  <   ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >
     135             :                     ,   ::comphelper::OInterfaceCompare< ::com::sun::star::form::XForm >
     136             :                     >   SetOfForms;
     137             : typedef ::std::map  <   ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
     138             :                     ,   SetOfForms
     139             :                     ,   ::comphelper::OInterfaceCompare< ::com::sun::star::awt::XControlContainer >
     140             :                     >   MapControlContainerToSetOfForms;
     141             : class SdrModel;
     142             : 
     143             : // FmXFormView
     144             : 
     145             : class FmXFormView : public ::cppu::WeakImplHelper3<
     146             :                             ::com::sun::star::form::XFormControllerListener,
     147             :                             ::com::sun::star::awt::XFocusListener,
     148             :                             ::com::sun::star::container::XContainerListener>
     149             : {
     150             :     friend class FmFormView;
     151             :     friend class FmFormShell;
     152             :     friend class FmXFormShell;
     153             :     friend class FormViewPageWindowAdapter;
     154             :     class ObjectRemoveListener;
     155             :     friend class ObjectRemoveListener;
     156             : 
     157             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>                   m_xWindow;
     158             :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >           m_xLastCreatedControlModel;
     159             : 
     160             :     FmFormObj*      m_pMarkedGrid;
     161             :     FmFormView*     m_pView;
     162             :     sal_uIntPtr     m_nActivationEvent;
     163             :     sal_uIntPtr     m_nErrorMessageEvent;   // event for an asynchronous error message. See also m_aAsyncError
     164             :     sal_uIntPtr     m_nAutoFocusEvent;      // event for asynchronously setting the focus to a control
     165             :     sal_uIntPtr     m_nControlWizardEvent;  // event for asynchronously setting the focus to a control
     166             : 
     167             :     ::com::sun::star::sdb::SQLErrorEvent
     168             :                     m_aAsyncError;          // error event which is to be displayed asyn. See m_nErrorMessageEvent.
     169             : 
     170             :     PageWindowAdapterList
     171             :                     m_aPageWindowAdapters;  // to be filled in alive mode only
     172             :     MapControlContainerToSetOfForms
     173             :                     m_aNeedTabOrderUpdate;
     174             : 
     175             :     // Liste der markierten Object, dient zur Restauration beim Umschalten von Alive in DesignMode
     176             :     SdrMarkList             m_aMark;
     177             :     ObjectRemoveListener*   m_pWatchStoredList;
     178             : 
     179             :     bool            m_bFirstActivation;
     180             :     bool            m_isTabOrderUpdateSuspended;
     181             : 
     182             :     FmFormShell* GetFormShell() const;
     183             : 
     184             :     void removeGridWindowListening();
     185             : 
     186             : protected:
     187             :     FmXFormView( FmFormView* _pView );
     188             :     virtual ~FmXFormView();
     189             : 
     190             :     void    saveMarkList( sal_Bool _bSmartUnmark = sal_True );
     191             :     void    restoreMarkList( SdrMarkList& _rRestoredMarkList );
     192             :     void    stopMarkListWatching();
     193             :     void    startMarkListWatching();
     194             : 
     195             :     void    notifyViewDying( );
     196             :         // notifies this impl class that the anti-impl instance (m_pView) is going to die
     197             : 
     198             : public:
     199             :     // UNO Anbindung
     200             : 
     201             : // ::com::sun::star::lang::XEventListener
     202             :     virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     203             : 
     204             : // ::com::sun::star::container::XContainerListener
     205             :     virtual void SAL_CALL elementInserted(const  ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     206             :     virtual void SAL_CALL elementReplaced(const  ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     207             :     virtual void SAL_CALL elementRemoved(const  ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     208             : 
     209             : // ::com::sun::star::form::XFormControllerListener
     210             :     virtual void SAL_CALL formActivated(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     211             :     virtual void SAL_CALL formDeactivated(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     212             : 
     213             :     // XFocusListener
     214             :     virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     215             :     virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     216             : 
     217           0 :     FmFormView* getView() const {return m_pView;}
     218             :     PFormViewPageWindowAdapter  findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC ) const;
     219             : 
     220             :     ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >
     221             :             getFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
     222             : 
     223             :     // activation handling
     224           0 :     inline  bool        hasEverBeenActivated( ) const { return !m_bFirstActivation; }
     225           0 :     inline  void        setHasBeenActivated( ) { m_bFirstActivation = false; }
     226             : 
     227             :             void        onFirstViewActivation( const FmFormModel* _pDocModel );
     228             : 
     229             :     /** suspends the calls to activateTabOrder, which normally happen whenever for any ControlContainer of the view,
     230             :         new controls are inserted. Cannot be nested, i.e. you need to call resumeTabOrderUpdate before calling
     231             :         suspendTabOrderUpdate, again.
     232             :     */
     233             :     void    suspendTabOrderUpdate();
     234             : 
     235             :     /** resumes calls to activateTabOrder, and also does all pending calls which were collected since the last
     236             :         suspendTabOrderUpdate call.
     237             :     */
     238             :     void    resumeTabOrderUpdate();
     239             : 
     240             :     void    onCreatedFormObject( FmFormObj& _rFormObject );
     241             : 
     242             :     static bool
     243             :             isFocusable(
     244             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& i_rControl
     245             :             );
     246             : 
     247             : private:
     248             :     //void addWindow(const SdrPageViewWinRec*);
     249             :     void addWindow(const SdrPageWindow&);
     250             :     void removeWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC );
     251             :     void Activate(sal_Bool bSync = sal_False);
     252             :     void Deactivate(sal_Bool bDeactivateController = sal_True);
     253             : 
     254             :     SdrObject*  implCreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor );
     255             :     SdrObject*  implCreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc );
     256             : 
     257             :     static bool createControlLabelPair(
     258             :         OutputDevice& _rOutDev,
     259             :         sal_Int32 _nXOffsetMM,
     260             :         sal_Int32 _nYOffsetMM,
     261             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
     262             :         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
     263             :         sal_uInt16 _nControlObjectID,
     264             :         const OUString& _rFieldPostfix,
     265             :         sal_uInt32 _nInventor,
     266             :         sal_uInt16 _nLabelObjectID,
     267             :         SdrPage* _pLabelPage,
     268             :         SdrPage* _pControlPage,
     269             :         SdrModel* _pModel,
     270             :         SdrUnoObj*& _rpLabel,
     271             :         SdrUnoObj*& _rpControl
     272             :     );
     273             : 
     274             :     bool    createControlLabelPair(
     275             :         OutputDevice& _rOutDev,
     276             :         sal_Int32 _nXOffsetMM,
     277             :         sal_Int32 _nYOffsetMM,
     278             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
     279             :         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
     280             :         sal_uInt16 _nControlObjectID,
     281             :         const OUString& _rFieldPostfix,
     282             :         SdrUnoObj*& _rpLabel,
     283             :         SdrUnoObj*& _rpControl,
     284             :         const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _rxDataSource = NULL,
     285             :         const OUString& _rDataSourceName = OUString(),
     286             :         const OUString& _rCommand= OUString(),
     287             :         const sal_Int32 _nCommandType = -1
     288             :     );
     289             : 
     290             :     void ObjectRemovedInAliveMode(const SdrObject* pObject);
     291             : 
     292             :     // asynchronously displays an error message. See also OnDelayedErrorMessage.
     293             :     void    displayAsyncErrorMessage( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent );
     294             : 
     295             :     // cancels all pending async events
     296             :     void cancelEvents();
     297             : 
     298             :     /// the auto focus to the first (in terms of the tab order) control
     299             :     void AutoFocus( sal_Bool _bSync = sal_False );
     300             :     DECL_LINK( OnActivate, void* );
     301             :     DECL_LINK( OnAutoFocus, void* );
     302             :     DECL_LINK( OnDelayedErrorMessage, void* );
     303             :     DECL_LINK( OnStartControlWizard, void* );
     304             : 
     305             : private:
     306             :     ::svxform::DocumentType impl_getDocumentType() const;
     307             : };
     308             : 
     309             : 
     310             : 
     311             : #endif // INCLUDED_SVX_SOURCE_INC_FMVWIMP_HXX
     312             : 
     313             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10