1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fmpgeimp.hxx,v $
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"
55 //FORWARD_DECLARE_INTERFACE(uno,Reference)
56 FORWARD_DECLARE_INTERFACE(io
,XObjectOutputStream
)
57 FORWARD_DECLARE_INTERFACE(io
,XObjectInputStream
)
58 FORWARD_DECLARE_INTERFACE(container
,XIndexContainer
)
62 //==================================================================
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
;
76 Link m_aFormsCreationHdl
;
78 sal_Bool m_bFirstActivation
;
79 bool m_bAttemptedFormCreation
;
86 FmFormPageImpl( FmFormPage
& _rPage
);
87 FmFormPageImpl( FmFormPage
& _rPage
, const FmFormPageImpl
& rImpl
);
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
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
; }
118 /** finds a form with a given data source signature
120 the form to start the search with. This form, including all possible sub forms,
123 the data source which to which the found form must be bound
125 the desired Command property value of the sought-after form
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 ::rtl::OUString
getDefaultName(
138 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
>& _rxControls
,
139 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XServiceInfo
>& _rxObject
144 static UniString
getDefaultName(
146 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XServiceInfo
>& _rxObject
149 ::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
);
150 ::rtl::OUString
getUniqueName(const ::rtl::OUString
& rName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& xNamedSet
) const;
152 void formObjectInserted( const FmFormObj
& _object
);
153 void formObjectRemoved( const FmFormObj
& _object
);
155 /** returns an object mapping from control models to drawing shapes.
157 SVX_DLLPUBLIC ::com::sun::star::uno::Reference
< ::com::sun::star::container::XMap
> getControlToShapeMap();
160 /** validates whether <member>xCurrentForm</member> is still valid and to be used
162 There are situations where our current form becomes invalid, without us noticing this. Thus,
163 every method which accesses <member>xCurrentForm</member> should beforehand validate the current
164 form by calling this method.
166 If <member>xCurrentForm</member> is not valid anymore, it is reset to <NULL/>.
169 <TRUE/> if and only if xCurrentForm is valid.
173 bool validateCurForm();
175 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XMap
>
176 impl_createControlShapeMap_nothrow();
179 FmFormPageImpl(); // never implemented
180 FmFormPageImpl( const FmFormPageImpl
& ); // never implemented
181 FmFormPageImpl
& operator=( const FmFormPageImpl
& ); // never implemented
185 #endif // _SVX_FMUNOPGE_HXX