25#define TEST_DYNAMICMENUOPTIONS
30#include <com/sun/star/lang/XMultiServiceFactory.hpp>
31#include <com/sun/star/lang/XInitialization.hpp>
32#include <com/sun/star/registry/XSimpleRegistry.hpp>
34#include <cppuhelper/servicefactory.hxx>
36#include <com/sun/star/uno/Reference.h>
37#include <com/sun/star/uno/Sequence.h>
40#include <rtl/ustrbuf.hxx>
41#include <osl/diagnose.h>
47using namespace ::
osl ;
106 #ifdef TEST_DYNAMICMENUOPTIONS
111 OSL_FAIL(
"Test was successful!" );
130 Sequence< Sequence< PropertyValue > > lNewMenu = aCFG.GetMenu( EDynamicMenuType::NewMenu );
131 Sequence< Sequence< PropertyValue > > lWizardMenu = aCFG.GetMenu( EDynamicMenuType::WizardMenu );
133 if( lNewMenu.getLength() < 1 )
135 aCFG.AppendItem( EDynamicMenuType::NewMenu,
"private:factory/swriter",
"new writer",
"icon_writer",
"_blank");
136 aCFG.AppendItem( EDynamicMenuType::NewMenu,
"private:factory/scalc",
"new calc",
"icon_calc",
"_blank");
137 aCFG.AppendItem( EDynamicMenuType::NewMenu,
"private:factory/sdraw",
"new draw",
"icon_draw",
"_blank");
139 lNewMenu = aCFG.GetMenu( EDynamicMenuType::NewMenu );
142 if( lWizardMenu.getLength() < 1 )
144 aCFG.AppendItem( EDynamicMenuType::WizardMenu,
"file://a",
"system file",
"icon_file",
"_self");
145 aCFG.AppendItem( EDynamicMenuType::WizardMenu,
"ftp://b",
"ftp host",
"icon_ftp",
"_self");
146 aCFG.AppendItem( EDynamicMenuType::WizardMenu,
"http://c",
"www",
"icon_www",
"_self");
148 lWizardMenu = aCFG.GetMenu( EDynamicMenuType::WizardMenu );
151 sal_uInt32 nItemCount ;
153 sal_uInt32 nPropertyCount;
154 sal_uInt32 nProperty ;
155 OUString sPropertyValue;
156 OUStringBuffer sOut( 5000 ) ;
158 nItemCount = lNewMenu.getLength();
159 for( nItem=0; nItem<nItemCount; ++nItem )
161 nPropertyCount = lNewMenu[nItem].getLength();
162 for( nProperty=0; nProperty<nPropertyCount; ++nProperty )
164 lNewMenu[nItem][nProperty].Value >>= sPropertyValue;
166 sOut.appendAscii (
"New/" );
167 sOut.append ( (sal_Int32)nItem );
168 sOut.appendAscii (
"/" );
169 sOut.append ( lNewMenu[nItem][nProperty].
Name );
170 sOut.appendAscii (
" = " );
171 sOut.append ( sPropertyValue );
172 sOut.appendAscii (
"\n" );
176 sOut.appendAscii(
"\n--------------------------------------\n");
178 nItemCount = lWizardMenu.getLength();
179 for( nItem=0; nItem<nItemCount; ++nItem )
181 nPropertyCount = lNewMenu[nItem].getLength();
182 for( nProperty=0; nProperty<nPropertyCount; ++nProperty )
184 lWizardMenu[nItem][nProperty].Value >>= sPropertyValue;
186 sOut.appendAscii (
"Wizard/" );
187 sOut.append ( (sal_Int32)nItem );
188 sOut.appendAscii (
"/" );
189 sOut.append ( lNewMenu[nItem][nProperty].
Name );
190 sOut.appendAscii (
" = " );
191 sOut.append ( sPropertyValue );
192 sOut.appendAscii (
"\n" );
205 static Reference< XMultiServiceFactory > smgr;
208 Reference< XComponentContext > rCtx =
210 smgr.set( rCtx->getServiceManager() , UNO_QUERY );
void impl_testDynamicMenuOptions()
static Reference< XMultiServiceFactory > getUNOServiceManager()
#define SAL_WARN(area, stream)
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL defaultBootstrap_InitialComponentContext()
TestApplication aTestApplication