1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _SVX_FMUNOPGE_HXX 28*cdf0e10cSrcweir #define _SVX_FMUNOPGE_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <com/sun/star/sdbc/XDataSource.hpp> 31*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/form/XFormComponent.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/form/XForm.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/container/XMap.hpp> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include <tools/list.hxx> 40*cdf0e10cSrcweir #include <tools/link.hxx> 41*cdf0e10cSrcweir #include <comphelper/uno3.hxx> 42*cdf0e10cSrcweir #include <cppuhelper/weakref.hxx> 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #include "svx/svxdllapi.h" 45*cdf0e10cSrcweir #include <map> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir class SvStream; 48*cdf0e10cSrcweir class FmFormObj; 49*cdf0e10cSrcweir class FmFormPage; 50*cdf0e10cSrcweir class SdrObject; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir //FORWARD_DECLARE_INTERFACE(uno,Reference) 53*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(io,XObjectOutputStream) 54*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(io,XObjectInputStream) 55*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(container,XIndexContainer) 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir class SdrObjList; 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir //================================================================== 60*cdf0e10cSrcweir // FmFormPageImpl 61*cdf0e10cSrcweir // lauscht an allen Containern, um festzustellen, wann Objecte 62*cdf0e10cSrcweir // eingefuegt worden sind und wann diese entfernt wurden 63*cdf0e10cSrcweir //================================================================== 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir class SVX_DLLPRIVATE FmFormPageImpl 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >,SdrObject* > m_aComponentMap; 68*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xCurrentForm; 69*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xForms; 70*cdf0e10cSrcweir ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XMap > m_aControlShapeMap; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir FmFormPage& m_rPage; 73*cdf0e10cSrcweir Link m_aFormsCreationHdl; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir sal_Bool m_bFirstActivation; 76*cdf0e10cSrcweir bool m_bAttemptedFormCreation; 77*cdf0e10cSrcweir bool m_bInFind; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir protected: 80*cdf0e10cSrcweir void Init(); 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir public: 83*cdf0e10cSrcweir FmFormPageImpl( FmFormPage& _rPage ); 84*cdf0e10cSrcweir ~FmFormPageImpl(); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir void initFrom( FmFormPageImpl& i_foreignImpl ); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir // nur wichtig fuer den DesignMode 89*cdf0e10cSrcweir void setCurForm(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm); 90*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getDefaultForm(); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir /** finds a place in the form component hierarchy where to insert the given component 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir Note that no actual insertion happens, this is the responsibility of the caller (as 95*cdf0e10cSrcweir the caller might decide on a suitable place where in the returned container the insertion 96*cdf0e10cSrcweir should happen). 97*cdf0e10cSrcweir */ 98*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> findPlaceInFormComponentHierarchy( 99*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& rContent, 100*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>(), 101*cdf0e10cSrcweir const ::rtl::OUString& rDBTitle = ::rtl::OUString(), 102*cdf0e10cSrcweir const ::rtl::OUString& rCursorSource = ::rtl::OUString(), 103*cdf0e10cSrcweir sal_Int32 nCommandType = 0 104*cdf0e10cSrcweir ); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir // activation handling 107*cdf0e10cSrcweir inline sal_Bool hasEverBeenActivated( ) const { return !m_bFirstActivation; } 108*cdf0e10cSrcweir inline void setHasBeenActivated( ) { m_bFirstActivation = sal_False; } 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& getForms( bool _bForceCreate = true ); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir void SetFormsCreationHdl( const Link& _rFormsCreationHdl ) { m_aFormsCreationHdl = _rFormsCreationHdl; } 113*cdf0e10cSrcweir const Link& GetFormsCreationHdl() const { return m_aFormsCreationHdl; } 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir protected: 116*cdf0e10cSrcweir /** finds a form with a given data source signature 117*cdf0e10cSrcweir @param rForm 118*cdf0e10cSrcweir the form to start the search with. This form, including all possible sub forms, 119*cdf0e10cSrcweir will be examined 120*cdf0e10cSrcweir @param rDatabase 121*cdf0e10cSrcweir the data source which to which the found form must be bound 122*cdf0e10cSrcweir @param rCommand 123*cdf0e10cSrcweir the desired Command property value of the sought-after form 124*cdf0e10cSrcweir @param nCommandType 125*cdf0e10cSrcweir the desired CommandType property value of the sought-after form 126*cdf0e10cSrcweir */ 127*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> findFormForDataSource( 128*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& rForm, 129*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase, 130*cdf0e10cSrcweir const ::rtl::OUString& rCommand, 131*cdf0e10cSrcweir sal_Int32 nCommandType 132*cdf0e10cSrcweir ); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir public: 135*cdf0e10cSrcweir ::rtl::OUString setUniqueName(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& xFormComponent, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& xControls); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir void formObjectInserted( const FmFormObj& _object ); 138*cdf0e10cSrcweir void formObjectRemoved( const FmFormObj& _object ); 139*cdf0e10cSrcweir void formModelAssigned( const FmFormObj& _object ); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir /** returns an object mapping from control models to drawing shapes. 142*cdf0e10cSrcweir */ 143*cdf0e10cSrcweir SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XMap > getControlToShapeMap(); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir private: 146*cdf0e10cSrcweir /** validates whether <member>xCurrentForm</member> is still valid and to be used 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir There are situations where our current form becomes invalid, without us noticing this. Thus, 149*cdf0e10cSrcweir every method which accesses <member>xCurrentForm</member> should beforehand validate the current 150*cdf0e10cSrcweir form by calling this method. 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir If <member>xCurrentForm</member> is not valid anymore, it is reset to <NULL/>. 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir @return 155*cdf0e10cSrcweir <TRUE/> if and only if xCurrentForm is valid. 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir @since #i40086# 158*cdf0e10cSrcweir */ 159*cdf0e10cSrcweir bool validateCurForm(); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XMap > 162*cdf0e10cSrcweir impl_createControlShapeMap_nothrow(); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir private: 165*cdf0e10cSrcweir FmFormPageImpl(); // never implemented 166*cdf0e10cSrcweir FmFormPageImpl( const FmFormPageImpl& ); // never implemented 167*cdf0e10cSrcweir FmFormPageImpl& operator=( const FmFormPageImpl& ); // never implemented 168*cdf0e10cSrcweir }; 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir #endif // _SVX_FMUNOPGE_HXX 172*cdf0e10cSrcweir 173