calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / dbaccess / source / core / api / datasettings.cxx
blobe845f11350f8bf1c945c2d91eb9613358c9557b6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
28 using namespace ::com::sun::star::uno;
29 using namespace ::com::sun::star::awt;
30 using namespace ::com::sun::star::lang;
31 using namespace ::com::sun::star::beans;
32 using namespace ::comphelper;
33 using namespace ::cppu;
35 namespace dbaccess
37 // ODataSettings
38 void ODataSettings::registerPropertiesFor(ODataSettings_Base* _pItem)
40 if ( m_bQuery )
42 registerProperty(PROPERTY_HAVING_CLAUSE, PROPERTY_ID_HAVING_CLAUSE, PropertyAttribute::BOUND,
43 &_pItem->m_sHavingClause, cppu::UnoType<decltype(_pItem->m_sHavingClause)>::get());
45 registerProperty(PROPERTY_GROUP_BY, PROPERTY_ID_GROUP_BY, PropertyAttribute::BOUND,
46 &_pItem->m_sGroupBy, cppu::UnoType<decltype(_pItem->m_sGroupBy)>::get());
49 registerProperty(PROPERTY_FILTER, PROPERTY_ID_FILTER, PropertyAttribute::BOUND,
50 &_pItem->m_sFilter, cppu::UnoType<decltype(_pItem->m_sFilter)>::get());
52 registerProperty(PROPERTY_ORDER, PROPERTY_ID_ORDER, PropertyAttribute::BOUND,
53 &_pItem->m_sOrder, cppu::UnoType<decltype(_pItem->m_sOrder)>::get());
55 registerProperty(PROPERTY_APPLYFILTER, PROPERTY_ID_APPLYFILTER, PropertyAttribute::BOUND,
56 &_pItem->m_bApplyFilter, cppu::UnoType<bool>::get());
58 registerProperty(PROPERTY_FONT, PROPERTY_ID_FONT, PropertyAttribute::BOUND,
59 &_pItem->m_aFont, cppu::UnoType<decltype(_pItem->m_aFont)>::get());
61 registerMayBeVoidProperty(PROPERTY_ROW_HEIGHT, PROPERTY_ID_ROW_HEIGHT, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
62 &_pItem->m_aRowHeight, ::cppu::UnoType<sal_Int32>::get());
64 registerProperty(PROPERTY_AUTOGROW, PROPERTY_ID_AUTOGROW, PropertyAttribute::BOUND,
65 &_pItem->m_bAutoGrow, cppu::UnoType<bool>::get());
67 registerMayBeVoidProperty(PROPERTY_TEXTCOLOR, PROPERTY_ID_TEXTCOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
68 &_pItem->m_aTextColor, ::cppu::UnoType<sal_Int32>::get());
70 registerMayBeVoidProperty(PROPERTY_TEXTLINECOLOR, PROPERTY_ID_TEXTLINECOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
71 &_pItem->m_aTextLineColor, ::cppu::UnoType<sal_Int32>::get());
73 registerProperty(PROPERTY_TEXTEMPHASIS, PROPERTY_ID_TEXTEMPHASIS, PropertyAttribute::BOUND,
74 &_pItem->m_nFontEmphasis, cppu::UnoType<decltype(_pItem->m_nFontEmphasis)>::get());
76 registerProperty(PROPERTY_TEXTRELIEF, PROPERTY_ID_TEXTRELIEF, PropertyAttribute::BOUND,&_pItem->m_nFontRelief, cppu::UnoType<decltype(_pItem->m_nFontRelief)>::get());
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());
96 ODataSettings::ODataSettings(OBroadcastHelper& _rBHelper,bool _bQuery)
97 :OPropertyStateContainer(_rBHelper)
98 ,m_bQuery(_bQuery)
102 ODataSettings_Base::ODataSettings_Base()
103 :m_bApplyFilter(false)
104 ,m_bAutoGrow(false)
105 ,m_aFont(::comphelper::getDefaultFont())
106 ,m_nFontEmphasis(css::awt::FontEmphasisMark::NONE)
107 ,m_nFontRelief(css::awt::FontRelief::NONE)
111 ODataSettings_Base::~ODataSettings_Base()
115 void ODataSettings::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const
117 static css::awt::FontDescriptor aFD = ::comphelper::getDefaultFont();
118 switch( _nHandle )
120 case PROPERTY_ID_HAVING_CLAUSE:
121 case PROPERTY_ID_GROUP_BY:
122 case PROPERTY_ID_FILTER:
123 case PROPERTY_ID_ORDER:
124 _rDefault <<= OUString();
125 break;
126 case PROPERTY_ID_FONT:
127 _rDefault <<= ::comphelper::getDefaultFont();
128 break;
129 case PROPERTY_ID_APPLYFILTER:
130 _rDefault <<= false;
131 break;
132 case PROPERTY_ID_TEXTRELIEF:
133 _rDefault <<= css::awt::FontRelief::NONE;
134 break;
135 case PROPERTY_ID_TEXTEMPHASIS:
136 _rDefault <<= css::awt::FontEmphasisMark::NONE;
137 break;
138 case PROPERTY_ID_FONTNAME:
139 _rDefault <<= aFD.Name;
140 break;
141 case PROPERTY_ID_FONTHEIGHT:
142 _rDefault <<= aFD.Height;
143 break;
144 case PROPERTY_ID_FONTWIDTH:
145 _rDefault <<= aFD.Width;
146 break;
147 case PROPERTY_ID_FONTSTYLENAME:
148 _rDefault <<= aFD.StyleName;
149 break;
150 case PROPERTY_ID_FONTFAMILY:
151 _rDefault <<= aFD.Family;
152 break;
153 case PROPERTY_ID_FONTCHARSET:
154 _rDefault <<= aFD.CharSet;
155 break;
156 case PROPERTY_ID_FONTPITCH:
157 _rDefault <<= aFD.Pitch;
158 break;
159 case PROPERTY_ID_FONTCHARWIDTH:
160 _rDefault <<= aFD.CharacterWidth;
161 break;
162 case PROPERTY_ID_FONTWEIGHT:
163 _rDefault <<= aFD.Weight;
164 break;
165 case PROPERTY_ID_FONTSLANT:
166 _rDefault <<= aFD.Slant;
167 break;
168 case PROPERTY_ID_FONTUNDERLINE:
169 _rDefault <<= aFD.Underline;
170 break;
171 case PROPERTY_ID_FONTSTRIKEOUT:
172 _rDefault <<= aFD.Strikeout;
173 break;
174 case PROPERTY_ID_FONTORIENTATION:
175 _rDefault <<= aFD.Orientation;
176 break;
177 case PROPERTY_ID_FONTKERNING:
178 _rDefault <<= aFD.Kerning;
179 break;
180 case PROPERTY_ID_FONTWORDLINEMODE:
181 _rDefault <<= aFD.WordLineMode;
182 break;
183 case PROPERTY_ID_FONTTYPE:
184 _rDefault <<= aFD.Type;
185 break;
189 } // namespace dbaccess
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */