Branch data Line data Source code
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 : :
21 : : #include "datasettings.hxx"
22 : : #include "apitools.hxx"
23 : : #include "dbastrings.hrc"
24 : : #include <osl/diagnose.h>
25 : : #include <comphelper/property.hxx>
26 : : #include <comphelper/types.hxx>
27 : : #include <com/sun/star/beans/PropertyAttribute.hpp>
28 : : #include <vcl/svapp.hxx>
29 : : #include <com/sun/star/awt/FontWeight.hpp>
30 : : #include <com/sun/star/awt/FontEmphasisMark.hpp>
31 : : #include <com/sun/star/awt/FontRelief.hpp>
32 : :
33 : : #include <com/sun/star/awt/FontWidth.hpp>
34 : :
35 : :
36 : : using namespace ::com::sun::star::uno;
37 : : using namespace ::com::sun::star::awt;
38 : : using namespace ::com::sun::star::lang;
39 : : using namespace ::com::sun::star::beans;
40 : : using namespace ::comphelper;
41 : : using namespace ::cppu;
42 : :
43 : : namespace dbaccess
44 : : {
45 : : //==========================================================================
46 : : //= ODataSettings
47 : : //==========================================================================
48 : 82 : void ODataSettings::registerPropertiesFor(ODataSettings_Base* _pItem)
49 : : {
50 [ + + ]: 82 : if ( m_bQuery )
51 : : {
52 : : registerProperty(PROPERTY_HAVING_CLAUSE, PROPERTY_ID_HAVING_CLAUSE, PropertyAttribute::BOUND,
53 [ + - ]: 2 : &_pItem->m_sHavingClause, ::getCppuType(&_pItem->m_sHavingClause));
54 : :
55 : : registerProperty(PROPERTY_GROUP_BY, PROPERTY_ID_GROUP_BY, PropertyAttribute::BOUND,
56 [ + - ]: 2 : &_pItem->m_sGroupBy, ::getCppuType(&_pItem->m_sGroupBy));
57 : : }
58 : :
59 : : registerProperty(PROPERTY_FILTER, PROPERTY_ID_FILTER, PropertyAttribute::BOUND,
60 [ + - ]: 82 : &_pItem->m_sFilter, ::getCppuType(&_pItem->m_sFilter));
61 : :
62 : : registerProperty(PROPERTY_ORDER, PROPERTY_ID_ORDER, PropertyAttribute::BOUND,
63 [ + - ]: 82 : &_pItem->m_sOrder, ::getCppuType(&_pItem->m_sOrder));
64 : :
65 : : registerProperty(PROPERTY_APPLYFILTER, PROPERTY_ID_APPLYFILTER, PropertyAttribute::BOUND,
66 [ + - ]: 82 : &_pItem->m_bApplyFilter, ::getBooleanCppuType());
67 : :
68 : : registerProperty(PROPERTY_FONT, PROPERTY_ID_FONT, PropertyAttribute::BOUND,
69 [ + - ]: 82 : &_pItem->m_aFont, ::getCppuType(&_pItem->m_aFont));
70 : :
71 : : registerMayBeVoidProperty(PROPERTY_ROW_HEIGHT, PROPERTY_ID_ROW_HEIGHT, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
72 [ + - ]: 82 : &_pItem->m_aRowHeight, ::getCppuType(static_cast<sal_Int32*>(NULL)));
73 : :
74 : : registerMayBeVoidProperty(PROPERTY_TEXTCOLOR, PROPERTY_ID_TEXTCOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
75 [ + - ]: 82 : &_pItem->m_aTextColor, ::getCppuType(static_cast<sal_Int32*>(NULL)));
76 : :
77 : : registerMayBeVoidProperty(PROPERTY_TEXTLINECOLOR, PROPERTY_ID_TEXTLINECOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
78 [ + - ]: 82 : &_pItem->m_aTextLineColor, ::getCppuType(static_cast<sal_Int32*>(NULL)));
79 : :
80 : : registerProperty(PROPERTY_TEXTEMPHASIS, PROPERTY_ID_TEXTEMPHASIS, PropertyAttribute::BOUND,
81 [ + - ]: 82 : &_pItem->m_nFontEmphasis, ::getCppuType(&_pItem->m_nFontEmphasis));
82 : :
83 [ + - ]: 82 : registerProperty(PROPERTY_TEXTRELIEF, PROPERTY_ID_TEXTRELIEF, PropertyAttribute::BOUND,&_pItem->m_nFontRelief, ::getCppuType(&_pItem->m_nFontRelief));
84 : :
85 [ + - ]: 82 : registerProperty(PROPERTY_FONTNAME, PROPERTY_ID_FONTNAME, PropertyAttribute::BOUND,&_pItem->m_aFont.Name, ::getCppuType(&_pItem->m_aFont.Name));
86 [ + - ]: 82 : registerProperty(PROPERTY_FONTHEIGHT, PROPERTY_ID_FONTHEIGHT, PropertyAttribute::BOUND,&_pItem->m_aFont.Height, ::getCppuType(&_pItem->m_aFont.Height));
87 [ + - ]: 82 : registerProperty(PROPERTY_FONTWIDTH, PROPERTY_ID_FONTWIDTH, PropertyAttribute::BOUND,&_pItem->m_aFont.Width, ::getCppuType(&_pItem->m_aFont.Width));
88 [ + - ]: 82 : registerProperty(PROPERTY_FONTSTYLENAME, PROPERTY_ID_FONTSTYLENAME, PropertyAttribute::BOUND,&_pItem->m_aFont.StyleName, ::getCppuType(&_pItem->m_aFont.StyleName));
89 [ + - ]: 82 : registerProperty(PROPERTY_FONTFAMILY, PROPERTY_ID_FONTFAMILY, PropertyAttribute::BOUND,&_pItem->m_aFont.Family, ::getCppuType(&_pItem->m_aFont.Family));
90 [ + - ]: 82 : registerProperty(PROPERTY_FONTCHARSET, PROPERTY_ID_FONTCHARSET, PropertyAttribute::BOUND,&_pItem->m_aFont.CharSet, ::getCppuType(&_pItem->m_aFont.CharSet));
91 [ + - ]: 82 : registerProperty(PROPERTY_FONTPITCH, PROPERTY_ID_FONTPITCH, PropertyAttribute::BOUND,&_pItem->m_aFont.Pitch, ::getCppuType(&_pItem->m_aFont.Pitch));
92 [ + - ]: 82 : registerProperty(PROPERTY_FONTCHARWIDTH, PROPERTY_ID_FONTCHARWIDTH, PropertyAttribute::BOUND,&_pItem->m_aFont.CharacterWidth, ::getCppuType(&_pItem->m_aFont.CharacterWidth));
93 [ + - ]: 82 : registerProperty(PROPERTY_FONTWEIGHT, PROPERTY_ID_FONTWEIGHT, PropertyAttribute::BOUND,&_pItem->m_aFont.Weight, ::getCppuType(&_pItem->m_aFont.Weight));
94 [ + - ]: 82 : registerProperty(PROPERTY_FONTSLANT, PROPERTY_ID_FONTSLANT, PropertyAttribute::BOUND,&_pItem->m_aFont.Slant, ::getCppuType(&_pItem->m_aFont.Slant));
95 [ + - ]: 82 : registerProperty(PROPERTY_FONTUNDERLINE, PROPERTY_ID_FONTUNDERLINE, PropertyAttribute::BOUND,&_pItem->m_aFont.Underline, ::getCppuType(&_pItem->m_aFont.Underline));
96 [ + - ]: 82 : registerProperty(PROPERTY_FONTSTRIKEOUT, PROPERTY_ID_FONTSTRIKEOUT, PropertyAttribute::BOUND,&_pItem->m_aFont.Strikeout, ::getCppuType(&_pItem->m_aFont.Strikeout));
97 [ + - ]: 82 : registerProperty(PROPERTY_FONTORIENTATION, PROPERTY_ID_FONTORIENTATION, PropertyAttribute::BOUND,&_pItem->m_aFont.Orientation, ::getCppuType(&_pItem->m_aFont.Orientation));
98 [ + - ]: 82 : registerProperty(PROPERTY_FONTKERNING, PROPERTY_ID_FONTKERNING, PropertyAttribute::BOUND,&_pItem->m_aFont.Kerning, ::getCppuType(&_pItem->m_aFont.Kerning));
99 [ + - ]: 82 : registerProperty(PROPERTY_FONTWORDLINEMODE, PROPERTY_ID_FONTWORDLINEMODE,PropertyAttribute::BOUND,&_pItem->m_aFont.WordLineMode, ::getCppuType(&_pItem->m_aFont.WordLineMode));
100 [ + - ]: 82 : registerProperty(PROPERTY_FONTTYPE, PROPERTY_ID_FONTTYPE, PropertyAttribute::BOUND,&_pItem->m_aFont.Type, ::getCppuType(&_pItem->m_aFont.Type));
101 : 82 : }
102 : :
103 : 82 : ODataSettings::ODataSettings(OBroadcastHelper& _rBHelper,sal_Bool _bQuery)
104 : : :OPropertyStateContainer(_rBHelper)
105 : : ,ODataSettings_Base()
106 [ + - ]: 82 : ,m_bQuery(_bQuery)
107 : : {
108 : 82 : }
109 : :
110 : 124 : ODataSettings_Base::ODataSettings_Base()
111 : : :m_bApplyFilter(sal_False)
112 : : ,m_aFont(::comphelper::getDefaultFont())
113 : : ,m_nFontEmphasis(::com::sun::star::awt::FontEmphasisMark::NONE)
114 [ + - ]: 124 : ,m_nFontRelief(::com::sun::star::awt::FontRelief::NONE)
115 : : {
116 : 124 : }
117 : :
118 : 0 : ODataSettings_Base::ODataSettings_Base(const ODataSettings_Base& _rSource)
119 : : :m_sFilter( _rSource.m_sFilter )
120 : : ,m_sHavingClause( _rSource.m_sHavingClause )
121 : : ,m_sGroupBy( _rSource.m_sGroupBy )
122 : : ,m_sOrder( _rSource.m_sOrder )
123 : : ,m_bApplyFilter( _rSource.m_bApplyFilter )
124 : : ,m_aFont( _rSource.m_aFont )
125 : : ,m_aRowHeight( _rSource.m_aRowHeight )
126 : : ,m_aTextColor( _rSource.m_aTextColor )
127 : : ,m_aTextLineColor( _rSource.m_aTextLineColor )
128 : : ,m_nFontEmphasis( _rSource.m_nFontEmphasis )
129 : 0 : ,m_nFontRelief( _rSource.m_nFontRelief )
130 : : {
131 : 0 : }
132 : :
133 : 124 : ODataSettings_Base::~ODataSettings_Base()
134 : : {
135 : 124 : }
136 : :
137 : 0 : void ODataSettings::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const
138 : : {
139 [ # # ][ # # ]: 0 : static ::com::sun::star::awt::FontDescriptor aFD = ::comphelper::getDefaultFont();
[ # # ][ # # ]
140 [ # # # # : 0 : switch( _nHandle )
# # # # #
# # # # #
# # # # #
# # # ]
141 : : {
142 : : case PROPERTY_ID_HAVING_CLAUSE:
143 : : case PROPERTY_ID_GROUP_BY:
144 : : case PROPERTY_ID_FILTER:
145 : : case PROPERTY_ID_ORDER:
146 [ # # ]: 0 : _rDefault <<= ::rtl::OUString();
147 : 0 : break;
148 : : case PROPERTY_ID_FONT:
149 [ # # ]: 0 : _rDefault <<= ::comphelper::getDefaultFont();
150 : 0 : break;
151 : : case PROPERTY_ID_APPLYFILTER:
152 [ # # ]: 0 : _rDefault <<= sal_False;
153 : 0 : break;
154 : : case PROPERTY_ID_TEXTRELIEF:
155 : 0 : _rDefault <<= ::com::sun::star::awt::FontRelief::NONE;
156 : 0 : break;
157 : : case PROPERTY_ID_TEXTEMPHASIS:
158 : 0 : _rDefault <<= ::com::sun::star::awt::FontEmphasisMark::NONE;
159 : 0 : break;
160 : : case PROPERTY_ID_FONTNAME:
161 : 0 : _rDefault <<= aFD.Name;
162 : 0 : break;
163 : : case PROPERTY_ID_FONTHEIGHT:
164 : 0 : _rDefault <<= aFD.Height;
165 : 0 : break;
166 : : case PROPERTY_ID_FONTWIDTH:
167 : 0 : _rDefault <<= aFD.Width;
168 : 0 : break;
169 : : case PROPERTY_ID_FONTSTYLENAME:
170 : 0 : _rDefault <<= aFD.StyleName;
171 : 0 : break;
172 : : case PROPERTY_ID_FONTFAMILY:
173 : 0 : _rDefault <<= aFD.Family;
174 : 0 : break;
175 : : case PROPERTY_ID_FONTCHARSET:
176 : 0 : _rDefault <<= aFD.CharSet;
177 : 0 : break;
178 : : case PROPERTY_ID_FONTPITCH:
179 : 0 : _rDefault <<= aFD.Pitch;
180 : 0 : break;
181 : : case PROPERTY_ID_FONTCHARWIDTH:
182 : 0 : _rDefault <<= aFD.CharacterWidth;
183 : 0 : break;
184 : : case PROPERTY_ID_FONTWEIGHT:
185 : 0 : _rDefault <<= aFD.Weight;
186 : 0 : break;
187 : : case PROPERTY_ID_FONTSLANT:
188 : 0 : _rDefault <<= aFD.Slant;
189 : 0 : break;
190 : : case PROPERTY_ID_FONTUNDERLINE:
191 : 0 : _rDefault <<= aFD.Underline;
192 : 0 : break;
193 : : case PROPERTY_ID_FONTSTRIKEOUT:
194 : 0 : _rDefault <<= aFD.Strikeout;
195 : 0 : break;
196 : : case PROPERTY_ID_FONTORIENTATION:
197 : 0 : _rDefault <<= aFD.Orientation;
198 : 0 : break;
199 : : case PROPERTY_ID_FONTKERNING:
200 : 0 : _rDefault <<= aFD.Kerning;
201 : 0 : break;
202 : : case PROPERTY_ID_FONTWORDLINEMODE:
203 : 0 : _rDefault <<= aFD.WordLineMode;
204 : 0 : break;
205 : : case PROPERTY_ID_FONTTYPE:
206 : 0 : _rDefault <<= aFD.Type;
207 : 0 : break;
208 : : }
209 : 0 : }
210 : :
211 : : } // namespace dbaccess
212 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|