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 <com/sun/star/beans/XPropertySet.hpp>
23 #include <osl/diagnose.h>
24 
25 namespace rptui
26 {
27 using namespace ::com::sun::star;
28 
29 
31 {
33 }
34 
35 
36 DlgEdFactory::~DlgEdFactory() COVERITY_NOEXCEPT_FALSE
37 {
39 }
40 
41 
43  DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
44 {
45  SdrObject* pNewObj = nullptr;
46 
47  if ( aParams.nInventor == SdrInventor::ReportDesign )
48  {
49  switch( aParams.nObjIdentifier )
50  {
51  case SdrObjKind::ReportDesignFixedText:
52  pNewObj = new OUnoObject(aParams.rSdrModel, SERVICE_FIXEDTEXT
53  ,OUString("com.sun.star.form.component.FixedText")
54  ,SdrObjKind::ReportDesignFixedText);
55  break;
56  case SdrObjKind::ReportDesignImageControl:
57  pNewObj = new OUnoObject(aParams.rSdrModel, SERVICE_IMAGECONTROL
58  ,OUString("com.sun.star.form.component.DatabaseImageControl")
59  ,SdrObjKind::ReportDesignImageControl);
60  break;
61  case SdrObjKind::ReportDesignFormattedField:
62  pNewObj = new OUnoObject(aParams.rSdrModel, SERVICE_FORMATTEDFIELD
63  ,OUString("com.sun.star.form.component.FormattedField")
64  ,SdrObjKind::ReportDesignFormattedField);
65  break;
66  case SdrObjKind::ReportDesignVerticalFixedLine:
67  case SdrObjKind::ReportDesignHorizontalFixedLine:
68  {
69  OUnoObject* pObj = new OUnoObject(aParams.rSdrModel, SERVICE_FIXEDLINE
70  ,OUString("com.sun.star.awt.UnoControlFixedLineModel")
71  ,aParams.nObjIdentifier);
72  pNewObj = pObj;
73  if ( aParams.nObjIdentifier == SdrObjKind::ReportDesignHorizontalFixedLine )
74  {
75  uno::Reference<beans::XPropertySet> xProp = pObj->getAwtComponent();
76  xProp->setPropertyValue( PROPERTY_ORIENTATION, uno::Any(sal_Int32(0)) );
77  }
78  }
79  break;
80  case SdrObjKind::CustomShape:
81  pNewObj = new OCustomShape(aParams.rSdrModel, SERVICE_SHAPE);
82  break;
83  case SdrObjKind::ReportDesignSubReport:
84  pNewObj = new OOle2Obj(aParams.rSdrModel, SERVICE_REPORTDEFINITION, SdrObjKind::ReportDesignSubReport);
85  break;
86  case SdrObjKind::OLE2:
87  pNewObj = new OOle2Obj(aParams.rSdrModel, "com.sun.star.chart2.ChartDocument", SdrObjKind::OLE2);
88  break;
89  default:
90  OSL_FAIL("Unknown object id");
91  break;
92  }
93  }
94  return pNewObj;
95 }
96 
97 }
98 
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void InsertMakeObjectHdl(Link< SdrObjCreatorParams, SdrObject * > const &rLink)
constexpr OUStringLiteral SERVICE_FORMATTEDFIELD
Definition: strings.hxx:23
~DlgEdFactory() COVERITY_NOEXCEPT_FALSE
Definition: dlgedfac.cxx:36
virtual css::uno::Reference< css::beans::XPropertySet > getAwtComponent() override
Definition: RptObject.cxx:885
constexpr OUStringLiteral SERVICE_REPORTDEFINITION
Definition: strings.hxx:27
constexpr OUStringLiteral SERVICE_FIXEDTEXT
Definition: strings.hxx:22
constexpr OUStringLiteral SERVICE_FIXEDLINE
Definition: strings.hxx:29
constexpr OUStringLiteral SERVICE_SHAPE
Definition: strings.hxx:28
#define PROPERTY_ORIENTATION
Definition: strings.hxx:61
IMPL_STATIC_LINK(DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject *)
Definition: dlgedfac.cxx:42
static void RemoveMakeObjectHdl(Link< SdrObjCreatorParams, SdrObject * > const &rLink)
constexpr OUStringLiteral SERVICE_IMAGECONTROL
Definition: strings.hxx:24