22#include <rptui_slotid.hrc>
27#include <com/sun/star/report/XSection.hpp>
28#include <com/sun/star/beans/PropertyAttribute.hpp>
30#include <com/sun/star/awt/Point.hpp>
31#include <com/sun/star/awt/Size.hpp>
45 using namespace beans;
48 using namespace container;
49 using namespace report;
54 void lcl_collectElements(
const uno::Reference< report::XSection >& _xSection,::std::vector< uno::Reference< drawing::XShape> >& _rControls)
58 sal_Int32
nCount = _xSection->getCount();
59 _rControls.reserve(nCount);
62 uno::Reference< drawing::XShape> xShape(_xSection->getByIndex(nCount-1),uno::UNO_QUERY);
63 _rControls.push_back(xShape);
64 _xSection->remove(xShape);
70 void lcl_insertElements(
const uno::Reference< report::XSection >& _xSection,const ::std::vector< uno::Reference< drawing::XShape> >& _aControls)
72 if ( !_xSection.is() )
75 ::std::vector< uno::Reference< drawing::XShape> >::const_reverse_iterator aIter = _aControls.rbegin();
76 ::std::vector< uno::Reference< drawing::XShape> >::const_reverse_iterator aEnd = _aControls.rend();
77 for (; aIter != aEnd; ++aIter)
81 const awt::Point aPos = (*aIter)->getPosition();
82 const awt::Size aSize = (*aIter)->getSize();
83 _xSection->add(*aIter);
84 (*aIter)->setPosition( aPos );
85 (*aIter)->setSize( aSize );
87 catch(
const uno::Exception&)
94 void lcl_setValues(
const uno::Reference< report::XSection >& _xSection,const ::std::vector< ::std::pair< OUString ,uno::Any> >& _aValues)
96 if ( !_xSection.is() )
99 for (
const auto& [rPropName, rValue] : _aValues)
103 _xSection->setPropertyValue(rPropName, rValue);
105 catch(
const uno::Exception&)
131 for (uno::Reference<drawing::XShape>& xShape :
m_aControls)
138 catch(
const uno::Exception &)
151 uno::Reference< beans::XPropertySetInfo> xInfo = _xSection->getPropertySetInfo();
152 const uno::Sequence< beans::Property>
aSeq = xInfo->getProperties();
153 for(
const beans::Property& rProp :
aSeq)
155 if ( 0 == (rProp.Attributes & beans::PropertyAttribute::READONLY) )
156 m_aValues.emplace_back(rProp.Name,_xSection->getPropertyValue(rProp.Name));
160 catch(uno::Exception&)
209 ::std::function<uno::Reference<report::XSection>(
OReportHelper*)> _pMemberFunction,
210 const uno::Reference<report::XReportDefinition>& _xReport,
Action _eAction)
212 , m_aReportHelper(_xReport)
213 , m_pMemberFunction(std::move(_pMemberFunction))
216 collectControls(m_pMemberFunction(&m_aReportHelper));
225 const uno::Sequence< beans::PropertyValue > aArgs;
237 const uno::Sequence< beans::PropertyValue > aArgs;
244 ::std::function<uno::Reference<report::XSection>(
OGroupHelper*)> _pMemberFunction,
245 const uno::Reference<report::XGroup>& _xGroup,
Action _eAction,
TranslateId pCommentID)
247 , m_aGroupHelper(_xGroup)
248 , m_pMemberFunction(
std::move(_pMemberFunction))
252 uno::Reference< report::XSection > xSection =
m_pMemberFunction(&m_aGroupHelper);
270 catch (
const uno::Exception&)
280 uno::Sequence< beans::PropertyValue > aArgs{
298 uno::Sequence< beans::PropertyValue > aArgs{
311 ,uno::Reference< report::XGroup> _xGroup
312 ,uno::Reference< report::XReportDefinition > _xReportDefinition)
314,m_xGroup(
std::move(_xGroup))
315,m_xReportDefinition(
std::move(_xReportDefinition))
327 catch(uno::Exception&)
339 catch(uno::Exception&)
SectionViewAction m_eAction
virtual void executeChecked(const css::util::URL &_rCommand, const css::uno::Sequence< css::beans::PropertyValue > &aArgs)=0
Helper class to allow std::mem_fun for SAL_CALL.
const css::uno::Reference< css::report::XGroup > & getGroup() const
Undo action for the group header, footer.
void implReInsert() override
OGroupHelper m_aGroupHelper
::std::function< css::uno::Reference< css::report::XSection >(OGroupHelper *)> m_pMemberFunction
void implReRemove() override
virtual OUString GetComment() const override
OGroupSectionUndo(const OGroupSectionUndo &)=delete
virtual void Redo() override
virtual void Undo() override
Action m_eAction
! the current action
css::uno::Reference< css::report::XGroup > m_xGroup
! the group for the undo redo action
OGroupUndo(OReportModel &rMod, TranslateId pCommentID, Action _eAction, css::uno::Reference< css::report::XGroup > _xGroup, css::uno::Reference< css::report::XReportDefinition > _xReportDefinition)
css::uno::Reference< css::report::XReportDefinition > m_xReportDefinition
! the parent report definition
sal_Int32 m_nLastPosition
! the last position of the group
Helper class to allow std::mem_fun for SAL_CALL.
::std::function< css::uno::Reference< css::report::XSection >(OReportHelper *)> m_pMemberFunction
OReportHelper m_aReportHelper
void implReRemove() override
void implReInsert() override
OReportSectionUndo(const OReportSectionUndo &)=delete
virtual ~OReportSectionUndo() override
Undo class for section add and remove.
virtual void implReInsert()=0
virtual void Redo() override
::std::vector< css::uno::Reference< css::drawing::XShape > > m_aControls
virtual void implReRemove()=0
OSectionUndo(const OSectionUndo &)=delete
void collectControls(const css::uno::Reference< css::report::XSection > &_xSection)
virtual ~OSectionUndo() override
::std::vector< ::std::pair< OUString,css::uno::Any > > m_aValues
virtual void Undo() override
void RemoveElement(const css::uno::Reference< css::uno::XInterface > &Element)
#define TOOLS_WARN_EXCEPTION(area, stream)
Sequence< sal_Int8 > aSeq
void disposeComponent(css::uno::Reference< TYPE > &_rxComp)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
sal_Int32 getPositionInIndexAccess(const css::uno::Reference< css::container::XIndexAccess > &_xCollection, const css::uno::Reference< T > &_xSearch)
returns the position of the object inside the index container
constexpr OUStringLiteral PROPERTY_GROUP
constexpr OUStringLiteral PROPERTY_HEADERON
constexpr OUStringLiteral PROPERTY_FOOTERON