summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-01-02 02:32:25 +0100
committerJan Holesovsky <kendy@collabora.com>2015-01-04 02:15:04 +0100
commit5f363ce8bc563f64271744026cf0e16830cf9b06 (patch)
tree33518d7f5fb100cab0cfbc2c4d72a801d8862e9b /svx
parent39ac529d141dcd4de534eddbcc6c07bc49367b90 (diff)
changes sidebar: Use images instead of texts for types of changes in Writer.
This is a Writer-only change because: 1) Calc does not have the changes sidebar yet. 2) The redlines in Calc have more complex descriptions (like 'Deleted column'), so postponing that for now until I have a good list of the possible values there so that I can ask for the icons. Change-Id: I2d9860261d0b690012c3c11cdd97a140f48842bf
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/ctredlin.cxx61
1 files changed, 36 insertions, 25 deletions
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index a6165b58a71b..57fd00e0912f 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -321,23 +321,35 @@ bool SvxRedlinTable::IsValidComment(const OUString &rCommentStr)
return pCommentSearcher->SearchForward( rCommentStr, &nStartPos, &nEndPos);
}
-SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,RedlinData *pUserData,
- SvTreeListEntry* pParent,sal_uIntPtr nPos)
+SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,
+ RedlinData *pUserData, SvTreeListEntry* pParent, sal_uIntPtr nPos)
{
const Color aColor = (pUserData && pUserData->bDisabled) ? Color(COL_GRAY) : GetTextColor();
+
return InsertEntry(rStr, pUserData, aColor, pParent, nPos);
}
-SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,RedlinData *pUserData,const Color& aColor,
- SvTreeListEntry* pParent,sal_uIntPtr nPos)
+SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,
+ RedlinData *pUserData, const Color& rColor, SvTreeListEntry* pParent, sal_uIntPtr nPos)
{
- aEntryColor=aColor;
+ maEntryColor = rColor;
+ maEntryImage = Image();
sal_Int32 nIndex = 0;
- const OUString aFirstStr( rStr.getToken(0, '\t', nIndex ) );
- aCurEntry = nIndex>0 ? rStr.copy(nIndex) : OUString();
+ const OUString aFirstStr(rStr.getToken(0, '\t', nIndex));
+ maEntryString = nIndex > 0 ? rStr.copy(nIndex) : OUString();
+
+ return SvSimpleTable::InsertEntry(aFirstStr, pParent, false, nPos, pUserData);
+}
+
+SvTreeListEntry* SvxRedlinTable::InsertEntry(const Image &rRedlineType, const OUString& rStr,
+ RedlinData *pUserData, SvTreeListEntry* pParent, sal_uIntPtr nPos)
+{
+ maEntryColor = (pUserData && pUserData->bDisabled) ? Color(COL_GRAY) : GetTextColor();
+ maEntryImage = rRedlineType;
+ maEntryString = rStr;
- return SvSimpleTable::InsertEntry( aFirstStr, pParent, false, nPos, pUserData );
+ return SvSimpleTable::InsertEntry(OUString(), pParent, false, nPos, pUserData);
}
SvTreeListEntry* SvxRedlinTable::CreateEntry() const
@@ -346,31 +358,30 @@ SvTreeListEntry* SvxRedlinTable::CreateEntry() const
}
void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr,
- const Image& rColl, const Image& rExp, SvLBoxButtonKind eButtonKind)
+ const Image& rColl, const Image& rExp, SvLBoxButtonKind eButtonKind)
{
- SvLBoxString* pString;
- SvLBoxContextBmp* pContextBmp;
-
- if( nTreeFlags & TREEFLAG_CHKBTN )
+ if (nTreeFlags & TREEFLAG_CHKBTN)
{
- SvLBoxButton* pButton= new SvLBoxButton( pEntry,eButtonKind,0,pCheckButtonData );
- pEntry->AddItem( pButton );
+ pEntry->AddItem(new SvLBoxButton(pEntry, eButtonKind, 0, pCheckButtonData));
}
- pContextBmp= new SvLBoxContextBmp(pEntry,0, rColl,rExp, true);
- pEntry->AddItem( pContextBmp );
+ pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, rColl, rExp, true));
- pString = new SvLBoxColorString( pEntry, 0, rStr ,aEntryColor);
- pEntry->AddItem( pString );
+ // the type of the change
+ assert((rStr.isEmpty() && !!maEntryImage) || (!rStr.isEmpty() && !maEntryImage));
+
+ if (rStr.isEmpty())
+ pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, maEntryImage, maEntryImage, true));
+ else
+ pEntry->AddItem(new SvLBoxColorString(pEntry, 0, rStr, maEntryColor));
+ // the change tracking entries
sal_Int32 nIndex = 0;
- // TODO: verify if TabCount() is always >0 here!
- const sal_uInt16 nCount = TabCount()-1;
- for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ )
+ const sal_uInt16 nCount = TabCount() - 1;
+ for (sal_uInt16 nToken = 0; nToken < nCount; nToken++)
{
- const OUString aToken = GetToken(aCurEntry, nIndex);
- SvLBoxColorString* pStr = new SvLBoxColorString( pEntry, 0, aToken, aEntryColor);
- pEntry->AddItem( pStr );
+ const OUString aToken = GetToken(maEntryString, nIndex);
+ pEntry->AddItem(new SvLBoxColorString(pEntry, 0, aToken, maEntryColor));
}
}