diff options
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r-- | dbaccess/source/ui/inc/imageprovider.hxx | 14 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/singledoccontroller.hxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/imageprovider.cxx | 38 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/singledoccontroller.cxx | 20 |
4 files changed, 29 insertions, 49 deletions
diff --git a/dbaccess/source/ui/inc/imageprovider.hxx b/dbaccess/source/ui/inc/imageprovider.hxx index a8d24f4288b9..28784e6dbfa1 100644 --- a/dbaccess/source/ui/inc/imageprovider.hxx +++ b/dbaccess/source/ui/inc/imageprovider.hxx @@ -22,12 +22,10 @@ #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/sdbc/XConnection.hpp> -#include <memory> +namespace com::sun::star::sdb::application { class XTableUIProvider; } namespace dbaui { - // ImageProvider - struct ImageProvider_Data; /** provides images for database objects such as tables, queries, forms, reports ... At the moment, this class cares for small icons only, that is, icons which can be used @@ -36,9 +34,6 @@ namespace dbaui */ class ImageProvider { - private: - std::shared_ptr< ImageProvider_Data > m_pData; - public: /** creates a semi-functional ImageProvider instance @@ -98,6 +93,13 @@ namespace dbaui the image to be used for folders of this type */ static OUString getDatabaseImage(); + private: + /// the connection we work with + css::uno::Reference< css::sdbc::XConnection > mxConnection; + /// the views of the connection, if the DB supports views + css::uno::Reference< css::container::XNameAccess > mxViews; + /// interface for providing table's UI + css::uno::Reference< css::sdb::application::XTableUIProvider > mxTableUI; }; } // namespace dbaui diff --git a/dbaccess/source/ui/inc/singledoccontroller.hxx b/dbaccess/source/ui/inc/singledoccontroller.hxx index e5e11ba7a2f0..6b535882bc80 100644 --- a/dbaccess/source/ui/inc/singledoccontroller.hxx +++ b/dbaccess/source/ui/inc/singledoccontroller.hxx @@ -31,9 +31,8 @@ class SfxUndoManager; namespace dbaui { +class UndoManager; - // OSingleDocumentController - struct OSingleDocumentController_Data; typedef ::cppu::ImplInheritanceHelper< DBSubComponentController , css::document::XUndoManagerSupplier > OSingleDocumentController_Base; @@ -70,7 +69,8 @@ namespace dbaui using OSingleDocumentController_Base::disposing; private: - std::unique_ptr< OSingleDocumentController_Data > m_pData; + // no Reference! see UndoManager::acquire + std::unique_ptr<UndoManager> m_pUndoManager; }; } // namespace dbaui diff --git a/dbaccess/source/ui/misc/imageprovider.cxx b/dbaccess/source/ui/misc/imageprovider.cxx index e3dea6dd62d0..388df30e271f 100644 --- a/dbaccess/source/ui/misc/imageprovider.cxx +++ b/dbaccess/source/ui/misc/imageprovider.cxx @@ -43,26 +43,16 @@ namespace dbaui namespace GraphicColorMode = css::graphic::GraphicColorMode; namespace DatabaseObject = css::sdb::application::DatabaseObject; - // ImageProvider_Data - struct ImageProvider_Data - { - /// the connection we work with - Reference< XConnection > xConnection; - /// the views of the connection, if the DB supports views - Reference< XNameAccess > xViews; - /// interface for providing table's UI - Reference< XTableUIProvider > xTableUI; - }; - namespace { - void lcl_getConnectionProvidedTableIcon_nothrow( const ImageProvider_Data& _rData, + void lcl_getConnectionProvidedTableIcon_nothrow( + const css::uno::Reference< css::sdb::application::XTableUIProvider >& _xTableUI, const OUString& _rName, Reference< XGraphic >& _out_rxGraphic ) { try { - if ( _rData.xTableUI.is() ) - _out_rxGraphic = _rData.xTableUI->getTableIcon( _rName, GraphicColorMode::NORMAL ); + if ( _xTableUI.is() ) + _out_rxGraphic = _xTableUI->getTableIcon( _rName, GraphicColorMode::NORMAL ); } catch( const Exception& ) { @@ -70,13 +60,15 @@ namespace dbaui } } - void lcl_getTableImageResourceID_nothrow( const ImageProvider_Data& _rData, const OUString& _rName, + void lcl_getTableImageResourceID_nothrow( + const css::uno::Reference< css::container::XNameAccess >& _xViews, + const OUString& _rName, OUString& _out_rResourceID) { _out_rResourceID = OUString(); try { - bool bIsView = _rData.xViews.is() && _rData.xViews->hasByName( _rName ); + bool bIsView = _xViews.is() && _xViews->hasByName( _rName ); if ( bIsView ) { _out_rResourceID = VIEW_TREE_ICON; @@ -94,21 +86,19 @@ namespace dbaui } // ImageProvider ImageProvider::ImageProvider() - :m_pData( std::make_shared<ImageProvider_Data>() ) { } ImageProvider::ImageProvider( const Reference< XConnection >& _rxConnection ) - :m_pData( std::make_shared<ImageProvider_Data>() ) + : mxConnection(_rxConnection) { - m_pData->xConnection = _rxConnection; try { - Reference< XViewsSupplier > xSuppViews( m_pData->xConnection, UNO_QUERY ); + Reference< XViewsSupplier > xSuppViews( mxConnection, UNO_QUERY ); if ( xSuppViews.is() ) - m_pData->xViews.set( xSuppViews->getViews(), UNO_SET_THROW ); + mxViews.set( xSuppViews->getViews(), UNO_SET_THROW ); - m_pData->xTableUI.set( _rxConnection, UNO_QUERY ); + mxTableUI.set( _rxConnection, UNO_QUERY ); } catch( const Exception& ) { @@ -127,7 +117,7 @@ namespace dbaui { // no -> determine by type OUString sImageResourceID; - lcl_getTableImageResourceID_nothrow( *m_pData, _rName, sImageResourceID ); + lcl_getTableImageResourceID_nothrow( mxViews, _rName, sImageResourceID ); return sImageResourceID; } } @@ -138,7 +128,7 @@ namespace dbaui if (_nDatabaseObjectType == DatabaseObject::TABLE) { // check whether the connection can give us an icon - lcl_getConnectionProvidedTableIcon_nothrow( *m_pData, _rName, xGraphic ); + lcl_getConnectionProvidedTableIcon_nothrow( mxTableUI, _rName, xGraphic ); } return xGraphic; } diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx index 28b0c9e774bd..6f58676629d0 100644 --- a/dbaccess/source/ui/misc/singledoccontroller.cxx +++ b/dbaccess/source/ui/misc/singledoccontroller.cxx @@ -35,22 +35,10 @@ namespace dbaui using ::com::sun::star::document::XUndoManager; using ::com::sun::star::beans::PropertyValue; - // OSingleDocumentController_Data - struct OSingleDocumentController_Data - { - // no Reference! see UndoManager::acquire - std::unique_ptr<UndoManager> m_pUndoManager; - - OSingleDocumentController_Data( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex ) - : m_pUndoManager(new UndoManager(i_parent, i_mutex)) - { - } - }; - // OSingleDocumentController OSingleDocumentController::OSingleDocumentController( const Reference< XComponentContext >& _rxORB ) :OSingleDocumentController_Base( _rxORB ) - ,m_pData( new OSingleDocumentController_Data( *this, getMutex() ) ) + ,m_pUndoManager(new UndoManager(*this, getMutex())) { } @@ -62,7 +50,7 @@ namespace dbaui { OSingleDocumentController_Base::disposing(); ClearUndoManager(); - m_pData->m_pUndoManager->disposing(); + m_pUndoManager->disposing(); } void OSingleDocumentController::ClearUndoManager() @@ -72,7 +60,7 @@ namespace dbaui SfxUndoManager& OSingleDocumentController::GetUndoManager() const { - return m_pData->m_pUndoManager->GetSfxUndoManager(); + return m_pUndoManager->GetSfxUndoManager(); } void OSingleDocumentController::addUndoActionAndInvalidate(std::unique_ptr<SfxUndoAction> _pAction) @@ -91,7 +79,7 @@ namespace dbaui Reference< XUndoManager > SAL_CALL OSingleDocumentController::getUndoManager( ) { // see UndoManager::acquire - return m_pData->m_pUndoManager.get(); + return m_pUndoManager.get(); } FeatureState OSingleDocumentController::GetState(sal_uInt16 _nId) const |