diff options
Diffstat (limited to 'dbaccess/source/ui/app/AppDetailPageHelper.cxx')
-rw-r--r-- | dbaccess/source/ui/app/AppDetailPageHelper.cxx | 150 |
1 files changed, 80 insertions, 70 deletions
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index f01c26bcf9ef..6907968e1fa2 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -188,34 +188,33 @@ namespace // class OAppDetailPageHelper OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindow& _rBorderWin,PreviewMode _ePreviewMode) : Window(_pParent,WB_DIALOGCONTROL) ,m_rBorderWin(_rBorderWin) - ,m_aFL(this,WB_VERT) - ,m_aTBPreview(this,WB_TABSTOP ) - ,m_aBorder(this,WB_BORDER | WB_READONLY) - ,m_aPreview(&m_aBorder) - ,m_aDocumentInfo(&m_aBorder,WB_LEFT | WB_VSCROLL | WB_READONLY ) - ,m_pTablePreview(NULL) + ,m_aFL(VclPtr<FixedLine>::Create(this,WB_VERT)) + ,m_aTBPreview(VclPtr<ToolBox>::Create(this,WB_TABSTOP) ) + ,m_aBorder(VclPtr<Window>::Create(this,WB_BORDER | WB_READONLY)) + ,m_aPreview(VclPtr<OPreviewWindow>::Create(m_aBorder.get())) + ,m_aDocumentInfo(new ::svtools::ODocumentInfoPreview(m_aBorder.get(), WB_LEFT | WB_VSCROLL | WB_READONLY) ) ,m_ePreviewMode(_ePreviewMode) { - m_aBorder.SetBorderStyle(WindowBorderStyle::MONO); + m_aBorder->SetBorderStyle(WindowBorderStyle::MONO); m_aMenu.reset(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) )); - m_aTBPreview.SetOutStyle(TOOLBOX_STYLE_FLAT); - m_aTBPreview.InsertItem(SID_DB_APP_DISABLE_PREVIEW,m_aMenu->GetItemText(SID_DB_APP_DISABLE_PREVIEW),ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK); - m_aTBPreview.SetHelpId(HID_APP_VIEW_PREVIEW_CB); - m_aTBPreview.SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) ); - m_aTBPreview.EnableMenuStrings(); - m_aTBPreview.Enable(true); + m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT); + m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,m_aMenu->GetItemText(SID_DB_APP_DISABLE_PREVIEW),ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK); + m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB); + m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) ); + m_aTBPreview->EnableMenuStrings(); + m_aTBPreview->Enable(true); - m_aBorder.SetUniqueId(UID_APP_VIEW_PREVIEW_1); + m_aBorder->SetUniqueId(UID_APP_VIEW_PREVIEW_1); - m_aPreview.SetHelpId(HID_APP_VIEW_PREVIEW_1); + m_aPreview->SetHelpId(HID_APP_VIEW_PREVIEW_1); - m_pTablePreview = new OTablePreviewWindow(&m_aBorder,WB_READONLY | WB_DIALOGCONTROL ); + m_pTablePreview.set( VclPtr<OTablePreviewWindow>::Create(m_aBorder.get(), WB_READONLY | WB_DIALOGCONTROL ) ); m_pTablePreview->SetHelpId(HID_APP_VIEW_PREVIEW_2); - m_aDocumentInfo.SetHelpId(HID_APP_VIEW_PREVIEW_3); + m_aDocumentInfo->SetHelpId(HID_APP_VIEW_PREVIEW_3); m_xWindow = VCLUnoHelper::GetInterface( m_pTablePreview ); @@ -227,6 +226,11 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo OAppDetailPageHelper::~OAppDetailPageHelper() { + disposeOnce(); +} + +void OAppDetailPageHelper::dispose() +{ try { Reference< ::util::XCloseable> xCloseable(m_xFrame,UNO_QUERY); @@ -244,13 +248,19 @@ OAppDetailPageHelper::~OAppDetailPageHelper() { m_pLists[i]->clearCurrentSelection(); m_pLists[i]->Hide(); - boost::scoped_ptr<DBTreeListBox> aTemp(m_pLists[i]); m_pLists[i]->clearCurrentSelection(); // why a second time? - m_pLists[i] = NULL; + m_pLists[i].disposeAndClear(); } - } - + m_aMenu.reset(); + m_pTablePreview.disposeAndClear(); + m_aDocumentInfo.disposeAndClear(); + m_aPreview.disposeAndClear(); + m_aBorder.disposeAndClear(); + m_aTBPreview.disposeAndClear(); + m_aFL.disposeAndClear(); + + vcl::Window::dispose(); } int OAppDetailPageHelper::getVisibleControlIndex() const @@ -358,7 +368,7 @@ void OAppDetailPageHelper::describeCurrentSelectionForControl( const Control& _r void OAppDetailPageHelper::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects ) { OSL_ENSURE( _eType < E_ELEMENT_TYPE_COUNT, "OAppDetailPageHelper::describeCurrentSelectionForType: invalid type!" ); - DBTreeListBox* pList = ( _eType < E_ELEMENT_TYPE_COUNT ) ? m_pLists[ _eType ] : NULL; + DBTreeListBox* pList = ( _eType < E_ELEMENT_TYPE_COUNT ) ? m_pLists[ _eType ].get() : NULL; OSL_ENSURE( pList, "OAppDetailPageHelper::describeCurrentSelectionForType: " "You really should ensure this type has already been viewed before!" ); if ( !pList ) @@ -560,7 +570,7 @@ void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xCon if ( !m_pLists[E_TABLE] ) { - OTableTreeListBox* pTreeView = new OTableTreeListBox(this, + VclPtrInstance<OTableTreeListBox> pTreeView(this, WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP); pTreeView->SetHelpId(HID_APP_TABLE_TREE); m_pLists[E_TABLE] = pTreeView; @@ -571,11 +581,11 @@ void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xCon ); pTreeView->notifyHiContrastChanged(); - m_aBorder.SetZOrder(pTreeView, WINDOW_ZORDER_BEHIND); + m_aBorder->SetZOrder(pTreeView, WINDOW_ZORDER_BEHIND); } if ( !m_pLists[E_TABLE]->GetEntryCount() ) { - static_cast<OTableTreeListBox*>(m_pLists[E_TABLE])->UpdateTableList(_xConnection); + static_cast<OTableTreeListBox*>(m_pLists[E_TABLE].get())->UpdateTableList(_xConnection); SvTreeListEntry* pEntry = m_pLists[E_TABLE]->First(); if ( pEntry ) @@ -657,13 +667,13 @@ void OAppDetailPageHelper::setDetailPage(vcl::Window* _pWindow) showPreview(NULL); bool bHasFocus = false; - m_aFL.Show(); + m_aFL->Show(); { bHasFocus = pCurrent != 0 && pCurrent->HasChildPathFocus(); _pWindow->Show(); } - m_aTBPreview.Show(); - m_aBorder.Show(); + m_aTBPreview->Show(); + m_aBorder->Show(); switchPreview(m_ePreviewMode,true); if ( bHasFocus ) @@ -727,7 +737,7 @@ void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContaine DBTreeListBox* OAppDetailPageHelper::createSimpleTree( const OString& _sHelpId, const Image& _rImage) { - DBTreeListBox* pTreeView = new DBTreeListBox(this, + VclPtrInstance<DBTreeListBox> pTreeView(this, WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP); pTreeView->SetHelpId( _sHelpId ); return createTree( pTreeView, _rImage ); @@ -947,17 +957,17 @@ void OAppDetailPageHelper::Resize() pWindow->SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) ); - m_aFL.SetPosSizePixel( Point(nHalfOutputWidth , 0 ), Size(aFLSize.Width(), nOutputHeight ) ); + m_aFL->SetPosSizePixel( Point(nHalfOutputWidth , 0 ), Size(aFLSize.Width(), nOutputHeight ) ); - Size aTBSize = m_aTBPreview.CalcWindowSizePixel(); - m_aTBPreview.SetPosSizePixel(Point(nOutputWidth - aTBSize.getWidth(), 0 ), + Size aTBSize = m_aTBPreview->CalcWindowSizePixel(); + m_aTBPreview->SetPosSizePixel(Point(nOutputWidth - aTBSize.getWidth(), 0 ), aTBSize ); - m_aBorder.SetPosSizePixel(Point(nHalfOutputWidth + aFLSize.Width() + n6PPT, aTBSize.getHeight() + n6PPT ), + m_aBorder->SetPosSizePixel(Point(nHalfOutputWidth + aFLSize.Width() + n6PPT, aTBSize.getHeight() + n6PPT ), Size(nHalfOutputWidth - aFLSize.Width() - n6PPT, nOutputHeight - 2*n6PPT - aTBSize.getHeight()) ); - m_aPreview.SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() ); - m_aDocumentInfo.SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() ); - m_pTablePreview->SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() ); + m_aPreview->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() ); + m_aDocumentInfo->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() ); + m_pTablePreview->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() ); } } @@ -993,7 +1003,7 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce) } m_aMenu->CheckItem(nSelectedAction); - m_aTBPreview.SetItemText(SID_DB_APP_DISABLE_PREVIEW, m_aMenu->GetItemText(nSelectedAction)); + m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, m_aMenu->GetItemText(nSelectedAction)); Resize(); // simulate a selectionChanged event at the controller, to force the preview to be updated @@ -1007,8 +1017,8 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce) else { m_pTablePreview->Hide(); - m_aPreview.Hide(); - m_aDocumentInfo.Hide(); + m_aPreview->Hide(); + m_aDocumentInfo->Hide(); } } } @@ -1034,8 +1044,8 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent) Any aPreview = xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()); if ( m_ePreviewMode == E_DOCUMENT ) { - m_aDocumentInfo.Hide(); - m_aPreview.Show(); + m_aDocumentInfo->Hide(); + m_aPreview->Show(); Graphic aGraphic; Sequence < sal_Int8 > aBmpSequence; @@ -1047,24 +1057,24 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent) GraphicConverter::Import(aData,aGraphic); } - m_aPreview.setGraphic( aGraphic ); - m_aPreview.Invalidate(); + m_aPreview->setGraphic( aGraphic ); + m_aPreview->Invalidate(); } else { - m_aPreview.Hide(); - m_aDocumentInfo.clear(); - m_aDocumentInfo.Show(); + m_aPreview->Hide(); + m_aDocumentInfo->clear(); + m_aDocumentInfo->Show(); Reference<document::XDocumentProperties> xProp( aPreview, UNO_QUERY); if ( xProp.is() ) - m_aDocumentInfo.fill(xProp,OUString()); + m_aDocumentInfo->fill(xProp,OUString()); } } else { - m_aPreview.Hide(); - m_aDocumentInfo.Hide(); + m_aPreview->Hide(); + m_aDocumentInfo->Hide(); } } catch( const Exception& ) @@ -1081,8 +1091,8 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName, if ( isPreviewEnabled() ) { WaitObject aWaitCursor( this ); - m_aPreview.Hide(); - m_aDocumentInfo.Hide(); + m_aPreview->Hide(); + m_aDocumentInfo->Hide(); m_pTablePreview->Show(); if ( !m_xFrame.is() ) { @@ -1142,17 +1152,17 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName, IMPL_LINK(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, /*pToolBox*/) { - m_aTBPreview.EndSelection(); + m_aTBPreview->EndSelection(); // tell the toolbox that the item is pressed down - m_aTBPreview.SetItemDown( SID_DB_APP_DISABLE_PREVIEW, true ); + m_aTBPreview->SetItemDown( SID_DB_APP_DISABLE_PREVIEW, true ); // simulate a mouse move (so the "down" state is really painted) - Point aPoint = m_aTBPreview.GetItemRect( SID_DB_APP_DISABLE_PREVIEW ).TopLeft(); + Point aPoint = m_aTBPreview->GetItemRect( SID_DB_APP_DISABLE_PREVIEW ).TopLeft(); MouseEvent aMove( aPoint, 0, MouseEventModifiers::SIMPLEMOVE | MouseEventModifiers::SYNTHETIC ); - m_aTBPreview.MouseMove( aMove ); + m_aTBPreview->MouseMove( aMove ); - m_aTBPreview.Update(); + m_aTBPreview->Update(); // execute the menu boost::scoped_ptr<PopupMenu> aMenu(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) )); @@ -1171,14 +1181,14 @@ IMPL_LINK(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, /*pToolBox*/) // no disabled entries aMenu->RemoveDisabledEntries(); - sal_uInt16 nSelectedAction = aMenu->Execute(&m_aTBPreview, m_aTBPreview.GetItemRect( SID_DB_APP_DISABLE_PREVIEW )); + sal_uInt16 nSelectedAction = aMenu->Execute(m_aTBPreview.get(), m_aTBPreview->GetItemRect( SID_DB_APP_DISABLE_PREVIEW )); // "cleanup" the toolbox state MouseEvent aLeave( aPoint, 0, MouseEventModifiers::LEAVEWINDOW | MouseEventModifiers::SYNTHETIC ); - m_aTBPreview.MouseMove( aLeave ); - m_aTBPreview.SetItemDown( SID_DB_APP_DISABLE_PREVIEW, false); + m_aTBPreview->MouseMove( aLeave ); + m_aTBPreview->SetItemDown( SID_DB_APP_DISABLE_PREVIEW, false); if ( nSelectedAction ) { - m_aTBPreview.SetItemText(SID_DB_APP_DISABLE_PREVIEW, aMenu->GetItemText(nSelectedAction)); + m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, aMenu->GetItemText(nSelectedAction)); Resize(); getBorderWin().getView()->getAppController().executeChecked(nSelectedAction,Sequence<PropertyValue>()); } @@ -1215,7 +1225,7 @@ void OAppDetailPageHelper::DataChanged( const DataChangedEvent& rDCEvt ) ImplInitSettings(); if ( m_pLists[ E_TABLE ] ) { - OTableTreeListBox* pTableTree = dynamic_cast< OTableTreeListBox* >( m_pLists[ E_TABLE ] ); + OTableTreeListBox* pTableTree = dynamic_cast< OTableTreeListBox* >( m_pLists[ E_TABLE ].get() ); OSL_ENSURE( pTableTree != NULL, "OAppDetailPageHelper::DataChanged: a tree list for tables which is no TableTreeList?" ); if ( pTableTree ) pTableTree->notifyHiContrastChanged(); @@ -1230,19 +1240,19 @@ void OAppDetailPageHelper::ImplInitSettings() aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); SetPointFont( aFont ); - m_aTBPreview.SetPointFont( aFont ); + m_aTBPreview->SetPointFont( aFont ); SetTextColor( rStyleSettings.GetFieldTextColor() ); SetTextFillColor(); - m_aBorder.SetTextColor( rStyleSettings.GetFieldTextColor() ); - m_aBorder.SetTextFillColor(); - m_aTBPreview.SetTextColor( rStyleSettings.GetFieldTextColor() ); - m_aTBPreview.SetTextFillColor(); + m_aBorder->SetTextColor( rStyleSettings.GetFieldTextColor() ); + m_aBorder->SetTextFillColor(); + m_aTBPreview->SetTextColor( rStyleSettings.GetFieldTextColor() ); + m_aTBPreview->SetTextFillColor(); SetBackground( rStyleSettings.GetFieldColor() ); - m_aBorder.SetBackground( rStyleSettings.GetFieldColor() ); - m_aFL.SetBackground( rStyleSettings.GetFieldColor() ); - m_aDocumentInfo.SetBackground( rStyleSettings.GetFieldColor() ); - m_aTBPreview.SetBackground( rStyleSettings.GetFieldColor() ); + m_aBorder->SetBackground( rStyleSettings.GetFieldColor() ); + m_aFL->SetBackground( rStyleSettings.GetFieldColor() ); + m_aDocumentInfo->SetBackground( rStyleSettings.GetFieldColor() ); + m_aTBPreview->SetBackground( rStyleSettings.GetFieldColor() ); m_pTablePreview->SetBackground( rStyleSettings.GetFieldColor() ); } |