LibreOffice Module reportdesign (master)  1
RptDef.hxx
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 
20 #pragma once
21 
22 #include <memory>
23 #include <map>
24 
25 #include <sal/config.h>
26 
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>
32 
33 namespace com::sun::star {
34  namespace report {
35  class XReportComponent;
36  class XReportDefinition;
37  }
38 }
39 
40 namespace rptui
41 {
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);
46 
47 // allows the alignment and resizing of controls
49 {
50  NONE = 0,
51  LEFT = 1,
52  RIGHT = 2,
53  TOP = 3,
54  BOTTOM = 4,
56  CENTER_VERTICAL = 6,
57  WIDTH_SMALLEST = 7,
58  HEIGHT_SMALLEST = 8,
59  WIDTH_GREATEST = 9,
60  HEIGHT_GREATEST = 10,
61 };
62 
64 {
65 public:
66  virtual ~AnyConverter(){}
67  virtual css::uno::Any operator() (const OUString& /*_sPropertyName*/,const css::uno::Any& lhs) const
68  {
69  return lhs;
70  }
71 };
72 typedef ::std::pair< OUString, std::shared_ptr<AnyConverter> > TPropertyConverter;
73 typedef std::map<OUString, TPropertyConverter> TPropertyNamePair;
77 REPORTDESIGN_DLLPUBLIC const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId);
78 REPORTDESIGN_DLLPUBLIC css::uno::Reference< css::style::XStyle> getUsedStyle(const css::uno::Reference< css::report::XReportDefinition>& _xReport);
79 
80 template < typename T> T getStyleProperty(const css::uno::Reference< css::report::XReportDefinition>& _xReport,const OUString& _sPropertyName)
81 {
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;
86 }
87 
88 }
89 
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr SdrLayerID RPT_LAYER_BACK(1)
std::map< OUString, TPropertyConverter > TPropertyNamePair
Definition: RptDef.hxx:73
#define REPORTDESIGN_DLLPUBLIC
Definition: dllapi.h:28
uno::Reference< style::XStyle > getUsedStyle(const uno::Reference< report::XReportDefinition > &_xReport)
Definition: RptObject.cxx:1197
T getStyleProperty(const css::uno::Reference< css::report::XReportDefinition > &_xReport, const OUString &_sPropertyName)
Definition: RptDef.hxx:80
::std::pair< OUString, std::shared_ptr< AnyConverter > > TPropertyConverter
Definition: RptDef.hxx:72
ControlModification
Definition: RptDef.hxx:48
constexpr SdrLayerID RPT_LAYER_FRONT(0)
virtual css::uno::Any operator()(const OUString &, const css::uno::Any &lhs) const
Definition: RptDef.hxx:67
constexpr SdrLayerID RPT_LAYER_HIDDEN(2)
const TPropertyNamePair & getPropertyNameMap(sal_uInt16 _nObjectId)
returns the property name map for the given property id
Definition: RptObject.cxx:226
virtual ~AnyConverter()
Definition: RptDef.hxx:66