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 <config_options.h>
23 #include <com/sun/star/sdbc/XDataSource.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/XMap.hpp>
28 
29 #include <tools/link.hxx>
30 #include <cppuhelper/weakref.hxx>
31 
32 #include <svx/svxdllapi.h>
33 
34 class FmFormObj;
35 class FmFormPage;
36 class SdrObject;
37 
38 
39 // FmFormPageImpl
40 // Listens to all containers to determine when objects have been inserted
41 // and when they have been removed
42 
43 
44 class FmFormPageImpl final
45 {
46  css::uno::Reference< css::form::XForm > xCurrentForm;
47  css::uno::Reference< css::form::XForms > m_xForms;
48  css::uno::WeakReference< css::container::XMap > m_aControlShapeMap;
49 
52 
55 
56 public:
57  explicit FmFormPageImpl( FmFormPage& _rPage );
59 
60  void initFrom( FmFormPageImpl& i_foreignImpl );
61 
62  // only important for the DesignMode
63  void setCurForm(const css::uno::Reference< css::form::XForm>& xForm);
64  css::uno::Reference< css::form::XForm> getDefaultForm();
65 
72  css::uno::Reference< css::form::XForm> findPlaceInFormComponentHierarchy(
73  const css::uno::Reference< css::form::XFormComponent>& rContent,
74  const css::uno::Reference< css::sdbc::XDataSource>& rDatabase = css::uno::Reference< css::sdbc::XDataSource>(),
75  const OUString& rDBTitle = OUString(),
76  const OUString& rCursorSource = OUString(),
77  sal_Int32 nCommandType = 0
78  );
79 
80  // activation handling
81  bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
82  void setHasBeenActivated( ) { m_bFirstActivation = false; }
83 
84  const css::uno::Reference< css::form::XForms>& getForms( bool _bForceCreate = true );
85 
86  void SetFormsCreationHdl( const Link<FmFormPageImpl&,void>& _rFormsCreationHdl ) { m_aFormsCreationHdl = _rFormsCreationHdl; }
87 
88 private:
100  css::uno::Reference< css::form::XForm> findFormForDataSource(
101  const css::uno::Reference< css::form::XForm>& rForm,
102  const css::uno::Reference< css::sdbc::XDataSource>& rDatabase,
103  const OUString& rCommand,
104  sal_Int32 nCommandType
105  );
106 
107 public:
108  static OUString setUniqueName(const css::uno::Reference< css::form::XFormComponent>& xFormComponent, const css::uno::Reference< css::form::XForm>& xControls);
109 
110  void formObjectInserted( const FmFormObj& _object );
111  void formObjectRemoved( const FmFormObj& _object );
112  void formModelAssigned( const FmFormObj& _object );
113 
116  UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) css::uno::Reference< css::container::XMap > getControlToShapeMap();
117 
118 private:
132  bool validateCurForm();
133 
134  css::uno::Reference< css::container::XMap >
136 
137  FmFormPageImpl( const FmFormPageImpl& ) = delete;
138  FmFormPageImpl& operator=( const FmFormPageImpl& ) = delete;
139 };
140 
141 
142 #endif // INCLUDED_SVX_SOURCE_INC_FMPGEIMP_HXX
143 
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::form::XForms > m_xForms
Definition: fmpgeimp.hxx:47
css::uno::Reference< css::form::XForm > getDefaultForm()
Definition: fmpgeimp.cxx:357
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:443
static OUString setUniqueName(const css::uno::Reference< css::form::XFormComponent > &xFormComponent, const css::uno::Reference< css::form::XForm > &xControls)
Definition: fmpgeimp.cxx:618
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:537
Link< FmFormPageImpl &, void > m_aFormsCreationHdl
Definition: fmpgeimp.hxx:51
css::uno::Reference< css::container::XMap > impl_createControlShapeMap_nothrow()
Definition: fmpgeimp.cxx:270
css::uno::WeakReference< css::container::XMap > m_aControlShapeMap
Definition: fmpgeimp.hxx:48
FmFormPage & m_rPage
Definition: fmpgeimp.hxx:50
void setHasBeenActivated()
Definition: fmpgeimp.hxx:82
void SetFormsCreationHdl(const Link< FmFormPageImpl &, void > &_rFormsCreationHdl)
Definition: fmpgeimp.hxx:86
void formModelAssigned(const FmFormObj &_object)
Definition: fmpgeimp.cxx:659
Abstract DrawObject.
Definition: svdobj.hxx:313
bool m_bFirstActivation
Definition: fmpgeimp.hxx:53
class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) OLocalExchange class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) OLocalExchangeHelper
a helper for navigator windows (SvTreeListBox'es) which allow DnD within themself ...
Definition: fmexch.hxx:87
void formObjectInserted(const FmFormObj &_object)
Definition: fmpgeimp.cxx:678
css::uno::Reference< css::form::XForm > xCurrentForm
Definition: fmpgeimp.hxx:46
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
bool m_bAttemptedFormCreation
Definition: fmpgeimp.hxx:54
void formObjectRemoved(const FmFormObj &_object)
Definition: fmpgeimp.cxx:696
void setCurForm(const css::uno::Reference< css::form::XForm > &xForm)
Definition: fmpgeimp.cxx:351
const css::uno::Reference< css::form::XForms > & getForms(bool _bForceCreate=true)
Definition: fmpgeimp.cxx:300
bool hasEverBeenActivated() const
Definition: fmpgeimp.hxx:81
void initFrom(FmFormPageImpl &i_foreignImpl)
Definition: fmpgeimp.cxx:147
bool validateCurForm()
returns an object mapping from control models to drawing shapes.
Definition: fmpgeimp.cxx:339
FmFormPageImpl(FmFormPage &_rPage)
Definition: fmpgeimp.cxx:65