summaryrefslogtreecommitdiffstats
path: root/framework/test/test.cxx
blob: 6ba09f5b470b8b32d89b1d2dea0c0575ee02b4be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
/*************************************************************************
 *
 *  $RCSfile: test.cxx,v $
 *
 *  $Revision: 1.1.1.1 $
 *
 *  last change: $Author: hr $ $Date: 2000-09-18 16:29:25 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

//_________________________________________________________________________________________________________________
//  my own includes
//_________________________________________________________________________________________________________________

#ifndef __FRAMEWORK_HELPER_OINSTANCEPROVIDER_HXX_
#include <helper/oinstanceprovider.hxx>
#endif

#ifndef __FRAMEWORK_CLASSES_SERVICEMANAGER_HXX_
#include <classes/servicemanager.hxx>
#endif

#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_
#include <macros/generic.hxx>
#endif

#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
#include <macros/debug.hxx>
#endif

#ifndef __FRAMEWORK_DEFINES_HXX_
#include <defines.hxx>
#endif

//_________________________________________________________________________________________________________________
//  interface includes
//_________________________________________________________________________________________________________________

#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_
#include <com/sun/star/frame/XDesktop.hpp>
#endif

#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
#include <com/sun/star/frame/XFrame.hpp>
#endif

#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
#endif

#ifndef _COM_SUN_STAR_FRAME_XFRAMELOADER_HPP_
#include <com/sun/star/frame/XFrameLoader.hpp>
#endif

#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
#endif

#ifndef _COM_SUN_STAR_FRAME_XLOADEVENTLISTENER_HPP_
#include <com/sun/star/frame/XLoadEventListener.hpp>
#endif

#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
#include <com/sun/star/frame/XDispatchProvider.hpp>
#endif

#ifndef _COM_SUN_STAR_UTIL_URL_HPP_
#include <com/sun/star/util/URL.hpp>
#endif

#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#endif

#ifndef _COM_SUN_STAR_FRAME_XFRAMES_HPP_
#include <com/sun/star/frame/XFrames.hpp>
#endif

#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif

#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
#include <com/sun/star/frame/XComponentLoader.hpp>
#endif

#ifndef _COM_SUN_STAR_FRAME_XTASKSSUPPLIER_HPP_
#include <com/sun/star/frame/XTasksSupplier.hpp>
#endif

#ifndef _COM_SUN_STAR_TASK_XSTATUSINDICATORFACTORY_HPP_
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#endif

#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#endif

#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif

#ifndef _COM_SUN_STAR_MOZILLA_XPLUGININSTANCEPEER_HPP_
#include <com/sun/star/mozilla/XPluginInstancePeer.hpp>
#endif

#ifndef _COM_SUN_STAR_BRIDGE_XINSTANCEPROVIDER_HPP_
#include <com/sun/star/bridge/XInstanceProvider.hpp>
#endif

//_________________________________________________________________________________________________________________
//  other includes
//_________________________________________________________________________________________________________________

#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <unotools/processfactory.hxx>
#endif

#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#endif

#ifndef _RTL_USTRING_
#include <rtl/ustring>
#endif

#ifndef _RTL_USTRBUF_HXX_
#include <rtl/ustrbuf.hxx>
#endif

#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/helper/vclunohelper.hxx>
#endif

#ifndef _SVT_UNOIFACE_HXX
#include <svtools/unoiface.hxx>
#endif

#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif

#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/msgbox.hxx>
#include <stdio.h>

//_________________________________________________________________________________________________________________
//  const
//_________________________________________________________________________________________________________________

#define APPLICATIONNAME                         "FrameWork - Testapplication"

//_________________________________________________________________________________________________________________
//  namespace
//_________________________________________________________________________________________________________________

using namespace ::rtl                       ;
using namespace ::utl                       ;
using namespace ::framework                 ;
using namespace ::cppu                      ;
using namespace ::com::sun::star::uno       ;
using namespace ::com::sun::star::lang      ;
using namespace ::com::sun::star::frame     ;
using namespace ::com::sun::star::awt       ;
using namespace ::com::sun::star::beans     ;
using namespace ::com::sun::star::util      ;
using namespace ::com::sun::star::task      ;
using namespace ::com::sun::star::mozilla   ;
using namespace ::com::sun::star::bridge    ;

//_________________________________________________________________________________________________________________
//  defines
//_________________________________________________________________________________________________________________

//_________________________________________________________________________________________________________________
//  declarations
//_________________________________________________________________________________________________________________

/*-***************************************************************************************************************/
class TestApplication : public Application
{
    public:
        void Main();

