LibreOffice Module chart2 (master) 1
|
This class serves for conversion between properties of an XPropertySet and SfxItems in SfxItemSets. More...
#include <ItemConverter.hxx>
Public Types | |
typedef sal_uInt16 | tWhichIdType |
typedef OUString | tPropertyNameType |
typedef sal_uInt8 | tMemberIdType |
typedef std::pair< tPropertyNameType, tMemberIdType > | tPropertyNameWithMemberId |
Public Member Functions | |
ItemConverter (css::uno::Reference< css::beans::XPropertySet > xPropertySet, SfxItemPool &rItemPool) | |
Construct an item converter that uses the given property set for reading/writing converted items. More... | |
virtual | ~ItemConverter () override |
virtual void | FillItemSet (SfxItemSet &rOutItemSet) const |
applies all properties that can be mapped to items into the given item set. More... | |
virtual bool | ApplyItemSet (const SfxItemSet &rItemSet) |
applies all properties that are results of a conversion from all items in rItemSet to the internal XPropertySet. More... | |
SfxItemSet | CreateEmptyItemSet () const |
creates an empty item set using the given pool or a common pool if empty (see GetItemPool) and allowing all items given in the ranges returned by GetWhichPairs. More... | |
Static Public Member Functions | |
static void | InvalidateUnequalItems (SfxItemSet &rDestSet, const SfxItemSet &rSourceSet) |
Invalidates all items in rDestSet, that are set (state SfxItemState::SET) in both item sets (rDestSet and rSourceSet) and have differing content. More... | |
Protected Member Functions | |
virtual const WhichRangesContainer & | GetWhichPairs () const =0 |
implement this method to provide an array of which-ranges More... | |
virtual bool | GetItemProperty (tWhichIdType nWhichId, tPropertyNameWithMemberId &rOutProperty) const =0 |
implement this method to return a Property object for a given which id. More... | |
virtual void | FillSpecialItem (sal_uInt16 nWhichId, SfxItemSet &rOutItemSet) const |
for items that can not be mapped directly to a property. More... | |
virtual bool | ApplySpecialItem (sal_uInt16 nWhichId, const SfxItemSet &rItemSet) |
for items that can not be mapped directly to a property. More... | |
SfxItemPool & | GetItemPool () const |
Returns the pool. More... | |
const css::uno::Reference< css::beans::XPropertySet > & | GetPropertySet () const |
Returns the XPropertySet that was given in the CTOR and is used to apply items in ApplyItemSet(). More... | |
virtual void | _disposing (const css::lang::EventObject &rSource) override |
void | resetPropertySet (const css::uno::Reference< css::beans::XPropertySet > &xPropSet) |
sets a new property set, that you get with GetPropertySet(). More... | |
Protected Member Functions inherited from utl::OEventListenerAdapter | |
OEventListenerAdapter () | |
virtual | ~OEventListenerAdapter () |
void | startComponentListening (const css::uno::Reference< css::lang::XComponent > &_rxComp) |
void | stopComponentListening (const css::uno::Reference< css::lang::XComponent > &_rxComp) |
void | stopAllComponentListening () |
virtual void | _disposing (const css::lang::EventObject &_rSource)=0 |
Private Attributes | |
css::uno::Reference< css::beans::XPropertySet > | m_xPropertySet |
css::uno::Reference< css::beans::XPropertySetInfo > | m_xPropertySetInfo |
SfxItemPool & | m_rItemPool |
This class serves for conversion between properties of an XPropertySet and SfxItems in SfxItemSets.
With this helper classes, you can feed dialogs with XPropertySets and let those modify by the dialogs.
You must implement GetWhichPairs() such that an SfxItemSet created with CreateEmptyItemSet() is able to hold all items that may be mapped.
You also have to implement GetItemProperty(), in order to return the property name for a given which-id together with the corresponding member-id that has to be used for conversion in QueryValue/PutValue.
FillSpecialItem and ApplySpecialItem may be used for special handling of individual item, e.g. if you need member-ids in QueryValue/PutValue
A typical use could be the following:
::comphelper::ChartTypeItemConverter aItemConverter( xPropertySet, GetItemPool() ); SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet(); aItemConverter.FillItemSet( aItemSet ); bool bChanged = false;
MyDialog aDlg( aItemSet ); if( aDlg.Execute() == RET_OK ) { const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet(); if( pOutItemSet ) bChanged = aItemConverter.ApplyItemSet( *pOutItemSet ); }
if( bChanged ) { [ apply model changes to view ] }
Definition at line 68 of file ItemConverter.hxx.
Definition at line 82 of file ItemConverter.hxx.
typedef OUString chart::wrapper::ItemConverter::tPropertyNameType |
Definition at line 81 of file ItemConverter.hxx.
typedef std::pair< tPropertyNameType, tMemberIdType > chart::wrapper::ItemConverter::tPropertyNameWithMemberId |
Definition at line 84 of file ItemConverter.hxx.
typedef sal_uInt16 chart::wrapper::ItemConverter::tWhichIdType |
Definition at line 80 of file ItemConverter.hxx.
chart::wrapper::ItemConverter::ItemConverter | ( | css::uno::Reference< css::beans::XPropertySet > | xPropertySet, |
SfxItemPool & | rItemPool | ||
) |
Construct an item converter that uses the given property set for reading/writing converted items.
Definition at line 36 of file ItemConverter.cxx.
References m_xPropertySet, and resetPropertySet().
|
overridevirtual |
Definition at line 45 of file ItemConverter.cxx.
References utl::OEventListenerAdapter::stopAllComponentListening().
|
overrideprotectedvirtual |
Implements utl::OEventListenerAdapter.
Definition at line 73 of file ItemConverter.cxx.
|
virtual |
applies all properties that are results of a conversion from all items in rItemSet to the internal XPropertySet.
Call this method after a dialog was closed with OK
Reimplemented in chart::wrapper::AxisItemConverter, chart::wrapper::DataPointItemConverter, chart::wrapper::DataTableItemConverter, chart::wrapper::ErrorBarItemConverter, chart::wrapper::LegendItemConverter, chart::wrapper::MultipleItemConverter, chart::wrapper::RegressionCurveItemConverter, chart::wrapper::RegressionEquationItemConverter, chart::wrapper::TextLabelItemConverter, and chart::wrapper::TitleItemConverter.
Definition at line 150 of file ItemConverter.cxx.
References ApplySpecialItem(), SfxItemIter::GetCurItem(), GetItemProperty(), SfxItemIter::GetItemState(), m_xPropertySet, SfxItemIter::NextItem(), and TOOLS_WARN_EXCEPTION.
Referenced by chart::wrapper::AxisItemConverter::ApplyItemSet(), chart::wrapper::DataPointItemConverter::ApplyItemSet(), chart::wrapper::DataTableItemConverter::ApplyItemSet(), chart::wrapper::ErrorBarItemConverter::ApplyItemSet(), chart::wrapper::LegendItemConverter::ApplyItemSet(), chart::wrapper::RegressionCurveItemConverter::ApplyItemSet(), chart::wrapper::RegressionEquationItemConverter::ApplyItemSet(), chart::wrapper::TextLabelItemConverter::ApplyItemSet(), and chart::wrapper::TitleItemConverter::ApplyItemSet().
|
protectedvirtual |
for items that can not be mapped directly to a property.
This method is called from ApplyItemSet(), if GetItemProperty() returns false.
The default implementation returns just false and shows an assertion
css::uno::Exception |
Reimplemented in chart::wrapper::AxisItemConverter, chart::wrapper::CharacterPropertyItemConverter, chart::wrapper::DataPointItemConverter, chart::wrapper::ErrorBarItemConverter, chart::wrapper::GraphicPropertyItemConverter, chart::wrapper::LegendItemConverter, chart::wrapper::RegressionCurveItemConverter, chart::wrapper::RegressionEquationItemConverter, chart::wrapper::SeriesOptionsItemConverter, chart::wrapper::StatisticsItemConverter, chart::wrapper::TextLabelItemConverter, and chart::wrapper::TitleItemConverter.
Definition at line 143 of file ItemConverter.cxx.
Referenced by ApplyItemSet().
SfxItemSet chart::wrapper::ItemConverter::CreateEmptyItemSet | ( | ) | const |
creates an empty item set using the given pool or a common pool if empty (see GetItemPool) and allowing all items given in the ranges returned by GetWhichPairs.
Definition at line 68 of file ItemConverter.cxx.
References GetItemPool(), and GetWhichPairs().
Referenced by chart::ChartController::executeDispatch_InsertErrorBars(), chart::ChartController::executeDispatch_InsertMenu_DataLabels(), chart::ChartController::executeDispatch_InsertTrendline(), chart::ChartController::executeDlg_ObjectProperties_withoutUndoGuard(), and chart::wrapper::MultipleItemConverter::FillItemSet().
|
virtual |
applies all properties that can be mapped to items into the given item set.
Call this method before opening a dialog.
rOutItemSet | the SfxItemSet is filled with all items that are a result of a conversion from a property of the internal XPropertySet. |
Reimplemented in chart::wrapper::AxisItemConverter, chart::wrapper::DataPointItemConverter, chart::wrapper::DataTableItemConverter, chart::wrapper::ErrorBarItemConverter, chart::wrapper::LegendItemConverter, chart::wrapper::MultipleItemConverter, chart::wrapper::RegressionCurveItemConverter, chart::wrapper::RegressionEquationItemConverter, chart::wrapper::TextLabelItemConverter, and chart::wrapper::TitleItemConverter.
Definition at line 77 of file ItemConverter.cxx.
References SfxPoolItem::Clone(), DBG_UNHANDLED_EXCEPTION, WhichRangesContainer::empty(), FillSpecialItem(), SfxItemPool::GetDefaultItem(), GetItemPool(), GetItemProperty(), SfxItemSet::GetRanges(), m_xPropertySet, m_xPropertySetInfo, SfxItemSet::Put(), and TOOLS_WARN_EXCEPTION.
Referenced by chart::wrapper::AxisItemConverter::FillItemSet(), chart::wrapper::DataPointItemConverter::FillItemSet(), chart::wrapper::DataTableItemConverter::FillItemSet(), chart::wrapper::ErrorBarItemConverter::FillItemSet(), chart::wrapper::LegendItemConverter::FillItemSet(), chart::wrapper::RegressionCurveItemConverter::FillItemSet(), chart::wrapper::RegressionEquationItemConverter::FillItemSet(), chart::wrapper::TextLabelItemConverter::FillItemSet(), and chart::wrapper::TitleItemConverter::FillItemSet().
|
protectedvirtual |
for items that can not be mapped directly to a property.
This method is called from FillItemSet(), if GetItemProperty() returns false.
The default implementation does nothing except showing an assertion
css::uno::Exception |
Reimplemented in chart::wrapper::AxisItemConverter, chart::wrapper::CharacterPropertyItemConverter, chart::wrapper::DataPointItemConverter, chart::wrapper::ErrorBarItemConverter, chart::wrapper::GraphicPropertyItemConverter, chart::wrapper::LegendItemConverter, chart::wrapper::RegressionCurveItemConverter, chart::wrapper::RegressionEquationItemConverter, chart::wrapper::SeriesOptionsItemConverter, chart::wrapper::StatisticsItemConverter, chart::wrapper::TextLabelItemConverter, and chart::wrapper::TitleItemConverter.
Definition at line 137 of file ItemConverter.cxx.
Referenced by FillItemSet().
|
inlineprotected |
Returns the pool.
Definition at line 158 of file ItemConverter.hxx.
References m_rItemPool.
Referenced by CreateEmptyItemSet(), and FillItemSet().
|
protectedpure virtual |
implement this method to return a Property object for a given which id.
rOutProperty | If true is returned, this contains the property name and the corresponding Member-Id. |
Implemented in chart::wrapper::AxisItemConverter, chart::wrapper::CharacterPropertyItemConverter, chart::wrapper::DataPointItemConverter, chart::wrapper::DataTableItemConverter, chart::wrapper::ErrorBarItemConverter, chart::wrapper::GraphicPropertyItemConverter, chart::wrapper::LegendItemConverter, chart::wrapper::MultipleItemConverter, chart::wrapper::RegressionCurveItemConverter, chart::wrapper::RegressionEquationItemConverter, chart::wrapper::SeriesOptionsItemConverter, chart::wrapper::StatisticsItemConverter, chart::wrapper::TextLabelItemConverter, and chart::wrapper::TitleItemConverter.
Referenced by ApplyItemSet(), and FillItemSet().
|
inlineprotected |
Returns the XPropertySet that was given in the CTOR and is used to apply items in ApplyItemSet().
Definition at line 163 of file ItemConverter.hxx.
References m_xPropertySet.
Referenced by chart::wrapper::AxisItemConverter::ApplySpecialItem(), chart::wrapper::DataPointItemConverter::ApplySpecialItem(), chart::wrapper::ErrorBarItemConverter::ApplySpecialItem(), chart::wrapper::GraphicPropertyItemConverter::ApplySpecialItem(), chart::wrapper::LegendItemConverter::ApplySpecialItem(), chart::wrapper::RegressionCurveItemConverter::ApplySpecialItem(), chart::wrapper::RegressionEquationItemConverter::ApplySpecialItem(), chart::wrapper::SeriesOptionsItemConverter::ApplySpecialItem(), chart::wrapper::StatisticsItemConverter::ApplySpecialItem(), chart::wrapper::TextLabelItemConverter::ApplySpecialItem(), chart::wrapper::TitleItemConverter::ApplySpecialItem(), chart::wrapper::AxisItemConverter::FillSpecialItem(), chart::wrapper::DataPointItemConverter::FillSpecialItem(), chart::wrapper::ErrorBarItemConverter::FillSpecialItem(), chart::wrapper::GraphicPropertyItemConverter::FillSpecialItem(), chart::wrapper::LegendItemConverter::FillSpecialItem(), chart::wrapper::RegressionCurveItemConverter::FillSpecialItem(), chart::wrapper::RegressionEquationItemConverter::FillSpecialItem(), chart::wrapper::StatisticsItemConverter::FillSpecialItem(), chart::wrapper::TextLabelItemConverter::FillSpecialItem(), and chart::wrapper::TitleItemConverter::FillSpecialItem().
|
protectedpure virtual |
implement this method to provide an array of which-ranges
Implemented in chart::wrapper::AxisItemConverter, chart::wrapper::CharacterPropertyItemConverter, chart::wrapper::DataPointItemConverter, chart::wrapper::DataTableItemConverter, chart::wrapper::ErrorBarItemConverter, chart::wrapper::GraphicPropertyItemConverter, chart::wrapper::LegendItemConverter, chart::wrapper::AllAxisItemConverter, chart::wrapper::AllGridItemConverter, chart::wrapper::AllDataLabelItemConverter, chart::wrapper::AllTitleItemConverter, chart::wrapper::AllSeriesStatisticsConverter, chart::wrapper::RegressionCurveItemConverter, chart::wrapper::RegressionEquationItemConverter, chart::wrapper::SeriesOptionsItemConverter, chart::wrapper::StatisticsItemConverter, chart::wrapper::TextLabelItemConverter, and chart::wrapper::TitleItemConverter.
Referenced by CreateEmptyItemSet().
|
static |
Invalidates all items in rDestSet, that are set (state SfxItemState::SET) in both item sets (rDestSet and rSourceSet) and have differing content.
Definition at line 194 of file ItemConverter.cxx.
References SfxWhichIter::FirstWhich(), SfxItemSet::Get(), SfxWhichIter::GetItemState(), SfxItemSet::GetItemState(), SfxItemSet::InvalidateItem(), and SfxWhichIter::NextWhich().
Referenced by chart::wrapper::MultipleItemConverter::FillItemSet().
|
protected |
sets a new property set, that you get with GetPropertySet().
It should not be necessary to use this method. It is introduced to allow changing the regression type of a regression curve which changes the object identity.
Definition at line 50 of file ItemConverter.cxx.
References m_xPropertySet, m_xPropertySetInfo, utl::OEventListenerAdapter::startComponentListening(), and utl::OEventListenerAdapter::stopAllComponentListening().
Referenced by chart::wrapper::RegressionCurveItemConverter::ApplySpecialItem(), chart::wrapper::StatisticsItemConverter::ApplySpecialItem(), and ItemConverter().
|
private |
Definition at line 180 of file ItemConverter.hxx.
Referenced by GetItemPool().
|
private |
Definition at line 177 of file ItemConverter.hxx.
Referenced by ApplyItemSet(), FillItemSet(), GetPropertySet(), ItemConverter(), and resetPropertySet().
|
private |
Definition at line 178 of file ItemConverter.hxx.
Referenced by FillItemSet(), and resetPropertySet().