Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #include "dlgedfac.hxx"
20 : #include "uistrings.hrc"
21 : #include "RptObject.hxx"
22 : #include <RptDef.hxx>
23 : #include <com/sun/star/container/XNameContainer.hpp>
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 : #include <com/sun/star/beans/PropertyValue.hpp>
26 : #include <com/sun/star/beans/XPropertySet.hpp>
27 : #include <com/sun/star/awt/ScrollBarOrientation.hpp>
28 : #include <svx/svdoole2.hxx>
29 : namespace rptui
30 : {
31 : using namespace ::com::sun::star;
32 :
33 :
34 :
35 0 : DlgEdFactory::DlgEdFactory()
36 : {
37 0 : SdrObjFactory::InsertMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
38 0 : }
39 :
40 :
41 :
42 0 : DlgEdFactory::~DlgEdFactory()
43 : {
44 0 : SdrObjFactory::RemoveMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
45 0 : }
46 :
47 :
48 :
49 0 : IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory )
50 : {
51 0 : if ( pObjFactory->nInventor == ReportInventor )
52 : {
53 0 : switch( pObjFactory->nIdentifier )
54 : {
55 : case OBJ_DLG_FIXEDTEXT:
56 : pObjFactory->pNewObj = new OUnoObject( SERVICE_FIXEDTEXT
57 : ,OUString("com.sun.star.form.component.FixedText")
58 0 : ,OBJ_DLG_FIXEDTEXT);
59 0 : break;
60 : case OBJ_DLG_IMAGECONTROL:
61 : pObjFactory->pNewObj = new OUnoObject( SERVICE_IMAGECONTROL
62 : ,OUString("com.sun.star.form.component.DatabaseImageControl")
63 0 : ,OBJ_DLG_IMAGECONTROL);
64 0 : break;
65 : case OBJ_DLG_FORMATTEDFIELD:
66 : pObjFactory->pNewObj = new OUnoObject( SERVICE_FORMATTEDFIELD
67 : ,OUString("com.sun.star.form.component.FormattedField")
68 0 : ,OBJ_DLG_FORMATTEDFIELD);
69 0 : break;
70 : case OBJ_DLG_VFIXEDLINE:
71 : case OBJ_DLG_HFIXEDLINE:
72 : {
73 : OUnoObject* pObj = new OUnoObject( SERVICE_FIXEDLINE
74 : ,OUString("com.sun.star.awt.UnoControlFixedLineModel")
75 0 : ,pObjFactory->nIdentifier);
76 0 : pObjFactory->pNewObj = pObj;
77 0 : if ( pObjFactory->nIdentifier == OBJ_DLG_HFIXEDLINE )
78 : {
79 0 : uno::Reference<beans::XPropertySet> xProp = pObj->getAwtComponent();
80 0 : xProp->setPropertyValue( PROPERTY_ORIENTATION, uno::makeAny(sal_Int32(0)) );
81 : }
82 : }
83 0 : break;
84 : case OBJ_CUSTOMSHAPE:
85 0 : pObjFactory->pNewObj = new OCustomShape(SERVICE_SHAPE);
86 0 : break;
87 : case OBJ_DLG_SUBREPORT:
88 0 : pObjFactory->pNewObj = new OOle2Obj(SERVICE_REPORTDEFINITION,OBJ_DLG_SUBREPORT);
89 0 : break;
90 : case OBJ_OLE2:
91 0 : pObjFactory->pNewObj = new OOle2Obj(OUString("com.sun.star.chart2.ChartDocument"),OBJ_OLE2);
92 0 : break;
93 : default:
94 : OSL_FAIL("Unknown object id");
95 0 : break;
96 : }
97 : }
98 :
99 0 : return 0;
100 : }
101 :
102 : }
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|