Kaydet (Commit) 5f363ce8 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

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
üst 39ac529d
...@@ -98,8 +98,9 @@ private: ...@@ -98,8 +98,9 @@ private:
DateTime aDaTiFilterFirst; DateTime aDaTiFilterFirst;
DateTime aDaTiFilterLast; DateTime aDaTiFilterLast;
OUString aAuthor; OUString aAuthor;
Color aEntryColor; Color maEntryColor;
OUString aCurEntry; Image maEntryImage;
OUString maEntryString;
utl::TextSearch* pCommentSearcher; utl::TextSearch* pCommentSearcher;
Link aColCompareLink; Link aColCompareLink;
...@@ -136,19 +137,32 @@ public: ...@@ -136,19 +137,32 @@ public:
bool IsValidEntry(const OUString &rAuthor, const DateTime &rDateTime); bool IsValidEntry(const OUString &rAuthor, const DateTime &rDateTime);
bool IsValidComment(const OUString &rComment); bool IsValidComment(const OUString &rComment);
SvTreeListEntry* InsertEntry(const OUString& ,RedlinData *pUserData, /** Insert a redline entry.
SvTreeListEntry* pParent=NULL,sal_uIntPtr nPos=TREELIST_APPEND);
SvTreeListEntry* InsertEntry(const OUString& ,RedlinData *pUserData,const Color&, The rStr contains the entire redline entry; the columns are delimited by '\t'.
SvTreeListEntry* pParent=NULL,sal_uIntPtr nPos=TREELIST_APPEND); */
SvTreeListEntry* InsertEntry(const OUString &rStr, RedlinData *pUserData,
SvTreeListEntry* pParent = NULL, sal_uIntPtr nPos = TREELIST_APPEND);
/** Insert a redline entry.
The rStr contains the entire redline entry; the columns are delimited by '\t'.
*/
SvTreeListEntry* InsertEntry(const OUString &rStr, RedlinData *pUserData, const Color&,
SvTreeListEntry* pParent = NULL, sal_uIntPtr nPos = TREELIST_APPEND);
/** Insert a redline entry.
rRedlineType contains the image for this redline entry (plus for insertion, minus for deletion etc.).
rStr contains the rest of the redline entry; the columns are delimited by '\t'.
*/
SvTreeListEntry* InsertEntry(const Image &rRedlineType, const OUString &rStr, RedlinData *pUserData,
SvTreeListEntry* pParent = NULL, sal_uIntPtr nPos = TREELIST_APPEND);
virtual SvTreeListEntry* CreateEntry() const SAL_OVERRIDE; virtual SvTreeListEntry* CreateEntry() const SAL_OVERRIDE;
void SetColCompareHdl(const Link& rLink ) { aColCompareLink = rLink; } void SetColCompareHdl(const Link& rLink ) { aColCompareLink = rLink; }
const Link& GetColCompareHdl() const { return aColCompareLink; } const Link& GetColCompareHdl() const { return aColCompareLink; }
}; };
......
...@@ -321,23 +321,35 @@ bool SvxRedlinTable::IsValidComment(const OUString &rCommentStr) ...@@ -321,23 +321,35 @@ bool SvxRedlinTable::IsValidComment(const OUString &rCommentStr)
return pCommentSearcher->SearchForward( rCommentStr, &nStartPos, &nEndPos); return pCommentSearcher->SearchForward( rCommentStr, &nStartPos, &nEndPos);
} }
SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,RedlinData *pUserData, SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,
SvTreeListEntry* pParent,sal_uIntPtr nPos) RedlinData *pUserData, SvTreeListEntry* pParent, sal_uIntPtr nPos)
{ {
const Color aColor = (pUserData && pUserData->bDisabled) ? Color(COL_GRAY) : GetTextColor(); const Color aColor = (pUserData && pUserData->bDisabled) ? Color(COL_GRAY) : GetTextColor();
return InsertEntry(rStr, pUserData, aColor, pParent, nPos); return InsertEntry(rStr, pUserData, aColor, pParent, nPos);
} }
SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,RedlinData *pUserData,const Color& aColor, SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,
SvTreeListEntry* pParent,sal_uIntPtr nPos) RedlinData *pUserData, const Color& rColor, SvTreeListEntry* pParent, sal_uIntPtr nPos)
{ {
aEntryColor=aColor; maEntryColor = rColor;
maEntryImage = Image();
sal_Int32 nIndex = 0; sal_Int32 nIndex = 0;
const OUString aFirstStr( rStr.getToken(0, '\t', nIndex ) ); const OUString aFirstStr(rStr.getToken(0, '\t', nIndex));
aCurEntry = nIndex>0 ? rStr.copy(nIndex) : OUString(); 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 SvTreeListEntry* SvxRedlinTable::CreateEntry() const
...@@ -346,31 +358,30 @@ SvTreeListEntry* SvxRedlinTable::CreateEntry() const ...@@ -346,31 +358,30 @@ SvTreeListEntry* SvxRedlinTable::CreateEntry() const
} }
void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, 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; if (nTreeFlags & TREEFLAG_CHKBTN)
SvLBoxContextBmp* pContextBmp;
if( nTreeFlags & TREEFLAG_CHKBTN )
{ {
SvLBoxButton* pButton= new SvLBoxButton( pEntry,eButtonKind,0,pCheckButtonData ); pEntry->AddItem(new SvLBoxButton(pEntry, eButtonKind, 0, pCheckButtonData));
pEntry->AddItem( pButton );
} }
pContextBmp= new SvLBoxContextBmp(pEntry,0, rColl,rExp, true); pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, rColl, rExp, true));
pEntry->AddItem( pContextBmp );
pString = new SvLBoxColorString( pEntry, 0, rStr ,aEntryColor); // the type of the change
pEntry->AddItem( pString ); 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; sal_Int32 nIndex = 0;
// TODO: verify if TabCount() is always >0 here! const sal_uInt16 nCount = TabCount() - 1;
const sal_uInt16 nCount = TabCount()-1; for (sal_uInt16 nToken = 0; nToken < nCount; nToken++)
for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ )
{ {
const OUString aToken = GetToken(aCurEntry, nIndex); const OUString aToken = GetToken(maEntryString, nIndex);
SvLBoxColorString* pStr = new SvLBoxColorString( pEntry, 0, aToken, aEntryColor); pEntry->AddItem(new SvLBoxColorString(pEntry, 0, aToken, maEntryColor));
pEntry->AddItem( pStr );
} }
} }
......
...@@ -71,6 +71,36 @@ String STR_REDLINE_AUTOFMT ...@@ -71,6 +71,36 @@ String STR_REDLINE_AUTOFMT
{ {
Text [ en-US ] = "AutoCorrect"; Text [ en-US ] = "AutoCorrect";
}; };
Image IMG_REDLINE_INSERTED
{
ImageBitmap = Bitmap{File = "redline_inserted.png";};
};
Image IMG_REDLINE_DELETED
{
ImageBitmap = Bitmap{File = "redline_deleted.png";};
};
Image IMG_REDLINE_FORMATED
{
// FIXME
ImageBitmap = Bitmap{File = "redline_inserted.png";};
};
Image IMG_REDLINE_TABLECHG
{
// FIXME
ImageBitmap = Bitmap{File = "redline_inserted.png";};
};
Image IMG_REDLINE_FMTCOLLSET
{
// FIXME
ImageBitmap = Bitmap{File = "redline_inserted.png";};
};
Image IMG_REDLINE_AUTOFMT
{
// FIXME
ImageBitmap = Bitmap{File = "redline_inserted.png";};
};
String STR_REDLINE_FORMATED String STR_REDLINE_FORMATED
{ {
Text [ en-US ] = "Formats" ; Text [ en-US ] = "Formats" ;
......
...@@ -110,6 +110,7 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg ...@@ -110,6 +110,7 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg
SAL_DLLPRIVATE void InitAuthors(); SAL_DLLPRIVATE void InitAuthors();
SAL_DLLPRIVATE OUString GetRedlineText(const SwRangeRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack = 0); SAL_DLLPRIVATE OUString GetRedlineText(const SwRangeRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack = 0);
SAL_DLLPRIVATE Image GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0);
SAL_DLLPRIVATE OUString GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0); SAL_DLLPRIVATE OUString GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0);
SAL_DLLPRIVATE sal_uInt16 GetRedlinePos( const SvTreeListEntry& rEntry) const; SAL_DLLPRIVATE sal_uInt16 GetRedlinePos( const SvTreeListEntry& rEntry) const;
......
...@@ -45,6 +45,13 @@ ...@@ -45,6 +45,13 @@
#define RID_OLE_TOOLBOX (RC_SHELLS_BEGIN + 22) #define RID_OLE_TOOLBOX (RC_SHELLS_BEGIN + 22)
#define RID_TOOLS_TOOLBOX (RC_SHELLS_BEGIN + 23) #define RID_TOOLS_TOOLBOX (RC_SHELLS_BEGIN + 23)
#define IMG_REDLINE_INSERTED (RC_SHELLS_BEGIN + 24)
#define IMG_REDLINE_DELETED (RC_SHELLS_BEGIN + 25)
#define IMG_REDLINE_FORMATED (RC_SHELLS_BEGIN + 26)
#define IMG_REDLINE_TABLECHG (RC_SHELLS_BEGIN + 27)
#define IMG_REDLINE_FMTCOLLSET (RC_SHELLS_BEGIN + 28)
#define IMG_REDLINE_AUTOFMT (RC_SHELLS_BEGIN + 29)
#define RID_BEZIER_TOOLBOX (RC_SHELLS_BEGIN + 33) #define RID_BEZIER_TOOLBOX (RC_SHELLS_BEGIN + 33)
#define STR_SWBG_PARAGRAPH (RC_SHELLS_BEGIN + 37) #define STR_SWBG_PARAGRAPH (RC_SHELLS_BEGIN + 37)
......
...@@ -312,12 +312,9 @@ void SwRedlineAcceptDlg::InitAuthors() ...@@ -312,12 +312,9 @@ void SwRedlineAcceptDlg::InitAuthors()
!bOnlyFormatedRedlines ); !bOnlyFormatedRedlines );
} }
OUString SwRedlineAcceptDlg::GetRedlineText( const SwRangeRedline& rRedln, OUString SwRedlineAcceptDlg::GetRedlineText(const SwRangeRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack)
DateTime &rDateTime, sal_uInt16 nStack)
{ {
OUString sEntry(GetActionText(rRedln, nStack)); OUString sEntry(rRedln.GetAuthorString(nStack));
sEntry += "\t";
sEntry += rRedln.GetAuthorString(nStack);
sEntry += "\t"; sEntry += "\t";
const DateTime &rDT = rRedln.GetTimeStamp(nStack); const DateTime &rDT = rRedln.GetTimeStamp(nStack);
...@@ -331,6 +328,28 @@ OUString SwRedlineAcceptDlg::GetRedlineText( const SwRangeRedline& rRedln, ...@@ -331,6 +328,28 @@ OUString SwRedlineAcceptDlg::GetRedlineText( const SwRangeRedline& rRedln,
return sEntry; return sEntry;
} }
Image SwRedlineAcceptDlg::GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack)
{
const static Image aInserted(SW_RES(IMG_REDLINE_INSERTED));
const static Image aDeleted(SW_RES(IMG_REDLINE_DELETED));
const static Image aFormated(SW_RES(IMG_REDLINE_FORMATED));
const static Image aTableChgd(SW_RES(IMG_REDLINE_TABLECHG));
const static Image aFmtCollSet(SW_RES(IMG_REDLINE_FMTCOLLSET));
const static Image aAutoFormat(SW_RES(IMG_REDLINE_AUTOFMT));
switch (rRedln.GetType(nStack))
{
case nsRedlineType_t::REDLINE_INSERT: return aInserted;
case nsRedlineType_t::REDLINE_DELETE: return aDeleted;
case nsRedlineType_t::REDLINE_FORMAT: return aFormated;
case nsRedlineType_t::REDLINE_PARAGRAPH_FORMAT: return aFormated;
case nsRedlineType_t::REDLINE_TABLE: return aTableChgd;
case nsRedlineType_t::REDLINE_FMTCOLL: return aFmtCollSet;
}
return Image();
}
OUString SwRedlineAcceptDlg::GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack) OUString SwRedlineAcceptDlg::GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack)
{ {
switch( rRedln.GetType(nStack) ) switch( rRedln.GetType(nStack) )
...@@ -585,7 +604,8 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa ...@@ -585,7 +604,8 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa
pData->bDisabled = true; pData->bDisabled = true;
sChild = GetRedlineText(rRedln, pData->aDateTime, nStack); sChild = GetRedlineText(rRedln, pData->aDateTime, nStack);
SvTreeListEntry* pChild = pTable->InsertEntry(sChild, pData, pParent->pTLBParent); SvTreeListEntry* pChild = pTable->InsertEntry(GetActionImage(rRedln, nStack),
sChild, pData, pParent->pTLBParent);
pRedlineChild->pTLBChild = pChild; pRedlineChild->pTLBChild = pChild;
if (!bValidParent) if (!bValidParent)
...@@ -731,7 +751,7 @@ void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd) ...@@ -731,7 +751,7 @@ void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd)
pData->bDisabled = false; pData->bDisabled = false;
sParent = GetRedlineText(rRedln, pData->aDateTime); sParent = GetRedlineText(rRedln, pData->aDateTime);
pParent = pTable->InsertEntry(sParent, pData, 0, i); pParent = pTable->InsertEntry(GetActionImage(rRedln), sParent, pData, 0, i);
if( pCurrRedline == &rRedln ) if( pCurrRedline == &rRedln )
{ {
pTable->SetCurEntry( pParent ); pTable->SetCurEntry( pParent );
......
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