LibreOffice Module svx (master)  1
fmpgeimp.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_SVX_SOURCE_INC_FMPGEIMP_HXX
20 #define INCLUDED_SVX_SOURCE_INC_FMPGEIMP_HXX
21 
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>
30 
31 #include <tools/link.hxx>
32 #include <cppuhelper/weakref.hxx>
33 
34 #include <svx/svxdllapi.h>
35 #include <map>
36 
37 class FmFormObj;
38 class FmFormPage;
39 class SdrObject;
40 
41 
42 // FmFormPageImpl
43 // Listens to all containers to determine when objects have been inserted
44 // and when they have been removed
45 
46 
47 class FmFormPageImpl final
48 {
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;
52 
55 
58 
59 public:
60  explicit FmFormPageImpl( FmFormPage& _rPage );
62 
63  void initFrom( FmFormPageImpl& i_foreignImpl );
64 
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();
68 
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
81  );
82 
83  // activation handling
84  bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
85  void setHasBeenActivated( ) { m_bFirstActivation = false; }
86 
87  const css::uno::Reference< css::form::XForms>& getForms( bool _bForceCreate = true );
88 
89  void SetFormsCreationHdl( const Link<FmFormPageImpl&,void>& _rFormsCreationHdl ) { m_aFormsCreationHdl = _rFormsCreationHdl; }
90 
91 private:
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
108  );
109 
110 public:
111  static OUString setUniqueName(const css::uno::Reference< css::form::XFormComponent>& xFormComponent, const css::uno::Reference< css::form::XForm>& xControls);
112 
113  void formObjectInserted( const FmFormObj& _object );
114  void formObjectRemoved( const FmFormObj& _object );
115  void formModelAssigned( const FmFormObj& _object );
116 
119  SVX_DLLPUBLIC css::uno::Reference< css::container::XMap > getControlToShapeMap();
120 
121 private:
135  bool validateCurForm();
136 
137  css::uno::Reference< css::container::XMap >
139 
140  FmFormPageImpl( const FmFormPageImpl& ) = delete;
141  FmFormPageImpl& operator=( const FmFormPageImpl& ) = delete;
142 };
143 
144 
145 #endif // INCLUDED_SVX_SOURCE_INC_FMPGEIMP_HXX
146 
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::form::XForms > m_xForms
Definition: fmpgeimp.hxx:50
css::uno::Reference< css::form::XForm > getDefaultForm()
Definition: fmpgeimp.cxx:360
css::uno::Reference< css::form::XForm > findPlaceInFormComponentHierarchy(const css::uno::Reference< css::form::XFormComponent > &rContent, const css::uno::Reference< css::sdbc::XDataSource > &rDatabase=css::uno::Reference< css::sdbc::XDataSource >(), const OUString &rDBTitle=OUString(), const OUString &rCursorSource=OUString(), sal_Int32 nCommandType=0)
finds a place in the form component hierarchy where to insert the given component ...
Definition: fmpgeimp.cxx:446
FmFormPageImpl & operator=(const FmFormPageImpl &)=delete
static OUString setUniqueName(const css::uno::Reference< css::form::XFormComponent > &xFormComponent, const css::uno::Reference< css::form::XForm > &xControls)
Definition: fmpgeimp.cxx:621
css::uno::Reference< css::form::XForm > findFormForDataSource(const css::uno::Reference< css::form::XForm > &rForm, const css::uno::Reference< css::sdbc::XDataSource > &rDatabase, const OUString &rCommand, sal_Int32 nCommandType)
finds a form with a given data source signature
Definition: fmpgeimp.cxx:540
Link< FmFormPageImpl &, void > m_aFormsCreationHdl
Definition: fmpgeimp.hxx:54
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
css::uno::Reference< css::container::XMap > impl_createControlShapeMap_nothrow()
Definition: fmpgeimp.cxx:273
css::uno::WeakReference< css::container::XMap > m_aControlShapeMap
Definition: fmpgeimp.hxx:51
FmFormPage & m_rPage
Definition: fmpgeimp.hxx:53
void setHasBeenActivated()
Definition: fmpgeimp.hxx:85
void SetFormsCreationHdl(const Link< FmFormPageImpl &, void > &_rFormsCreationHdl)
Definition: fmpgeimp.hxx:89
void formModelAssigned(const FmFormObj &_object)
Definition: fmpgeimp.cxx:662
Abstract DrawObject.
Definition: svdobj.hxx:312
bool m_bFirstActivation
Definition: fmpgeimp.hxx:56
void formObjectInserted(const FmFormObj &_object)
Definition: fmpgeimp.cxx:681
css::uno::Reference< css::form::XForm > xCurrentForm
Definition: fmpgeimp.hxx:49
SVX_DLLPUBLIC css::uno::Reference< css::container::XMap > getControlToShapeMap()
returns an object mapping from control models to drawing shapes.
Definition: fmpgeimp.cxx:225
bool m_bAttemptedFormCreation
Definition: fmpgeimp.hxx:57
void formObjectRemoved(const FmFormObj &_object)
Definition: fmpgeimp.cxx:699
void setCurForm(const css::uno::Reference< css::form::XForm > &xForm)
Definition: fmpgeimp.cxx:354
const css::uno::Reference< css::form::XForms > & getForms(bool _bForceCreate=true)
Definition: fmpgeimp.cxx:303
bool hasEverBeenActivated() const
Definition: fmpgeimp.hxx:84
void initFrom(FmFormPageImpl &i_foreignImpl)
Definition: fmpgeimp.cxx:150
bool validateCurForm()
validates whether xCurrentForm is still valid and to be used
Definition: fmpgeimp.cxx:342
FmFormPageImpl(FmFormPage &_rPage)
Definition: fmpgeimp.cxx:68