Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "AppView.hxx"
21 : #include "dbu_app.hrc"
22 : #include <tools/debug.hxx>
23 : #include <tools/diagnose_ex.h>
24 : #include "dbaccess_helpid.hrc"
25 : #include <vcl/toolbox.hxx>
26 : #include <unotools/configmgr.hxx>
27 : #include <vcl/waitobj.hxx>
28 : #include <comphelper/types.hxx>
29 : #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
30 : #include <com/sun/star/beans/XPropertySet.hpp>
31 : #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
32 : #include <com/sun/star/sdb/XQueriesSupplier.hpp>
33 : #include <unotools/syslocale.hxx>
34 : #include "UITools.hxx"
35 : #include "AppDetailView.hxx"
36 : #include "tabletree.hxx"
37 : #include "AppSwapWindow.hxx"
38 : #include <vcl/svapp.hxx>
39 : #include "AppTitleWindow.hxx"
40 : #include "dsntypes.hxx"
41 : #include "dbustrings.hrc"
42 : #include <dbaccess/IController.hxx>
43 : #include "browserids.hxx"
44 : #include <unotools/pathoptions.hxx>
45 : #include "IApplicationController.hxx"
46 :
47 : using namespace ::dbaui;
48 : using namespace ::com::sun::star::uno;
49 : using namespace ::com::sun::star::ucb;
50 : using namespace ::com::sun::star::beans;
51 : using namespace ::com::sun::star::sdb;
52 : using namespace ::com::sun::star::sdbc;
53 : using namespace ::com::sun::star::sdbcx;
54 : using namespace ::com::sun::star::datatransfer::clipboard;
55 : using namespace ::com::sun::star::lang;
56 : using namespace ::com::sun::star::frame;
57 : using namespace ::com::sun::star::container;
58 : using ::com::sun::star::sdb::application::NamedDatabaseObject;
59 :
60 : //==================================================================
61 : // class OAppBorderWindow
62 : DBG_NAME(OAppBorderWindow)
63 : //==================================================================
64 0 : OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode) : Window(_pParent,WB_DIALOGCONTROL)
65 : ,m_pPanel(NULL)
66 : ,m_pDetailView(NULL)
67 0 : ,m_pView(_pParent)
68 : {
69 : DBG_CTOR(OAppBorderWindow,NULL);
70 :
71 0 : SetBorderStyle(WINDOW_BORDER_MONO);
72 :
73 0 : m_pPanel = new OTitleWindow(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL ,sal_False);
74 0 : m_pPanel->SetBorderStyle(WINDOW_BORDER_MONO);
75 0 : OApplicationSwapWindow* pSwap = new OApplicationSwapWindow( m_pPanel, *this );
76 0 : pSwap->Show();
77 0 : pSwap->SetUniqueId(UID_APP_SWAP_VIEW);
78 :
79 0 : m_pPanel->setChildWindow(pSwap);
80 0 : m_pPanel->SetUniqueId(UID_APP_DATABASE_VIEW);
81 0 : m_pPanel->Show();
82 :
83 0 : m_pDetailView = new OApplicationDetailView(*this,_ePreviewMode);
84 0 : m_pDetailView->Show();
85 :
86 0 : ImplInitSettings();
87 0 : }
88 : // -----------------------------------------------------------------------------
89 0 : OAppBorderWindow::~OAppBorderWindow()
90 : {
91 : // destroy children
92 0 : if ( m_pPanel )
93 : {
94 0 : m_pPanel->Hide();
95 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
96 0 : ::std::auto_ptr<Window> aTemp(m_pPanel);
97 : SAL_WNODEPRECATED_DECLARATIONS_POP
98 0 : m_pPanel = NULL;
99 : }
100 0 : if ( m_pDetailView )
101 : {
102 0 : m_pDetailView->Hide();
103 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
104 0 : ::std::auto_ptr<Window> aTemp(m_pDetailView);
105 : SAL_WNODEPRECATED_DECLARATIONS_POP
106 0 : m_pDetailView = NULL;
107 : }
108 :
109 : DBG_DTOR(OAppBorderWindow,NULL);
110 0 : }
111 : // -----------------------------------------------------------------------------
112 0 : void OAppBorderWindow::GetFocus()
113 : {
114 0 : if ( m_pPanel )
115 0 : m_pPanel->GrabFocus();
116 0 : }
117 : // -----------------------------------------------------------------------------
118 0 : void OAppBorderWindow::Resize()
119 : {
120 : // parent window dimension
121 0 : Size aOutputSize( GetOutputSize() );
122 0 : long nOutputWidth = aOutputSize.Width();
123 0 : long nOutputHeight = aOutputSize.Height();
124 0 : long nX = 0;
125 :
126 0 : Size aFLSize = LogicToPixel( Size( 3, 8 ), MAP_APPFONT );
127 0 : if ( m_pPanel )
128 : {
129 0 : OApplicationSwapWindow* pSwap = getPanel();
130 0 : if ( pSwap )
131 : {
132 0 : if ( pSwap->GetEntryCount() != 0 )
133 0 : nX = pSwap->GetBoundingBox( pSwap->GetEntry(0) ).GetWidth() + aFLSize.Height();
134 : }
135 0 : nX = ::std::max(m_pPanel->GetWidthPixel() ,nX);
136 0 : m_pPanel->SetPosSizePixel(Point(0,0),Size(nX,nOutputHeight));
137 : }
138 :
139 0 : if ( m_pDetailView )
140 0 : m_pDetailView->SetPosSizePixel(Point(nX + aFLSize.Width(),0),Size(nOutputWidth - nX - aFLSize.Width(),nOutputHeight));
141 0 : }
142 : // -----------------------------------------------------------------------------
143 0 : void OAppBorderWindow::DataChanged( const DataChangedEvent& rDCEvt )
144 : {
145 0 : Window::DataChanged( rDCEvt );
146 :
147 0 : if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
148 0 : (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
149 0 : (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
150 0 : ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
151 0 : (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
152 : {
153 0 : ImplInitSettings();
154 0 : Invalidate();
155 : }
156 0 : }
157 : // -----------------------------------------------------------------------------
158 0 : void OAppBorderWindow::ImplInitSettings()
159 : {
160 0 : const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
161 : if( true )
162 : {
163 0 : Font aFont;
164 0 : aFont = rStyleSettings.GetFieldFont();
165 0 : aFont.SetColor( rStyleSettings.GetWindowTextColor() );
166 0 : SetPointFont( aFont );
167 : }
168 :
169 : if( true )
170 : {
171 0 : SetTextColor( rStyleSettings.GetFieldTextColor() );
172 0 : SetTextFillColor();
173 : }
174 :
175 : if( true )
176 0 : SetBackground( rStyleSettings.GetDialogColor() );
177 0 : }
178 : // -----------------------------------------------------------------------------
179 0 : OApplicationView* OAppBorderWindow::getView() const
180 : {
181 0 : return m_pView;
182 : }
183 :
184 : // -----------------------------------------------------------------------------
185 0 : OApplicationSwapWindow* OAppBorderWindow::getPanel() const
186 : {
187 0 : return static_cast< OApplicationSwapWindow* >( m_pPanel->getChildWindow() );
188 : }
189 :
190 : // -----------------------------------------------------------------------------
191 0 : OApplicationDetailView* OAppBorderWindow::getDetailView() const
192 : {
193 0 : return m_pDetailView;
194 : }
195 :
196 : //==================================================================
197 : // class OApplicationView
198 : //==================================================================
199 : DBG_NAME(OApplicationView);
200 : //------------------------------------------------------------------------------
201 0 : OApplicationView::OApplicationView( Window* pParent
202 : ,const Reference< XComponentContext >& _rxOrb
203 : ,IApplicationController& _rAppController
204 : ,PreviewMode _ePreviewMode
205 : ) :
206 : ODataView( pParent, _rAppController, _rxOrb, WB_DIALOGCONTROL )
207 : ,m_rAppController( _rAppController )
208 0 : ,m_eChildFocus(NONE)
209 : {
210 : DBG_CTOR(OApplicationView,NULL);
211 :
212 : try
213 : {
214 0 : m_aLocale = SvtSysLocale().GetLanguageTag().getLocale();
215 : }
216 0 : catch(Exception&)
217 : {
218 : }
219 :
220 0 : m_pWin = new OAppBorderWindow(this,_ePreviewMode);
221 0 : m_pWin->SetUniqueId(UID_APP_VIEW_BORDER_WIN);
222 0 : m_pWin->Show();
223 :
224 0 : ImplInitSettings();
225 0 : }
226 :
227 : //------------------------------------------------------------------------------
228 0 : OApplicationView::~OApplicationView()
229 : {
230 : DBG_DTOR(OApplicationView,NULL);
231 :
232 : {
233 0 : stopComponentListening(m_xObject);
234 0 : m_pWin->Hide();
235 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
236 0 : ::std::auto_ptr<Window> aTemp(m_pWin);
237 : SAL_WNODEPRECATED_DECLARATIONS_POP
238 0 : m_pWin = NULL;
239 : }
240 0 : }
241 : // -----------------------------------------------------------------------------
242 0 : void OApplicationView::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics )
243 : {
244 0 : if ( m_pWin && m_pWin->getPanel() )
245 0 : m_pWin->getPanel()->createIconAutoMnemonics( _rMnemonics );
246 0 : }
247 :
248 : // -----------------------------------------------------------------------------
249 0 : void OApplicationView::setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics )
250 : {
251 0 : if ( m_pWin && m_pWin->getDetailView() )
252 0 : m_pWin->getDetailView()->setTaskExternalMnemonics( _rMnemonics );
253 0 : }
254 :
255 : // -----------------------------------------------------------------------------
256 0 : void OApplicationView::DataChanged( const DataChangedEvent& rDCEvt )
257 : {
258 0 : ODataView::DataChanged( rDCEvt );
259 :
260 0 : if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
261 0 : (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
262 0 : (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
263 0 : ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
264 0 : (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
265 : {
266 0 : ImplInitSettings();
267 0 : Invalidate();
268 : }
269 0 : }
270 : //------------------------------------------------------------------------------
271 0 : void OApplicationView::resizeDocumentView(Rectangle& _rPlayground)
272 : {
273 0 : if ( m_pWin && !_rPlayground.IsEmpty() )
274 : {
275 0 : Size aFLSize = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
276 0 : _rPlayground.Move( aFLSize.A(),aFLSize.B() );
277 0 : Size aOldSize = _rPlayground.GetSize();
278 0 : _rPlayground.SetSize( Size(aOldSize.A() - 2*aFLSize.A(), aOldSize.B() - 2*aFLSize.B()) );
279 :
280 0 : m_pWin->SetPosSizePixel(_rPlayground.TopLeft() , _rPlayground.GetSize() );
281 : }
282 : // just for completeness: there is no space left, we occupied it all ...
283 0 : _rPlayground.SetPos( _rPlayground.BottomRight() );
284 0 : _rPlayground.SetSize( Size( 0, 0 ) );
285 0 : }
286 : //------------------------------------------------------------------------------
287 0 : long OApplicationView::PreNotify( NotifyEvent& rNEvt )
288 : {
289 0 : switch(rNEvt.GetType())
290 : {
291 : case EVENT_GETFOCUS:
292 0 : if( m_pWin && getPanel() && getPanel()->HasChildPathFocus() )
293 0 : m_eChildFocus = PANELSWAP;
294 0 : else if ( m_pWin && getDetailView() && getDetailView()->HasChildPathFocus() )
295 0 : m_eChildFocus = DETAIL;
296 : else
297 0 : m_eChildFocus = NONE;
298 0 : break;
299 : case EVENT_KEYINPUT:
300 : {
301 0 : const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
302 : // give the pane the chance to intercept mnemonic accelerators
303 : // #i34790#
304 0 : if ( getPanel() && getPanel()->interceptKeyInput( *pKeyEvent ) )
305 0 : return 1L;
306 : // and ditto the detail view
307 : // #i72799#
308 0 : if ( getDetailView() && getDetailView()->interceptKeyInput( *pKeyEvent ) )
309 0 : return 1L;
310 : }
311 0 : break;
312 : }
313 :
314 0 : return ODataView::PreNotify(rNEvt);
315 : }
316 : // -----------------------------------------------------------------------------
317 0 : IClipboardTest* OApplicationView::getActiveChild() const
318 : {
319 0 : IClipboardTest* pTest = NULL;
320 0 : if ( DETAIL == m_eChildFocus )
321 0 : pTest = getDetailView();
322 0 : return pTest;
323 : }
324 : // -----------------------------------------------------------------------------
325 0 : sal_Bool OApplicationView::isCopyAllowed()
326 : {
327 0 : IClipboardTest* pTest = getActiveChild();
328 0 : return pTest && pTest->isCopyAllowed();
329 : }
330 : // -----------------------------------------------------------------------------
331 0 : sal_Bool OApplicationView::isCutAllowed()
332 : {
333 0 : IClipboardTest* pTest = getActiveChild();
334 0 : return pTest && pTest->isCutAllowed();
335 : }
336 : // -----------------------------------------------------------------------------
337 0 : sal_Bool OApplicationView::isPasteAllowed()
338 : {
339 0 : IClipboardTest* pTest = getActiveChild();
340 0 : return pTest && pTest->isPasteAllowed();
341 : }
342 : // -----------------------------------------------------------------------------
343 0 : void OApplicationView::copy()
344 : {
345 0 : IClipboardTest* pTest = getActiveChild();
346 0 : if ( pTest )
347 0 : pTest->copy();
348 0 : }
349 : // -----------------------------------------------------------------------------
350 0 : void OApplicationView::cut()
351 : {
352 0 : IClipboardTest* pTest = getActiveChild();
353 0 : if ( pTest )
354 0 : pTest->cut();
355 0 : }
356 : // -----------------------------------------------------------------------------
357 0 : void OApplicationView::paste()
358 : {
359 0 : IClipboardTest* pTest = getActiveChild();
360 0 : if ( pTest )
361 0 : pTest->paste();
362 0 : }
363 : // -----------------------------------------------------------------------------
364 0 : OUString OApplicationView::getQualifiedName( SvTreeListEntry* _pEntry ) const
365 : {
366 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
367 0 : return getDetailView()->getQualifiedName( _pEntry );
368 : }
369 : // -----------------------------------------------------------------------------
370 0 : sal_Bool OApplicationView::isLeaf(SvTreeListEntry* _pEntry) const
371 : {
372 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
373 0 : return getDetailView()->isLeaf(_pEntry);
374 : }
375 : // -----------------------------------------------------------------------------
376 0 : sal_Bool OApplicationView::isALeafSelected() const
377 : {
378 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
379 0 : return getDetailView()->isALeafSelected();
380 : }
381 : // -----------------------------------------------------------------------------
382 0 : void OApplicationView::selectAll()
383 : {
384 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
385 0 : getDetailView()->selectAll();
386 0 : }
387 : // -----------------------------------------------------------------------------
388 0 : sal_Bool OApplicationView::isSortUp() const
389 : {
390 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
391 0 : return getDetailView()->isSortUp();
392 : }
393 : // -----------------------------------------------------------------------------
394 0 : void OApplicationView::sortDown()
395 : {
396 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
397 0 : getDetailView()->sortDown();
398 0 : }
399 : // -----------------------------------------------------------------------------
400 0 : void OApplicationView::sortUp()
401 : {
402 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
403 0 : getDetailView()->sortUp();
404 0 : }
405 : // -----------------------------------------------------------------------------
406 0 : sal_Bool OApplicationView::isFilled() const
407 : {
408 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
409 0 : return getDetailView()->isFilled();
410 : }
411 : // -----------------------------------------------------------------------------
412 0 : ElementType OApplicationView::getElementType() const
413 : {
414 : OSL_ENSURE(m_pWin && getDetailView() && getPanel(),"Detail view is NULL! -> GPF");
415 0 : return getDetailView()->HasChildPathFocus() ? getDetailView()->getElementType() : getPanel()->getElementType();
416 : }
417 : // -----------------------------------------------------------------------------
418 0 : sal_Int32 OApplicationView::getSelectionCount()
419 : {
420 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
421 0 : return getDetailView()->getSelectionCount();
422 : }
423 : // -----------------------------------------------------------------------------
424 0 : sal_Int32 OApplicationView::getElementCount()
425 : {
426 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
427 0 : return getDetailView()->getElementCount();
428 : }
429 : // -----------------------------------------------------------------------------
430 0 : void OApplicationView::getSelectionElementNames( ::std::vector< OUString>& _rNames ) const
431 : {
432 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
433 0 : getDetailView()->getSelectionElementNames( _rNames );
434 0 : }
435 : // -----------------------------------------------------------------------------
436 0 : void OApplicationView::describeCurrentSelectionForControl( const Control& _rControl, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
437 : {
438 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
439 0 : getDetailView()->describeCurrentSelectionForControl( _rControl, _out_rSelectedObjects );
440 0 : }
441 : // -----------------------------------------------------------------------------
442 0 : void OApplicationView::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
443 : {
444 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
445 0 : getDetailView()->describeCurrentSelectionForType( _eType, _out_rSelectedObjects );
446 0 : }
447 : // -----------------------------------------------------------------------------
448 0 : void OApplicationView::selectElements(const Sequence< OUString>& _aNames)
449 : {
450 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
451 0 : getDetailView()->selectElements( _aNames );
452 0 : }
453 : // -----------------------------------------------------------------------------
454 0 : SvTreeListEntry* OApplicationView::elementAdded(ElementType eType,const OUString& _rName, const Any& _rObject )
455 : {
456 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
457 0 : return getDetailView()->elementAdded(eType,_rName,_rObject);
458 : }
459 : // -----------------------------------------------------------------------------
460 0 : void OApplicationView::elementRemoved(ElementType eType,const OUString& _rName )
461 : {
462 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
463 0 : getDetailView()->elementRemoved(eType,_rName);
464 0 : }
465 : // -----------------------------------------------------------------------------
466 0 : void OApplicationView::elementReplaced(ElementType _eType
467 : ,const OUString& _rOldName
468 : ,const OUString& _rNewName )
469 : {
470 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
471 0 : getDetailView()->elementReplaced(_eType, _rOldName, _rNewName );
472 0 : }
473 : // -----------------------------------------------------------------------------
474 0 : void OApplicationView::clearPages(sal_Bool _bTaskAlso)
475 : {
476 : OSL_ENSURE(m_pWin && getDetailView() && getPanel(),"Detail view is NULL! -> GPF");
477 0 : getPanel()->clearSelection();
478 0 : getDetailView()->clearPages(_bTaskAlso);
479 0 : }
480 : // -----------------------------------------------------------------------------
481 0 : void OApplicationView::selectContainer(ElementType _eType)
482 : {
483 : OSL_ENSURE(m_pWin && getPanel(),"Detail view is NULL! -> GPF");
484 0 : WaitObject aWO(this);
485 0 : getPanel()->selectContainer(_eType);
486 0 : }
487 : // -----------------------------------------------------------------------------
488 0 : SvTreeListEntry* OApplicationView::getEntry( const Point& _aPosPixel ) const
489 : {
490 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
491 0 : return getDetailView()->getEntry(_aPosPixel);
492 : }
493 : // -----------------------------------------------------------------------------
494 0 : PreviewMode OApplicationView::getPreviewMode()
495 : {
496 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
497 0 : return getDetailView()->getPreviewMode();
498 : }
499 : // -----------------------------------------------------------------------------
500 0 : sal_Bool OApplicationView::isPreviewEnabled()
501 : {
502 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
503 0 : return getDetailView()->isPreviewEnabled();
504 : }
505 : // -----------------------------------------------------------------------------
506 0 : void OApplicationView::switchPreview(PreviewMode _eMode)
507 : {
508 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
509 0 : getDetailView()->switchPreview(_eMode);
510 0 : }
511 : // -----------------------------------------------------------------------------
512 0 : void OApplicationView::showPreview(const Reference< XContent >& _xContent)
513 : {
514 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
515 0 : stopComponentListening(m_xObject);
516 0 : m_xObject = NULL;
517 0 : getDetailView()->showPreview(_xContent);
518 0 : }
519 : // -----------------------------------------------------------------------------
520 0 : void OApplicationView::showPreview( const OUString& _sDataSourceName,
521 : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
522 : const OUString& _sName,
523 : sal_Bool _bTable)
524 : {
525 : OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
526 0 : if ( isPreviewEnabled() )
527 : {
528 0 : stopComponentListening(m_xObject);
529 0 : m_xObject = NULL;
530 : try
531 : {
532 0 : Reference<XNameAccess> xNameAccess;
533 0 : if ( _bTable )
534 : {
535 0 : Reference<XTablesSupplier> xSup(_xConnection,UNO_QUERY);
536 0 : if ( xSup.is() )
537 0 : xNameAccess.set(xSup->getTables(),UNO_QUERY);
538 : }
539 : else
540 : {
541 0 : Reference<XQueriesSupplier> xSup(_xConnection,UNO_QUERY);
542 0 : if ( xSup.is() )
543 0 : xNameAccess.set(xSup->getQueries(),UNO_QUERY);
544 : }
545 0 : if ( xNameAccess.is() && xNameAccess->hasByName(_sName) )
546 0 : m_xObject.set(xNameAccess->getByName(_sName),UNO_QUERY);
547 : }
548 0 : catch( const Exception& )
549 : {
550 : DBG_UNHANDLED_EXCEPTION();
551 : }
552 0 : if ( m_xObject.is() )
553 0 : startComponentListening(m_xObject);
554 0 : getDetailView()->showPreview(_sDataSourceName,_sName,_bTable);
555 : }
556 0 : }
557 : // -----------------------------------------------------------------------------
558 0 : void OApplicationView::GetFocus()
559 : {
560 0 : if ( m_eChildFocus == NONE && m_pWin )
561 : {
562 0 : m_pWin->GrabFocus();
563 : }
564 0 : }
565 : // -----------------------------------------------------------------------------
566 0 : void OApplicationView::_disposing( const ::com::sun::star::lang::EventObject& /*_rSource*/ )
567 : {
568 0 : if ( m_pWin && getDetailView() )
569 0 : showPreview(NULL);
570 0 : }
571 : // -----------------------------------------------------------------------------
572 0 : void OApplicationView::ImplInitSettings()
573 : {
574 0 : const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
575 : if( true )
576 : {
577 0 : Font aFont;
578 0 : aFont = rStyleSettings.GetFieldFont();
579 0 : aFont.SetColor( rStyleSettings.GetWindowTextColor() );
580 0 : SetPointFont( aFont );
581 : }
582 :
583 : if( true )
584 : {
585 0 : SetTextColor( rStyleSettings.GetFieldTextColor() );
586 0 : SetTextFillColor();
587 : }
588 :
589 : if( true )
590 0 : SetBackground( rStyleSettings.GetFieldColor() );
591 12 : }
592 : //-----------------------------------------------------------------------------
593 :
594 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|