tdf#150732 ReportBuilder,Moving fields breaks connection of field to datasource
[LibreOffice.git] / reportdesign / source / ui / report / dlgedfac.cxx
blobac820a95a3c6e87f0e807535cfdab1530ba10a82
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #include <dlgedfac.hxx>
20 #include <strings.hxx>
21 #include <RptObject.hxx>
22 #include <com/sun/star/beans/XPropertySet.hpp>
23 #include <osl/diagnose.h>
25 namespace rptui
27 using namespace ::com::sun::star;
30 DlgEdFactory::DlgEdFactory()
32 SdrObjFactory::InsertMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
36 DlgEdFactory::~DlgEdFactory() COVERITY_NOEXCEPT_FALSE
38 SdrObjFactory::RemoveMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
42 IMPL_STATIC_LINK(
43 DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, rtl::Reference<SdrObject> )
45 rtl::Reference<SdrObject> pNewObj;
47 if ( aParams.nInventor == SdrInventor::ReportDesign )
49 switch( aParams.nObjIdentifier )
51 case SdrObjKind::ReportDesignFixedText:
52 pNewObj = new OUnoObject(aParams.rSdrModel
53 ,"com.sun.star.form.component.FixedText"
54 ,SdrObjKind::ReportDesignFixedText);
55 break;
56 case SdrObjKind::ReportDesignImageControl:
57 pNewObj = new OUnoObject(aParams.rSdrModel
58 ,"com.sun.star.form.component.DatabaseImageControl"
59 ,SdrObjKind::ReportDesignImageControl);
60 break;
61 case SdrObjKind::ReportDesignFormattedField:
62 pNewObj = new OUnoObject(aParams.rSdrModel
63 ,"com.sun.star.form.component.FormattedField"
64 ,SdrObjKind::ReportDesignFormattedField);
65 break;
66 case SdrObjKind::ReportDesignVerticalFixedLine:
67 case SdrObjKind::ReportDesignHorizontalFixedLine:
69 rtl::Reference<OUnoObject> pObj = new OUnoObject(aParams.rSdrModel
70 ,"com.sun.star.awt.UnoControlFixedLineModel"
71 ,aParams.nObjIdentifier);
72 pNewObj = pObj;
73 if ( aParams.nObjIdentifier == SdrObjKind::ReportDesignHorizontalFixedLine )
75 uno::Reference<beans::XPropertySet> xProp = pObj->getAwtComponent();
76 xProp->setPropertyValue( PROPERTY_ORIENTATION, uno::Any(sal_Int32(0)) );
79 break;
80 case SdrObjKind::CustomShape:
81 pNewObj = new OCustomShape(aParams.rSdrModel);
82 break;
83 case SdrObjKind::ReportDesignSubReport:
84 pNewObj = new OOle2Obj(aParams.rSdrModel, SdrObjKind::ReportDesignSubReport);
85 break;
86 case SdrObjKind::OLE2:
87 pNewObj = new OOle2Obj(aParams.rSdrModel, SdrObjKind::OLE2);
88 break;
89 default:
90 OSL_FAIL("Unknown object id");
91 break;
94 return pNewObj;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */