Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / reportdesign / inc / RptDef.hxx
blob33de83b9e1a5a0c191a9a6576194cccd60129917
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 .
20 #ifndef INCLUDED_REPORTDESIGN_INC_RPTDEF_HXX
21 #define INCLUDED_REPORTDESIGN_INC_RPTDEF_HXX
23 #include <memory>
24 #include <map>
26 #include <sal/config.h>
28 #include "dllapi.h"
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <svx/fmglob.hxx>
31 #include <svx/svdobj.hxx>
33 namespace com { namespace sun { namespace star {
34 namespace report {
35 class XReportComponent;
36 class XReportDefinition;
38 namespace style {
39 class XStyle;
41 }}}
43 namespace rptui
45 // not all used at the moment
46 constexpr SdrLayerID RPT_LAYER_FRONT (0);
47 constexpr SdrLayerID RPT_LAYER_BACK (1);
48 constexpr SdrLayerID RPT_LAYER_HIDDEN (2);
52 #define OBJ_DLG_FIXEDTEXT (sal_uInt16(OBJ_MAXI) + 1)
53 #define OBJ_DLG_IMAGECONTROL OBJ_FM_IMAGECONTROL
54 #define OBJ_DLG_FORMATTEDFIELD (sal_uInt16(OBJ_MAXI) + 3)
55 #define OBJ_DLG_HFIXEDLINE (sal_uInt16(OBJ_MAXI) + 4)
56 #define OBJ_DLG_VFIXEDLINE (sal_uInt16(OBJ_MAXI) + 5)
57 #define OBJ_DLG_SUBREPORT (sal_uInt16(OBJ_MAXI) + 6)
59 // allows the alignment and resizing of controls
60 enum class ControlModification
62 NONE = 0,
63 LEFT = 1,
64 RIGHT = 2,
65 TOP = 3,
66 BOTTOM = 4,
67 CENTER_HORIZONTAL = 5,
68 CENTER_VERTICAL = 6,
69 WIDTH_SMALLEST = 7,
70 HEIGHT_SMALLEST = 8,
71 WIDTH_GREATEST = 9,
72 HEIGHT_GREATEST = 10,
75 class AnyConverter
77 public:
78 virtual ~AnyConverter(){}
79 virtual css::uno::Any operator() (const OUString& /*_sPropertyName*/,const css::uno::Any& lhs) const
81 return lhs;
84 typedef ::std::pair< OUString, std::shared_ptr<AnyConverter> > TPropertyConverter;
85 typedef std::map<OUString, TPropertyConverter> TPropertyNamePair;
86 /** returns the property name map for the given property id
87 @param _nObjectId the object id
89 REPORTDESIGN_DLLPUBLIC const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId);
90 REPORTDESIGN_DLLPUBLIC css::uno::Reference< css::style::XStyle> getUsedStyle(const css::uno::Reference< css::report::XReportDefinition>& _xReport);
92 template < typename T> T getStyleProperty(const css::uno::Reference< css::report::XReportDefinition>& _xReport,const OUString& _sPropertyName)
94 T nReturn = T();
95 css::uno::Reference<css::beans::XPropertySet> xProp(getUsedStyle(_xReport),css::uno::UNO_QUERY_THROW);
96 xProp->getPropertyValue(_sPropertyName) >>= nReturn;
97 return nReturn;
102 #endif // INCLUDED_REPORTDESIGN_INC_RPTDEF_HXX
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */