[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - include/item include/svl include/svx sc/inc sc/source svl/source svx/source sw/inc sw/source
Armin Le Grand (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 3 16:30:30 UTC 2019
include/item/base/ItemBase.hxx | 55 ++++++++++++++++++++++++++++++++++++
include/svl/itempool.hxx | 2 -
include/svx/svdpool.hxx | 2 -
sc/inc/docpool.hxx | 2 -
sc/source/core/data/docpool.cxx | 2 -
svl/source/items/itempool.cxx | 2 -
svl/source/items/style.cxx | 2 -
svx/source/dialog/srchdlg.cxx | 2 -
svx/source/svdraw/svdattr.cxx | 4 +-
sw/inc/format.hxx | 4 +-
sw/inc/swatrset.hxx | 2 -
sw/source/core/crsr/crstrvl.cxx | 2 -
sw/source/uibase/app/docstyle.cxx | 4 +-
sw/source/uibase/utlui/attrdesc.cxx | 4 +-
14 files changed, 72 insertions(+), 17 deletions(-)
New commits:
commit 203d0f02f5bbe89ed4c30c3addcd1a212e3c1787
Author: Armin Le Grand <Armin.Le.Grand at me.com>
AuthorDate: Mon Jun 3 18:28:14 2019 +0200
Commit: Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Mon Jun 3 18:28:14 2019 +0200
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
diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx
index d099bb4a93ea..ee465ad7f0f9 100644
--- a/include/item/base/ItemBase.hxx
+++ b/include/item/base/ItemBase.hxx
@@ -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;
};
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
index 6a455788c273..b8e641354cf0 100644
--- a/include/svl/itempool.hxx
+++ b/include/svl/itempool.hxx
@@ -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;
diff --git a/include/svx/svdpool.hxx b/include/svx/svdpool.hxx
index da8c241831d9..696ed143cfaa 100644
--- a/include/svx/svdpool.hxx
+++ b/include/svx/svdpool.hxx
@@ -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;
diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx
index 0b91a5494526..564ac9c5f228 100644
--- a/sc/inc/docpool.hxx
+++ b/sc/inc/docpool.hxx
@@ -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;
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index 74f60996cb5b..017613df6e25 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -476,7 +476,7 @@ static bool lcl_HFPresentation
return true;
}
-bool ScDocumentPool::GetPresentation(
+bool ScDocumentPool::ItemPoolGetPresentation(
const SfxPoolItem& rItem,
MapUnit ePresentationMetric,
OUString& rText,
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 6c3e43daef80..2ba0f5f5b106 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -456,7 +456,7 @@ const OUString& SfxItemPool::GetName() const
}
-bool SfxItemPool::GetPresentation
+bool SfxItemPool::ItemPoolGetPresentation
(
const SfxPoolItem& rItem,
MapUnit eMetric,
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index a563e5a00cbf..ff5dae8a5600 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -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() )
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index a0af88237f15..f92b3e2b14f2 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -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 )
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 5223c72e6889..9902767920b1 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -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)
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 849b14d8b688..e8b20ced4686 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -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; }
diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx
index 48cc2d6f0e20..34426d4a6269 100644
--- a/sw/inc/swatrset.hxx
+++ b/sw/inc/swatrset.hxx
@@ -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()); }
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index a593db4de4bd..9757fc7d3d2c 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -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(", ");
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index cc1b8121faca..b1bdd5a0b6ee 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -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;
diff --git a/sw/source/uibase/utlui/attrdesc.cxx b/sw/source/uibase/utlui/attrdesc.cxx
index e69c13419bf0..88c4dbcd1f91 100644
--- a/sw/source/uibase/utlui/attrdesc.cxx
+++ b/sw/source/uibase/utlui/attrdesc.cxx
@@ -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
More information about the Libreoffice-commits
mailing list