21#include <com/sun/star/lang/NoSupportException.hpp>
22#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
24#include <core_resource.hxx>
33OGroups::OGroups(
const uno::Reference< report::XReportDefinition >& _xParent,uno::Reference< uno::XComponentContext > context)
47void SAL_CALL OGroups::dispose()
49 cppu::WeakComponentImplHelperBase::dispose();
54void SAL_CALL OGroups::disposing()
56 for(
auto& rGroup : m_aGroups)
59 lang::EventObject aDisposeEvent( getXWeak() );
60 m_aContainerListeners.disposeAndClear( aDisposeEvent );
65uno::Reference< report::XReportDefinition > SAL_CALL OGroups::getReportDefinition()
70uno::Reference< report::XGroup > SAL_CALL OGroups::createGroup( )
76void SAL_CALL OGroups::insertByIndex( ::sal_Int32
Index,
const uno::Any& aElement )
80 bool bAdd = (
Index ==
static_cast<sal_Int32
>(m_aGroups.size()));
83 uno::Reference< report::XGroup > xGroup(aElement,uno::UNO_QUERY);
85 throw lang::IllegalArgumentException(
RptResId(RID_STR_ARGUMENT_IS_NULL),*
this,2);
88 m_aGroups.push_back(xGroup);
91 TGroups::iterator aPos = m_aGroups.begin();
92 ::std::advance(aPos,
Index);
93 m_aGroups.insert(aPos, xGroup);
98 m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,
aEvent);
102void SAL_CALL OGroups::removeByIndex( ::sal_Int32
Index )
104 uno::Reference< report::XGroup > xGroup;
108 TGroups::iterator aPos = m_aGroups.begin();
109 ::std::advance(aPos,
Index);
111 m_aGroups.erase(aPos);
114 m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,
aEvent);
118void SAL_CALL OGroups::replaceByIndex( ::sal_Int32
Index,
const uno::Any& Element )
124 uno::Reference< report::XGroup > xGroup(Element,uno::UNO_QUERY);
126 throw lang::IllegalArgumentException(
RptResId(RID_STR_ARGUMENT_IS_NULL),*
this,2);
127 TGroups::iterator aPos = m_aGroups.begin();
128 ::std::advance(aPos,
Index);
129 aOldElement <<= *aPos;
133 container::ContainerEvent
aEvent(
static_cast<container::XContainer*
>(
this),
uno::Any(
Index), Element, aOldElement);
134 m_aContainerListeners.notifyEach(&container::XContainerListener::elementReplaced,
aEvent);
138::sal_Int32 SAL_CALL OGroups::getCount( )
141 return m_aGroups.size();
148 TGroups::const_iterator aPos = m_aGroups.begin();
149 ::std::advance(aPos,
Index);
162 return !m_aGroups.empty();
166uno::Reference< uno::XInterface > SAL_CALL OGroups::getParent( )
171void SAL_CALL OGroups::setParent(
const uno::Reference< uno::XInterface >& )
173 throw lang::NoSupportException();
177void SAL_CALL OGroups::addContainerListener(
const uno::Reference< container::XContainerListener >& xListener )
179 m_aContainerListeners.addInterface(xListener);
182void SAL_CALL OGroups::removeContainerListener(
const uno::Reference< container::XContainerListener >& xListener )
184 m_aContainerListeners.removeInterface(xListener);
187void OGroups::checkIndex(sal_Int32 _nIndex)
190 throw lang::IndexOutOfBoundsException();
Reference< XComponentContext > m_xContext
css::uno::Type const & get()
OGroups(const OGroups &)=delete
OUString RptResId(TranslateId aId)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
::cppu::WeakComponentImplHelper< css::report::XGroups > GroupsBase