    private:
        // Test the whole desktop implementation.
        void impl_testDesktop( const Reference< XDesktop >& xDesktop );
        // Build a new tree with desktop on top.
        void impl_buildTree( const Reference< XDesktop >& xDesktop );
        // Write names of all frames in tree to logfile.
        void impl_logTree( const Reference< XDesktop >& xDesktop );
        void impl_testPlugIn( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory );
        // Test login dialog
        void impl_testLoginDialog();

};  //  class TestApplication

//_________________________________________________________________________________________________________________
//  global variables
//_________________________________________________________________________________________________________________

TestApplication aTestApplication ;

//_________________________________________________________________________________________________________________
//  main
//_________________________________________________________________________________________________________________

void TestApplication::Main()
{
    // 1) Init global servicemanager and set it.
    ServiceManager aManager;
    Reference< XMultiServiceFactory > xGlobalServiceManager = aManager.getManager();
    LOG_ASSERT( !(xGlobalServiceManager.is()==sal_False), "TestApplication::Main()\nCan't create global service manager.\n\n" )

    // We must set this global servicemanager as global static variable.
    // Office must have access to this.
    setProcessServiceFactory( xGlobalServiceManager );
    // Control this!
    LOG_ASSERT( !(getProcessServiceFactory()!=xGlobalServiceManager), "TestApplication::Main()\nGlobal servicemanager not set in UNOTOOLS.\n\n" )

    // For follow operations, we need the vcl-toolkit!
    // But there is nothing to test for us.
    InitExtVclToolkit();

    // 2) Try to create the root of ouer frame hierarchy - the desktop himself.
    Reference< XDesktop > xDesktop( xGlobalServiceManager->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
    LOG_ASSERT( !(xDesktop.is()==sal_False), "TestApplication::Main()\nServicename of Desktop is unknown.\n\n" )

    ResMgr* pRessourceManager = CREATEVERSIONRESMGR( lgd );
    Resource::SetResManager( pRessourceManager );

//  impl_testLoginDialog();
    impl_testDesktop( xDesktop );
//  impl_testPlugIn( xDesktop, xGlobalServiceManager );

/*
    Reference< XDispatchProvider > xProvider( xDesktop, UNO_QUERY );
    URL aURL;
    aURL.Complete = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|/bla.htm"));
    Reference< XDispatch > xDispatcher = xProvider->queryDispatch( aURL, OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")), 0 );
    if( xDispatcher.is()==sal_True )
    {
        xDispatcher->dispatch(aURL, Sequence< PropertyValue >() );
    aURL.Complete = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|/bla.htm"));
        xDispatcher->dispatch(aURL, Sequence< PropertyValue >() );
    aURL.Complete = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|/bla.html"));
        xDispatcher->dispatch(aURL, Sequence< PropertyValue >() );
    aURL.Complete = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|/test.txt"));
        xDispatcher->dispatch(aURL, Sequence< PropertyValue >() );
    }
*/
/*
    Reference< XMultiServiceFactory > xFrameLoaderFactory( xGlobalServiceManager->createInstance( SERVICENAME_FRAMELOADERFACTORY ), UNO_QUERY );
    LOG_ASSERT( !(xFrameLoaderFactory.is()==sal_False), "TestApplication::Main()\nServicename of FrameLoaderFactory is unknown.\n\n" );
    Sequence< OUString > seqFilterNames = xFrameLoaderFactory->getAvailableServiceNames();
    if (seqFilterNames.getLength()>0)
    {
        Sequence< Any > seqArguments(1);
        seqArguments[0] <<= seqFilterNames[0];

        Reference< XPropertySet > xPropertySet( xFrameLoaderFactory->createInstanceWithArguments( OUString(), seqArguments ), UNO_QUERY );
        if ( xPropertySet.is()==sal_True )
        {
            Sequence< OUString >    seqPattern      ;
            Sequence< OUString >    seqExtension    ;
            sal_Int32               nFlags          ;
            sal_Int32               nFormat         ;
            OUString                sMimeType       ;
            OUString                sFilterName     ;
            OUString                sDetectService  ;
            Reference< XInterface > xLoader         ;
            OUString                sURL            ;
            PropertyValue           aPropertyValue  ;
            Any                     aValue          ;

            aValue = xPropertySet->getPropertyValue( PROPERTYNAME_PATTERN );
            aValue >>= seqPattern;
            aValue = xPropertySet->getPropertyValue( PROPERTYNAME_EXTENSION );
            aValue >>= seqExtension;
            aValue = xPropertySet->getPropertyValue( PROPERTYNAME_FLAGS );
            aValue >>= nFlags;
            aValue = xPropertySet->getPropertyValue( PROPERTYNAME_FORMAT );
            aValue >>= nFormat;
            aValue = xPropertySet->getPropertyValue( PROPERTYNAME_MIMETYPE );
            aValue >>= sMimeType;
            aValue = xPropertySet->getPropertyValue( PROPERTYNAME_FILTERNAME );
            aValue >>= sFilterName;
            aValue = xPropertySet->getPropertyValue( PROPERTYNAME_DETECTSERVICE );
            aValue >>= sDetectService;

            sURL                    =   OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|bla.htm"))   ;
            aPropertyValue.Name     =   PROPERTYNAME_FILTERNAME                                     ;
            aPropertyValue.Value    <<= sFilterName                                                 ;
            seqArguments.realloc(1);
            seqArguments[0]         <<= aPropertyValue                                              ;
            xLoader = xFrameLoaderFactory->createInstanceWithArguments( sURL, seqArguments );
            LOG_ASSERT( !(xLoader.is()==sal_False), "TestApplication::Main()\nCreation of loader 1 failed.\n\n" );

            sURL                    =   OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|bla.htm"))   ;
            aPropertyValue.Name     =   PROPERTYNAME_MIMETYPE                                       ;
            aPropertyValue.Value    <<= sMimeType                                                   ;
            seqArguments.realloc(1);
            seqArguments[0]         <<= aPropertyValue                                              ;
            xLoader = xFrameLoaderFactory->createInstanceWithArguments( sURL, seqArguments );
            LOG_ASSERT( !(xLoader.is()==sal_False), "TestApplication::Main()\nCreation of loader 2 failed.\n\n" );

            sURL                    =   OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|bla.htm"))   ;
            aPropertyValue.Name     =   PROPERTYNAME_FORMAT                                         ;
            aPropertyValue.Value    <<= nFormat                                                     ;
            seqArguments.realloc(1);
            seqArguments[0]         <<= aPropertyValue                                              ;
            xLoader = xFrameLoaderFactory->createInstanceWithArguments( sURL, seqArguments );
            LOG_ASSERT( !(xLoader.is()==sal_False), "TestApplication::Main()\nCreation of loader 3 failed.\n\n" );
        }
    }
*/
//  Execute();
//    xFrame->dispose();
//    delete pMainWindow;
}

//_________________________________________________________________________________________________________________
//  test method
//_________________________________________________________________________________________________________________
void TestApplication::impl_testLoginDialog()
{
    // Get global servicemanager to create service "LoginDialog".
    Reference< XMultiServiceFactory > xFactory = getProcessServiceFactory();
    LOG_ASSERT( !(xFactory.is()==sal_False), "TestApplication::impl_testLoginDialog()\nServicemanager not valid.\n" )
    // Create LoginDialog.
    Reference< XDialog > xDialog( xFactory->createInstance( DECLARE_ASCII("com.sun.star.framework.LoginDialog") ), UNO_QUERY );
    LOG_ASSERT( !(xDialog.is()==sal_False), "TestApplication::impl_testLoginDialog()\nCould not create login dialog.\n" )
    // Check set/getTitle()
    /* not implemented yet! */
//  OUString sTitle = DECLARE_ASCII("Login Dialog Test");
//  xDialog->setTitle( sTitle );
//  LOG_ASSERT( !(xDialog->getTitle()!=sTitle), "TestApplication::impl_testLoginDialog()\nset/getTitle don't work correct.\n" )

    UniString sInternalURL = DECLARE_ASCII("private:factory/scalc");
    UniString sExternalURL = OUString();

    OString sOut = "internal: ";
    sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ).getStr();
    sOut += "\nexternal: ";
    sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ).getStr();
    sOut += "\n";
    LOG_ASSERT( sal_False, sOut.getStr() )

    INetURLObject::translateToExternal( sInternalURL, sExternalURL );
    sOut = "internal: ";
    sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ).getStr();
    sOut += "\nexternal: ";
    sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ).getStr();
    sOut += "\n";
    LOG_ASSERT( sal_False, sOut.getStr() )

    INetURLObject::translateToInternal( sExternalURL, sInternalURL );
    sOut = "internal: ";
    sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ).getStr();
    sOut += "\nexternal: ";
    sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ).getStr();
    sOut += "\n";
    LOG_ASSERT( sal_False, sOut.getStr() )

    // Work with properties of dialog.
    Reference< XPropertySet > xPropertySet( xDialog, UNO_QUERY );
    LOG_ASSERT( !(xPropertySet.is()==sal_False), "TestApplication::impl_testLoginDialog()\nCan't cast dialog to XPropertySet interface.\n" )
    Any aUserName       ;
    Any aPassword       ;
    Any aServer         ;
    Any aConnectionType ;
    Any aPort           ;
    aUserName       <<= DECLARE_ASCII("Andreas");
    aPassword       <<= DECLARE_ASCII("Test");
    aServer         <<= DECLARE_ASCII("www.yahoo.de:7777");
    aConnectionType <<= DECLARE_ASCII("Bla");
    sal_Int32 nPort = 8081;
    aPort           <<= nPort;
    try
    {
    xPropertySet->setPropertyValue( DECLARE_ASCII("UserName"            ), aUserName        );
    xPropertySet->setPropertyValue( DECLARE_ASCII("Password"            ), aPassword        );
    xPropertySet->setPropertyValue( DECLARE_ASCII("Server"              ), aServer          );
    xPropertySet->setPropertyValue( DECLARE_ASCII("ConnectionType"  ), aConnectionType  );
    xPropertySet->setPropertyValue( DECLARE_ASCII("Compressed"      ), aPort            );
    }
    catch( ::com::sun::star::beans::UnknownPropertyException& )
    {
        LOG_ASSERT( sal_False, "UnkownPropertyException detected!\n" )
    }
    catch( ::com::sun::star::beans::PropertyVetoException& )
    {
        LOG_ASSERT( sal_False, "PropertyVetoException detected!\n" )
    }
    catch( ::com::sun::star::lang::IllegalArgumentException& )
    {
        LOG_ASSERT( sal_False, "IllegalArgumentException detected!\n" )
    }
    catch( ::com::sun::star::lang::WrappedTargetException& )
    {
        LOG_ASSERT( sal_False, "WrappedTargetException detected!\n" )
    }
    catch( ::com::sun::star::uno::RuntimeException& )
    {
        LOG_ASSERT( sal_False, "RuntimeException detected!\n" )
    }

    xDialog->execute();

    OUString sUserName          ;
    OUString sPassword          ;
    OUString sServer            ;
    OUString sConnectionType    ;
    xPropertySet->getPropertyValue( DECLARE_ASCII("UserName"            ) ) >>= sUserName       ;
    xPropertySet->getPropertyValue( DECLARE_ASCII("Password"            ) ) >>= sPassword       ;
    xPropertySet->getPropertyValue( DECLARE_ASCII("Server"              ) ) >>= sServer         ;
    xPropertySet->getPropertyValue( DECLARE_ASCII("ConnectionType"  ) ) >>= sConnectionType ;
    xPropertySet->getPropertyValue( sConnectionType ) >>= nPort ;

    LOG_ASSERT( sal_False, OUStringToOString( sUserName, RTL_TEXTENCODING_UTF8 ).getStr() )
    LOG_ASSERT( sal_False, OUStringToOString( sPassword, RTL_TEXTENCODING_UTF8 ).getStr() )
    LOG_ASSERT( sal_False, OUStringToOString( sServer  , RTL_TEXTENCODING_UTF8 ).getStr() )
    LOG_ASSERT( sal_False, OUStringToOString( sConnectionType  , RTL_TEXTENCODING_UTF8 ).getStr() )
    LOG_ASSERT( sal_False, OString::valueOf( (sal_Int32)nPort ).getStr() )
}

//_________________________________________________________________________________________________________________
//  test method
//_________________________________________________________________________________________________________________
void TestApplication::impl_testPlugIn( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory )
{
    // create instance provider for creation of factories.
    Reference< XInstanceProvider > xInstanceProvider( (OWeakObject*)(new OInstanceProvider( xFactory )), UNO_QUERY );
    LOG_ASSERT( !(xInstanceProvider.is()==sal_False), "TestApplication::impl_testPlugIn()\nCan't create new instance provider!\n" )

    // try to get factory for create a plugin
    Reference< XSingleServiceFactory > xPlugInFactory( xInstanceProvider->getInstance( INSTANCENAME_PLUGINFACTORY ), UNO_QUERY );
    LOG_ASSERT( !(xPlugInFactory.is()==sal_False), "TestApplication::impl_testPlugIn()\nCan't get PlugInFactory from instance provider!\n" )

    // initialize parameter for creation of plugin
    Reference< XPluginInstancePeer > xPlugInDLL =Reference< XPluginInstancePeer >();
    Sequence< Any > seqArguments(1);
    seqArguments[0] <<= xPlugInDLL;

    // create plugin
    Reference< XFrame > xPlugIn( xPlugInFactory->createInstanceWithArguments( seqArguments ), UNO_QUERY );
    LOG_ASSERT( !(xPlugIn.is()==sal_False), "TestApplication::impl_testPlugIn()\nFactory has created no valid plugin!\n" )

    xPlugIn->setName( OUString(RTL_CONSTASCII_USTRINGPARAM("PlugIn")) );
    Reference< XFramesSupplier > xSupplier( xDesktop, UNO_QUERY );
    xPlugIn->setCreator( xSupplier );
}

//_________________________________________________________________________________________________________________
//  test method
//_________________________________________________________________________________________________________________
void TestApplication::impl_testDesktop( const Reference< XDesktop >& xDesktop )
{
    //-------------------------------------------------------------------------------------------------------------
    //  1) Test cast to all supported interfaces of Desktop.

    Reference< XInterface >                 xDesktopInterface               ( xDesktop, UNO_QUERY );
    Reference< XTypeProvider >              xDesktopTypeProvider            ( xDesktop, UNO_QUERY );
    Reference< XServiceInfo >               xDesktopServiceInfo             ( xDesktop, UNO_QUERY );
    Reference< XComponentLoader >           xDesktopComponentLoader         ( xDesktop, UNO_QUERY );
    Reference< XTasksSupplier >             xDesktopTasksSupplier           ( xDesktop, UNO_QUERY );
    Reference< XDispatchProvider >          xDesktopDispatchProvider        ( xDesktop, UNO_QUERY );
    Reference< XFramesSupplier >            xDesktopFramesSupplier          ( xDesktop, UNO_QUERY );
    Reference< XFrame >                     xDesktopFrame                   ( xDesktop, UNO_QUERY );
    Reference< XComponent >                 xDesktopComponent               ( xDesktop, UNO_QUERY );
    Reference< XStatusIndicatorFactory >    xDesktopStatusIndicatorFactory  ( xDesktop, UNO_QUERY );
    Reference< XPropertySet >               xDesktopPropertySet             ( xDesktop, UNO_QUERY );
    Reference< XFastPropertySet >           xDesktopFastPropertySet         ( xDesktop, UNO_QUERY );
    Reference< XMultiPropertySet >          xDesktopMultiPropertySet        ( xDesktop, UNO_QUERY );

    LOG_ASSERT( !(xDesktopInterface.is()                ==sal_False), "TestApplication::impl_testDesktop()\nXInterface not supported by Desktop.\n\n"               )
    LOG_ASSERT( !(xDesktopTypeProvider.is()             ==sal_False), "TestApplication::impl_testDesktop()\nXTypeProvider not supported by Desktop.\n\n"            )
    LOG_ASSERT( !(xDesktopServiceInfo.is()              ==sal_False), "TestApplication::impl_testDesktop()\nXServiceInfo not supported by Desktop.\n\n"             )
    LOG_ASSERT( !(xDesktop.is()                         ==sal_False), "TestApplication::impl_testDesktop()\nXDesktop not supported by Desktop.\n\n"                 )
    LOG_ASSERT( !(xDesktopComponentLoader.is()          ==sal_False), "TestApplication::impl_testDesktop()\nXComponentLoader not supported by Desktop.\n\n"         )
    LOG_ASSERT( !(xDesktopTasksSupplier.is()            ==sal_False), "TestApplication::impl_testDesktop()\nXTasksSupplier not supported by Desktop.\n\n"           )
    LOG_ASSERT( !(xDesktopDispatchProvider.is()         ==sal_False), "TestApplication::impl_testDesktop()\nXDispatchProvider not supported by Desktop.\n\n"        )
    LOG_ASSERT( !(xDesktopFramesSupplier.is()           ==sal_False), "TestApplication::impl_testDesktop()\nXFramesSupplier not supported by Desktop.\n\n"          )
    LOG_ASSERT( !(xDesktopFrame.is()                    ==sal_False), "TestApplication::impl_testDesktop()\nXFrame not supported by Desktop.\n\n"                   )
    LOG_ASSERT( !(xDesktopComponent.is()                ==sal_False), "TestApplication::impl_testDesktop()\nXComponent not supported by Desktop.\n\n"               )
    LOG_ASSERT( !(xDesktopStatusIndicatorFactory.is()   ==sal_False), "TestApplication::impl_testDesktop()\nXStatusIndicatorFactory not supported by Desktop.\n\n"  )
    LOG_ASSERT( !(xDesktopPropertySet.is()              ==sal_False), "TestApplication::impl_testDesktop()\nXPropertySet not supported by Desktop.\n\n"             )
    LOG_ASSERT( !(xDesktopFastPropertySet.is()          ==sal_False), "TestApplication::impl_testDesktop()\nXFastPropertySet not supported by Desktop.\n\n"         )
    LOG_ASSERT( !(xDesktopMultiPropertySet.is()         ==sal_False), "TestApplication::impl_testDesktop()\nXMultiPropertySet not supported by Desktop.\n\n"        )

    //-------------------------------------------------------------------------------------------------------------
    //  2) Test set-/getName().

    //  2a) Test default value "Desktop".
    OUString sName( RTL_CONSTASCII_USTRINGPARAM("Desktop") );
    LOG_ASSERT( !(xDesktopFrame->getName()!=sName), "TestApplication::impl_testDesktop()\nDefault value of desktop name is invalid.\n\n" )

    //  2b) Set name and try to get the same name.
    sName = OUString( RTL_CONSTASCII_USTRINGPARAM("New Desktop") );
    xDesktopFrame->setName( sName );
    LOG_ASSERT( !(xDesktopFrame->getName()!=sName), "TestApplication::impl_testDesktop()\nSetting of name works not correct on desktop.\n\n" )

    //  Reset name do default!
    //  Its neccessary for follow operations.
    sName = OUString( RTL_CONSTASCII_USTRINGPARAM("Desktop") );
    xDesktopFrame->setName( sName );

    //-------------------------------------------------------------------------------------------------------------
    //  3) Test findFrame().

    //  Build new example tree and log initial structure in file.
    impl_buildTree  ( xDesktop );
    impl_logTree    ( xDesktop );

    OUString            sTargetFrameName;
    sal_uInt32          nSearchFlags    ;
    Reference< XFrame > xSearchFrame    ;
    Reference< XFrame > xTask_4         ;
    Reference< XFrame > xFrame_41       ;
    Reference< XFrame > xFrame_411      ;
    Reference< XFrame > xFrame_112      ;
    Reference< XFrame > xFrame_1123     ;
    Reference< XFrame > xFrame_11231    ;
    Reference< XFrame > xFrame_11221    ;

    //  3a) Search for Desktop
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Desktop\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    sTargetFrameName    = OUString(RTL_CONSTASCII_USTRINGPARAM("Desktop"));
    nSearchFlags        = FrameSearchFlag::SELF;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3a)-1 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Desktop\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::ALL;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3a)-2 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Desktop\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::CHILDREN;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-3 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Desktop\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::SIBLINGS;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-4 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with AUTO for \"Desktop\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::AUTO;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-5 invalid\n" );

    //  3b) Search for Task_4
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Task_4\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    sTargetFrameName    = OUString(RTL_CONSTASCII_USTRINGPARAM("Task_4"));
    nSearchFlags        = FrameSearchFlag::SELF;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3b)-1 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Task_4\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::SIBLINGS;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3b)-2 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Task_4\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::CHILDREN;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3b)-3 invalid\n" );

    xTask_4 = xSearchFrame;

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Task_4\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::ALL;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3b)-4 invalid\n" );

    //  3c) Search for Frame_41
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Frame_41\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    sTargetFrameName    = OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_41"));
    nSearchFlags        = FrameSearchFlag::SELF;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-1 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Frame_41\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::SIBLINGS;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-2 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Frame_41\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::CHILDREN;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-3 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Frame_41\" on Desktop\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::ALL;
    xSearchFrame        = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-4 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Frame_41\" on Task_4\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::SELF;
    xSearchFrame        = xTask_4->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-5 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Frame_41\" on Task_4\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::SIBLINGS;
    xSearchFrame        = xTask_4->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-6 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Frame_41\" on Task_4\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::CHILDREN;
    xSearchFrame        = xTask_4->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-7 invalid\n" );

    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Frame_41\" on Task_4\n" )
    WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" )
    nSearchFlags        = FrameSearchFlag::ALL;
    xSearchFrame        = xTask_4->findFrame(sTargetFrameName, nSearchFlags);
    LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-8 invalid\n" );

    xFrame_41 = xSearchFrame;

    //  3d) Search for Frame_411
    //  3e) Search for Frame_112
    //  3f) Search for Frame_1123
    //  3g) Search for Frame_11231
    //  3h) Search for Frame_11221
}

