LibreOffice Module reportdesign (master)  1
reportformula.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 #ifndef INCLUDED_REPORTDESIGN_INC_REPORTFORMULA_HXX
21 #define INCLUDED_REPORTDESIGN_INC_REPORTFORMULA_HXX
22 
23 #include "dllapi.h"
24 
25 #include <osl/diagnose.h>
26 #include <rtl/ustring.hxx>
27 
28 
29 namespace rptui
30 {
31 
32 
33  //= ReportFormula
34 
36  {
37  public:
38  enum BindType
39  {
42 
44  };
45 
46  private:
50 
51  public:
53  ReportFormula( const OUString& _rFormula );
54 
56  ReportFormula( const BindType _eType, const OUString& _rFieldOrExpression );
57  ~ReportFormula();
58 
60  bool isValid() const;
61 
63  BindType getType() const { return m_eType; }
64 
66  const OUString&
67  getCompleteFormula() const { return m_sCompleteFormula; }
68 
77  const OUString& getUndecoratedContent() const { return m_sUndecoratedContent; }
78 
80  inline OUString const & getFieldName() const;
81 
85  OUString getEqualUndecoratedContent() const;
86 
88  inline OUString const & getExpression() const;
89 
96  OUString getBracketedFieldOrExpression() const;
97  };
98 
99 
100  inline OUString const & ReportFormula::getFieldName() const
101  {
102  OSL_PRECOND( getType() == Field, "ReportFormula::getFieldName: not bound to a field!" );
103  return getUndecoratedContent();
104  }
105 
106 
107  inline OUString const & ReportFormula::getExpression() const
108  {
109  OSL_PRECOND( getType() == Expression, "ReportFormula::getExpression: not bound to an expression!" );
110  return getUndecoratedContent();
111  }
112 
113 
114 } // namespace rptui
115 
116 
117 #endif // INCLUDED_REPORTDESIGN_INC_REPORTFORMULA_HXX
118 
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & getUndecoratedContent() const
gets the undecorated formula content
OUString getFieldName(guint nCol)
BindType getType() const
returns the type of the binding represented by the formula
#define REPORTDESIGN_DLLPUBLIC
Definition: dllapi.h:28
OUString m_sUndecoratedContent
OUString getExpression(const sal_Unicode *&rpcString, const sal_Unicode *pcEnd, sal_Unicode cEndChar)
OUString const & getFieldName() const
convenience alias for getUndecoratedContent, which asserts (in a non-product build) when used on an e...
const OUString & getCompleteFormula() const
returns the complete formula represented by the object
OUString const & getExpression() const
convenience alias for getUndecoratedContent, which asserts (in a non-product build) when used on a fi...