LibreOffice Module reportdesign (master)  1
dlgedfac.cxx
Go to the documentation of this file.
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 <strings.hxx>
21 #include <RptObject.hxx>
22 #include <RptDef.hxx>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <osl/diagnose.h>
25 
26 namespace rptui
27 {
28 using namespace ::com::sun::star;
29 
30 
32 {
34 }
35 
36 
37 DlgEdFactory::~DlgEdFactory() COVERITY_NOEXCEPT_FALSE
38 {
40 }
41 
42 
44  DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
45 {
46  SdrObject* pNewObj = nullptr;
47 
48  if ( aParams.nInventor == SdrInventor::ReportDesign )
49  {
50  switch( aParams.nObjIdentifier )
51  {
52  case OBJ_RD_FIXEDTEXT:
53  pNewObj = new OUnoObject(aParams.rSdrModel, SERVICE_FIXEDTEXT
54  ,OUString("com.sun.star.form.component.FixedText")
56  break;
58  pNewObj = new OUnoObject(aParams.rSdrModel, SERVICE_IMAGECONTROL
59  ,OUString("com.sun.star.form.component.DatabaseImageControl")
61  break;
63  pNewObj = new OUnoObject(aParams.rSdrModel, SERVICE_FORMATTEDFIELD
64  ,OUString("com.sun.star.form.component.FormattedField")
66  break;
67  case OBJ_RD_VFIXEDLINE:
68  case OBJ_RD_HFIXEDLINE:
69  {
70  OUnoObject* pObj = new OUnoObject(aParams.rSdrModel, SERVICE_FIXEDLINE
71  ,OUString("com.sun.star.awt.UnoControlFixedLineModel")
72  ,aParams.nObjIdentifier);
73  pNewObj = pObj;
74  if ( aParams.nObjIdentifier == OBJ_RD_HFIXEDLINE )
75  {
76  uno::Reference<beans::XPropertySet> xProp = pObj->getAwtComponent();
77  xProp->setPropertyValue( PROPERTY_ORIENTATION, uno::makeAny(sal_Int32(0)) );
78  }
79  }
80  break;
81  case OBJ_CUSTOMSHAPE:
82  pNewObj = new OCustomShape(aParams.rSdrModel, SERVICE_SHAPE);
83  break;
84  case OBJ_RD_SUBREPORT:
85  pNewObj = new OOle2Obj(aParams.rSdrModel, SERVICE_REPORTDEFINITION, OBJ_RD_SUBREPORT);
86  break;
87  case OBJ_OLE2:
88  pNewObj = new OOle2Obj(aParams.rSdrModel, "com.sun.star.chart2.ChartDocument", OBJ_OLE2);
89  break;
90  default:
91  OSL_FAIL("Unknown object id");
92  break;
93  }
94  }
95  return pNewObj;
96 }
97 
98 }
99 
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SERVICE_IMAGECONTROL
Definition: strings.hxx:24
OBJ_RD_HFIXEDLINE
static void InsertMakeObjectHdl(Link< SdrObjCreatorParams, SdrObject * > const &rLink)
~DlgEdFactory() COVERITY_NOEXCEPT_FALSE
Definition: dlgedfac.cxx:37
virtual css::uno::Reference< css::beans::XPropertySet > getAwtComponent() override
Definition: RptObject.cxx:886
OBJ_RD_FORMATTEDFIELD
OBJ_RD_VFIXEDLINE
#define SERVICE_FIXEDLINE
Definition: strings.hxx:29
OBJ_RD_SUBREPORT
OBJ_RD_IMAGECONTROL
#define SERVICE_FORMATTEDFIELD
Definition: strings.hxx:23
OBJ_RD_FIXEDTEXT
#define PROPERTY_ORIENTATION
Definition: strings.hxx:61
IMPL_STATIC_LINK(DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject *)
Definition: dlgedfac.cxx:43
static void RemoveMakeObjectHdl(Link< SdrObjCreatorParams, SdrObject * > const &rLink)
#define SERVICE_REPORTDEFINITION
Definition: strings.hxx:27
OBJ_CUSTOMSHAPE
OBJ_OLE2
#define SERVICE_SHAPE
Definition: strings.hxx:28
#define SERVICE_FIXEDTEXT
Definition: strings.hxx:22