1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #ifndef SVX_FORMCONTROLMANAGER_HXX
26 #define SVX_FORMCONTROLMANAGER_HXX
27 
28 #include "fmdocumentclassification.hxx"
29 
30 /** === begin UNO includes === **/
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/util/XNumberFormats.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/container/XNameAccess.hpp>
36 /** === end UNO includes === **/
37 
38 #include <memory>
39 
40 class SdrUnoObj;
41 class Rectangle;
42 
43 namespace comphelper {
44     class ComponentContext;
45 }
46 
47 //........................................................................
48 namespace svxform
49 {
50 //........................................................................
51 
52 	//====================================================================
53 	//= FormControlFactory
54 	//====================================================================
55     struct FormControlFactory_Data;
56 
57 	class FormControlFactory
58 	{
59     public:
60         FormControlFactory( const ::comphelper::ComponentContext& _rContext );
61         ~FormControlFactory();
62 
63         /** initializes the given control model which is to be newly inserted into a document
64 
65             @param _eDocType
66                 the type of the document which the control is to be inserted into
67             @param _rxControlModel
68                 the control model to be inserted
69             @param _rControlBoundRect
70                 the bound rect of the control, if applicable
71             @return
72                 the class ID of the control
73         */
74         sal_Int16 initializeControlModel(
75                     const DocumentType _eDocType,
76                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
77                     const Rectangle& _rControlBoundRect
78                 );
79 
80         sal_Int16 initializeControlModel( const DocumentType _eDocType, const SdrUnoObj& _rObject );
81         sal_Int16 initializeControlModel( const DocumentType _eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel );
82 
83         void initializeTextFieldLineEnds(
84                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
85                 );
86 
87         void    initializeFieldDependentProperties(
88                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDatabaseField,
89                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
90                     const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats
91                 );
92 
93         static ::rtl::OUString getDefaultName(
94                     const sal_Int16 nClassId,
95                     const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo >& _rxObject
96                 );
97 
98         static ::rtl::OUString getDefaultUniqueName_ByComponentType(
99                     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer,
100                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject
101                 );
102 
103         static ::rtl::OUString getUniqueName(
104                     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer,
105                     const ::rtl::OUString& _rBaseName
106                 );
107 
108     private:
109         ::std::auto_ptr< FormControlFactory_Data >  m_pData;
110 	};
111 
112 //........................................................................
113 } // namespace svxform
114 //........................................................................
115 
116 #endif // SVX_FORMCONTROLMANAGER_HXX
117