1 
2 /*************************************************************************
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26 ************************************************************************/
27 
28 #ifndef SVX_FORMCONTROLMANAGER_HXX
29 #define SVX_FORMCONTROLMANAGER_HXX
30 
31 #include "fmdocumentclassification.hxx"
32 
33 /** === begin UNO includes === **/
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #include <com/sun/star/util/XNumberFormats.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/container/XNameAccess.hpp>
39 /** === end UNO includes === **/
40 
41 #include <memory>
42 
43 class SdrUnoObj;
44 class Rectangle;
45 
46 namespace comphelper {
47     class ComponentContext;
48 }
49 
50 //........................................................................
51 namespace svxform
52 {
53 //........................................................................
54 
55 	//====================================================================
56 	//= FormControlFactory
57 	//====================================================================
58     struct FormControlFactory_Data;
59 
60 	class FormControlFactory
61 	{
62     public:
63         FormControlFactory( const ::comphelper::ComponentContext& _rContext );
64         ~FormControlFactory();
65 
66         /** initializes the given control model which is to be newly inserted into a document
67 
68             @param _eDocType
69                 the type of the document which the control is to be inserted into
70             @param _rxControlModel
71                 the control model to be inserted
72             @param _rControlBoundRect
73                 the bound rect of the control, if applicable
74             @return
75                 the class ID of the control
76         */
77         sal_Int16 initializeControlModel(
78                     const DocumentType _eDocType,
79                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
80                     const Rectangle& _rControlBoundRect
81                 );
82 
83         sal_Int16 initializeControlModel( const DocumentType _eDocType, const SdrUnoObj& _rObject );
84         sal_Int16 initializeControlModel( const DocumentType _eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel );
85 
86         void initializeTextFieldLineEnds(
87                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
88                 );
89 
90         void    initializeFieldDependentProperties(
91                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDatabaseField,
92                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
93                     const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats
94                 );
95 
96         static ::rtl::OUString getDefaultName(
97                     const sal_Int16 nClassId,
98                     const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo >& _rxObject
99                 );
100 
101         static ::rtl::OUString getDefaultUniqueName_ByComponentType(
102                     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer,
103                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject
104                 );
105 
106         static ::rtl::OUString getUniqueName(
107                     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer,
108                     const ::rtl::OUString& _rBaseName
109                 );
110 
111     private:
112         ::std::auto_ptr< FormControlFactory_Data >  m_pData;
113 	};
114 
115 //........................................................................
116 } // namespace svxform
117 //........................................................................
118 
119 #endif // SVX_FORMCONTROLMANAGER_HXX
120