use rtl::Reference in BibliographyLoader
instead of storing both a raw pointer and an uno::Reference Change-Id: Ic46c5cda34c1df818cbe1ffa4b2d44d1519b4d6f
This commit is contained in:
parent
7d7a5666ae
commit
3663edf465
@ -61,6 +61,7 @@
|
|||||||
#include "datman.hxx"
|
#include "datman.hxx"
|
||||||
#include <bibconfig.hxx>
|
#include <bibconfig.hxx>
|
||||||
#include <cppuhelper/implbase.hxx>
|
#include <cppuhelper/implbase.hxx>
|
||||||
|
#include <rtl/ref.hxx>
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
using namespace ::com::sun::star::uno;
|
using namespace ::com::sun::star::uno;
|
||||||
@ -76,8 +77,7 @@ class BibliographyLoader : public cppu::WeakImplHelper
|
|||||||
< XServiceInfo, XNameAccess, XPropertySet, XFrameLoader >
|
< XServiceInfo, XNameAccess, XPropertySet, XFrameLoader >
|
||||||
{
|
{
|
||||||
HdlBibModul m_pBibMod;
|
HdlBibModul m_pBibMod;
|
||||||
Reference< XLoadable > m_xDatMan;
|
rtl::Reference<BibDataManager> m_xDatMan;
|
||||||
BibDataManager* m_pDatMan;
|
|
||||||
Reference< XNameAccess > m_xColumns;
|
Reference< XNameAccess > m_xColumns;
|
||||||
Reference< XResultSet > m_xCursor;
|
Reference< XResultSet > m_xCursor;
|
||||||
|
|
||||||
@ -139,8 +139,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
BibliographyLoader::BibliographyLoader() :
|
BibliographyLoader::BibliographyLoader() :
|
||||||
m_pBibMod(nullptr),
|
m_pBibMod(nullptr)
|
||||||
m_pDatMan(nullptr)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,8 +252,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
|
|||||||
if(!m_pBibMod)
|
if(!m_pBibMod)
|
||||||
m_pBibMod = OpenBibModul();
|
m_pBibMod = OpenBibModul();
|
||||||
|
|
||||||
m_pDatMan = BibModul::createDataManager();
|
m_xDatMan = BibModul::createDataManager();
|
||||||
m_xDatMan = m_pDatMan;
|
|
||||||
BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL();
|
BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL();
|
||||||
|
|
||||||
if(aBibDesc.sDataSource.isEmpty())
|
if(aBibDesc.sDataSource.isEmpty())
|
||||||
@ -265,7 +263,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
|
|||||||
aBibDesc.sDataSource = aSources.getConstArray()[0];
|
aBibDesc.sDataSource = aSources.getConstArray()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference< XForm > xForm = m_pDatMan->createDatabaseForm( aBibDesc );
|
Reference< XForm > xForm = m_xDatMan->createDatabaseForm( aBibDesc );
|
||||||
|
|
||||||
Reference< awt::XWindow > aWindow = rFrame->getContainerWindow();
|
Reference< awt::XWindow > aWindow = rFrame->getContainerWindow();
|
||||||
VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(aWindow);
|
VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(aWindow);
|
||||||
@ -276,11 +274,11 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
|
|||||||
VclPtrInstance<BibBookContainer> pMyWindow( pParent );
|
VclPtrInstance<BibBookContainer> pMyWindow( pParent );
|
||||||
pMyWindow->Show();
|
pMyWindow->Show();
|
||||||
|
|
||||||
VclPtrInstance< ::bib::BibView> pView( pMyWindow, m_pDatMan, WB_VSCROLL | WB_HSCROLL | WB_3DLOOK );
|
VclPtrInstance< ::bib::BibView> pView( pMyWindow, m_xDatMan.get(), WB_VSCROLL | WB_HSCROLL | WB_3DLOOK );
|
||||||
pView->Show();
|
pView->Show();
|
||||||
m_pDatMan->SetView( pView );
|
m_xDatMan->SetView( pView );
|
||||||
|
|
||||||
VclPtrInstance< ::bib::BibBeamer> pBeamer( pMyWindow, m_pDatMan );
|
VclPtrInstance< ::bib::BibBeamer> pBeamer( pMyWindow, m_xDatMan.get() );
|
||||||
pBeamer->Show();
|
pBeamer->Show();
|
||||||
pMyWindow->createTopFrame(pBeamer);
|
pMyWindow->createTopFrame(pBeamer);
|
||||||
|
|
||||||
@ -288,7 +286,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
|
|||||||
|
|
||||||
Reference< awt::XWindow > xWin ( pMyWindow->GetComponentInterface(), UNO_QUERY );
|
Reference< awt::XWindow > xWin ( pMyWindow->GetComponentInterface(), UNO_QUERY );
|
||||||
|
|
||||||
Reference< XController > xCtrRef( new BibFrameController_Impl( xWin, m_pDatMan ) );
|
Reference< XController > xCtrRef( new BibFrameController_Impl( xWin, m_xDatMan.get() ) );
|
||||||
|
|
||||||
xCtrRef->attachFrame(rFrame);
|
xCtrRef->attachFrame(rFrame);
|
||||||
rFrame->setComponent( xWin, xCtrRef);
|
rFrame->setComponent( xWin, xCtrRef);
|
||||||
@ -300,8 +298,8 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
|
|||||||
pParentComponent->setVisible(true);
|
pParentComponent->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_xDatMan->load();
|
Reference<XLoadable>(m_xDatMan.get())->load();
|
||||||
m_pDatMan->RegisterInterceptor(pBeamer);
|
m_xDatMan->RegisterInterceptor(pBeamer);
|
||||||
|
|
||||||
if ( rListener.is() )
|
if ( rListener.is() )
|
||||||
rListener->loadFinished( this );
|
rListener->loadFinished( this );
|
||||||
@ -327,14 +325,13 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
|
|||||||
|
|
||||||
BibDataManager* BibliographyLoader::GetDataManager()const
|
BibDataManager* BibliographyLoader::GetDataManager()const
|
||||||
{
|
{
|
||||||
if(!m_pDatMan)
|
if(!m_xDatMan.is())
|
||||||
{
|
{
|
||||||
if(!m_pBibMod)
|
if(!m_pBibMod)
|
||||||
const_cast< BibliographyLoader* >( this )->m_pBibMod = OpenBibModul();
|
const_cast< BibliographyLoader* >( this )->m_pBibMod = OpenBibModul();
|
||||||
const_cast< BibliographyLoader* >( this )->m_pDatMan = BibModul::createDataManager();
|
const_cast< BibliographyLoader* >( this )->m_xDatMan = BibModul::createDataManager();
|
||||||
const_cast< BibliographyLoader* >( this )->m_xDatMan = m_pDatMan;
|
|
||||||
}
|
}
|
||||||
return m_pDatMan;
|
return m_xDatMan.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference< XNameAccess > const & BibliographyLoader::GetDataColumns() const
|
Reference< XNameAccess > const & BibliographyLoader::GetDataColumns() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user