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 #include "adminpages.hxx"
28cdf0e10cSrcweir #include "dbadmin.hrc"
29cdf0e10cSrcweir #include "dbadmin.hxx"
30cdf0e10cSrcweir #include "dbu_dlg.hrc"
31cdf0e10cSrcweir #include <svl/stritem.hxx>
32cdf0e10cSrcweir #include <svl/eitem.hxx>
33cdf0e10cSrcweir #include <svl/intitem.hxx>
34cdf0e10cSrcweir #include "dbustrings.hrc"
35cdf0e10cSrcweir #include "dsitems.hxx"
36cdf0e10cSrcweir #include "dsselect.hxx"
37cdf0e10cSrcweir #include "localresaccess.hxx"
38cdf0e10cSrcweir #include "odbcconfig.hxx"
39cdf0e10cSrcweir #include "optionalboolitem.hxx"
40cdf0e10cSrcweir #include "sqlmessage.hxx"
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <osl/file.hxx>
43cdf0e10cSrcweir #include <svl/eitem.hxx>
44cdf0e10cSrcweir #include <svl/intitem.hxx>
45cdf0e10cSrcweir #include <svl/stritem.hxx>
46cdf0e10cSrcweir #include <vcl/accel.hxx>
47cdf0e10cSrcweir #include <vcl/button.hxx>
48cdf0e10cSrcweir #include <vcl/edit.hxx>
49cdf0e10cSrcweir #include <vcl/field.hxx>
50cdf0e10cSrcweir #include <vcl/lstbox.hxx>
51cdf0e10cSrcweir #include <vcl/msgbox.hxx>
52cdf0e10cSrcweir 
53cdf0e10cSrcweir #include <algorithm>
54cdf0e10cSrcweir #include <stdlib.h>
55cdf0e10cSrcweir 
56cdf0e10cSrcweir //.........................................................................
57cdf0e10cSrcweir namespace dbaui
58cdf0e10cSrcweir {
59cdf0e10cSrcweir //.........................................................................
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
62cdf0e10cSrcweir 	using namespace ::com::sun::star::sdbc;
63cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
64cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
65cdf0e10cSrcweir 	using namespace ::dbtools;
66cdf0e10cSrcweir 	using namespace ::svt;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	//=========================================================================
70cdf0e10cSrcweir 	//= OGenericAdministrationPage
71cdf0e10cSrcweir 	//=========================================================================
DBG_NAME(OGenericAdministrationPage)72cdf0e10cSrcweir     DBG_NAME(OGenericAdministrationPage)
73cdf0e10cSrcweir     //-------------------------------------------------------------------------
74cdf0e10cSrcweir 	OGenericAdministrationPage::OGenericAdministrationPage(Window* _pParent, const ResId& _rId, const SfxItemSet& _rAttrSet)
75cdf0e10cSrcweir 		:SfxTabPage(_pParent, _rId, _rAttrSet)
76cdf0e10cSrcweir 		,m_abEnableRoadmap(sal_False)
77cdf0e10cSrcweir 		,m_pAdminDialog(NULL)
78cdf0e10cSrcweir 		,m_pItemSetHelper(NULL)
79cdf0e10cSrcweir 		,m_pFT_HeaderText(NULL)
80cdf0e10cSrcweir 	{
81cdf0e10cSrcweir         DBG_CTOR(OGenericAdministrationPage,NULL);
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 		SetExchangeSupport(sal_True);
84cdf0e10cSrcweir 	}
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	//-------------------------------------------------------------------------
~OGenericAdministrationPage()87cdf0e10cSrcweir 	OGenericAdministrationPage::~OGenericAdministrationPage()
88cdf0e10cSrcweir 	{
89cdf0e10cSrcweir 		DELETEZ(m_pFT_HeaderText);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir         DBG_DTOR(OGenericAdministrationPage,NULL);
92cdf0e10cSrcweir     }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	//-------------------------------------------------------------------------
DeactivatePage(SfxItemSet * _pSet)95cdf0e10cSrcweir 	int OGenericAdministrationPage::DeactivatePage(SfxItemSet* _pSet)
96cdf0e10cSrcweir 	{
97cdf0e10cSrcweir 		if (_pSet)
98cdf0e10cSrcweir 		{
99cdf0e10cSrcweir 			if (!prepareLeave())
100cdf0e10cSrcweir 				return KEEP_PAGE;
101cdf0e10cSrcweir 			FillItemSet(*_pSet);
102cdf0e10cSrcweir 		}
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 		return LEAVE_PAGE;
105cdf0e10cSrcweir 	}
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	//-------------------------------------------------------------------------
Reset(const SfxItemSet & _rCoreAttrs)108cdf0e10cSrcweir 	void OGenericAdministrationPage::Reset(const SfxItemSet& _rCoreAttrs)
109cdf0e10cSrcweir 	{
110cdf0e10cSrcweir 		implInitControls(_rCoreAttrs, sal_False);
111cdf0e10cSrcweir 	}
112cdf0e10cSrcweir 	//-------------------------------------------------------------------------
ActivatePage()113cdf0e10cSrcweir 	void OGenericAdministrationPage::ActivatePage()
114cdf0e10cSrcweir 	{
115cdf0e10cSrcweir 		TabPage::ActivatePage();
116cdf0e10cSrcweir 		OSL_ENSURE(m_pItemSetHelper,"NO ItemSetHelper set!");
117cdf0e10cSrcweir 		if ( m_pItemSetHelper )
118cdf0e10cSrcweir 			ActivatePage(*m_pItemSetHelper->getOutputSet());
119cdf0e10cSrcweir 	}
120cdf0e10cSrcweir 	//-------------------------------------------------------------------------
ActivatePage(const SfxItemSet & _rSet)121cdf0e10cSrcweir 	void OGenericAdministrationPage::ActivatePage(const SfxItemSet& _rSet)
122cdf0e10cSrcweir 	{
123cdf0e10cSrcweir 		implInitControls(_rSet, sal_True);
124cdf0e10cSrcweir 	}
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	// -----------------------------------------------------------------------
getFlags(const SfxItemSet & _rSet,sal_Bool & _rValid,sal_Bool & _rReadonly)127cdf0e10cSrcweir 	void OGenericAdministrationPage::getFlags(const SfxItemSet& _rSet, sal_Bool& _rValid, sal_Bool& _rReadonly)
128cdf0e10cSrcweir 	{
129cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pInvalid, SfxBoolItem, DSID_INVALID_SELECTION, sal_True);
130cdf0e10cSrcweir 		_rValid = !pInvalid || !pInvalid->GetValue();
131cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pReadonly, SfxBoolItem, DSID_READONLY, sal_True);
132cdf0e10cSrcweir 		_rReadonly = !_rValid || (pReadonly && pReadonly->GetValue());
133cdf0e10cSrcweir 	}
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	// -----------------------------------------------------------------------
IMPL_LINK(OGenericAdministrationPage,OnControlModified,Control *,EMPTYARG)137cdf0e10cSrcweir 	IMPL_LINK(OGenericAdministrationPage, OnControlModified, Control*, EMPTYARG)
138cdf0e10cSrcweir 	{
139cdf0e10cSrcweir 		callModifiedHdl();
140cdf0e10cSrcweir 		return 0L;
141cdf0e10cSrcweir 	}
142cdf0e10cSrcweir 	// -----------------------------------------------------------------------
getSelectedDataSource(::rtl::OUString & _sReturn,::rtl::OUString & _sCurr)143cdf0e10cSrcweir 	sal_Bool OGenericAdministrationPage::getSelectedDataSource(::rtl::OUString& _sReturn,::rtl::OUString& _sCurr)
144cdf0e10cSrcweir 	{
145cdf0e10cSrcweir 		// collect all ODBC data source names
146cdf0e10cSrcweir 		StringBag aOdbcDatasources;
147cdf0e10cSrcweir 		OOdbcEnumeration aEnumeration;
148cdf0e10cSrcweir 		if (!aEnumeration.isLoaded())
149cdf0e10cSrcweir 		{
150cdf0e10cSrcweir 			// show an error message
151cdf0e10cSrcweir             LocalResourceAccess aLocRes( PAGE_GENERAL, RSC_TABPAGE );
152cdf0e10cSrcweir 			String sError(ModuleRes(STR_COULDNOTLOAD_ODBCLIB));
153cdf0e10cSrcweir 			sError.SearchAndReplaceAscii("#lib#", aEnumeration.getLibraryName());
154cdf0e10cSrcweir 			ErrorBox aDialog(this, WB_OK, sError);
155cdf0e10cSrcweir 			aDialog.Execute();
156cdf0e10cSrcweir 			return sal_False;
157cdf0e10cSrcweir 		}
158cdf0e10cSrcweir 		else
159cdf0e10cSrcweir 		{
160cdf0e10cSrcweir 			aEnumeration.getDatasourceNames(aOdbcDatasources);
161cdf0e10cSrcweir 			// excute the select dialog
162cdf0e10cSrcweir 			ODatasourceSelectDialog aSelector(GetParent(), aOdbcDatasources, false);
163cdf0e10cSrcweir 			if (_sCurr.getLength())
164cdf0e10cSrcweir 				aSelector.Select(_sCurr);
165cdf0e10cSrcweir 			if ( RET_OK == aSelector.Execute() )
166cdf0e10cSrcweir 				_sReturn = aSelector.GetSelected();
167cdf0e10cSrcweir 		}
168cdf0e10cSrcweir 		return sal_True;
169cdf0e10cSrcweir 	}
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	// -----------------------------------------------------------------------
implInitControls(const SfxItemSet & _rSet,sal_Bool _bSaveValue)172cdf0e10cSrcweir 	void OGenericAdministrationPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
173cdf0e10cSrcweir 	{
174cdf0e10cSrcweir 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
175cdf0e10cSrcweir 		sal_Bool bValid, bReadonly;
176cdf0e10cSrcweir 		getFlags(_rSet, bValid, bReadonly);
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 		::std::vector< ISaveValueWrapper* > aControlList;
179cdf0e10cSrcweir 		if ( _bSaveValue )
180cdf0e10cSrcweir 		{
181cdf0e10cSrcweir 			fillControls(aControlList);
182cdf0e10cSrcweir 			::std::for_each(aControlList.begin(),aControlList.end(),TSaveValueWrapperFunctor());
183cdf0e10cSrcweir 		}
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 		if ( bReadonly )
186cdf0e10cSrcweir 		{
187cdf0e10cSrcweir 			fillWindows(aControlList);
188cdf0e10cSrcweir 			::std::for_each(aControlList.begin(),aControlList.end(),TDisableWrapperFunctor());
189cdf0e10cSrcweir 		}
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 		::std::for_each(aControlList.begin(),aControlList.end(),TDeleteWrapperFunctor());
192cdf0e10cSrcweir 		aControlList.clear();
193cdf0e10cSrcweir 	}
194cdf0e10cSrcweir 
195cdf0e10cSrcweir     // -----------------------------------------------------------------------
initializePage()196cdf0e10cSrcweir 	void OGenericAdministrationPage::initializePage()
197cdf0e10cSrcweir 	{
198cdf0e10cSrcweir 		OSL_ENSURE(m_pItemSetHelper,"NO ItemSetHelper set!");
199cdf0e10cSrcweir 		if ( m_pItemSetHelper )
200cdf0e10cSrcweir 			Reset(*m_pItemSetHelper->getOutputSet());
201cdf0e10cSrcweir 	}
202cdf0e10cSrcweir 	// -----------------------------------------------------------------------
commitPage(::svt::WizardTypes::CommitPageReason)203cdf0e10cSrcweir 	sal_Bool OGenericAdministrationPage::commitPage( ::svt::WizardTypes::CommitPageReason )
204cdf0e10cSrcweir 	{
205cdf0e10cSrcweir 		return sal_True;
206cdf0e10cSrcweir 	}
207cdf0e10cSrcweir 	// -----------------------------------------------------------------------
canAdvance() const208cdf0e10cSrcweir     bool OGenericAdministrationPage::canAdvance() const
209cdf0e10cSrcweir     {
210cdf0e10cSrcweir         return true;
211cdf0e10cSrcweir     }
212cdf0e10cSrcweir 	// -----------------------------------------------------------------------
fillBool(SfxItemSet & _rSet,CheckBox * _pCheckBox,sal_uInt16 _nID,sal_Bool & _bChangedSomething,bool _bRevertValue)213cdf0e10cSrcweir 	void OGenericAdministrationPage::fillBool( SfxItemSet& _rSet, CheckBox* _pCheckBox, sal_uInt16 _nID, sal_Bool& _bChangedSomething, bool _bRevertValue )
214cdf0e10cSrcweir 	{
215cdf0e10cSrcweir 		if ( (_pCheckBox != NULL ) && ( _pCheckBox->GetState() != _pCheckBox->GetSavedValue() ) )
216cdf0e10cSrcweir 		{
217cdf0e10cSrcweir             sal_Bool bValue = _pCheckBox->IsChecked();
218cdf0e10cSrcweir             if ( _bRevertValue )
219cdf0e10cSrcweir                 bValue = !bValue;
220cdf0e10cSrcweir 
221cdf0e10cSrcweir             if ( _pCheckBox->IsTriStateEnabled() )
222cdf0e10cSrcweir             {
223cdf0e10cSrcweir                 OptionalBoolItem aValue( _nID );
224cdf0e10cSrcweir                 if ( _pCheckBox->GetState() != STATE_DONTKNOW )
225cdf0e10cSrcweir                     aValue.SetValue( bValue );
226cdf0e10cSrcweir                 _rSet.Put( aValue );
227cdf0e10cSrcweir             }
228cdf0e10cSrcweir             else
229cdf0e10cSrcweir                 _rSet.Put( SfxBoolItem( _nID, bValue ) );
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 			_bChangedSomething = sal_True;
232cdf0e10cSrcweir 		}
233cdf0e10cSrcweir 	}
234cdf0e10cSrcweir 	// -----------------------------------------------------------------------
fillInt32(SfxItemSet & _rSet,NumericField * _pEdit,sal_uInt16 _nID,sal_Bool & _bChangedSomething)235cdf0e10cSrcweir 	void OGenericAdministrationPage::fillInt32(SfxItemSet& _rSet,NumericField* _pEdit,sal_uInt16 _nID,sal_Bool& _bChangedSomething)
236cdf0e10cSrcweir 	{
237cdf0e10cSrcweir 		if( (_pEdit != NULL) && (_pEdit->GetValue() != _pEdit->GetSavedValue().ToInt32()) )
238cdf0e10cSrcweir 		{
239cdf0e10cSrcweir 			_rSet.Put(SfxInt32Item(_nID, static_cast<sal_Int32>(_pEdit->GetValue())));
240cdf0e10cSrcweir 			_bChangedSomething = sal_True;
241cdf0e10cSrcweir 		}
242cdf0e10cSrcweir 	}
243cdf0e10cSrcweir 	// -----------------------------------------------------------------------
fillString(SfxItemSet & _rSet,Edit * _pEdit,sal_uInt16 _nID,sal_Bool & _bChangedSomething)244cdf0e10cSrcweir 	void OGenericAdministrationPage::fillString(SfxItemSet& _rSet,Edit* _pEdit,sal_uInt16 _nID,sal_Bool& _bChangedSomething)
245cdf0e10cSrcweir 	{
246cdf0e10cSrcweir 		if( (_pEdit != NULL) && (_pEdit->GetText() != _pEdit->GetSavedValue()) )
247cdf0e10cSrcweir 		{
248cdf0e10cSrcweir 			_rSet.Put(SfxStringItem(_nID, _pEdit->GetText()));
249cdf0e10cSrcweir 			_bChangedSomething = sal_True;
250cdf0e10cSrcweir 		}
251cdf0e10cSrcweir 	}
252cdf0e10cSrcweir 
SetControlFontWeight(Window * _pWindow,FontWeight _eWeight)253cdf0e10cSrcweir     void OGenericAdministrationPage::SetControlFontWeight(Window* _pWindow, FontWeight _eWeight)
254cdf0e10cSrcweir     {
255cdf0e10cSrcweir         Font aFont = _pWindow->GetControlFont();
256cdf0e10cSrcweir 	    aFont.SetWeight( _eWeight );
257cdf0e10cSrcweir 	    _pWindow->SetControlFont( aFont );
258cdf0e10cSrcweir     }
259cdf0e10cSrcweir 
260cdf0e10cSrcweir     // -----------------------------------------------------------------------
261cdf0e10cSrcweir 	IMPL_LINK(OGenericAdministrationPage, OnTestConnectionClickHdl, PushButton*, /*_pButton*/)
262cdf0e10cSrcweir 	{
263cdf0e10cSrcweir 		OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
264cdf0e10cSrcweir 		sal_Bool bSuccess = sal_False;
265cdf0e10cSrcweir 		if ( m_pAdminDialog )
266cdf0e10cSrcweir 		{
267cdf0e10cSrcweir 			m_pAdminDialog->saveDatasource();
268cdf0e10cSrcweir 			OGenericAdministrationPage::implInitControls(*m_pItemSetHelper->getOutputSet(), sal_True);
269cdf0e10cSrcweir 			sal_Bool bShowMessage = sal_True;
270cdf0e10cSrcweir 			try
271cdf0e10cSrcweir 			{
272cdf0e10cSrcweir 				::std::pair< Reference<XConnection>,sal_Bool> xConnection = m_pAdminDialog->createConnection();
273cdf0e10cSrcweir 				bShowMessage = xConnection.second;
274cdf0e10cSrcweir 				bSuccess = xConnection.first.is();
275cdf0e10cSrcweir 				::comphelper::disposeComponent(xConnection.first);
276cdf0e10cSrcweir 			}
277cdf0e10cSrcweir 			catch(Exception&)
278cdf0e10cSrcweir 			{
279cdf0e10cSrcweir 			}
280cdf0e10cSrcweir 			if ( bShowMessage )
281cdf0e10cSrcweir 			{
282cdf0e10cSrcweir 				OSQLMessageBox::MessageType eImage = OSQLMessageBox::Info;
283cdf0e10cSrcweir 				String aMessage,sTitle;
284cdf0e10cSrcweir 				sTitle = String (ModuleRes(STR_CONNECTION_TEST));
285cdf0e10cSrcweir 				if ( bSuccess )
286cdf0e10cSrcweir 				{
287cdf0e10cSrcweir 					aMessage = String(ModuleRes(STR_CONNECTION_SUCCESS));
288cdf0e10cSrcweir 				}
289cdf0e10cSrcweir 				else
290cdf0e10cSrcweir 				{
291cdf0e10cSrcweir 					eImage = OSQLMessageBox::Error;
292cdf0e10cSrcweir 					aMessage = String(ModuleRes(STR_CONNECTION_NO_SUCCESS));
293cdf0e10cSrcweir 				}
294cdf0e10cSrcweir 				OSQLMessageBox aMsg( this, sTitle, aMessage, WB_OK, eImage );
295cdf0e10cSrcweir 				aMsg.Execute();
296cdf0e10cSrcweir 			}
297cdf0e10cSrcweir             if ( !bSuccess )
298cdf0e10cSrcweir                 m_pAdminDialog->clearPassword();
299cdf0e10cSrcweir 		}
300cdf0e10cSrcweir 		return 0L;
301cdf0e10cSrcweir 	}
302cdf0e10cSrcweir 
SetHeaderText(sal_uInt16 _nFTResId,sal_uInt16 _StringResId)303cdf0e10cSrcweir     void OGenericAdministrationPage::SetHeaderText( sal_uInt16 _nFTResId, sal_uInt16 _StringResId)
304cdf0e10cSrcweir     {
305cdf0e10cSrcweir         delete(m_pFT_HeaderText);
306cdf0e10cSrcweir         m_pFT_HeaderText = new FixedText(this, ModuleRes(_nFTResId));
307cdf0e10cSrcweir         String sHeaderText = String(ModuleRes(_StringResId));
308cdf0e10cSrcweir         m_pFT_HeaderText->SetText(sHeaderText);
309cdf0e10cSrcweir         SetControlFontWeight(m_pFT_HeaderText);
310cdf0e10cSrcweir     }
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 	//=========================================================================
313cdf0e10cSrcweir 	//= LayoutHelper
314cdf0e10cSrcweir 	//=========================================================================
315cdf0e10cSrcweir 	//-------------------------------------------------------------------------
positionBelow(const Control & _rReference,Control & _rControl,const ControlRelation _eRelation,const long _nIndentAppFont)316cdf0e10cSrcweir     void LayoutHelper::positionBelow( const Control& _rReference, Control& _rControl, const ControlRelation _eRelation,
317cdf0e10cSrcweir         const long _nIndentAppFont )
318cdf0e10cSrcweir     {
319cdf0e10cSrcweir         Point aReference = _rReference.GetPosPixel();
320cdf0e10cSrcweir         aReference.Y() += _rReference.GetSizePixel().Height();
321cdf0e10cSrcweir 
322cdf0e10cSrcweir         const Window* pConverter = _rControl.GetParent();
323cdf0e10cSrcweir         Size aOffset = pConverter->LogicToPixel( Size( _nIndentAppFont, ( _eRelation == RelatedControls ? 3 : 6 ) ), MAP_APPFONT );
324cdf0e10cSrcweir 
325cdf0e10cSrcweir         Point aControlPos( aReference.X() + aOffset.Width(), aReference.Y() + aOffset.Height() );
326cdf0e10cSrcweir         _rControl.SetPosPixel( aControlPos );
327cdf0e10cSrcweir     }
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 	//-------------------------------------------------------------------------
fitSizeRightAligned(PushButton & io_button)330cdf0e10cSrcweir     void LayoutHelper::fitSizeRightAligned( PushButton& io_button )
331cdf0e10cSrcweir     {
332cdf0e10cSrcweir         const Point aOldPos = io_button.GetPosPixel();
333cdf0e10cSrcweir         const Size aOldSize = io_button.GetSizePixel();
334cdf0e10cSrcweir         const Size aMinSize( io_button.CalcMinimumSize() );
335cdf0e10cSrcweir         if ( aMinSize.Width() > aOldSize.Width() )
336cdf0e10cSrcweir         {
337cdf0e10cSrcweir             io_button.SetPosSizePixel(
338cdf0e10cSrcweir                 aOldPos.X() + aOldSize.Width() - aMinSize.Width(),
339cdf0e10cSrcweir                 0,
340cdf0e10cSrcweir                 aMinSize.Width(),
341cdf0e10cSrcweir                 0,
342cdf0e10cSrcweir                 WINDOW_POSSIZE_X | WINDOW_POSSIZE_WIDTH
343cdf0e10cSrcweir             );
344cdf0e10cSrcweir         }
345cdf0e10cSrcweir     }
346cdf0e10cSrcweir 
347cdf0e10cSrcweir //.........................................................................
348cdf0e10cSrcweir }	// namespace dbaui
349cdf0e10cSrcweir //.........................................................................
350cdf0e10cSrcweir 
351