1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVX_SOURCE_INC_FMPGEIMP_HXX
20 #define INCLUDED_SVX_SOURCE_INC_FMPGEIMP_HXX
22 #include <com/sun/star/sdbc/XDataSource.hpp>
23 #include <com/sun/star/container/XNameAccess.hpp>
24 #include <com/sun/star/form/XFormComponent.hpp>
25 #include <com/sun/star/form/XForm.hpp>
26 #include <com/sun/star/form/XForms.hpp>
27 #include <com/sun/star/container/XNameContainer.hpp>
28 #include <com/sun/star/frame/XModel.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/container/XMap.hpp>
32 #include <tools/link.hxx>
33 #include <comphelper/uno3.hxx>
34 #include <cppuhelper/weakref.hxx>
36 #include "svx/svxdllapi.h"
45 // lauscht an allen Containern, um festzustellen, wann Objecte
46 // eingefuegt worden sind und wann diese entfernt wurden
49 class SVX_DLLPRIVATE FmFormPageImpl
51 ::std::map
< ::com::sun::star::uno::Reference
< ::com::sun::star::form::XFormComponent
>,SdrObject
* > m_aComponentMap
;
52 ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
> xCurrentForm
;
53 ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForms
> m_xForms
;
54 ::com::sun::star::uno::WeakReference
< ::com::sun::star::container::XMap
> m_aControlShapeMap
;
57 Link
<> m_aFormsCreationHdl
;
59 bool m_bFirstActivation
;
60 bool m_bAttemptedFormCreation
;
67 explicit FmFormPageImpl( FmFormPage
& _rPage
);
70 void initFrom( FmFormPageImpl
& i_foreignImpl
);
72 // nur wichtig fuer den DesignMode
73 void setCurForm(::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
> xForm
);
74 ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
> getDefaultForm();
76 /** finds a place in the form component hierarchy where to insert the given component
78 Note that no actual insertion happens, this is the responsibility of the caller (as
79 the caller might decide on a suitable place where in the returned container the insertion
82 ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
> findPlaceInFormComponentHierarchy(
83 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XFormComponent
>& rContent
,
84 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
>& rDatabase
= ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
>(),
85 const OUString
& rDBTitle
= OUString(),
86 const OUString
& rCursorSource
= OUString(),
87 sal_Int32 nCommandType
= 0
90 // activation handling
91 inline bool hasEverBeenActivated( ) const { return !m_bFirstActivation
; }
92 inline void setHasBeenActivated( ) { m_bFirstActivation
= false; }
94 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForms
>& getForms( bool _bForceCreate
= true );
96 void SetFormsCreationHdl( const Link
<>& _rFormsCreationHdl
) { m_aFormsCreationHdl
= _rFormsCreationHdl
; }
97 const Link
<>& GetFormsCreationHdl() const { return m_aFormsCreationHdl
; }
100 /** finds a form with a given data source signature
102 the form to start the search with. This form, including all possible sub forms,
105 the data source which to which the found form must be bound
107 the desired Command property value of the sought-after form
109 the desired CommandType property value of the sought-after form
111 ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
> findFormForDataSource(
112 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
>& rForm
,
113 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
>& rDatabase
,
114 const OUString
& rCommand
,
115 sal_Int32 nCommandType
119 static 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
);
121 void formObjectInserted( const FmFormObj
& _object
);
122 void formObjectRemoved( const FmFormObj
& _object
);
123 void formModelAssigned( const FmFormObj
& _object
);
125 /** returns an object mapping from control models to drawing shapes.
127 SVX_DLLPUBLIC ::com::sun::star::uno::Reference
< ::com::sun::star::container::XMap
> getControlToShapeMap();
130 /** validates whether <member>xCurrentForm</member> is still valid and to be used
132 There are situations where our current form becomes invalid, without us noticing this. Thus,
133 every method which accesses <member>xCurrentForm</member> should beforehand validate the current
134 form by calling this method.
136 If <member>xCurrentForm</member> is not valid anymore, it is reset to <NULL/>.
139 <TRUE/> if and only if xCurrentForm is valid.
143 bool validateCurForm();
145 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XMap
>
146 impl_createControlShapeMap_nothrow();
149 FmFormPageImpl( const FmFormPageImpl
& ) SAL_DELETED_FUNCTION
;
150 FmFormPageImpl
& operator=( const FmFormPageImpl
& ) SAL_DELETED_FUNCTION
;
154 #endif // INCLUDED_SVX_SOURCE_INC_FMPGEIMP_HXX
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */