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