1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96de5490SAndrew Rist  * distributed with this work for additional information
6*96de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist  * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*96de5490SAndrew Rist  *
11*96de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*96de5490SAndrew Rist  *
13*96de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist  * software distributed under the License is distributed on an
15*96de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96de5490SAndrew Rist  * specific language governing permissions and limitations
18*96de5490SAndrew Rist  * under the License.
19*96de5490SAndrew Rist  *
20*96de5490SAndrew Rist  *************************************************************/
21*96de5490SAndrew Rist 
22*96de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _DBA_CORE_DATASETTINGS_HXX_
28cdf0e10cSrcweir #include "datasettings.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _DBASHARED_APITOOLS_HXX_
31cdf0e10cSrcweir #include "apitools.hxx"
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBASTRINGS_HRC
34cdf0e10cSrcweir #include "dbastrings.hrc"
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _OSL_DIAGNOSE_H_
37cdf0e10cSrcweir #include <osl/diagnose.h>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _COMPHELPER_PROPERTY_HXX_
40cdf0e10cSrcweir #include <comphelper/property.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
43cdf0e10cSrcweir #include <comphelper/types.hxx>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
46cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir #ifndef _SV_SVAPP_HXX
49cdf0e10cSrcweir #include <vcl/svapp.hxx>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_
52cdf0e10cSrcweir #include <com/sun/star/awt/FontWeight.hpp>
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_FONTEMPHASISMARK_HPP_
55cdf0e10cSrcweir #include <com/sun/star/awt/FontEmphasisMark.hpp>
56cdf0e10cSrcweir #endif
57cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_FONTRELIEF_HPP_
58cdf0e10cSrcweir #include <com/sun/star/awt/FontRelief.hpp>
59cdf0e10cSrcweir #endif
60cdf0e10cSrcweir 
61cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_FONTWIDTH_HPP_
62cdf0e10cSrcweir #include <com/sun/star/awt/FontWidth.hpp>
63cdf0e10cSrcweir #endif
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir using namespace ::com::sun::star::uno;
67cdf0e10cSrcweir using namespace ::com::sun::star::awt;
68cdf0e10cSrcweir using namespace ::com::sun::star::lang;
69cdf0e10cSrcweir using namespace ::com::sun::star::beans;
70cdf0e10cSrcweir using namespace ::comphelper;
71cdf0e10cSrcweir using namespace ::cppu;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir //........................................................................
74cdf0e10cSrcweir namespace dbaccess
75cdf0e10cSrcweir {
76cdf0e10cSrcweir //==========================================================================
77cdf0e10cSrcweir //= ODataSettings
78cdf0e10cSrcweir //==========================================================================
79cdf0e10cSrcweir //--------------------------------------------------------------------------
registerPropertiesFor(ODataSettings_Base * _pItem)80cdf0e10cSrcweir void ODataSettings::registerPropertiesFor(ODataSettings_Base* _pItem)
81cdf0e10cSrcweir {
82cdf0e10cSrcweir 	if ( m_bQuery )
83cdf0e10cSrcweir 	{
84cdf0e10cSrcweir 		registerProperty(PROPERTY_HAVING_CLAUSE, PROPERTY_ID_HAVING_CLAUSE, PropertyAttribute::BOUND,
85cdf0e10cSrcweir 					&_pItem->m_sHavingClause, ::getCppuType(&_pItem->m_sHavingClause));
86cdf0e10cSrcweir 
87cdf0e10cSrcweir         registerProperty(PROPERTY_GROUP_BY, PROPERTY_ID_GROUP_BY, PropertyAttribute::BOUND,
88cdf0e10cSrcweir 					&_pItem->m_sGroupBy, ::getCppuType(&_pItem->m_sGroupBy));
89cdf0e10cSrcweir 	}
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	registerProperty(PROPERTY_FILTER, PROPERTY_ID_FILTER, PropertyAttribute::BOUND,
92cdf0e10cSrcweir 					&_pItem->m_sFilter, ::getCppuType(&_pItem->m_sFilter));
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	registerProperty(PROPERTY_ORDER, PROPERTY_ID_ORDER, PropertyAttribute::BOUND,
95cdf0e10cSrcweir 					&_pItem->m_sOrder, ::getCppuType(&_pItem->m_sOrder));
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	registerProperty(PROPERTY_APPLYFILTER, PROPERTY_ID_APPLYFILTER, PropertyAttribute::BOUND,
98cdf0e10cSrcweir 					&_pItem->m_bApplyFilter, ::getBooleanCppuType());
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	registerProperty(PROPERTY_FONT, PROPERTY_ID_FONT, PropertyAttribute::BOUND,
101cdf0e10cSrcweir 					&_pItem->m_aFont, ::getCppuType(&_pItem->m_aFont));
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	registerMayBeVoidProperty(PROPERTY_ROW_HEIGHT, PROPERTY_ID_ROW_HEIGHT, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
104cdf0e10cSrcweir 					&_pItem->m_aRowHeight, ::getCppuType(static_cast<sal_Int32*>(NULL)));
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	registerMayBeVoidProperty(PROPERTY_TEXTCOLOR, PROPERTY_ID_TEXTCOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
107cdf0e10cSrcweir 					&_pItem->m_aTextColor, ::getCppuType(static_cast<sal_Int32*>(NULL)));
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	registerMayBeVoidProperty(PROPERTY_TEXTLINECOLOR, PROPERTY_ID_TEXTLINECOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
110cdf0e10cSrcweir 					&_pItem->m_aTextLineColor, ::getCppuType(static_cast<sal_Int32*>(NULL)));
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 	registerProperty(PROPERTY_TEXTEMPHASIS, PROPERTY_ID_TEXTEMPHASIS, PropertyAttribute::BOUND,
113cdf0e10cSrcweir 		&_pItem->m_nFontEmphasis, ::getCppuType(&_pItem->m_nFontEmphasis));
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	registerProperty(PROPERTY_TEXTRELIEF, PROPERTY_ID_TEXTRELIEF, PropertyAttribute::BOUND,&_pItem->m_nFontRelief, ::getCppuType(&_pItem->m_nFontRelief));
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTNAME,			PROPERTY_ID_FONTNAME,		 PropertyAttribute::BOUND,&_pItem->m_aFont.Name,			::getCppuType(&_pItem->m_aFont.Name));
118cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTHEIGHT,		PROPERTY_ID_FONTHEIGHT,		 PropertyAttribute::BOUND,&_pItem->m_aFont.Height,			::getCppuType(&_pItem->m_aFont.Height));
119cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTWIDTH,		PROPERTY_ID_FONTWIDTH,		 PropertyAttribute::BOUND,&_pItem->m_aFont.Width,			::getCppuType(&_pItem->m_aFont.Width));
120cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTSTYLENAME,	PROPERTY_ID_FONTSTYLENAME,	 PropertyAttribute::BOUND,&_pItem->m_aFont.StyleName,		::getCppuType(&_pItem->m_aFont.StyleName));
121cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTFAMILY,		PROPERTY_ID_FONTFAMILY,		 PropertyAttribute::BOUND,&_pItem->m_aFont.Family,			::getCppuType(&_pItem->m_aFont.Family));
122cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTCHARSET,		PROPERTY_ID_FONTCHARSET,	 PropertyAttribute::BOUND,&_pItem->m_aFont.CharSet,			::getCppuType(&_pItem->m_aFont.CharSet));
123cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTPITCH,		PROPERTY_ID_FONTPITCH,		 PropertyAttribute::BOUND,&_pItem->m_aFont.Pitch,			::getCppuType(&_pItem->m_aFont.Pitch));
124cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTCHARWIDTH,	PROPERTY_ID_FONTCHARWIDTH,	 PropertyAttribute::BOUND,&_pItem->m_aFont.CharacterWidth,	::getCppuType(&_pItem->m_aFont.CharacterWidth));
125cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTWEIGHT,		PROPERTY_ID_FONTWEIGHT,		 PropertyAttribute::BOUND,&_pItem->m_aFont.Weight,			::getCppuType(&_pItem->m_aFont.Weight));
126cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTSLANT,		PROPERTY_ID_FONTSLANT,		 PropertyAttribute::BOUND,&_pItem->m_aFont.Slant,			::getCppuType(&_pItem->m_aFont.Slant));
127cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTUNDERLINE,	PROPERTY_ID_FONTUNDERLINE,	 PropertyAttribute::BOUND,&_pItem->m_aFont.Underline,		::getCppuType(&_pItem->m_aFont.Underline));
128cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTSTRIKEOUT,	PROPERTY_ID_FONTSTRIKEOUT,	 PropertyAttribute::BOUND,&_pItem->m_aFont.Strikeout,		::getCppuType(&_pItem->m_aFont.Strikeout));
129cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTORIENTATION,	PROPERTY_ID_FONTORIENTATION, PropertyAttribute::BOUND,&_pItem->m_aFont.Orientation,		::getCppuType(&_pItem->m_aFont.Orientation));
130cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTKERNING,		PROPERTY_ID_FONTKERNING,	 PropertyAttribute::BOUND,&_pItem->m_aFont.Kerning,			::getCppuType(&_pItem->m_aFont.Kerning));
131cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTWORDLINEMODE, PROPERTY_ID_FONTWORDLINEMODE,PropertyAttribute::BOUND,&_pItem->m_aFont.WordLineMode,	::getCppuType(&_pItem->m_aFont.WordLineMode));
132cdf0e10cSrcweir 	registerProperty(PROPERTY_FONTTYPE,			PROPERTY_ID_FONTTYPE,		 PropertyAttribute::BOUND,&_pItem->m_aFont.Type,			::getCppuType(&_pItem->m_aFont.Type));
133cdf0e10cSrcweir }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir //--------------------------------------------------------------------------
ODataSettings(OBroadcastHelper & _rBHelper,sal_Bool _bQuery)136cdf0e10cSrcweir ODataSettings::ODataSettings(OBroadcastHelper& _rBHelper,sal_Bool _bQuery)
137cdf0e10cSrcweir 	:OPropertyStateContainer(_rBHelper)
138cdf0e10cSrcweir 	,ODataSettings_Base()
139cdf0e10cSrcweir 	,m_bQuery(_bQuery)
140cdf0e10cSrcweir {
141cdf0e10cSrcweir }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir //--------------------------------------------------------------------------
ODataSettings_Base()144cdf0e10cSrcweir ODataSettings_Base::ODataSettings_Base()
145cdf0e10cSrcweir     :m_bApplyFilter(sal_False)
146cdf0e10cSrcweir 	,m_aFont(::comphelper::getDefaultFont())
147cdf0e10cSrcweir 	,m_nFontEmphasis(::com::sun::star::awt::FontEmphasisMark::NONE)
148cdf0e10cSrcweir 	,m_nFontRelief(::com::sun::star::awt::FontRelief::NONE)
149cdf0e10cSrcweir {
150cdf0e10cSrcweir }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir //--------------------------------------------------------------------------
ODataSettings_Base(const ODataSettings_Base & _rSource)153cdf0e10cSrcweir ODataSettings_Base::ODataSettings_Base(const ODataSettings_Base& _rSource)
154cdf0e10cSrcweir     :m_sFilter( _rSource.m_sFilter )
155cdf0e10cSrcweir     ,m_sHavingClause( _rSource.m_sHavingClause )
156cdf0e10cSrcweir     ,m_sGroupBy( _rSource.m_sGroupBy )
157cdf0e10cSrcweir     ,m_sOrder( _rSource.m_sOrder )
158cdf0e10cSrcweir     ,m_bApplyFilter( _rSource.m_bApplyFilter )
159cdf0e10cSrcweir     ,m_aFont( _rSource.m_aFont )
160cdf0e10cSrcweir     ,m_aRowHeight( _rSource.m_aRowHeight )
161cdf0e10cSrcweir     ,m_aTextColor( _rSource.m_aTextColor )
162cdf0e10cSrcweir     ,m_aTextLineColor( _rSource.m_aTextLineColor )
163cdf0e10cSrcweir     ,m_nFontEmphasis( _rSource.m_nFontEmphasis )
164cdf0e10cSrcweir     ,m_nFontRelief( _rSource.m_nFontRelief )
165cdf0e10cSrcweir {
166cdf0e10cSrcweir }
167cdf0e10cSrcweir 
168cdf0e10cSrcweir // -----------------------------------------------------------------------------
~ODataSettings_Base()169cdf0e10cSrcweir ODataSettings_Base::~ODataSettings_Base()
170cdf0e10cSrcweir {
171cdf0e10cSrcweir }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPropertyDefaultByHandle(sal_Int32 _nHandle,Any & _rDefault) const174cdf0e10cSrcweir void ODataSettings::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const
175cdf0e10cSrcweir {
176cdf0e10cSrcweir 	static ::com::sun::star::awt::FontDescriptor aFD = ::comphelper::getDefaultFont();
177cdf0e10cSrcweir 	switch( _nHandle )
178cdf0e10cSrcweir 	{
179cdf0e10cSrcweir         case PROPERTY_ID_HAVING_CLAUSE:
180cdf0e10cSrcweir         case PROPERTY_ID_GROUP_BY:
181cdf0e10cSrcweir 		case PROPERTY_ID_FILTER:
182cdf0e10cSrcweir 		case PROPERTY_ID_ORDER:
183cdf0e10cSrcweir 			_rDefault <<= ::rtl::OUString();
184cdf0e10cSrcweir             break;
185cdf0e10cSrcweir 		case PROPERTY_ID_FONT:
186cdf0e10cSrcweir             _rDefault <<= ::comphelper::getDefaultFont();
187cdf0e10cSrcweir             break;
188cdf0e10cSrcweir 		case PROPERTY_ID_APPLYFILTER:
189cdf0e10cSrcweir 			_rDefault <<= sal_False;
190cdf0e10cSrcweir             break;
191cdf0e10cSrcweir 		case PROPERTY_ID_TEXTRELIEF:
192cdf0e10cSrcweir 			_rDefault <<= ::com::sun::star::awt::FontRelief::NONE;
193cdf0e10cSrcweir             break;
194cdf0e10cSrcweir 		case PROPERTY_ID_TEXTEMPHASIS:
195cdf0e10cSrcweir 			_rDefault <<= ::com::sun::star::awt::FontEmphasisMark::NONE;
196cdf0e10cSrcweir             break;
197cdf0e10cSrcweir 		case PROPERTY_ID_FONTNAME:
198cdf0e10cSrcweir 			_rDefault <<= aFD.Name;
199cdf0e10cSrcweir             break;
200cdf0e10cSrcweir 		case PROPERTY_ID_FONTHEIGHT:
201cdf0e10cSrcweir 			_rDefault <<= aFD.Height;
202cdf0e10cSrcweir             break;
203cdf0e10cSrcweir 		case PROPERTY_ID_FONTWIDTH:
204cdf0e10cSrcweir 			_rDefault <<= aFD.Width;
205cdf0e10cSrcweir             break;
206cdf0e10cSrcweir 		case PROPERTY_ID_FONTSTYLENAME:
207cdf0e10cSrcweir 			_rDefault <<= aFD.StyleName;
208cdf0e10cSrcweir             break;
209cdf0e10cSrcweir 		case PROPERTY_ID_FONTFAMILY:
210cdf0e10cSrcweir 			_rDefault <<= aFD.Family;
211cdf0e10cSrcweir             break;
212cdf0e10cSrcweir 		case PROPERTY_ID_FONTCHARSET:
213cdf0e10cSrcweir 			_rDefault <<= aFD.CharSet;
214cdf0e10cSrcweir             break;
215cdf0e10cSrcweir 		case PROPERTY_ID_FONTPITCH:
216cdf0e10cSrcweir 			_rDefault <<= aFD.Pitch;
217cdf0e10cSrcweir             break;
218cdf0e10cSrcweir 		case PROPERTY_ID_FONTCHARWIDTH:
219cdf0e10cSrcweir 			_rDefault <<= aFD.CharacterWidth;
220cdf0e10cSrcweir             break;
221cdf0e10cSrcweir 		case PROPERTY_ID_FONTWEIGHT:
222cdf0e10cSrcweir 			_rDefault <<= aFD.Weight;
223cdf0e10cSrcweir             break;
224cdf0e10cSrcweir 		case PROPERTY_ID_FONTSLANT:
225cdf0e10cSrcweir 			_rDefault <<= aFD.Slant;
226cdf0e10cSrcweir             break;
227cdf0e10cSrcweir 		case PROPERTY_ID_FONTUNDERLINE:
228cdf0e10cSrcweir 			_rDefault <<= aFD.Underline;
229cdf0e10cSrcweir             break;
230cdf0e10cSrcweir 		case PROPERTY_ID_FONTSTRIKEOUT:
231cdf0e10cSrcweir 			_rDefault <<= aFD.Strikeout;
232cdf0e10cSrcweir             break;
233cdf0e10cSrcweir 		case PROPERTY_ID_FONTORIENTATION:
234cdf0e10cSrcweir 			_rDefault <<= aFD.Orientation;
235cdf0e10cSrcweir             break;
236cdf0e10cSrcweir 		case PROPERTY_ID_FONTKERNING:
237cdf0e10cSrcweir 			_rDefault <<= aFD.Kerning;
238cdf0e10cSrcweir             break;
239cdf0e10cSrcweir 		case PROPERTY_ID_FONTWORDLINEMODE:
240cdf0e10cSrcweir 			_rDefault <<= aFD.WordLineMode;
241cdf0e10cSrcweir             break;
242cdf0e10cSrcweir 		case PROPERTY_ID_FONTTYPE:
243cdf0e10cSrcweir 			_rDefault <<= aFD.Type;
244cdf0e10cSrcweir             break;
245cdf0e10cSrcweir 	}
246cdf0e10cSrcweir }
247cdf0e10cSrcweir //........................................................................
248cdf0e10cSrcweir }	// namespace dbaccess
249cdf0e10cSrcweir //........................................................................
250cdf0e10cSrcweir 
251