refactor reportdesign::OSection construction
Indended to solve a problem that turned out to be imaginary. Change-Id: I185887f6e45869102ac600717a0bb7564ebdb7e5
This commit is contained in:
@@ -661,7 +661,7 @@ OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > co
|
||||
{
|
||||
init();
|
||||
m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext);
|
||||
m_pImpl->m_xDetail = new OSection(this,m_aProps->m_xContext);
|
||||
m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
|
||||
m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager()));
|
||||
}
|
||||
osl_decrementInterlockedCount( &m_refCount );
|
||||
@@ -682,7 +682,7 @@ OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > co
|
||||
m_aProps->setShape(_xShape,this,m_refCount);
|
||||
init();
|
||||
m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext);
|
||||
m_pImpl->m_xDetail = new OSection(this,m_aProps->m_xContext);
|
||||
m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
|
||||
m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager()));
|
||||
}
|
||||
osl_decrementInterlockedCount( &m_refCount );
|
||||
@@ -703,7 +703,7 @@ OReportDefinition::OReportDefinition(const OReportDefinition& _rCopy)
|
||||
OGroups* pGroups = new OGroups(this,m_aProps->m_xContext);
|
||||
m_pImpl->m_xGroups = pGroups;
|
||||
pGroups->copyGroups(_rCopy.m_pImpl->m_xGroups);
|
||||
m_pImpl->m_xDetail = new OSection(this,m_aProps->m_xContext);
|
||||
m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
|
||||
OSection::lcl_copySection(_rCopy.m_pImpl->m_xDetail,m_pImpl->m_xDetail);
|
||||
|
||||
setPageHeaderOn(_rCopy.m_pImpl->m_xPageHeader.is());
|
||||
|
@@ -52,6 +52,7 @@ namespace reportdesign
|
||||
using namespace com::sun::star;
|
||||
using namespace comphelper;
|
||||
DBG_NAME( rpt_OSection )
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
uno::Sequence< ::rtl::OUString> lcl_getGroupAbsent()
|
||||
{
|
||||
@@ -63,31 +64,6 @@ uno::Sequence< ::rtl::OUString> lcl_getGroupAbsent()
|
||||
return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
OSection::OSection( const uno::Reference< report::XGroup >& _xParent
|
||||
,const uno::Reference< uno::XComponentContext >& context
|
||||
,bool /*_bPageSection*/)
|
||||
:SectionBase(m_aMutex)
|
||||
,SectionPropertySet(context,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getGroupAbsent())
|
||||
,m_aContainerListeners(m_aMutex)
|
||||
,m_xContext(context)
|
||||
,m_xGroup(_xParent)
|
||||
,m_nHeight(3000)
|
||||
,m_nBackgroundColor(COL_TRANSPARENT)
|
||||
,m_nForceNewPage(report::ForceNewPage::NONE)
|
||||
,m_nNewRowOrCol(report::ForceNewPage::NONE)
|
||||
,m_bKeepTogether(sal_False)
|
||||
,m_bCanGrow(sal_False)
|
||||
,m_bCanShrink(sal_False)
|
||||
,m_bRepeatSection(sal_False)
|
||||
,m_bVisible(sal_True)
|
||||
,m_bBacktransparent(sal_True)
|
||||
,m_bInRemoveNotify(false)
|
||||
,m_bInInsertNotify(false)
|
||||
{
|
||||
DBG_CTOR( rpt_OSection,NULL);
|
||||
init();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
uno::Sequence< ::rtl::OUString> lcl_getAbsent(bool _bPageSection)
|
||||
{
|
||||
@@ -112,15 +88,40 @@ uno::Sequence< ::rtl::OUString> lcl_getAbsent(bool _bPageSection)
|
||||
|
||||
return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
|
||||
}
|
||||
|
||||
uno::Reference<report::XSection> OSection::createOSection(
|
||||
const uno::Reference< report::XReportDefinition >& xParentDef,
|
||||
const uno::Reference< uno::XComponentContext >& context,
|
||||
bool const bPageSection)
|
||||
{
|
||||
OSection *const pNew =
|
||||
new OSection(xParentDef, 0, context, lcl_getAbsent(bPageSection));
|
||||
pNew->init();
|
||||
return pNew;
|
||||
}
|
||||
|
||||
uno::Reference<report::XSection> OSection::createOSection(
|
||||
const uno::Reference< report::XGroup >& xParentGroup,
|
||||
const uno::Reference< uno::XComponentContext >& context,
|
||||
bool const)
|
||||
{
|
||||
OSection *const pNew =
|
||||
new OSection(0, xParentGroup, context, lcl_getGroupAbsent());
|
||||
pNew->init();
|
||||
return pNew;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
OSection::OSection(const uno::Reference< report::XReportDefinition >& _xParent
|
||||
OSection::OSection(const uno::Reference< report::XReportDefinition >& xParentDef
|
||||
,const uno::Reference< report::XGroup >& xParentGroup
|
||||
,const uno::Reference< uno::XComponentContext >& context
|
||||
,bool _bPageSection)
|
||||
,uno::Sequence< ::rtl::OUString> const& rStrings)
|
||||
:SectionBase(m_aMutex)
|
||||
,SectionPropertySet(context,SectionPropertySet::IMPLEMENTS_PROPERTY_SET,lcl_getAbsent(_bPageSection))
|
||||
,SectionPropertySet(context,SectionPropertySet::IMPLEMENTS_PROPERTY_SET,rStrings)
|
||||
,m_aContainerListeners(m_aMutex)
|
||||
,m_xContext(context)
|
||||
,m_xReportDefinition(_xParent)
|
||||
,m_xGroup(xParentGroup)
|
||||
,m_xReportDefinition(xParentDef)
|
||||
,m_nHeight(3000)
|
||||
,m_nBackgroundColor(COL_TRANSPARENT)
|
||||
,m_nForceNewPage(report::ForceNewPage::NONE)
|
||||
@@ -135,7 +136,6 @@ OSection::OSection(const uno::Reference< report::XReportDefinition >& _xParent
|
||||
,m_bInInsertNotify(false)
|
||||
{
|
||||
DBG_CTOR( rpt_OSection,NULL);
|
||||
init();
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// TODO: VirtualFunctionFinder: This is virtual function!
|
||||
|
@@ -115,9 +115,17 @@ namespace reportdesign
|
||||
public:
|
||||
typedef ::comphelper::ImplementationReference< OSection ,::com::sun::star::report::XSection,::com::sun::star::uno::XWeak > TSection;
|
||||
|
||||
OSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xParent
|
||||
private:
|
||||
OSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& xParentDef
|
||||
,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& xParentGroup
|
||||
,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,
|
||||
::com::sun::star::uno::Sequence< ::rtl::OUString> const&);
|
||||
public:
|
||||
static ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>
|
||||
createOSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xParent
|
||||
,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,bool _bPageSection=false);
|
||||
OSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xParent
|
||||
static ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>
|
||||
createOSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xParent
|
||||
,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,bool _bPageSection=false);
|
||||
|
||||
DECLARE_XINTERFACE( )
|
||||
|
@@ -47,7 +47,7 @@ namespace reportdesign
|
||||
template <class T> void lcl_createSectionIfNeeded(sal_Bool _bOn,const T& _xParent,::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection/*in/out*/,bool _bPageSection = false)
|
||||
{
|
||||
if ( _bOn && !_xSection.is() )
|
||||
_xSection = new OSection(_xParent,_xParent->getContext(),_bPageSection);
|
||||
_xSection = OSection::createOSection(_xParent,_xParent->getContext(),_bPageSection);
|
||||
else if ( !_bOn )
|
||||
::comphelper::disposeComponent(_xSection);
|
||||
}
|
||||
|
Reference in New Issue
Block a user