Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / svx / source / inc / fmpgeimp.hxx
blob0f39df015b117a6f8bbf089d31517cea1c1f8c73
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
28 #ifndef _SVX_FMUNOPGE_HXX
29 #define _SVX_FMUNOPGE_HXX
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>
40 #include <tools/link.hxx>
41 #include <comphelper/uno3.hxx>
42 #include <cppuhelper/weakref.hxx>
44 #include "svx/svxdllapi.h"
45 #include <map>
47 class SvStream;
48 class FmFormObj;
49 class FmFormPage;
50 class SdrObject;
52 namespace com { namespace sun { namespace star {
53 namespace container {
54 class XIndexContainer;
56 namespace io {
57 class XObjectOutputStream;
58 class XObjectInputStream;
60 }}}
62 class SdrObjList;
64 //==================================================================
65 // FmFormPageImpl
66 // lauscht an allen Containern, um festzustellen, wann Objecte
67 // eingefuegt worden sind und wann diese entfernt wurden
68 //==================================================================
70 class SVX_DLLPRIVATE FmFormPageImpl
72 ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >,SdrObject* > m_aComponentMap;
73 ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xCurrentForm;
74 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xForms;
75 ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XMap > m_aControlShapeMap;
77 FmFormPage& m_rPage;
78 Link m_aFormsCreationHdl;
80 sal_Bool m_bFirstActivation;
81 bool m_bAttemptedFormCreation;
82 bool m_bInFind;
84 protected:
85 void Init();
87 public:
88 FmFormPageImpl( FmFormPage& _rPage );
89 ~FmFormPageImpl();
91 void initFrom( FmFormPageImpl& i_foreignImpl );
93 // nur wichtig fuer den DesignMode
94 void setCurForm(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm);
95 ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getDefaultForm();
97 /** finds a place in the form component hierarchy where to insert the given component
99 Note that no actual insertion happens, this is the responsibility of the caller (as
100 the caller might decide on a suitable place where in the returned container the insertion
101 should happen).
103 ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> findPlaceInFormComponentHierarchy(
104 const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& rContent,
105 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>(),
106 const ::rtl::OUString& rDBTitle = ::rtl::OUString(),
107 const ::rtl::OUString& rCursorSource = ::rtl::OUString(),
108 sal_Int32 nCommandType = 0
111 // activation handling
112 inline sal_Bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
113 inline void setHasBeenActivated( ) { m_bFirstActivation = sal_False; }
115 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& getForms( bool _bForceCreate = true );
117 void SetFormsCreationHdl( const Link& _rFormsCreationHdl ) { m_aFormsCreationHdl = _rFormsCreationHdl; }
118 const Link& GetFormsCreationHdl() const { return m_aFormsCreationHdl; }
120 protected:
121 /** finds a form with a given data source signature
122 @param rForm
123 the form to start the search with. This form, including all possible sub forms,
124 will be examined
125 @param rDatabase
126 the data source which to which the found form must be bound
127 @param rCommand
128 the desired Command property value of the sought-after form
129 @param nCommandType
130 the desired CommandType property value of the sought-after form
132 ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> findFormForDataSource(
133 const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& rForm,
134 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase,
135 const ::rtl::OUString& rCommand,
136 sal_Int32 nCommandType
139 public:
140 ::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);
142 void formObjectInserted( const FmFormObj& _object );
143 void formObjectRemoved( const FmFormObj& _object );
144 void formModelAssigned( const FmFormObj& _object );
146 /** returns an object mapping from control models to drawing shapes.
148 SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XMap > getControlToShapeMap();
150 private:
151 /** validates whether <member>xCurrentForm</member> is still valid and to be used
153 There are situations where our current form becomes invalid, without us noticing this. Thus,
154 every method which accesses <member>xCurrentForm</member> should beforehand validate the current
155 form by calling this method.
157 If <member>xCurrentForm</member> is not valid anymore, it is reset to <NULL/>.
159 @return
160 <TRUE/> if and only if xCurrentForm is valid.
162 @since #i40086#
164 bool validateCurForm();
166 ::com::sun::star::uno::Reference< ::com::sun::star::container::XMap >
167 impl_createControlShapeMap_nothrow();
169 private:
170 FmFormPageImpl(); // never implemented
171 FmFormPageImpl( const FmFormPageImpl& ); // never implemented
172 FmFormPageImpl& operator=( const FmFormPageImpl& ); // never implemented
176 #endif // _SVX_FMUNOPGE_HXX
178 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */