Kaydet (Commit) 203d0f02 authored tarafından Armin Le Grand's avatar Armin Le Grand

WIP: Discussion methods at ItemBase

Isloated quite some funcs in code to deep-dive
functionality, commented quite some how to refactor
these.

Change-Id: Ie8808de6bc096449186af86d8a578269911890c1
üst d349e2f8
......@@ -129,10 +129,63 @@ namespace Item
// clone-op, secured by returning a std::unique_ptr to make
// explicit the ownership you get when calling this
// -> no longer virtual, no impls at the Items, one central method
std::unique_ptr<ItemBase> clone() const;
// ca. 220 impls
// /** @return true if it has a valid string representation */
//
// Notes:
// used as 'GetPresentation' in old environment, at least in three
// incarnations:
// - virtual SfxPoolItem::GetPresentation inm all Items implementing this
// -> needs to be taken over for all transformend items (of course)
// - virtual SfxItemPool::GetPresentation in two forms: -> ItemPoolGetPresentation
// SfxItemPool::GetPresentation:
// Base impl just adds metric using GetMetric(rItem.Which())
// thus usually from SfxItemPool, except that Items in Calc (see
// other comments about metrics)
// -> replace using metic from ModelSpecificItemValues directly
// -> for the mentioned Items in Calc: use fixed metric in the
// items GetPresentation implementation
// ScDocumentPool::GetPresentation
// Fallback to base impl, except for Items which use
// case ATTR_PAGE_TOPDOWN:
// case ATTR_PAGE_HEADERS:
// case ATTR_PAGE_NULLVALS:
// case ATTR_PAGE_FORMULAS:
// case ATTR_PAGE_NOTES:
// case ATTR_PAGE_GRID:
// case ATTR_PAGE_SCALETOPAGES:
// case ATTR_PAGE_FIRSTPAGENO:
// case ATTR_PAGE_SCALE:
// case ATTR_PAGE_HEADERSET:
// case ATTR_PAGE_FOOTERSET:
// -> adapt thse Items GetPresentation impl as needed, we
// will have one ItemType (derivation) per ID in the future
// -> also uses helper lcl_HFPresentation that iterates over ItemSet of
// SetItem to create a combined string using SfxItemIter for the
// WhichIDs
// ATTR_PAGE_ON:
// ATTR_PAGE_DYNAMIC:
// ATTR_PAGE_SHARED:
// ATTR_LRSPACE:
// So need to adapt GetPresentation for the new Items which will
// be used for this
// SdrItemPool::GetPresentation
// Uses fallback to rItem.GetPresentation, but adds 'TakeItemName'
// in front of the result. See SdrItemPool::TakeItemName which uses
// ResIDs to get the ItemNames. All that for Items in the WhichID ragnes of
// (nWhich>=SDRATTR_SHADOW_FIRST && nWhich<=SDRATTR_END)
// -> for Items SDRATTR_SHADOW_FIRST..SDRATTR_END use the WhichIDs from that
// ressoures as ItemName (already prepared for new Items) and
// add that in front of usual result in GetPresentation impl of those Items
// - SwAttrSet::GetPresentation -> AttrSetGetPresentation
// non-virtual, local helper at SwAttrSet
// uses SfxItemIter to create a combined presentation
// -> extend to include new items from itemSet()
// - SwFormat::GetPresentation -> SwFormatGetPresentation
// simple forwarder to SwAttrSet::GetPresentation
virtual bool getPresentation(
SfxItemPresentation ePresentation,
MapUnit eCoreMetric,
......@@ -143,6 +196,7 @@ namespace Item
// ::ScaleMetrics 18 implementations
// used by sdr::properties::ScaleItemSet / itemSetTools only
// used by DefaultProperties::DefaultProperties only -> probably copying SdrObjects between Writer/Draw/Impress
// -> adapt where used to also use new Items, access over temp solution of itemSet()
virtual void scaleMetrics(long lMult, long lDiv);
// around 250 impls for each
......@@ -151,6 +205,7 @@ namespace Item
// -> 'virtual bool putAnyValue(const css::uno::Any& rVal, sal_uInt8 nMemberId);'
// ca. 150 impls
// -> needs to be taken over for all transformend items (of course)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
};
......
......@@ -143,7 +143,7 @@ public:
@return true if it has a valid string representation
*/
virtual bool GetPresentation( const SfxPoolItem& rItem,
virtual bool ItemPoolGetPresentation( const SfxPoolItem& rItem,
MapUnit ePresentationMetric,
OUString& rText,
const IntlWrapper& rIntlWrapper ) const;
......
......@@ -38,7 +38,7 @@ protected:
public:
virtual SfxItemPool* Clone() const override;
virtual bool GetPresentation(const SfxPoolItem& rItem,
virtual bool ItemPoolGetPresentation(const SfxPoolItem& rItem,
MapUnit ePresentationMetric,
OUString& rText,
const IntlWrapper& rIntlWrapper) const override;
......
......@@ -43,7 +43,7 @@ public:
void StyleDeleted( const ScStyleSheet* pStyle ); // delete templates(?) in organizer
void CellStyleCreated( const OUString& rName, const ScDocument* pDoc );
virtual bool GetPresentation( const SfxPoolItem& rItem,
virtual bool ItemPoolGetPresentation( const SfxPoolItem& rItem,
MapUnit ePresentationMetric,
OUString& rText,
const IntlWrapper& rIntl ) const override;
......
......@@ -476,7 +476,7 @@ static bool lcl_HFPresentation
return true;
}
bool ScDocumentPool::GetPresentation(
bool ScDocumentPool::ItemPoolGetPresentation(
const SfxPoolItem& rItem,
MapUnit ePresentationMetric,
OUString& rText,
......
......@@ -456,7 +456,7 @@ const OUString& SfxItemPool::GetName() const
}
bool SfxItemPool::GetPresentation
bool SfxItemPool::ItemPoolGetPresentation
(
const SfxPoolItem& rItem,
MapUnit eMetric,
......
......@@ -337,7 +337,7 @@ OUString SfxStyleSheetBase::GetDescription( MapUnit eMetric )
OUString aItemPresentation;
if ( !IsInvalidItem( pItem ) &&
m_pPool->GetPool().GetPresentation(
m_pPool->GetPool().ItemPoolGetPresentation(
*pItem, eMetric, aItemPresentation, aIntlWrapper ) )
{
if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
......
......@@ -2123,7 +2123,7 @@ OUString& SvxSearchDialog::BuildAttrText_Impl( OUString& rStr,
if ( !IsInvalidItem( rItem.pItem ) )
{
OUString aStr;
rPool.GetPresentation(*rItem.pItem, eMapUnit, aStr, aIntlWrapper);
rPool.ItemPoolGetPresentation(*rItem.pItem, eMapUnit, aStr, aIntlWrapper);
rStr += aStr;
}
else if ( rItem.nSlot == SID_ATTR_BRUSH_CHAR )
......
......@@ -356,7 +356,7 @@ SdrItemPool::~SdrItemPool()
SetSecondaryPool(nullptr);
}
bool SdrItemPool::GetPresentation(
bool SdrItemPool::ItemPoolGetPresentation(
const SfxPoolItem& rItem,
MapUnit ePresentationMetric, OUString& rText,
const IntlWrapper& rIntlWrapper) const
......@@ -375,7 +375,7 @@ bool SdrItemPool::GetPresentation(
return true;
}
}
return XOutdevItemPool::GetPresentation(rItem,ePresentationMetric,rText,rIntlWrapper);
return XOutdevItemPool::ItemPoolGetPresentation(rItem,ePresentationMetric,rText,rIntlWrapper);
}
void SdrItemPool::TakeItemName(sal_uInt16 nWhich, OUString& rItemName)
......
......@@ -150,9 +150,9 @@ public:
void SetPoolHlpFileId( sal_uInt8 nId ) { m_nPoolHlpFileId = nId; }
/// Get attribute-description. Returns passed string.
void GetPresentation( SfxItemPresentation ePres,
void SwFormatGetPresentation( SfxItemPresentation ePres,
MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText ) const
{ m_aSet.GetPresentation( ePres, eCoreMetric, ePresMetric, rText ); }
{ m_aSet.AttrSetGetPresentation( ePres, eCoreMetric, ePresMetric, rText ); }
/// Query / set AutoFormat-flag.
bool IsAuto() const { return m_bAutoFormat; }
......
......@@ -184,7 +184,7 @@ public:
int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
void GetPresentation( SfxItemPresentation ePres,
void AttrSetGetPresentation( SfxItemPresentation ePres,
MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText ) const;
SwAttrPool* GetPool() const { return static_cast<SwAttrPool*>(SfxItemSet::GetPool()); }
......
......@@ -1811,7 +1811,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
if( !IsInvalidItem( pItem ))
{
OUString aStr;
GetDoc()->GetAttrPool().GetPresentation(*pItem,
GetDoc()->GetAttrPool().ItemPoolGetPresentation(*pItem,
MapUnit::MapCM, aStr, aInt);
if (!sAttrs.isEmpty())
sAttrs.append(", ");
......
......@@ -848,7 +848,7 @@ OUString SwDocStyleSheet::GetDescription(MapUnit eUnit)
{
OUString aItemPresentation;
if ( !IsInvalidItem( pItem ) &&
m_pPool->GetPool().GetPresentation(
m_pPool->GetPool().ItemPoolGetPresentation(
*pItem, eUnit, aItemPresentation, aIntlWrapper ) )
{
if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
......@@ -896,7 +896,7 @@ OUString SwDocStyleSheet::GetDescription(MapUnit eUnit)
{
OUString aItemPresentation;
if ( !IsInvalidItem( pItem ) &&
m_pPool->GetPool().GetPresentation(
m_pPool->GetPool().ItemPoolGetPresentation(
*pItem, eUnit, aItemPresentation, aIntlWrapper ) )
{
bool bIsDefault = false;
......
......@@ -62,7 +62,7 @@ using namespace com::sun::star;
// query the attribute descriptions
void SwAttrSet::GetPresentation(
void SwAttrSet::AttrSetGetPresentation(
SfxItemPresentation ePres,
MapUnit eCoreMetric,
MapUnit ePresMetric,
......@@ -103,7 +103,7 @@ bool SwFormatCharFormat::GetPresentation
{
OUString aStr;
rText = SwResId( STR_CHARFMT );
pCharFormat->GetPresentation( ePres, eCoreUnit, ePresUnit, aStr );
pCharFormat->SwFormatGetPresentation( ePres, eCoreUnit, ePresUnit, aStr );
rText = rText + "(" + aStr + ")";
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment