xref: /aoo41x/main/soldep/source/depapp.cxx (revision d9e04f7d)
1*d9e04f7dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*d9e04f7dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*d9e04f7dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*d9e04f7dSAndrew Rist  * distributed with this work for additional information
6*d9e04f7dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*d9e04f7dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*d9e04f7dSAndrew Rist  * "License"); you may not use this file except in compliance
9*d9e04f7dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*d9e04f7dSAndrew Rist  *
11*d9e04f7dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*d9e04f7dSAndrew Rist  *
13*d9e04f7dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*d9e04f7dSAndrew Rist  * software distributed under the License is distributed on an
15*d9e04f7dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d9e04f7dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*d9e04f7dSAndrew Rist  * specific language governing permissions and limitations
18*d9e04f7dSAndrew Rist  * under the License.
19*d9e04f7dSAndrew Rist  *
20*d9e04f7dSAndrew Rist  *************************************************************/
21*d9e04f7dSAndrew Rist 
22*d9e04f7dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // -----------------------------------------------------------------------
25cdf0e10cSrcweir #include "depapp.hxx"
26cdf0e10cSrcweir #include <ucbhelper/contentbroker.hxx>
27cdf0e10cSrcweir #include <ucbhelper/configurationkeys.hxx>
28cdf0e10cSrcweir 
Main()29cdf0e10cSrcweir void MyApp::Main()
30cdf0e10cSrcweir {
31cdf0e10cSrcweir #if defined(WNT)
32cdf0e10cSrcweir     pDebugFile = fopen( "fprintf.out", "w" );
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir 
35cdf0e10cSrcweir     pMyApp = GetpApp();
36cdf0e10cSrcweir 	MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
37cdf0e10cSrcweir     pAppWindow = &aMainWin;
38cdf0e10cSrcweir    // pToolBarFrame = new FloatingWindow( aMainWin, WB_STDWORK );
39cdf0e10cSrcweir     //pToolBox = new ToolBox(pToolBarFrame,DtSodResId(TID_SOLDEP_MAIN));
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 	pSolDep = new SolDep( &aMainWin );
42cdf0e10cSrcweir 	pSolDep->Init();
43cdf0e10cSrcweir 	aMainWin.SetText( String::CreateFromAscii( SOLDEPL_NAME ));
44cdf0e10cSrcweir 	pSolDep->Hide();
45cdf0e10cSrcweir 	aMainWin.Show();
46cdf0e10cSrcweir 	Help aHelp;
47cdf0e10cSrcweir 	SetHelp(&aHelp);
48cdf0e10cSrcweir 	aHelp.EnableContextHelp();
49cdf0e10cSrcweir 	aHelp.EnableQuickHelp();
50cdf0e10cSrcweir 	Execute();
51cdf0e10cSrcweir 	delete pResMgr;
52cdf0e10cSrcweir 	delete pSolDep;
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir // -----------------------------------------------------------------------
56cdf0e10cSrcweir 
MyWin(Window * pParent,WinBits nWinStyle)57cdf0e10cSrcweir MyWin::MyWin( Window* pParent, WinBits nWinStyle ) :
58cdf0e10cSrcweir     WorkWindow( pParent, nWinStyle )//,aToolBox( this, DtSodResId(TID_SOLDEP_MAIN)),
59cdf0e10cSrcweir         // depper aTaskBarFrame(this, 0)
60cdf0e10cSrcweir {
61cdf0e10cSrcweir //depper    aTaskBarFrame.EnableAlwaysOnTop();
62cdf0e10cSrcweir 
63cdf0e10cSrcweir //depper    aMenuBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Source" ) ) );
64cdf0e10cSrcweir //depper    aMenuBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Exit" ) ) );
65cdf0e10cSrcweir //depper    SetMenuBar( &aMenuBar );
66cdf0e10cSrcweir //depper	aToolBox.SetPosSizePixel( Point( 0,0 ), Size( 1100,35 ));
67cdf0e10cSrcweir //    aToolBox.Show();
68cdf0e10cSrcweir }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir // -----------------------------------------------------------------------
71cdf0e10cSrcweir 
MouseMove(const MouseEvent & rMEvt)72cdf0e10cSrcweir void MyWin::MouseMove( const MouseEvent& rMEvt )
73cdf0e10cSrcweir {
74cdf0e10cSrcweir 	WorkWindow::MouseMove( rMEvt );
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir // -----------------------------------------------------------------------
78cdf0e10cSrcweir 
MouseButtonDown(const MouseEvent & rMEvt)79cdf0e10cSrcweir void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 	WorkWindow::MouseButtonDown( rMEvt );
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir // -----------------------------------------------------------------------
85cdf0e10cSrcweir 
MouseButtonUp(const MouseEvent & rMEvt)86cdf0e10cSrcweir void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
87cdf0e10cSrcweir {
88cdf0e10cSrcweir 	WorkWindow::MouseButtonUp( rMEvt );
89cdf0e10cSrcweir }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir // -----------------------------------------------------------------------
92cdf0e10cSrcweir 
KeyInput(const KeyEvent & rKEvt)93cdf0e10cSrcweir void MyWin::KeyInput( const KeyEvent& rKEvt )
94cdf0e10cSrcweir {
95cdf0e10cSrcweir 	WorkWindow::KeyInput( rKEvt );
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir // -----------------------------------------------------------------------
99cdf0e10cSrcweir 
KeyUp(const KeyEvent & rKEvt)100cdf0e10cSrcweir void MyWin::KeyUp( const KeyEvent& rKEvt )
101cdf0e10cSrcweir {
102cdf0e10cSrcweir 	WorkWindow::KeyUp( rKEvt );
103cdf0e10cSrcweir }
104cdf0e10cSrcweir 
105cdf0e10cSrcweir // -----------------------------------------------------------------------
106cdf0e10cSrcweir 
Paint(const Rectangle & rRect)107cdf0e10cSrcweir void MyWin::Paint( const Rectangle& rRect )
108cdf0e10cSrcweir {
109cdf0e10cSrcweir 	WorkWindow::Paint( rRect );
110cdf0e10cSrcweir }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir // -----------------------------------------------------------------------
113cdf0e10cSrcweir 
Resize()114cdf0e10cSrcweir void MyWin::Resize()
115cdf0e10cSrcweir {
116cdf0e10cSrcweir     ((MyApp*)GetpApp())->GetSolDep()->Resize();
117cdf0e10cSrcweir     WorkWindow::Resize();
118cdf0e10cSrcweir }
119cdf0e10cSrcweir 
SAL_IMPLEMENT_MAIN()120cdf0e10cSrcweir SAL_IMPLEMENT_MAIN()
121cdf0e10cSrcweir {
122cdf0e10cSrcweir     //Reference< XMultiServiceFactory > xMS;
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     // for this to work make sure an <appname>.ini file is available, you can just copy soffice.ini
125cdf0e10cSrcweir     Reference< XComponentContext > xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext();
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	//xMS = cppu::createRegistryServiceFactory(
128cdf0e10cSrcweir     //              rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 	Reference< XMultiServiceFactory > xMS( xComponentContext->getServiceManager(), UNO_QUERY);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     InitVCL( xMS );
133cdf0e10cSrcweir     ::comphelper::setProcessServiceFactory(xMS);
134cdf0e10cSrcweir 	com::sun::star::uno::Sequence< com::sun::star::uno::Any > aArgs(2);
135cdf0e10cSrcweir     aArgs[0] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
136cdf0e10cSrcweir     aArgs[1] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     ::ucbhelper::ContentBroker::initialize( xMS, aArgs );
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	aMyApp.Main();
141cdf0e10cSrcweir     DeInitVCL();
142cdf0e10cSrcweir 	return 0;
143cdf0e10cSrcweir }
144