Update git submodules
[LibreOffice.git] / reportdesign / inc / RptDef.hxx
blob9d60fe3594aabbbc5b9610f62a8e5e77f3dba9f6
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 #pragma once
22 #include <memory>
23 #include <map>
25 #include <sal/config.h>
27 #include "dllapi.h"
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/style/XStyle.hpp>
30 #include <svx/svdobjkind.hxx>
31 #include <svx/svdtypes.hxx>
33 namespace com::sun::star {
34 namespace report {
35 class XReportComponent;
36 class XReportDefinition;
40 namespace rptui
42 // not all used at the moment
43 constexpr SdrLayerID RPT_LAYER_FRONT (0);
44 constexpr SdrLayerID RPT_LAYER_BACK (1);
45 constexpr SdrLayerID RPT_LAYER_HIDDEN (2);
47 // allows the alignment and resizing of controls
48 enum class ControlModification
50 NONE = 0,
51 LEFT = 1,
52 RIGHT = 2,
53 TOP = 3,
54 BOTTOM = 4,
55 CENTER_HORIZONTAL = 5,
56 CENTER_VERTICAL = 6,
57 WIDTH_SMALLEST = 7,
58 HEIGHT_SMALLEST = 8,
59 WIDTH_GREATEST = 9,
60 HEIGHT_GREATEST = 10,
63 class AnyConverter
65 public:
66 virtual ~AnyConverter(){}
67 virtual css::uno::Any operator() (const OUString& /*_sPropertyName*/,const css::uno::Any& lhs) const
69 return lhs;
72 typedef ::std::pair< OUString, std::shared_ptr<AnyConverter> > TPropertyConverter;
73 typedef std::map<OUString, TPropertyConverter> TPropertyNamePair;
74 /** returns the property name map for the given property id
75 @param _nObjectId the object id
77 REPORTDESIGN_DLLPUBLIC const TPropertyNamePair& getPropertyNameMap(SdrObjKind _nObjectId);
78 REPORTDESIGN_DLLPUBLIC css::uno::Reference< css::style::XStyle> getUsedStyle(const css::uno::Reference< css::report::XReportDefinition>& _xReport);
80 template < typename T> T getStyleProperty(const css::uno::Reference< css::report::XReportDefinition>& _xReport,const OUString& _sPropertyName)
82 T nReturn = T();
83 css::uno::Reference<css::beans::XPropertySet> xProp(getUsedStyle(_xReport),css::uno::UNO_QUERY_THROW);
84 xProp->getPropertyValue(_sPropertyName) >>= nReturn;
85 return nReturn;
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */