diff options
Diffstat (limited to 'dbaccess/source/ui/app')
-rw-r--r-- | dbaccess/source/ui/app/AppController.cxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppControllerDnD.cxx | 23 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppControllerGen.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppDetailPageHelper.cxx | 150 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppDetailPageHelper.hxx | 19 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppDetailView.cxx | 146 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppDetailView.hxx | 24 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppIconControl.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppIconControl.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppSwapWindow.cxx | 44 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppSwapWindow.hxx | 10 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppTitleWindow.cxx | 33 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppTitleWindow.hxx | 9 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppView.cxx | 41 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppView.hxx | 10 | ||||
-rw-r--r-- | dbaccess/source/ui/app/subcomponentmanager.cxx | 1 |
16 files changed, 303 insertions, 242 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 1cbbf0e24897..8836a5dc0dce 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -309,9 +309,7 @@ OApplicationController::~OApplicationController() osl_atomic_increment( &m_refCount ); dispose(); } - ::std::unique_ptr< vcl::Window> aTemp( getView() ); clearView(); - } IMPLEMENT_FORWARD_XTYPEPROVIDER2(OApplicationController,OApplicationController_CBASE,OApplicationController_Base) @@ -427,7 +425,7 @@ void SAL_CALL OApplicationController::disposing() bool OApplicationController::Construct(vcl::Window* _pParent) { - setView( * new OApplicationView( _pParent, getORB(), *this, m_ePreviewMode ) ); + setView( VclPtr<OApplicationView>::Create( _pParent, getORB(), *this, m_ePreviewMode ) ); getView()->SetUniqueId(UID_APP_VIEW); // late construction @@ -447,7 +445,6 @@ bool OApplicationController::Construct(vcl::Window* _pParent) if ( !bSuccess ) { - ::std::unique_ptr< vcl::Window> aTemp( getView() ); clearView(); return false; } @@ -2048,7 +2045,7 @@ void OApplicationController::renameEntry() if ( xContainer.is() ) { ::std::unique_ptr< IObjectNameCheck > pNameChecker; - ::std::unique_ptr< OSaveAsDlg > aDialog; + VclPtr< OSaveAsDlg > aDialog; Reference<XRename> xRename; const ElementType eType = getContainer()->getElementType(); @@ -2081,7 +2078,8 @@ void OApplicationController::renameEntry() } } pNameChecker.reset( new HierarchicalNameCheck( xHNames.get(), OUString() ) ); - aDialog.reset( new OSaveAsDlg( + aDialog.reset( VclPtr<OSaveAsDlg>::Create( + getView(), getORB(), sName, sLabel, *pNameChecker, SAD_TITLE_RENAME ) ); } } @@ -2100,7 +2098,8 @@ void OApplicationController::renameEntry() ensureConnection(); pNameChecker.reset( new DynamicTableOrQueryNameCheck( getConnection(), nCommandType ) ); - aDialog.reset( new OSaveAsDlg( + aDialog.reset( VclPtr<OSaveAsDlg>::Create( + getView(), nCommandType, getORB(), getConnection(), *aList.begin(), *pNameChecker, SAD_TITLE_RENAME ) ); } diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index 4f4da2f070d0..f18b2d010b85 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -175,8 +175,8 @@ void OApplicationController::deleteTables(const ::std::vector< OUString>& _rList else { OUString sMessage(ModuleRes(STR_MISSING_TABLES_XDROP)); - MessageDialog aError(getView(), sMessage); - aError.Execute(); + ScopedVclPtrInstance< MessageDialog > aError(getView(), sMessage); + aError->Execute(); } } } @@ -210,19 +210,19 @@ void OApplicationController::deleteObjects( ElementType _eType, const ::std::vec if ( eResult != svtools::QUERYDELETE_ALL ) { - svtools::QueryDeleteDlg_Impl aDlg( getView(), *aThisRound ); + ScopedVclPtrInstance< svtools::QueryDeleteDlg_Impl > aDlg(getView(), *aThisRound); if ( !sDialogPosition.isEmpty() ) - aDlg.SetWindowState( sDialogPosition ); + aDlg->SetWindowState( sDialogPosition ); if ( nObjectsLeft > 1 ) - aDlg.EnableAllButton(); + aDlg->EnableAllButton(); - eResult = aDlg.Execute(); + eResult = aDlg->Execute(); if (eResult == svtools::QUERYDELETE_CANCEL) return; - sDialogPosition = aDlg.GetWindowState( ); + sDialogPosition = aDlg->GetWindowState( ); } bool bSuccess = false; @@ -686,17 +686,18 @@ bool OApplicationController::paste( ElementType _eType, const ::svx::ODataAccess has a /table/ with that name) */ if ( bNeedAskForName ) { - OSaveAsDlg aAskForName( getView(), + ScopedVclPtrInstance<OSaveAsDlg> aAskForName( + getView(), CommandType::QUERY, getORB(), getConnection(), sTargetName, aNameChecker, - SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS); - if ( RET_OK != aAskForName.Execute() ) + SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS ); + if ( RET_OK != aAskForName->Execute() ) // cancelled by the user return false; - sTargetName = aAskForName.getName(); + sTargetName = aAskForName->getName(); } // create a new object diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 3eda31592a78..e9424506727a 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -111,12 +111,12 @@ void OApplicationController::convertToView(const OUString& _sName) OUString aDefaultName = ::dbaui::createDefaultName(xMeta,xTables,aName); DynamicTableOrQueryNameCheck aNameChecker( xConnection, CommandType::TABLE ); - OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker ); - if ( aDlg.Execute() == RET_OK ) + ScopedVclPtrInstance< OSaveAsDlg > aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker ); + if ( aDlg->Execute() == RET_OK ) { - OUString sName = aDlg.getName(); - OUString sCatalog = aDlg.getCatalog(); - OUString sSchema = aDlg.getSchema(); + OUString sName = aDlg->getName(); + OUString sCatalog = aDlg->getCatalog(); + OUString sSchema = aDlg->getSchema(); OUString sNewName( ::dbtools::composeTableName( xMeta, sCatalog, sSchema, sName, false, ::dbtools::eInTableDefinitions ) ); Reference<XPropertySet> xView = ::dbaui::createView(sNewName,xConnection,xSourceObject); @@ -534,8 +534,8 @@ void OApplicationController::askToReconnect() bool bClear = true; if ( !m_pSubComponentManager->empty() ) { - MessageDialog aQry(getView(), ModuleRes(STR_QUERY_CLOSEDOCUMENTS), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - switch (aQry.Execute()) + ScopedVclPtrInstance< MessageDialog > aQry(getView(), ModuleRes(STR_QUERY_CLOSEDOCUMENTS), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + switch (aQry->Execute()) { case RET_YES: closeSubComponents(); 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() ); } diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx index fb86bdd3f050..9240fb94e0b5 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx @@ -77,15 +77,15 @@ namespace dbaui // Combines general functionality. class OAppDetailPageHelper : public vcl::Window { - DBTreeListBox* m_pLists[ELEMENT_COUNT]; + VclPtr<DBTreeListBox> m_pLists[ELEMENT_COUNT]; OAppBorderWindow& m_rBorderWin; - FixedLine m_aFL; - ToolBox m_aTBPreview; - Window m_aBorder; - OPreviewWindow m_aPreview; - ::svtools::ODocumentInfoPreview - m_aDocumentInfo; - vcl::Window* m_pTablePreview; + VclPtr<FixedLine> m_aFL; + VclPtr<ToolBox> m_aTBPreview; + VclPtr<Window> m_aBorder; + VclPtr<OPreviewWindow> m_aPreview; + VclPtr<::svtools::ODocumentInfoPreview> + m_aDocumentInfo; + VclPtr<vcl::Window> m_pTablePreview; ::std::unique_ptr<PopupMenu> m_aMenu; PreviewMode m_ePreviewMode; ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 > @@ -169,6 +169,7 @@ namespace dbaui public: OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindow& _rBorderWin,PreviewMode _ePreviewMode); virtual ~OAppDetailPageHelper(); + virtual void dispose() SAL_OVERRIDE; // Window overrides virtual void Resize() SAL_OVERRIDE; @@ -193,7 +194,7 @@ namespace dbaui inline DBTreeListBox* getCurrentView() const { ElementType eType = getElementType(); - return (eType != E_NONE ) ? m_pLists[static_cast<sal_Int32>(eType)] : NULL; + return (eType != E_NONE ) ? m_pLists[static_cast<sal_Int32>(eType)].get() : NULL; } /// select all entries in the visible control diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx index aebcd5d3d35d..5ef2b69be554 100644 --- a/dbaccess/source/ui/app/AppDetailView.cxx +++ b/dbaccess/source/ui/app/AppDetailView.cxx @@ -341,30 +341,41 @@ void OCreationList::KeyInput( const KeyEvent& rKEvt ) OTasksWindow::OTasksWindow(vcl::Window* _pParent,OApplicationDetailView* _pDetailView) : Window(_pParent,WB_DIALOGCONTROL ) - ,m_aCreation(*this) - ,m_aDescription(this) - ,m_aHelpText(this,WB_WORDBREAK) - ,m_aFL(this,WB_VERT) + ,m_aCreation(VclPtr<OCreationList>::Create(*this)) + ,m_aDescription(VclPtr<FixedText>::Create(this)) + ,m_aHelpText(VclPtr<FixedText>::Create(this,WB_WORDBREAK)) + ,m_aFL(VclPtr<FixedLine>::Create(this,WB_VERT)) ,m_pDetailView(_pDetailView) { SetUniqueId(UID_APP_TASKS_WINDOW); - m_aCreation.SetHelpId(HID_APP_CREATION_LIST); - m_aCreation.SetSelectHdl(LINK(this, OTasksWindow, OnEntrySelectHdl)); - m_aHelpText.SetHelpId(HID_APP_HELP_TEXT); - m_aDescription.SetHelpId(HID_APP_DESCRIPTION_TEXT); - m_aDescription.SetText(ModuleRes(STR_DESCRIPTION)); + m_aCreation->SetHelpId(HID_APP_CREATION_LIST); + m_aCreation->SetSelectHdl(LINK(this, OTasksWindow, OnEntrySelectHdl)); + m_aHelpText->SetHelpId(HID_APP_HELP_TEXT); + m_aDescription->SetHelpId(HID_APP_DESCRIPTION_TEXT); + m_aDescription->SetText(ModuleRes(STR_DESCRIPTION)); ImageProvider aImageProvider; Image aFolderImage = aImageProvider.getFolderImage( css::sdb::application::DatabaseObject::FORM ); - m_aCreation.SetDefaultCollapsedEntryBmp( aFolderImage ); - m_aCreation.SetDefaultExpandedEntryBmp( aFolderImage ); + m_aCreation->SetDefaultCollapsedEntryBmp( aFolderImage ); + m_aCreation->SetDefaultExpandedEntryBmp( aFolderImage ); ImplInitSettings(true,true,true); } OTasksWindow::~OTasksWindow() { + disposeOnce(); +} + +void OTasksWindow::dispose() +{ Clear(); + m_aCreation.disposeAndClear(); + m_aDescription.disposeAndClear(); + m_aHelpText.disposeAndClear(); + m_aFL.disposeAndClear(); + m_pDetailView.clear(); + vcl::Window::dispose(); } void OTasksWindow::DataChanged( const DataChangedEvent& rDCEvt ) @@ -394,23 +405,23 @@ void OTasksWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackgro { SetTextColor( rStyleSettings.GetFieldTextColor() ); SetTextFillColor(); - m_aHelpText.SetTextColor( rStyleSettings.GetFieldTextColor() ); - m_aHelpText.SetTextFillColor(); - m_aDescription.SetTextColor( rStyleSettings.GetFieldTextColor() ); - m_aDescription.SetTextFillColor(); + m_aHelpText->SetTextColor( rStyleSettings.GetFieldTextColor() ); + m_aHelpText->SetTextFillColor(); + m_aDescription->SetTextColor( rStyleSettings.GetFieldTextColor() ); + m_aDescription->SetTextFillColor(); } if( bBackground ) { SetBackground( rStyleSettings.GetFieldColor() ); - m_aHelpText.SetBackground( rStyleSettings.GetFieldColor() ); - m_aDescription.SetBackground( rStyleSettings.GetFieldColor() ); - m_aFL.SetBackground( rStyleSettings.GetFieldColor() ); + m_aHelpText->SetBackground( rStyleSettings.GetFieldColor() ); + m_aDescription->SetBackground( rStyleSettings.GetFieldColor() ); + m_aFL->SetBackground( rStyleSettings.GetFieldColor() ); } - vcl::Font aFont = m_aDescription.GetControlFont(); + vcl::Font aFont = m_aDescription->GetControlFont(); aFont.SetWeight(WEIGHT_BOLD); - m_aDescription.SetControlFont(aFont); + m_aDescription->SetControlFont(aFont); } void OTasksWindow::setHelpText(sal_uInt16 _nId) @@ -418,20 +429,20 @@ void OTasksWindow::setHelpText(sal_uInt16 _nId) if ( _nId ) { OUString sText = ModuleRes(_nId); - m_aHelpText.SetText(sText); + m_aHelpText->SetText(sText); } else { - m_aHelpText.SetText(OUString()); + m_aHelpText->SetText(OUString()); } } IMPL_LINK(OTasksWindow, OnEntrySelectHdl, SvTreeListBox*, /*_pTreeBox*/) { - SvTreeListEntry* pEntry = m_aCreation.GetHdlEntry(); + SvTreeListEntry* pEntry = m_aCreation->GetHdlEntry(); if ( pEntry ) - m_aHelpText.SetText( ModuleRes( static_cast< TaskEntry* >( pEntry->GetUserData() )->nHelpID ) ); + m_aHelpText->SetText( ModuleRes( static_cast< TaskEntry* >( pEntry->GetUserData() )->nHelpID ) ); return 1L; } @@ -446,14 +457,14 @@ void OTasksWindow::Resize() sal_Int32 n6PPT = aFLSize.Height(); long nHalfOutputWidth = static_cast<long>(nOutputWidth * 0.5); - m_aCreation.SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) ); + m_aCreation->SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) ); // i77897 make the m_aHelpText a little bit smaller. (-5) sal_Int32 nNewWidth = nOutputWidth - nHalfOutputWidth - aFLSize.Width() - 5; - m_aDescription.SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, 0), Size(nNewWidth, nOutputHeight) ); - Size aDesc = m_aDescription.CalcMinimumSize(); - m_aHelpText.SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, aDesc.Height() ), Size(nNewWidth, nOutputHeight - aDesc.Height() - n6PPT) ); + m_aDescription->SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, 0), Size(nNewWidth, nOutputHeight) ); + Size aDesc = m_aDescription->CalcMinimumSize(); + m_aHelpText->SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, aDesc.Height() ), Size(nNewWidth, nOutputHeight - aDesc.Height() - n6PPT) ); - m_aFL.SetPosSizePixel( Point(nHalfOutputWidth , 0), Size(aFLSize.Width(), nOutputHeight ) ); + m_aFL->SetPosSizePixel( Point(nHalfOutputWidth , 0), Size(aFLSize.Width(), nOutputHeight ) ); } void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList ) @@ -485,79 +496,88 @@ void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList ) for ( TaskEntryList::const_iterator pTask = _rList.begin(); pTask != aEnd; ++pTask, ++pImages ) { - SvTreeListEntry* pEntry = m_aCreation.InsertEntry( pTask->sTitle ); + SvTreeListEntry* pEntry = m_aCreation->InsertEntry( pTask->sTitle ); pEntry->SetUserData( reinterpret_cast< void* >( new TaskEntry( *pTask ) ) ); Image aImage = Image( *pImages ); - m_aCreation.SetExpandedEntryBmp( pEntry, aImage ); - m_aCreation.SetCollapsedEntryBmp( pEntry, aImage ); + m_aCreation->SetExpandedEntryBmp( pEntry, aImage ); + m_aCreation->SetCollapsedEntryBmp( pEntry, aImage ); } } catch(Exception&) { } - m_aCreation.Show(); - m_aCreation.SelectAll(false); - m_aHelpText.Show(); - m_aDescription.Show(); - m_aFL.Show(); - m_aCreation.updateHelpText(); + m_aCreation->Show(); + m_aCreation->SelectAll(false); + m_aHelpText->Show(); + m_aDescription->Show(); + m_aFL->Show(); + m_aCreation->updateHelpText(); Enable(!_rList.empty()); } void OTasksWindow::Clear() { - m_aCreation.resetLastActive(); - SvTreeListEntry* pEntry = m_aCreation.First(); + m_aCreation->resetLastActive(); + SvTreeListEntry* pEntry = m_aCreation->First(); while ( pEntry ) { delete static_cast< TaskEntry* >( pEntry->GetUserData() ); - pEntry = m_aCreation.Next(pEntry); + pEntry = m_aCreation->Next(pEntry); } - m_aCreation.Clear(); + m_aCreation->Clear(); } // class OApplicationDetailView OApplicationDetailView::OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode) : OSplitterView(&_rParent,false ) - ,m_aHorzSplitter(this) - ,m_aTasks(this,STR_TASKS,WB_BORDER | WB_DIALOGCONTROL ) - ,m_aContainer(this,0,WB_BORDER | WB_DIALOGCONTROL ) + ,m_aHorzSplitter(VclPtr<Splitter>::Create(this)) + ,m_aTasks(VclPtr<dbaui::OTitleWindow>::Create(this,STR_TASKS,WB_BORDER | WB_DIALOGCONTROL) ) + ,m_aContainer(VclPtr<dbaui::OTitleWindow>::Create(this,0,WB_BORDER | WB_DIALOGCONTROL) ) ,m_rBorderWin(_rParent) { SetUniqueId(UID_APP_DETAIL_VIEW); ImplInitSettings( true, true, true ); - m_pControlHelper = new OAppDetailPageHelper(&m_aContainer,m_rBorderWin,_ePreviewMode); + m_pControlHelper = VclPtr<OAppDetailPageHelper>::Create(m_aContainer.get(),m_rBorderWin,_ePreviewMode); m_pControlHelper->Show(); - m_aContainer.setChildWindow(m_pControlHelper); + m_aContainer->setChildWindow(m_pControlHelper); - OTasksWindow* pTasks = new OTasksWindow(&m_aTasks,this); + VclPtrInstance<OTasksWindow> pTasks(m_aTasks.get(),this); pTasks->Show(); pTasks->Disable(m_rBorderWin.getView()->getCommandController().isDataSourceReadOnly()); - m_aTasks.setChildWindow(pTasks); - m_aTasks.SetUniqueId(UID_APP_TASKS_VIEW); - m_aTasks.Show(); + m_aTasks->setChildWindow(pTasks); + m_aTasks->SetUniqueId(UID_APP_TASKS_VIEW); + m_aTasks->Show(); - m_aContainer.SetUniqueId(UID_APP_CONTAINER_VIEW); - m_aContainer.Show(); + m_aContainer->SetUniqueId(UID_APP_CONTAINER_VIEW); + m_aContainer->Show(); const long nFrameWidth = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width(); - m_aHorzSplitter.SetPosSizePixel( Point(0,50), Size(0,nFrameWidth) ); + m_aHorzSplitter->SetPosSizePixel( Point(0,50), Size(0,nFrameWidth) ); // now set the components at the base class - set(&m_aContainer,&m_aTasks); + set(m_aContainer.get(),m_aTasks.get()); - m_aHorzSplitter.Show(); - m_aHorzSplitter.SetUniqueId(UID_APP_VIEW_HORZ_SPLIT); - setSplitter(&m_aHorzSplitter); + m_aHorzSplitter->Show(); + m_aHorzSplitter->SetUniqueId(UID_APP_VIEW_HORZ_SPLIT); + setSplitter(m_aHorzSplitter.get()); } OApplicationDetailView::~OApplicationDetailView() { + disposeOnce(); +} + +void OApplicationDetailView::dispose() +{ set(NULL,NULL); setSplitter(NULL); - m_pControlHelper = NULL; + m_aHorzSplitter.disposeAndClear(); + m_aTasks.disposeAndClear(); + m_aContainer.disposeAndClear(); + m_pControlHelper.clear(); + OSplitterView::dispose(); } void OApplicationDetailView::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) @@ -580,9 +600,9 @@ void OApplicationDetailView::ImplInitSettings( bool bFont, bool bForeground, boo if( bBackground ) SetBackground( rStyleSettings.GetFieldColor() ); - m_aHorzSplitter.SetBackground( rStyleSettings.GetDialogColor() ); - m_aHorzSplitter.SetFillColor( rStyleSettings.GetDialogColor() ); - m_aHorzSplitter.SetTextFillColor(rStyleSettings.GetDialogColor() ); + m_aHorzSplitter->SetBackground( rStyleSettings.GetDialogColor() ); + m_aHorzSplitter->SetFillColor( rStyleSettings.GetDialogColor() ); + m_aHorzSplitter->SetTextFillColor(rStyleSettings.GetDialogColor() ); } void OApplicationDetailView::DataChanged( const DataChangedEvent& rDCEvt ) @@ -642,7 +662,7 @@ void OApplicationDetailView::impl_createPage( ElementType _eType, const Referenc bool bEnabled = !rData.aTasks.empty() && getBorderWin().getView()->getCommandController().isCommandEnabled( rData.aTasks[0].sUNOCommand ); getTasksWindow().Enable( bEnabled ); - m_aContainer.setTitle( rData.nTitleId ); + m_aContainer->setTitle( rData.nTitleId ); // let our helper create the object list if ( _eType == E_TABLE ) diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx index f90048248ce8..fadf67574c38 100644 --- a/dbaccess/source/ui/app/AppDetailView.hxx +++ b/dbaccess/source/ui/app/AppDetailView.hxx @@ -111,11 +111,11 @@ namespace dbaui class OTasksWindow : public vcl::Window { - OCreationList m_aCreation; - FixedText m_aDescription; - FixedText m_aHelpText; - FixedLine m_aFL; - OApplicationDetailView* m_pDetailView; + VclPtr<OCreationList> m_aCreation; + VclPtr<FixedText> m_aDescription; + VclPtr<FixedText> m_aHelpText; + VclPtr<FixedLine> m_aFL; + VclPtr<OApplicationDetailView> m_pDetailView; DECL_LINK( OnEntrySelectHdl, SvTreeListBox* ); void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); @@ -124,6 +124,7 @@ namespace dbaui public: OTasksWindow(vcl::Window* _pParent,OApplicationDetailView* _pDetailView); virtual ~OTasksWindow(); + virtual void dispose() SAL_OVERRIDE; // Window overrides virtual void Resize() SAL_OVERRIDE; @@ -135,7 +136,7 @@ namespace dbaui inline bool HandleKeyInput( const KeyEvent& _rKEvt ) { - return m_aCreation.HandleKeyInput( _rKEvt ); + return m_aCreation->HandleKeyInput( _rKEvt ); } void Clear(); @@ -144,11 +145,11 @@ namespace dbaui class OApplicationDetailView : public OSplitterView , public IClipboardTest { - Splitter m_aHorzSplitter; - OTitleWindow m_aTasks; - OTitleWindow m_aContainer; + VclPtr<Splitter> m_aHorzSplitter; + VclPtr<OTitleWindow> m_aTasks; + VclPtr<OTitleWindow> m_aContainer; OAppBorderWindow& m_rBorderWin; // my parent - OAppDetailPageHelper* m_pControlHelper; + VclPtr<OAppDetailPageHelper> m_pControlHelper; ::std::vector< TaskPaneData > m_aTaskPaneData; MnemonicGenerator m_aExternalMnemonics; @@ -161,6 +162,7 @@ namespace dbaui OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode); virtual ~OApplicationDetailView(); // Window overrides + virtual void dispose() SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; /** creates the tables page @@ -188,7 +190,7 @@ namespace dbaui bool interceptKeyInput( const KeyEvent& _rEvent ); inline OAppBorderWindow& getBorderWin() const { return m_rBorderWin; } - inline OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_aTasks.getChildWindow() ); } + inline OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_aTasks->getChildWindow() ); } bool isCutAllowed() SAL_OVERRIDE ; bool isCopyAllowed() SAL_OVERRIDE ; diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx index ff73ba0fdafc..a4b7d02bb944 100644 --- a/dbaccess/source/ui/app/AppIconControl.cxx +++ b/dbaccess/source/ui/app/AppIconControl.cxx @@ -62,6 +62,11 @@ OApplicationIconControl::OApplicationIconControl(vcl::Window* _pParent) OApplicationIconControl::~OApplicationIconControl() { + disposeOnce(); +} + +void OApplicationIconControl::dispose() +{ sal_uLong nCount = GetEntryCount(); for ( sal_uLong i = 0; i < nCount; ++i ) { @@ -72,7 +77,7 @@ OApplicationIconControl::~OApplicationIconControl() pEntry->SetUserData(NULL); } } - + SvtIconChoiceCtrl::dispose(); } sal_Int8 OApplicationIconControl::AcceptDrop( const AcceptDropEvent& _rEvt ) diff --git a/dbaccess/source/ui/app/AppIconControl.hxx b/dbaccess/source/ui/app/AppIconControl.hxx index 5fcecef90022..10c425b6ea31 100644 --- a/dbaccess/source/ui/app/AppIconControl.hxx +++ b/dbaccess/source/ui/app/AppIconControl.hxx @@ -34,6 +34,7 @@ namespace dbaui public: OApplicationIconControl(vcl::Window* _pParent); virtual ~OApplicationIconControl(); + virtual void dispose() SAL_OVERRIDE; void setControlActionListener( IControlActionListener* _pListener ) { m_pActionListener = _pListener; } IControlActionListener* getControlActionListener( ) const { return m_pActionListener; } diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx index 902c7181d5fe..1f215dfd22b5 100644 --- a/dbaccess/source/ui/app/AppSwapWindow.cxx +++ b/dbaccess/source/ui/app/AppSwapWindow.cxx @@ -38,35 +38,41 @@ using namespace ::com::sun::star::container; // class OApplicationSwapWindow OApplicationSwapWindow::OApplicationSwapWindow( vcl::Window* _pParent, OAppBorderWindow& _rBorderWindow ) :Window(_pParent,WB_DIALOGCONTROL ) - ,m_aIconControl(this) + ,m_aIconControl(VclPtr<OApplicationIconControl>::Create(this)) ,m_eLastType(E_NONE) ,m_rBorderWin( _rBorderWindow ) { ImplInitSettings( true, true, true ); - m_aIconControl.SetClickHdl(LINK(this, OApplicationSwapWindow, OnContainerSelectHdl)); - m_aIconControl.setControlActionListener( &m_rBorderWin.getView()->getAppController() ); - m_aIconControl.SetHelpId(HID_APP_SWAP_ICONCONTROL); - m_aIconControl.Show(); + m_aIconControl->SetClickHdl(LINK(this, OApplicationSwapWindow, OnContainerSelectHdl)); + m_aIconControl->setControlActionListener( &m_rBorderWin.getView()->getAppController() ); + m_aIconControl->SetHelpId(HID_APP_SWAP_ICONCONTROL); + m_aIconControl->Show(); } OApplicationSwapWindow::~OApplicationSwapWindow() { + disposeOnce(); +} +void OApplicationSwapWindow::dispose() +{ + m_aIconControl.disposeAndClear(); + vcl::Window::dispose(); } void OApplicationSwapWindow::Resize() { Size aFLSize = LogicToPixel( Size( 8, 0 ), MAP_APPFONT ); long nX = 0; - if ( m_aIconControl.GetEntryCount() != 0 ) - nX = m_aIconControl.GetBoundingBox( m_aIconControl.GetEntry(0) ).GetWidth() + aFLSize.Width(); + if ( m_aIconControl->GetEntryCount() != 0 ) + nX = m_aIconControl->GetBoundingBox( m_aIconControl->GetEntry(0) ).GetWidth() + aFLSize.Width(); Size aOutputSize = GetOutputSize(); - m_aIconControl.SetPosSizePixel( Point(static_cast<long>((aOutputSize.Width() - nX)*0.5), 0) ,Size(nX,aOutputSize.Height())); - m_aIconControl.ArrangeIcons(); + m_aIconControl->SetPosSizePixel( Point(static_cast<long>((aOutputSize.Width() - nX)*0.5), 0) ,Size(nX,aOutputSize.Height())); + m_aIconControl->ArrangeIcons(); } void OApplicationSwapWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) @@ -106,24 +112,24 @@ void OApplicationSwapWindow::DataChanged( const DataChangedEvent& rDCEvt ) void OApplicationSwapWindow::clearSelection() { - m_aIconControl.SetNoSelection(); + m_aIconControl->SetNoSelection(); sal_uLong nPos = 0; - SvxIconChoiceCtrlEntry* pEntry = m_aIconControl.GetSelectedEntry(nPos); + SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry(nPos); if ( pEntry ) - m_aIconControl.InvalidateEntry(pEntry); - m_aIconControl.GetClickHdl().Call(&m_aIconControl); + m_aIconControl->InvalidateEntry(pEntry); + m_aIconControl->GetClickHdl().Call(&m_aIconControl); } void OApplicationSwapWindow::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics ) { - m_aIconControl.CreateAutoMnemonics( _rMnemonics ); + m_aIconControl->CreateAutoMnemonics( _rMnemonics ); } bool OApplicationSwapWindow::interceptKeyInput( const KeyEvent& _rEvent ) { const vcl::KeyCode& rKeyCode = _rEvent.GetKeyCode(); if ( rKeyCode.GetModifier() == KEY_MOD2 ) - return m_aIconControl.DoKeyInput( _rEvent ); + return m_aIconControl->DoKeyInput( _rEvent ); // not handled return false; @@ -132,7 +138,7 @@ bool OApplicationSwapWindow::interceptKeyInput( const KeyEvent& _rEvent ) ElementType OApplicationSwapWindow::getElementType() const { sal_uLong nPos = 0; - SvxIconChoiceCtrlEntry* pEntry = m_aIconControl.GetSelectedEntry(nPos); + SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry(nPos); return ( pEntry ) ? *static_cast<ElementType*>(pEntry->GetUserData()) : E_NONE; } @@ -174,18 +180,18 @@ IMPL_LINK_NOARG(OApplicationSwapWindow, ChangeToLastSelected) void OApplicationSwapWindow::selectContainer(ElementType _eType) { - sal_uLong nCount = m_aIconControl.GetEntryCount(); + sal_uLong nCount = m_aIconControl->GetEntryCount(); SvxIconChoiceCtrlEntry* pEntry = NULL; for (sal_uLong i=0; i < nCount; ++i) { - pEntry = m_aIconControl.GetEntry(i); + pEntry = m_aIconControl->GetEntry(i); if ( pEntry && *static_cast<ElementType*>(pEntry->GetUserData()) == _eType ) break; pEntry = NULL; } if ( pEntry ) - m_aIconControl.SetCursor(pEntry); // this call also initiates a onContainerSelected call + m_aIconControl->SetCursor(pEntry); // this call also initiates a onContainerSelected call else onContainerSelected( _eType ); } diff --git a/dbaccess/source/ui/app/AppSwapWindow.hxx b/dbaccess/source/ui/app/AppSwapWindow.hxx index c7b61c4651c6..b655dd8e4dc1 100644 --- a/dbaccess/source/ui/app/AppSwapWindow.hxx +++ b/dbaccess/source/ui/app/AppSwapWindow.hxx @@ -21,6 +21,7 @@ #include "IClipBoardTest.hxx" #include <vcl/lstbox.hxx> +#include <vcl/vclptr.hxx> #include "AppIconControl.hxx" #include "AppElementType.hxx" @@ -30,7 +31,7 @@ namespace dbaui class OApplicationSwapWindow : public vcl::Window, public IClipboardTest { - OApplicationIconControl m_aIconControl; + VclPtr<OApplicationIconControl> m_aIconControl; ElementType m_eLastType; OAppBorderWindow& m_rBorderWin; @@ -44,6 +45,7 @@ namespace dbaui OApplicationSwapWindow( vcl::Window* _pParent, OAppBorderWindow& _rBorderWindow ); virtual ~OApplicationSwapWindow(); // Window overrides + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; bool isCutAllowed() SAL_OVERRIDE { return false; } @@ -54,9 +56,9 @@ namespace dbaui void cut() SAL_OVERRIDE { } void paste() SAL_OVERRIDE { } - inline sal_uLong GetEntryCount() const { return m_aIconControl.GetEntryCount(); } - inline SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return m_aIconControl.GetEntry(nPos); } - inline Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const { return m_aIconControl.GetBoundingBox(pEntry); } + inline sal_uLong GetEntryCount() const { return m_aIconControl->GetEntryCount(); } + inline SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return m_aIconControl->GetEntry(nPos); } + inline Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const { return m_aIconControl->GetBoundingBox(pEntry); } /** automatically creates mnemonics for the icon/texts in our left hand side panel */ diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx index 2bbd2c66231c..71317b01a82b 100644 --- a/dbaccess/source/ui/app/AppTitleWindow.cxx +++ b/dbaccess/source/ui/app/AppTitleWindow.cxx @@ -29,9 +29,9 @@ namespace dbaui OTitleWindow::OTitleWindow(vcl::Window* _pParent,sal_uInt16 _nTitleId,WinBits _nBits,bool _bShift) : Window(_pParent,_nBits | WB_DIALOGCONTROL) -, m_aSpace1(this) -, m_aSpace2(this) -, m_aTitle(this) +, m_aSpace1(VclPtr<FixedText>::Create(this)) +, m_aSpace2(VclPtr<FixedText>::Create(this)) +, m_aTitle(VclPtr<FixedText>::Create(this)) , m_pChild(NULL) , m_bShift(_bShift) { @@ -40,20 +40,27 @@ OTitleWindow::OTitleWindow(vcl::Window* _pParent,sal_uInt16 _nTitleId,WinBits _n SetBorderStyle(WindowBorderStyle::MONO); ImplInitSettings( true, true, true ); - vcl::Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle }; + vcl::Window* pWindows [] = { m_aSpace1.get(), m_aSpace2.get(), m_aTitle.get() }; for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) pWindows[i]->Show(); } OTitleWindow::~OTitleWindow() { + disposeOnce(); +} + +void OTitleWindow::dispose() +{ if ( m_pChild ) { m_pChild->Hide(); - boost::scoped_ptr<vcl::Window> aTemp(m_pChild); - m_pChild = NULL; } - + m_pChild.disposeAndClear(); + m_aSpace1.disposeAndClear(); + m_aSpace2.disposeAndClear(); + m_aTitle.disposeAndClear(); + vcl::Window::dispose(); } void OTitleWindow::setChildWindow(vcl::Window* _pChild) @@ -74,11 +81,11 @@ void OTitleWindow::Resize() sal_Int32 nYOffset = aTextSize.Height(); sal_Int32 nHeight = GetTextHeight() + 2*nYOffset; - m_aSpace1.SetPosSizePixel( Point(SPACE_BORDER, SPACE_BORDER ), + m_aSpace1->SetPosSizePixel( Point(SPACE_BORDER, SPACE_BORDER ), Size(nXOffset , nHeight - SPACE_BORDER) ); - m_aSpace2.SetPosSizePixel( Point(nXOffset + SPACE_BORDER, SPACE_BORDER ), + m_aSpace2->SetPosSizePixel( Point(nXOffset + SPACE_BORDER, SPACE_BORDER ), Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nYOffset) ); - m_aTitle.SetPosSizePixel( Point(nXOffset + SPACE_BORDER, nYOffset + SPACE_BORDER), + m_aTitle->SetPosSizePixel( Point(nXOffset + SPACE_BORDER, nYOffset + SPACE_BORDER), Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nHeight - nYOffset - SPACE_BORDER) ); if ( m_pChild ) { @@ -91,7 +98,7 @@ void OTitleWindow::setTitle(sal_uInt16 _nTitleId) { if ( _nTitleId != 0 ) { - m_aTitle.SetText(ModuleRes(_nTitleId)); + m_aTitle->SetText(ModuleRes(_nTitleId)); } } @@ -105,7 +112,7 @@ void OTitleWindow::GetFocus() long OTitleWindow::GetWidthPixel() const { Size aTextSize = LogicToPixel( Size( 12, 0 ), MAP_APPFONT ); - sal_Int32 nWidth = GetTextWidth(m_aTitle.GetText()) + 2*aTextSize.Width(); + sal_Int32 nWidth = GetTextWidth(m_aTitle->GetText()) + 2*aTextSize.Width(); return nWidth; } @@ -151,7 +158,7 @@ void OTitleWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackgro if( bBackground ) SetBackground( rStyleSettings.GetFieldColor() ); - vcl::Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle}; + vcl::Window* pWindows [] = { m_aSpace1.get(), m_aSpace2.get(), m_aTitle.get()}; for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) { vcl::Font aFont = pWindows[i]->GetFont(); diff --git a/dbaccess/source/ui/app/AppTitleWindow.hxx b/dbaccess/source/ui/app/AppTitleWindow.hxx index 76228b54b6cf..875f693107ab 100644 --- a/dbaccess/source/ui/app/AppTitleWindow.hxx +++ b/dbaccess/source/ui/app/AppTitleWindow.hxx @@ -25,10 +25,10 @@ namespace dbaui { class OTitleWindow : public vcl::Window { - FixedText m_aSpace1; - FixedText m_aSpace2; - FixedText m_aTitle; - vcl::Window* m_pChild; + VclPtr<FixedText> m_aSpace1; + VclPtr<FixedText> m_aSpace2; + VclPtr<FixedText> m_aTitle; + VclPtr<vcl::Window> m_pChild; bool m_bShift; void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); protected: @@ -36,6 +36,7 @@ namespace dbaui public: OTitleWindow(vcl::Window* _pParent,sal_uInt16 _nTitleId,WinBits _nBits,bool _bShift = true); virtual ~OTitleWindow(); + virtual void dispose() SAL_OVERRIDE; // Window overrides virtual void Resize() SAL_OVERRIDE; diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx index fe2d505e9018..6fa8030ceadc 100644 --- a/dbaccess/source/ui/app/AppView.cxx +++ b/dbaccess/source/ui/app/AppView.cxx @@ -68,9 +68,9 @@ OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePrev SetBorderStyle(WindowBorderStyle::MONO); - m_pPanel = new OTitleWindow(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL, false); + m_pPanel = VclPtr<OTitleWindow>::Create(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL, false); m_pPanel->SetBorderStyle(WindowBorderStyle::MONO); - OApplicationSwapWindow* pSwap = new OApplicationSwapWindow( m_pPanel, *this ); + VclPtrInstance<OApplicationSwapWindow> pSwap( m_pPanel, *this ); pSwap->Show(); pSwap->SetUniqueId(UID_APP_SWAP_VIEW); @@ -78,7 +78,7 @@ OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePrev m_pPanel->SetUniqueId(UID_APP_DATABASE_VIEW); m_pPanel->Show(); - m_pDetailView = new OApplicationDetailView(*this,_ePreviewMode); + m_pDetailView = VclPtr<OApplicationDetailView>::Create(*this,_ePreviewMode); m_pDetailView->Show(); ImplInitSettings(); @@ -86,20 +86,20 @@ OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePrev OAppBorderWindow::~OAppBorderWindow() { + disposeOnce(); +} + +void OAppBorderWindow::dispose() +{ // destroy children if ( m_pPanel ) - { m_pPanel->Hide(); - boost::scoped_ptr<vcl::Window> aTemp(m_pPanel); - m_pPanel = NULL; - } + m_pPanel.disposeAndClear(); if ( m_pDetailView ) - { m_pDetailView->Hide(); - boost::scoped_ptr<vcl::Window> aTemp(m_pDetailView); - m_pDetailView = NULL; - } - + m_pDetailView.disposeAndClear(); + m_pView.clear(); + vcl::Window::dispose(); } void OAppBorderWindow::GetFocus() @@ -195,7 +195,7 @@ OApplicationView::OApplicationView( vcl::Window* pParent { } - m_pWin = new OAppBorderWindow(this,_ePreviewMode); + m_pWin = VclPtr<OAppBorderWindow>::Create(this,_ePreviewMode); m_pWin->SetUniqueId(UID_APP_VIEW_BORDER_WIN); m_pWin->Show(); @@ -204,13 +204,16 @@ OApplicationView::OApplicationView( vcl::Window* pParent OApplicationView::~OApplicationView() { + disposeOnce(); +} - { - stopComponentListening(m_xObject); - m_pWin->Hide(); - boost::scoped_ptr<vcl::Window> aTemp(m_pWin); - m_pWin = NULL; - } +void OApplicationView::dispose() +{ + stopComponentListening(m_xObject); + m_xObject.clear(); + m_pWin->Hide(); + m_pWin.disposeAndClear(); + ODataView::dispose(); } void OApplicationView::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics ) diff --git a/dbaccess/source/ui/app/AppView.hxx b/dbaccess/source/ui/app/AppView.hxx index 87288117d2cd..41f30c85b99e 100644 --- a/dbaccess/source/ui/app/AppView.hxx +++ b/dbaccess/source/ui/app/AppView.hxx @@ -44,9 +44,9 @@ namespace dbaui class OTitleWindow; class OAppBorderWindow : public vcl::Window { - OTitleWindow* m_pPanel; - OApplicationDetailView* m_pDetailView; - OApplicationView* m_pView; + VclPtr<OTitleWindow> m_pPanel; + VclPtr<OApplicationDetailView> m_pDetailView; + VclPtr<OApplicationView> m_pView; void ImplInitSettings(); protected: @@ -55,6 +55,7 @@ namespace dbaui public: OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode); virtual ~OAppBorderWindow(); + virtual void dispose() SAL_OVERRIDE; // Window overrides virtual void GetFocus() SAL_OVERRIDE; @@ -79,7 +80,7 @@ namespace dbaui ::com::sun::star::lang::Locale m_aLocale; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xObject; - OAppBorderWindow* m_pWin; + VclPtr<OAppBorderWindow> m_pWin; IApplicationController& m_rAppController; ChildFocusState m_eChildFocus; @@ -103,6 +104,7 @@ namespace dbaui ,PreviewMode _ePreviewMode ); virtual ~OApplicationView(); + virtual void dispose() SAL_OVERRIDE; /// automatically creates mnemonics for the icon/texts in our left hand side panel void createIconAutoMnemonics( MnemonicGenerator& _rMnemonics ); diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx index e4c05397585b..880504587747 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.cxx +++ b/dbaccess/source/ui/app/subcomponentmanager.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <tools/diagnose_ex.h> +#include <dbaccess/dataview.hxx> #include <vcl/svapp.hxx> #include <osl/mutex.hxx> |