Bump version to 6.4-15
[LibreOffice.git] / svx / source / inc / fmpgeimp.hxx
blob3e0a2503f1495e9e4c6083d986bfdcf6af62fb8b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/lang/XServiceInfo.hpp>
29 #include <com/sun/star/container/XMap.hpp>
31 #include <tools/link.hxx>
32 #include <cppuhelper/weakref.hxx>
34 #include <svx/svxdllapi.h>
35 #include <map>
37 class FmFormObj;
38 class FmFormPage;
39 class SdrObject;
42 // FmFormPageImpl
43 // Listens to all containers to determine when objects have been inserted
44 // and when they have been removed
47 class FmFormPageImpl final
49 css::uno::Reference< css::form::XForm > xCurrentForm;
50 css::uno::Reference< css::form::XForms > m_xForms;
51 css::uno::WeakReference< css::container::XMap > m_aControlShapeMap;
53 FmFormPage& m_rPage;
54 Link<FmFormPageImpl&,void> m_aFormsCreationHdl;
56 bool m_bFirstActivation;
57 bool m_bAttemptedFormCreation;
59 public:
60 explicit FmFormPageImpl( FmFormPage& _rPage );
61 ~FmFormPageImpl();
63 void initFrom( FmFormPageImpl& i_foreignImpl );
65 // only important for the DesignMode
66 void setCurForm(const css::uno::Reference< css::form::XForm>& xForm);
67 css::uno::Reference< css::form::XForm> getDefaultForm();
69 /** finds a place in the form component hierarchy where to insert the given component
71 Note that no actual insertion happens, this is the responsibility of the caller (as
72 the caller might decide on a suitable place where in the returned container the insertion
73 should happen).
75 css::uno::Reference< css::form::XForm> findPlaceInFormComponentHierarchy(
76 const css::uno::Reference< css::form::XFormComponent>& rContent,
77 const css::uno::Reference< css::sdbc::XDataSource>& rDatabase = css::uno::Reference< css::sdbc::XDataSource>(),
78 const OUString& rDBTitle = OUString(),
79 const OUString& rCursorSource = OUString(),
80 sal_Int32 nCommandType = 0
83 // activation handling
84 bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
85 void setHasBeenActivated( ) { m_bFirstActivation = false; }
87 const css::uno::Reference< css::form::XForms>& getForms( bool _bForceCreate = true );
89 void SetFormsCreationHdl( const Link<FmFormPageImpl&,void>& _rFormsCreationHdl ) { m_aFormsCreationHdl = _rFormsCreationHdl; }
91 private:
92 /** finds a form with a given data source signature
93 @param rForm
94 the form to start the search with. This form, including all possible sub forms,
95 will be examined
96 @param rDatabase
97 the data source which to which the found form must be bound
98 @param rCommand
99 the desired Command property value of the sought-after form
100 @param nCommandType
101 the desired CommandType property value of the sought-after form
103 css::uno::Reference< css::form::XForm> findFormForDataSource(
104 const css::uno::Reference< css::form::XForm>& rForm,
105 const css::uno::Reference< css::sdbc::XDataSource>& rDatabase,
106 const OUString& rCommand,
107 sal_Int32 nCommandType
110 public:
111 static OUString setUniqueName(const css::uno::Reference< css::form::XFormComponent>& xFormComponent, const css::uno::Reference< css::form::XForm>& xControls);
113 void formObjectInserted( const FmFormObj& _object );
114 void formObjectRemoved( const FmFormObj& _object );
115 void formModelAssigned( const FmFormObj& _object );
117 /** returns an object mapping from control models to drawing shapes.
119 SVX_DLLPUBLIC css::uno::Reference< css::container::XMap > getControlToShapeMap();
121 private:
122 /** validates whether <member>xCurrentForm</member> is still valid and to be used
124 There are situations where our current form becomes invalid, without us noticing this. Thus,
125 every method which accesses <member>xCurrentForm</member> should beforehand validate the current
126 form by calling this method.
128 If <member>xCurrentForm</member> is not valid anymore, it is reset to <NULL/>.
130 @return
131 <TRUE/> if and only if xCurrentForm is valid.
133 @since #i40086#
135 bool validateCurForm();
137 css::uno::Reference< css::container::XMap >
138 impl_createControlShapeMap_nothrow();
140 FmFormPageImpl( const FmFormPageImpl& ) = delete;
141 FmFormPageImpl& operator=( const FmFormPageImpl& ) = delete;
145 #endif // INCLUDED_SVX_SOURCE_INC_FMPGEIMP_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */