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