19e0e4191SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39e0e4191SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49e0e4191SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59e0e4191SAndrew Rist  * distributed with this work for additional information
69e0e4191SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79e0e4191SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89e0e4191SAndrew Rist  * "License"); you may not use this file except in compliance
99e0e4191SAndrew Rist  * with the License.  You may obtain a copy of the License at
109e0e4191SAndrew Rist  *
119e0e4191SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
129e0e4191SAndrew Rist  *
139e0e4191SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149e0e4191SAndrew Rist  * software distributed under the License is distributed on an
159e0e4191SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169e0e4191SAndrew Rist  * KIND, either express or implied.  See the License for the
179e0e4191SAndrew Rist  * specific language governing permissions and limitations
189e0e4191SAndrew Rist  * under the License.
199e0e4191SAndrew Rist  *
209e0e4191SAndrew Rist  *************************************************************/
219e0e4191SAndrew Rist 
229e0e4191SAndrew Rist 
23*b63233d8Sdamjan #include "precompiled_rptui.hxx"
24cdf0e10cSrcweir #include "dlgedfac.hxx"
25cdf0e10cSrcweir #ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC
26cdf0e10cSrcweir #include "uistrings.hrc"
27cdf0e10cSrcweir #endif
28cdf0e10cSrcweir #include "RptObject.hxx"
29cdf0e10cSrcweir #include <RptDef.hxx>
30cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
32cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
33cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
34cdf0e10cSrcweir #include <com/sun/star/awt/ScrollBarOrientation.hpp>
35cdf0e10cSrcweir #include <svx/svdoole2.hxx>
36cdf0e10cSrcweir namespace rptui
37cdf0e10cSrcweir {
38cdf0e10cSrcweir using namespace ::com::sun::star;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //----------------------------------------------------------------------------
41cdf0e10cSrcweir 
DlgEdFactory()42cdf0e10cSrcweir DlgEdFactory::DlgEdFactory()
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	SdrObjFactory::InsertMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //----------------------------------------------------------------------------
48cdf0e10cSrcweir 
~DlgEdFactory()49cdf0e10cSrcweir DlgEdFactory::~DlgEdFactory()
50cdf0e10cSrcweir {
51cdf0e10cSrcweir 	SdrObjFactory::RemoveMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
52cdf0e10cSrcweir }
53cdf0e10cSrcweir 
54cdf0e10cSrcweir //----------------------------------------------------------------------------
55cdf0e10cSrcweir 
IMPL_LINK(DlgEdFactory,MakeObject,SdrObjFactory *,pObjFactory)56cdf0e10cSrcweir IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory )
57cdf0e10cSrcweir {
58cdf0e10cSrcweir 	if ( pObjFactory->nInventor == ReportInventor )
59cdf0e10cSrcweir 	{
60cdf0e10cSrcweir         switch( pObjFactory->nIdentifier )
61cdf0e10cSrcweir 	    {
62cdf0e10cSrcweir 		    case OBJ_DLG_FIXEDTEXT:
63cdf0e10cSrcweir 				    pObjFactory->pNewObj = new OUnoObject( SERVICE_FIXEDTEXT
64cdf0e10cSrcweir 													    ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText"))
65cdf0e10cSrcweir 													    ,OBJ_DLG_FIXEDTEXT);
66cdf0e10cSrcweir 				    break;
67cdf0e10cSrcweir 		    case OBJ_DLG_IMAGECONTROL:
68cdf0e10cSrcweir 				    pObjFactory->pNewObj = new OUnoObject( SERVICE_IMAGECONTROL
69cdf0e10cSrcweir 													    ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl"))
70cdf0e10cSrcweir 														,OBJ_DLG_IMAGECONTROL);
71cdf0e10cSrcweir 				    break;
72cdf0e10cSrcweir 		    case OBJ_DLG_FORMATTEDFIELD:
73cdf0e10cSrcweir 				    pObjFactory->pNewObj = new OUnoObject( SERVICE_FORMATTEDFIELD
74cdf0e10cSrcweir 													    ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FormattedField"))
75cdf0e10cSrcweir 														,OBJ_DLG_FORMATTEDFIELD);
76cdf0e10cSrcweir 				    break;
77cdf0e10cSrcweir             case OBJ_DLG_VFIXEDLINE:
78cdf0e10cSrcweir             case OBJ_DLG_HFIXEDLINE:
79cdf0e10cSrcweir                 {
80cdf0e10cSrcweir                     OUnoObject* pObj = new OUnoObject( SERVICE_FIXEDLINE
81cdf0e10cSrcweir 													    ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel"))
82cdf0e10cSrcweir 														,pObjFactory->nIdentifier);
83cdf0e10cSrcweir                     pObjFactory->pNewObj = pObj;
84cdf0e10cSrcweir                     if ( pObjFactory->nIdentifier == OBJ_DLG_HFIXEDLINE )
85cdf0e10cSrcweir                     {
86cdf0e10cSrcweir                         uno::Reference<beans::XPropertySet> xProp = pObj->getAwtComponent();
87cdf0e10cSrcweir                         xProp->setPropertyValue( PROPERTY_ORIENTATION, uno::makeAny(sal_Int32(0)) );
88cdf0e10cSrcweir                     }
89cdf0e10cSrcweir                 }
90cdf0e10cSrcweir                 break;
91cdf0e10cSrcweir             case OBJ_CUSTOMSHAPE:
92cdf0e10cSrcweir                 pObjFactory->pNewObj = new OCustomShape(SERVICE_SHAPE);
93cdf0e10cSrcweir                 break;
94cdf0e10cSrcweir             case OBJ_DLG_SUBREPORT:
95cdf0e10cSrcweir                 pObjFactory->pNewObj = new OOle2Obj(SERVICE_REPORTDEFINITION,OBJ_DLG_SUBREPORT);
96cdf0e10cSrcweir                 break;
97cdf0e10cSrcweir             case OBJ_OLE2:
98cdf0e10cSrcweir                 pObjFactory->pNewObj = new OOle2Obj(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.ChartDocument")),OBJ_OLE2);
99cdf0e10cSrcweir                 break;
100cdf0e10cSrcweir 		    default:
101cdf0e10cSrcweir 			    OSL_ENSURE(0,"Unknown object id");
102cdf0e10cSrcweir 			    break;
103cdf0e10cSrcweir 	    }
104cdf0e10cSrcweir 	}
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	return 0;
107cdf0e10cSrcweir }
108cdf0e10cSrcweir //----------------------------------------------------------------------------
109cdf0e10cSrcweir }
110