Look for libboostrap.uno.so and not bootstrap.uno.so on Android
[LibreOffice.git] / basctl / source / dlged / dlgedfac.cxx
blob9659dda143ed69ca12ec770afd711cf8ad436d82
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_basctl.hxx"
33 #include "dlgedfac.hxx"
34 #include "dlgedobj.hxx"
35 #include <dlgeddef.hxx>
36 #include <com/sun/star/container/XNameContainer.hpp>
37 #include <com/sun/star/beans/PropertyValue.hpp>
38 #include <com/sun/star/beans/XPropertySet.hpp>
39 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
41 using namespace ::com::sun::star;
44 DlgEdFactory::DlgEdFactory()
46 SdrObjFactory::InsertMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
50 DlgEdFactory::~DlgEdFactory()
52 SdrObjFactory::RemoveMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
56 IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory )
58 static sal_Bool bNeedsInit = sal_True;
59 static uno::Reference< lang::XMultiServiceFactory > xDialogSFact;
61 if( bNeedsInit )
63 uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
64 uno::Reference< container::XNameContainer > xC( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), uno::UNO_QUERY );
65 if( xC.is() )
67 uno::Reference< lang::XMultiServiceFactory > xModFact( xC, uno::UNO_QUERY );
68 xDialogSFact = xModFact;
70 bNeedsInit = sal_False;
73 if( (pObjFactory->nInventor == DlgInventor) &&
74 (pObjFactory->nIdentifier >= OBJ_DLG_PUSHBUTTON) &&
75 (pObjFactory->nIdentifier <= OBJ_DLG_TREECONTROL) )
77 switch( pObjFactory->nIdentifier )
79 case OBJ_DLG_PUSHBUTTON:
80 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" )) , xDialogSFact );
81 break;
82 case OBJ_DLG_RADIOBUTTON:
83 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlRadioButtonModel" )) , xDialogSFact );
84 break;
85 case OBJ_DLG_CHECKBOX:
86 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCheckBoxModel" )) , xDialogSFact );
87 break;
88 case OBJ_DLG_LISTBOX:
89 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlListBoxModel" )) , xDialogSFact );
90 break;
91 case OBJ_DLG_COMBOBOX:
93 DlgEdObj* pNew = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlComboBoxModel" )) , xDialogSFact );
94 pObjFactory->pNewObj = pNew;
95 try
97 uno::Reference< beans::XPropertySet > xPSet(pNew->GetUnoControlModel(), uno::UNO_QUERY);
98 if (xPSet.is())
100 sal_Bool bB = sal_True;
101 xPSet->setPropertyValue( DLGED_PROP_DROPDOWN, uno::Any(&bB,::getBooleanCppuType()));
104 catch(...)
107 } break;
108 case OBJ_DLG_GROUPBOX:
109 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlGroupBoxModel" )) , xDialogSFact );
110 break;
111 case OBJ_DLG_EDIT:
112 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlEditModel" )) , xDialogSFact );
113 break;
114 case OBJ_DLG_FIXEDTEXT:
115 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedTextModel" )) , xDialogSFact );
116 break;
117 case OBJ_DLG_IMAGECONTROL:
118 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlImageControlModel" )) , xDialogSFact );
119 break;
120 case OBJ_DLG_PROGRESSBAR:
121 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlProgressBarModel" )) , xDialogSFact );
122 break;
123 case OBJ_DLG_HSCROLLBAR:
124 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlScrollBarModel" )) , xDialogSFact );
125 break;
126 case OBJ_DLG_VSCROLLBAR:
128 DlgEdObj* pNew = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlScrollBarModel" )) , xDialogSFact );
129 pObjFactory->pNewObj = pNew;
130 // set vertical orientation
133 uno::Reference< beans::XPropertySet > xPSet(pNew->GetUnoControlModel(), uno::UNO_QUERY);
134 if (xPSet.is())
136 uno::Any aValue;
137 aValue <<= (sal_Int32) ::com::sun::star::awt::ScrollBarOrientation::VERTICAL;
138 xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, aValue );
141 catch(...)
144 } break;
145 case OBJ_DLG_HFIXEDLINE:
146 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedLineModel" )) , xDialogSFact );
147 break;
148 case OBJ_DLG_VFIXEDLINE:
150 DlgEdObj* pNew = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedLineModel" )) , xDialogSFact );
151 pObjFactory->pNewObj = pNew;
152 // set vertical orientation
155 uno::Reference< beans::XPropertySet > xPSet(pNew->GetUnoControlModel(), uno::UNO_QUERY);
156 if (xPSet.is())
158 uno::Any aValue;
159 aValue <<= (sal_Int32) 1;
160 xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, aValue );
163 catch(...)
166 } break;
167 case OBJ_DLG_DATEFIELD:
168 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDateFieldModel" )) , xDialogSFact );
169 break;
170 case OBJ_DLG_TIMEFIELD:
171 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlTimeFieldModel" )) , xDialogSFact );
172 break;
173 case OBJ_DLG_NUMERICFIELD:
174 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlNumericFieldModel" )) , xDialogSFact );
175 break;
176 case OBJ_DLG_CURRENCYFIELD:
177 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCurrencyFieldModel" )) , xDialogSFact );
178 break;
179 case OBJ_DLG_FORMATTEDFIELD:
180 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFormattedFieldModel" )) , xDialogSFact );
181 break;
182 case OBJ_DLG_PATTERNFIELD:
183 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlPatternFieldModel" )) , xDialogSFact );
184 break;
185 case OBJ_DLG_FILECONTROL:
186 pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFileControlModel" )) , xDialogSFact );
187 break;
188 case OBJ_DLG_TREECONTROL:
189 DlgEdObj* pNew = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.tree.TreeControlModel" )) , xDialogSFact );
190 pObjFactory->pNewObj = pNew;
191 break;
195 return 0;
198 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */