update dev300-m58
[ooovba.git] / soldep / source / depapp.cxx
blobfcec1597b859f50cdf3c7fe7706d4b78ca2a2629
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: depapp.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // -----------------------------------------------------------------------
32 #include "depapp.hxx"
33 #include <ucbhelper/contentbroker.hxx>
34 #include <ucbhelper/configurationkeys.hxx>
36 void MyApp::Main()
38 #if defined(WNT)
39 pDebugFile = fopen( "fprintf.out", "w" );
40 #endif
42 pMyApp = GetpApp();
43 MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
44 pAppWindow = &aMainWin;
45 // pToolBarFrame = new FloatingWindow( aMainWin, WB_STDWORK );
46 //pToolBox = new ToolBox(pToolBarFrame,DtSodResId(TID_SOLDEP_MAIN));
48 pSolDep = new SolDep( &aMainWin );
49 pSolDep->Init();
50 aMainWin.SetText( String::CreateFromAscii( SOLDEPL_NAME ));
51 pSolDep->Hide();
52 aMainWin.Show();
53 Help aHelp;
54 SetHelp(&aHelp);
55 aHelp.EnableContextHelp();
56 aHelp.EnableQuickHelp();
57 Execute();
58 delete pResMgr;
59 delete pSolDep;
62 // -----------------------------------------------------------------------
64 MyWin::MyWin( Window* pParent, WinBits nWinStyle ) :
65 WorkWindow( pParent, nWinStyle )//,aToolBox( this, DtSodResId(TID_SOLDEP_MAIN)),
66 // depper aTaskBarFrame(this, 0)
68 //depper aTaskBarFrame.EnableAlwaysOnTop();
70 //depper aMenuBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Source" ) ) );
71 //depper aMenuBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Exit" ) ) );
72 //depper SetMenuBar( &aMenuBar );
73 //depper aToolBox.SetPosSizePixel( Point( 0,0 ), Size( 1100,35 ));
74 // aToolBox.Show();
77 // -----------------------------------------------------------------------
79 void MyWin::MouseMove( const MouseEvent& rMEvt )
81 WorkWindow::MouseMove( rMEvt );
84 // -----------------------------------------------------------------------
86 void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
88 WorkWindow::MouseButtonDown( rMEvt );
91 // -----------------------------------------------------------------------
93 void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
95 WorkWindow::MouseButtonUp( rMEvt );
98 // -----------------------------------------------------------------------
100 void MyWin::KeyInput( const KeyEvent& rKEvt )
102 WorkWindow::KeyInput( rKEvt );
105 // -----------------------------------------------------------------------
107 void MyWin::KeyUp( const KeyEvent& rKEvt )
109 WorkWindow::KeyUp( rKEvt );
112 // -----------------------------------------------------------------------
114 void MyWin::Paint( const Rectangle& rRect )
116 WorkWindow::Paint( rRect );
119 // -----------------------------------------------------------------------
121 void MyWin::Resize()
123 ((MyApp*)GetpApp())->GetSolDep()->Resize();
124 WorkWindow::Resize();
127 SAL_IMPLEMENT_MAIN()
129 //Reference< XMultiServiceFactory > xMS;
131 // for this to work make sure an <appname>.ini file is available, you can just copy soffice.ini
132 Reference< XComponentContext > xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext();
134 //xMS = cppu::createRegistryServiceFactory(
135 // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
137 Reference< XMultiServiceFactory > xMS( xComponentContext->getServiceManager(), UNO_QUERY);
139 InitVCL( xMS );
140 ::comphelper::setProcessServiceFactory(xMS);
141 com::sun::star::uno::Sequence< com::sun::star::uno::Any > aArgs(2);
142 aArgs[0] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
143 aArgs[1] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
145 ::ucbhelper::ContentBroker::initialize( xMS, aArgs );
147 aMyApp.Main();
148 DeInitVCL();
149 return 0;