//_________________________________________________________________________________________________________________
//  helper method to build a new binaer-tree with desktop as top-frame
//_________________________________________________________________________________________________________________
void TestApplication::impl_buildTree( const Reference< XDesktop >& xDesktop )
{
    // You can append and remove frames only on XFRames interface of desktop.
    // But the desktop support this interface not directly! Use getFrames() instantly.
    Reference< XFramesSupplier > xDesktopSupplier( xDesktop, UNO_QUERY );
    Reference< XFrames > xFrames = xDesktopSupplier->getFrames();
    LOG_ASSERT( !(xFrames.is()==sal_False), "TestApplication::impl_buildTree()\nCan't get framesaccess on desktop.\n\n" )

    // Create some tasks and frames.
    Reference< XMultiServiceFactory > xServiceManager( getProcessServiceFactory() );

    Reference< XTask >  xTask_1( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY );
    Reference< XTask >  xTask_2( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY );
    Reference< XTask >  xTask_3( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY );
    Reference< XTask >  xTask_4( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY );
    Reference< XTask >  xTask_5( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY );
    Reference< XFrame > xFrame_11( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_12( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_21( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_22( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_31( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_32( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_41( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_42( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_51( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_52( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_111( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_112( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_121( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_411( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_1121( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_1122( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_1123( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_4111( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_4112( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_4113( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_11221( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );
    Reference< XFrame > xFrame_11231( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY );

    // Initialize tasks and frames with names to support easy finding!
    Reference< XFrame > xTaskFrame_1( xTask_1, UNO_QUERY );
    Reference< XFrame > xTaskFrame_2( xTask_2, UNO_QUERY );
    Reference< XFrame > xTaskFrame_3( xTask_3, UNO_QUERY );
    Reference< XFrame > xTaskFrame_4( xTask_4, UNO_QUERY );
    Reference< XFrame > xTaskFrame_5( xTask_5, UNO_QUERY );

    xTaskFrame_1->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_1")));
    xTaskFrame_2->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_2")));
    xTaskFrame_3->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_3")));
    xTaskFrame_4->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_4")));
    xTaskFrame_5->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_5")));
    xFrame_11->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11")));
    xFrame_12->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_12")));
    xFrame_21->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_21")));
    xFrame_22->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_22")));
    xFrame_31->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_31")));
    xFrame_32->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_32")));
    xFrame_41->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_41")));
    xFrame_42->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_42")));
    xFrame_51->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_51")));
    xFrame_52->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_52")));
    xFrame_111->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_111")));
    xFrame_112->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_112")));
    xFrame_121->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_121")));
    xFrame_411->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_411")));
    xFrame_1121->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1121")));
    xFrame_1122->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1122")));
    xFrame_1123->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1123")));
    xFrame_4111->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4111")));
    xFrame_4112->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4112")));
    xFrame_4113->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4113")));
    xFrame_11221->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11221")));
    xFrame_11231->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11231")));

    // Build tree.
    // Append tasks as childs of desktop.
    xFrames->append( xTaskFrame_1 );
    xFrames->append( xTaskFrame_2 );
    xFrames->append( xTaskFrame_3 );
    xFrames->append( xTaskFrame_4 );
    xFrames->append( xTaskFrame_5 );

    // Append frames as childs of tasks.
    Reference< XFramesSupplier > xTaskFramesSupplier_1( xTask_1, UNO_QUERY );
    Reference< XFramesSupplier > xTaskFramesSupplier_2( xTask_2, UNO_QUERY );
    Reference< XFramesSupplier > xTaskFramesSupplier_3( xTask_3, UNO_QUERY );
    Reference< XFramesSupplier > xTaskFramesSupplier_4( xTask_4, UNO_QUERY );
    Reference< XFramesSupplier > xTaskFramesSupplier_5( xTask_5, UNO_QUERY );
    Reference< XFramesSupplier > xFramesSupplier_11( xFrame_11, UNO_QUERY );
    Reference< XFramesSupplier > xFramesSupplier_12( xFrame_12, UNO_QUERY );
    Reference< XFramesSupplier > xFramesSupplier_112( xFrame_112, UNO_QUERY );
    Reference< XFramesSupplier > xFramesSupplier_1122( xFrame_1122, UNO_QUERY );
    Reference< XFramesSupplier > xFramesSupplier_1123( xFrame_1123, UNO_QUERY );
    Reference< XFramesSupplier > xFramesSupplier_41( xFrame_41, UNO_QUERY );
    Reference< XFramesSupplier > xFramesSupplier_411( xFrame_411, UNO_QUERY );

    xFrames = xTaskFramesSupplier_1->getFrames();
    xFrames->append( xFrame_11 );
    xFrames->append( xFrame_12 );
    xFrames = xTaskFramesSupplier_2->getFrames();
    xFrames->append( xFrame_21 );
    xFrames->append( xFrame_22 );
    xFrames = xTaskFramesSupplier_3->getFrames();
    xFrames->append( xFrame_31 );
    xFrames->append( xFrame_32 );
    xFrames = xTaskFramesSupplier_4->getFrames();
    xFrames->append( xFrame_41 );
    xFrames->append( xFrame_42 );
    xFrames = xTaskFramesSupplier_5->getFrames();
    xFrames->append( xFrame_51 );
    xFrames->append( xFrame_52 );
    xFrames = xFramesSupplier_11->getFrames();
    xFrames->append( xFrame_111 );
    xFrames->append( xFrame_112 );
    xFrames = xFramesSupplier_12->getFrames();
    xFrames->append( xFrame_121 );
    xFrames = xFramesSupplier_112->getFrames();
    xFrames->append( xFrame_1121 );
    xFrames->append( xFrame_1122 );
    xFrames->append( xFrame_1123 );
    xFrames = xFramesSupplier_1122->getFrames();
    xFrames->append( xFrame_11221 );
    xFrames = xFramesSupplier_1123->getFrames();
    xFrames->append( xFrame_11231 );
    xFrames = xFramesSupplier_41->getFrames();
    xFrames->append( xFrame_411 );
    xFrames = xFramesSupplier_411->getFrames();
    xFrames->append( xFrame_4111 );
    xFrames->append( xFrame_4112 );
    xFrames->append( xFrame_4113 );

    // Create some active paths.
    // desktop => task_1 => frame_11 => frame_112 => frame_1122
//  xDesktopSupplier->setActiveFrame( xTaskFrame_1 );
//  xTaskFramesSupplier_1->setActiveFrame( xFrame_11 );
//  xFramesSupplier_11->setActiveFrame( xFrame_112 );
//  xFramesSupplier_112->setActiveFrame( xFrame_1122 );
    // frame_41 => frame_411 => frame_4111
//  xFramesSupplier_41->setActiveFrame( xFrame_411 );
//  xFramesSupplier_411->setActiveFrame( xFrame_4111 );
    // task_3 => frame_31
//  xTaskFramesSupplier_3->setActiveFrame( xFrame_31 );
    // frame_1123 => frame_11231
//  xFramesSupplier_1123->setActiveFrame( xFrame_11231 );

//  xTask_1->activate();
//  impl_logTree( xDesktop );
//  xFrame_41->activate();
//  impl_logTree( xDesktop );
//  xFrame_52->activate();
//  impl_logTree( xDesktop );
//  WRITE_LOGFILE( LOGFILENAME_TREE, "initiale Hierarchy:" )
    impl_logTree( xDesktop );

//  xFrame_121->activate();
//  impl_logTree( xDesktop );
//  xFrame_41->activate();
//  impl_logTree( xDesktop );
//  xFrame_52->activate();
//  impl_logTree( xDesktop );
//  WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_411->activate():" )
    xFrame_411->activate();
//  WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_411->activate():" )
    impl_logTree( xDesktop );
//  xFrame_41->deactivate();
//  impl_logTree( xDesktop );
//  xFrame_4113->activate();
//  impl_logTree( xDesktop );
//  xFrame_21->activate();
//  impl_logTree( xDesktop );
//  WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_11231->activate():" )
    xFrame_11231->activate();
//  WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_11231->activate():" )
    impl_logTree( xDesktop );

//  WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_11221->activate():" )
    xFrame_11221->activate();
//  WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_11221->activate():" )
    impl_logTree( xDesktop );

//  WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_112->deactivate():" )
//  xFrame_112->getCreator()->setActiveFrame( Reference< XFrame >() );
    xFrame_112->deactivate();
//  WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_112->deactivate():" )
    impl_logTree( xDesktop );

//  WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_41->activate():" )
    xFrame_41->activate();
//  WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_41->activate():" )
    impl_logTree( xDesktop );

//  WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xTask_4->activate():" )
    xTask_4->activate();
//  WRITE_LOGFILE( LOGFILENAME_TREE, "nach xTask_4->activate():" )
    impl_logTree( xDesktop );

//  WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_1123->deactivate():" )
    xFrame_1123->deactivate();
//  WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_1123->deactivate():" )
    impl_logTree( xDesktop );
}

//_________________________________________________________________________________________________________________
//  helper method to log current tree state
//_________________________________________________________________________________________________________________
void TestApplication::impl_logTree( const Reference< XDesktop >& xDesktop )
{
#ifdef ENABLE_SERVICEDEBUG
    // Use special feature of Desktop-implementation.
    // NEVER USE THIS IN RELEASE VERSIONS!!!
    Reference< XSPECIALDEBUGINTERFACE > xDebug( xDesktop, UNO_QUERY );

    // Get a "stream" of all names of frames in tree.
    OUString sTreeNamesStream = xDebug->dumpVariable( DUMPVARIABLE_TREEINFO, 0 );
    // And write it to logfile.
    OString sOutPut = OUStringToOString( sTreeNamesStream, RTL_TEXTENCODING_UTF8 );
//  WRITE_LOGFILE( LOGFILENAME_TREE, "\nNew tree log:\n\n"  );
//  WRITE_LOGFILE( LOGFILENAME_TREE, sOutPut.getStr()           );
//  WRITE_LOGFILE( LOGFILENAME_TREE, "\n"                       );
#endif
}