LibreOffice Module dbaccess (master) 1
datasettings.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
20#include <datasettings.hxx>
21#include <stringconstants.hxx>
22#include <strings.hxx>
23#include <comphelper/types.hxx>
24#include <com/sun/star/beans/PropertyAttribute.hpp>
25#include <com/sun/star/awt/FontEmphasisMark.hpp>
26#include <com/sun/star/awt/FontRelief.hpp>
27
28using namespace ::com::sun::star::uno;
29using namespace ::com::sun::star::awt;
30using namespace ::com::sun::star::lang;
31using namespace ::com::sun::star::beans;
32using namespace ::comphelper;
33using namespace ::cppu;
34
35namespace dbaccess
36{
37// ODataSettings
39{
40 if ( m_bQuery )
41 {
43 &_pItem->m_sHavingClause, cppu::UnoType<decltype(_pItem->m_sHavingClause)>::get());
44
46 &_pItem->m_sGroupBy, cppu::UnoType<decltype(_pItem->m_sGroupBy)>::get());
47 }
48
49 registerProperty(PROPERTY_FILTER, PROPERTY_ID_FILTER, PropertyAttribute::BOUND,
50 &_pItem->m_sFilter, cppu::UnoType<decltype(_pItem->m_sFilter)>::get());
51
52 registerProperty(PROPERTY_ORDER, PROPERTY_ID_ORDER, PropertyAttribute::BOUND,
53 &_pItem->m_sOrder, cppu::UnoType<decltype(_pItem->m_sOrder)>::get());
54
57
58 registerProperty(PROPERTY_FONT, PROPERTY_ID_FONT, PropertyAttribute::BOUND,
59 &_pItem->m_aFont, cppu::UnoType<decltype(_pItem->m_aFont)>::get());
60
61 registerMayBeVoidProperty(PROPERTY_ROW_HEIGHT, PROPERTY_ID_ROW_HEIGHT, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
63
66
67 registerMayBeVoidProperty(PROPERTY_TEXTCOLOR, PROPERTY_ID_TEXTCOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
69
70 registerMayBeVoidProperty(PROPERTY_TEXTLINECOLOR, PROPERTY_ID_TEXTLINECOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
72
74 &_pItem->m_nFontEmphasis, cppu::UnoType<decltype(_pItem->m_nFontEmphasis)>::get());
75
76 registerProperty(PROPERTY_TEXTRELIEF, PROPERTY_ID_TEXTRELIEF, PropertyAttribute::BOUND,&_pItem->m_nFontRelief, cppu::UnoType<decltype(_pItem->m_nFontRelief)>::get());
77
78 registerProperty(PROPERTY_FONTNAME, PROPERTY_ID_FONTNAME, PropertyAttribute::BOUND,&_pItem->m_aFont.Name, cppu::UnoType<decltype(_pItem->m_aFont.Name)>::get());
79 registerProperty(PROPERTY_FONTHEIGHT, PROPERTY_ID_FONTHEIGHT, PropertyAttribute::BOUND,&_pItem->m_aFont.Height, cppu::UnoType<decltype(_pItem->m_aFont.Height)>::get());
80 registerProperty(PROPERTY_FONTWIDTH, PROPERTY_ID_FONTWIDTH, PropertyAttribute::BOUND,&_pItem->m_aFont.Width, cppu::UnoType<decltype(_pItem->m_aFont.Width)>::get());
81 registerProperty(PROPERTY_FONTSTYLENAME, PROPERTY_ID_FONTSTYLENAME, PropertyAttribute::BOUND,&_pItem->m_aFont.StyleName, cppu::UnoType<decltype(_pItem->m_aFont.StyleName)>::get());
82 registerProperty(PROPERTY_FONTFAMILY, PROPERTY_ID_FONTFAMILY, PropertyAttribute::BOUND,&_pItem->m_aFont.Family, cppu::UnoType<decltype(_pItem->m_aFont.Family)>::get());
83 registerProperty(PROPERTY_FONTCHARSET, PROPERTY_ID_FONTCHARSET, PropertyAttribute::BOUND,&_pItem->m_aFont.CharSet, cppu::UnoType<decltype(_pItem->m_aFont.CharSet)>::get());
84 registerProperty(PROPERTY_FONTPITCH, PROPERTY_ID_FONTPITCH, PropertyAttribute::BOUND,&_pItem->m_aFont.Pitch, cppu::UnoType<decltype(_pItem->m_aFont.Pitch)>::get());
85 registerProperty(PROPERTY_FONTCHARWIDTH, PROPERTY_ID_FONTCHARWIDTH, PropertyAttribute::BOUND,&_pItem->m_aFont.CharacterWidth, cppu::UnoType<decltype(_pItem->m_aFont.CharacterWidth)>::get());
86 registerProperty(PROPERTY_FONTWEIGHT, PROPERTY_ID_FONTWEIGHT, PropertyAttribute::BOUND,&_pItem->m_aFont.Weight, cppu::UnoType<decltype(_pItem->m_aFont.Weight)>::get());
87 registerProperty(PROPERTY_FONTSLANT, PROPERTY_ID_FONTSLANT, PropertyAttribute::BOUND,&_pItem->m_aFont.Slant, cppu::UnoType<decltype(_pItem->m_aFont.Slant)>::get());
88 registerProperty(PROPERTY_FONTUNDERLINE, PROPERTY_ID_FONTUNDERLINE, PropertyAttribute::BOUND,&_pItem->m_aFont.Underline, cppu::UnoType<decltype(_pItem->m_aFont.Underline)>::get());
89 registerProperty(PROPERTY_FONTSTRIKEOUT, PROPERTY_ID_FONTSTRIKEOUT, PropertyAttribute::BOUND,&_pItem->m_aFont.Strikeout, cppu::UnoType<decltype(_pItem->m_aFont.Strikeout)>::get());
90 registerProperty(PROPERTY_FONTORIENTATION, PROPERTY_ID_FONTORIENTATION, PropertyAttribute::BOUND,&_pItem->m_aFont.Orientation, cppu::UnoType<decltype(_pItem->m_aFont.Orientation)>::get());
91 registerProperty(PROPERTY_FONTKERNING, PROPERTY_ID_FONTKERNING, PropertyAttribute::BOUND,&_pItem->m_aFont.Kerning, cppu::UnoType<decltype(_pItem->m_aFont.Kerning)>::get());
92 registerProperty(PROPERTY_FONTWORDLINEMODE, PROPERTY_ID_FONTWORDLINEMODE,PropertyAttribute::BOUND,&_pItem->m_aFont.WordLineMode, cppu::UnoType<decltype(_pItem->m_aFont.WordLineMode)>::get());
93 registerProperty(PROPERTY_FONTTYPE, PROPERTY_ID_FONTTYPE, PropertyAttribute::BOUND,&_pItem->m_aFont.Type, cppu::UnoType<decltype(_pItem->m_aFont.Type)>::get());
94}
95
97 :OPropertyStateContainer(_rBHelper)
98 ,m_bQuery(_bQuery)
99{
100}
101
103 :m_bApplyFilter(false)
104 ,m_bAutoGrow(false)
106 ,m_nFontEmphasis(css::awt::FontEmphasisMark::NONE)
107 ,m_nFontRelief(css::awt::FontRelief::NONE)
108{
109}
110
112{
113}
114
115void ODataSettings::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const
116{
117 static css::awt::FontDescriptor aFD = ::comphelper::getDefaultFont();
118 switch( _nHandle )
119 {
124 _rDefault <<= OUString();
125 break;
126 case PROPERTY_ID_FONT:
127 _rDefault <<= ::comphelper::getDefaultFont();
128 break;
130 _rDefault <<= false;
131 break;
133 _rDefault <<= css::awt::FontRelief::NONE;
134 break;
136 _rDefault <<= css::awt::FontEmphasisMark::NONE;
137 break;
139 _rDefault <<= aFD.Name;
140 break;
142 _rDefault <<= aFD.Height;
143 break;
145 _rDefault <<= aFD.Width;
146 break;
148 _rDefault <<= aFD.StyleName;
149 break;
151 _rDefault <<= aFD.Family;
152 break;
154 _rDefault <<= aFD.CharSet;
155 break;
157 _rDefault <<= aFD.Pitch;
158 break;
160 _rDefault <<= aFD.CharacterWidth;
161 break;
163 _rDefault <<= aFD.Weight;
164 break;
166 _rDefault <<= aFD.Slant;
167 break;
169 _rDefault <<= aFD.Underline;
170 break;
172 _rDefault <<= aFD.Strikeout;
173 break;
175 _rDefault <<= aFD.Orientation;
176 break;
178 _rDefault <<= aFD.Kerning;
179 break;
181 _rDefault <<= aFD.WordLineMode;
182 break;
184 _rDefault <<= aFD.Type;
185 break;
186 }
187}
188
189} // namespace dbaccess
190
191/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void registerProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType)
void registerMayBeVoidProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, css::uno::Any *_pPointerToMember, const css::uno::Type &_rExpectedType)
css::awt::FontDescriptor m_aFont
ODataSettings(::cppu::OBroadcastHelper &_rBHelper, bool _bQuery=false)
void registerPropertiesFor(ODataSettings_Base *_pItem)
register the properties from the param given.
virtual void getPropertyDefaultByHandle(sal_Int32 _nHandle, css::uno::Any &_rDefault) const override
FontRelief
FontEmphasisMark
Font m_aFont
NONE
FontDescriptor getDefaultFont()
OBroadcastHelperVar< OMultiTypeInterfaceContainerHelper, OMultiTypeInterfaceContainerHelper::keyType > OBroadcastHelper
#define PROPERTY_ID_FONTFAMILY
#define PROPERTY_ID_TEXTEMPHASIS
#define PROPERTY_ID_HAVING_CLAUSE
#define PROPERTY_ID_TEXTRELIEF
#define PROPERTY_ID_AUTOGROW
#define PROPERTY_ID_FONTWORDLINEMODE
#define PROPERTY_ID_FILTER
#define PROPERTY_ID_FONTHEIGHT
#define PROPERTY_ID_FONTSLANT
#define PROPERTY_ID_FONTSTYLENAME
#define PROPERTY_ID_FONTSTRIKEOUT
#define PROPERTY_ID_FONTUNDERLINE
#define PROPERTY_ID_FONTWIDTH
#define PROPERTY_ID_FONTWEIGHT
#define PROPERTY_ID_FONTNAME
#define PROPERTY_ID_ORDER
#define PROPERTY_ID_FONTTYPE
#define PROPERTY_ID_FONTCHARWIDTH
#define PROPERTY_ID_GROUP_BY
#define PROPERTY_ID_TEXTLINECOLOR
#define PROPERTY_ID_TEXTCOLOR
#define PROPERTY_ID_FONTKERNING
#define PROPERTY_ID_FONT
#define PROPERTY_ID_FONTORIENTATION
#define PROPERTY_ID_ROW_HEIGHT
#define PROPERTY_ID_FONTPITCH
#define PROPERTY_ID_APPLYFILTER
#define PROPERTY_ID_FONTCHARSET
constexpr OUStringLiteral PROPERTY_FONTHEIGHT(u"FontHeight")
constexpr OUStringLiteral PROPERTY_FONTCHARWIDTH(u"FontCharWidth")
constexpr OUStringLiteral PROPERTY_FONTORIENTATION(u"FontOrientation")
constexpr OUStringLiteral PROPERTY_TEXTCOLOR(u"TextColor")
constexpr OUStringLiteral PROPERTY_HAVING_CLAUSE(u"HavingClause")
constexpr OUStringLiteral PROPERTY_FONTUNDERLINE(u"FontUnderline")
constexpr OUStringLiteral PROPERTY_FONTKERNING(u"FontKerning")
constexpr OUStringLiteral PROPERTY_FONTSTRIKEOUT(u"FontStrikeout")
constexpr OUStringLiteral PROPERTY_FONTPITCH(u"FontPitch")
constexpr OUStringLiteral PROPERTY_FONTSLANT(u"FontSlant")
constexpr OUStringLiteral PROPERTY_APPLYFILTER(u"ApplyFilter")
constexpr OUStringLiteral PROPERTY_GROUP_BY(u"GroupBy")
constexpr OUStringLiteral PROPERTY_TEXTEMPHASIS(u"FontEmphasisMark")
constexpr OUStringLiteral PROPERTY_AUTOGROW(u"AutoGrow")
constexpr OUStringLiteral PROPERTY_FILTER(u"Filter")
constexpr OUStringLiteral PROPERTY_FONTCHARSET(u"FontCharset")
constexpr OUStringLiteral PROPERTY_FONT(u"FontDescriptor")
constexpr OUStringLiteral PROPERTY_FONTNAME(u"FontName")
constexpr OUStringLiteral PROPERTY_TEXTLINECOLOR(u"TextLineColor")
constexpr OUStringLiteral PROPERTY_FONTSTYLENAME(u"FontStyleName")
constexpr OUStringLiteral PROPERTY_FONTWEIGHT(u"FontWeight")
constexpr OUStringLiteral PROPERTY_FONTFAMILY(u"FontFamily")
constexpr OUStringLiteral PROPERTY_TEXTRELIEF(u"FontRelief")
constexpr OUStringLiteral PROPERTY_FONTTYPE(u"FontType")
constexpr OUStringLiteral PROPERTY_FONTWIDTH(u"FontWidth")
constexpr OUStringLiteral PROPERTY_FONTWORDLINEMODE(u"FontWordLineMode")
constexpr OUStringLiteral PROPERTY_ROW_HEIGHT(u"RowHeight")
constexpr OUStringLiteral PROPERTY_ORDER(u"Order")