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