Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #include "dlgedfac.hxx"
29 : : #include "uistrings.hrc"
30 : : #include "RptObject.hxx"
31 : : #include <RptDef.hxx>
32 : : #include <com/sun/star/container/XNameContainer.hpp>
33 : : #include <com/sun/star/lang/XServiceInfo.hpp>
34 : : #include <com/sun/star/beans/PropertyValue.hpp>
35 : : #include <com/sun/star/beans/XPropertySet.hpp>
36 : : #include <com/sun/star/awt/ScrollBarOrientation.hpp>
37 : : #include <svx/svdoole2.hxx>
38 : : namespace rptui
39 : : {
40 : : using namespace ::com::sun::star;
41 : :
42 : : //----------------------------------------------------------------------------
43 : :
44 : 0 : DlgEdFactory::DlgEdFactory()
45 : : {
46 : 0 : SdrObjFactory::InsertMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
47 : 0 : }
48 : :
49 : : //----------------------------------------------------------------------------
50 : :
51 : 0 : DlgEdFactory::~DlgEdFactory()
52 : : {
53 : 0 : SdrObjFactory::RemoveMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
54 : 0 : }
55 : :
56 : : //----------------------------------------------------------------------------
57 : :
58 : 0 : IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory )
59 : : {
60 : 0 : if ( pObjFactory->nInventor == ReportInventor )
61 : : {
62 : 0 : switch( pObjFactory->nIdentifier )
63 : : {
64 : : case OBJ_DLG_FIXEDTEXT:
65 : : pObjFactory->pNewObj = new OUnoObject( SERVICE_FIXEDTEXT
66 : : ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText"))
67 : 0 : ,OBJ_DLG_FIXEDTEXT);
68 : 0 : break;
69 : : case OBJ_DLG_IMAGECONTROL:
70 : : pObjFactory->pNewObj = new OUnoObject( SERVICE_IMAGECONTROL
71 : : ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl"))
72 : 0 : ,OBJ_DLG_IMAGECONTROL);
73 : 0 : break;
74 : : case OBJ_DLG_FORMATTEDFIELD:
75 : : pObjFactory->pNewObj = new OUnoObject( SERVICE_FORMATTEDFIELD
76 : : ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FormattedField"))
77 : 0 : ,OBJ_DLG_FORMATTEDFIELD);
78 : 0 : break;
79 : : case OBJ_DLG_VFIXEDLINE:
80 : : case OBJ_DLG_HFIXEDLINE:
81 : : {
82 : : OUnoObject* pObj = new OUnoObject( SERVICE_FIXEDLINE
83 : : ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel"))
84 : 0 : ,pObjFactory->nIdentifier);
85 : 0 : pObjFactory->pNewObj = pObj;
86 : 0 : if ( pObjFactory->nIdentifier == OBJ_DLG_HFIXEDLINE )
87 : : {
88 : 0 : uno::Reference<beans::XPropertySet> xProp = pObj->getAwtComponent();
89 : 0 : xProp->setPropertyValue( PROPERTY_ORIENTATION, uno::makeAny(sal_Int32(0)) );
90 : : }
91 : : }
92 : 0 : break;
93 : : case OBJ_CUSTOMSHAPE:
94 : 0 : pObjFactory->pNewObj = new OCustomShape(SERVICE_SHAPE);
95 : 0 : break;
96 : : case OBJ_DLG_SUBREPORT:
97 : 0 : pObjFactory->pNewObj = new OOle2Obj(SERVICE_REPORTDEFINITION,OBJ_DLG_SUBREPORT);
98 : 0 : break;
99 : : case OBJ_OLE2:
100 : 0 : pObjFactory->pNewObj = new OOle2Obj(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.ChartDocument")),OBJ_OLE2);
101 : 0 : break;
102 : : default:
103 : : OSL_FAIL("Unknown object id");
104 : 0 : break;
105 : : }
106 : : }
107 : :
108 : 0 : return 0;
109 : : }
110 : : //----------------------------------------------------------------------------
111 : : }
112 : :
113 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|