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