Update ooo320-m1
[ooovba.git] / reportdesign / source / ui / report / dlgedfac.cxx
blobe6d825f02d46bc662bbdd7d67db4e19864ddf3f3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlgedfac.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include "precompiled_reportdesign.hxx"
31 #include "dlgedfac.hxx"
32 #ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC
33 #include "uistrings.hrc"
34 #endif
35 #include "RptObject.hxx"
36 #include <RptDef.hxx>
37 #include <com/sun/star/container/XNameContainer.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/beans/PropertyValue.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
42 #include <svx/svdoole2.hxx>
43 namespace rptui
45 using namespace ::com::sun::star;
47 //----------------------------------------------------------------------------
49 DlgEdFactory::DlgEdFactory()
51 SdrObjFactory::InsertMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
54 //----------------------------------------------------------------------------
56 DlgEdFactory::~DlgEdFactory()
58 SdrObjFactory::RemoveMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
61 //----------------------------------------------------------------------------
63 IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory )
65 if ( pObjFactory->nInventor == ReportInventor )
67 switch( pObjFactory->nIdentifier )
69 case OBJ_DLG_FIXEDTEXT:
70 pObjFactory->pNewObj = new OUnoObject( SERVICE_FIXEDTEXT
71 ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText"))
72 ,OBJ_DLG_FIXEDTEXT);
73 break;
74 case OBJ_DLG_IMAGECONTROL:
75 pObjFactory->pNewObj = new OUnoObject( SERVICE_IMAGECONTROL
76 ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl"))
77 ,OBJ_DLG_IMAGECONTROL);
78 break;
79 case OBJ_DLG_FORMATTEDFIELD:
80 pObjFactory->pNewObj = new OUnoObject( SERVICE_FORMATTEDFIELD
81 ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FormattedField"))
82 ,OBJ_DLG_FORMATTEDFIELD);
83 break;
84 case OBJ_DLG_VFIXEDLINE:
85 case OBJ_DLG_HFIXEDLINE:
87 OUnoObject* pObj = new OUnoObject( SERVICE_FIXEDLINE
88 ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel"))
89 ,pObjFactory->nIdentifier);
90 pObjFactory->pNewObj = pObj;
91 if ( pObjFactory->nIdentifier == OBJ_DLG_HFIXEDLINE )
93 uno::Reference<beans::XPropertySet> xProp = pObj->getAwtComponent();
94 xProp->setPropertyValue( PROPERTY_ORIENTATION, uno::makeAny(sal_Int32(0)) );
97 break;
98 case OBJ_CUSTOMSHAPE:
99 pObjFactory->pNewObj = new OCustomShape(SERVICE_SHAPE);
100 break;
101 case OBJ_DLG_SUBREPORT:
102 pObjFactory->pNewObj = new OOle2Obj(SERVICE_REPORTDEFINITION,OBJ_DLG_SUBREPORT);
103 break;
104 case OBJ_OLE2:
105 pObjFactory->pNewObj = new OOle2Obj(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.ChartDocument")),OBJ_OLE2);
106 break;
107 default:
108 OSL_ENSURE(0,"Unknown object id");
109 break;
113 return 0;
115 //----------------------------------------------------------------------------