diff options
-rw-r--r-- | icon-themes/galaxy/sw/res/redline_deleted.png | bin | 0 -> 278 bytes | |||
-rw-r--r-- | icon-themes/galaxy/sw/res/redline_inserted.png | bin | 0 -> 232 bytes | |||
-rw-r--r-- | include/svx/ctredlin.hxx | 30 | ||||
-rw-r--r-- | svx/source/dialog/ctredlin.cxx | 61 | ||||
-rw-r--r-- | sw/source/ui/shells/shells.src | 30 | ||||
-rw-r--r-- | sw/source/uibase/inc/redlndlg.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/inc/shells.hrc | 7 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 34 |
8 files changed, 123 insertions, 40 deletions
diff --git a/icon-themes/galaxy/sw/res/redline_deleted.png b/icon-themes/galaxy/sw/res/redline_deleted.png Binary files differnew file mode 100644 index 000000000000..e4e1ee60a420 --- /dev/null +++ b/icon-themes/galaxy/sw/res/redline_deleted.png diff --git a/icon-themes/galaxy/sw/res/redline_inserted.png b/icon-themes/galaxy/sw/res/redline_inserted.png Binary files differnew file mode 100644 index 000000000000..c85ef5f508d2 --- /dev/null +++ b/icon-themes/galaxy/sw/res/redline_inserted.png diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx index 8d0f31915525..2eb1f17bc1ae 100644 --- a/include/svx/ctredlin.hxx +++ b/include/svx/ctredlin.hxx @@ -98,8 +98,9 @@ private: DateTime aDaTiFilterFirst; DateTime aDaTiFilterLast; OUString aAuthor; - Color aEntryColor; - OUString aCurEntry; + Color maEntryColor; + Image maEntryImage; + OUString maEntryString; utl::TextSearch* pCommentSearcher; Link aColCompareLink; @@ -136,19 +137,32 @@ public: bool IsValidEntry(const OUString &rAuthor, const DateTime &rDateTime); bool IsValidComment(const OUString &rComment); - SvTreeListEntry* InsertEntry(const OUString& ,RedlinData *pUserData, - SvTreeListEntry* pParent=NULL,sal_uIntPtr nPos=TREELIST_APPEND); + /** Insert a redline entry. - SvTreeListEntry* InsertEntry(const OUString& ,RedlinData *pUserData,const Color&, - SvTreeListEntry* pParent=NULL,sal_uIntPtr nPos=TREELIST_APPEND); + The rStr contains the entire redline entry; the columns are delimited by '\t'. + */ + 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; void SetColCompareHdl(const Link& rLink ) { aColCompareLink = rLink; } const Link& GetColCompareHdl() const { return aColCompareLink; } - - }; 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)); } } diff --git a/sw/source/ui/shells/shells.src b/sw/source/ui/shells/shells.src index 4bb18b38311d..8db90320895f 100644 --- a/sw/source/ui/shells/shells.src +++ b/sw/source/ui/shells/shells.src @@ -71,6 +71,36 @@ String STR_REDLINE_AUTOFMT { 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 { Text [ en-US ] = "Formats" ; diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index f26b02350ed8..97cffe688fc2 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -110,6 +110,7 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg SAL_DLLPRIVATE void InitAuthors(); 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 sal_uInt16 GetRedlinePos( const SvTreeListEntry& rEntry) const; diff --git a/sw/source/uibase/inc/shells.hrc b/sw/source/uibase/inc/shells.hrc index 685b0e2a6116..538376965250 100644 --- a/sw/source/uibase/inc/shells.hrc +++ b/sw/source/uibase/inc/shells.hrc @@ -45,6 +45,13 @@ #define RID_OLE_TOOLBOX (RC_SHELLS_BEGIN + 22) #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 STR_SWBG_PARAGRAPH (RC_SHELLS_BEGIN + 37) diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index ef6c96a3b385..18ecbc4b4fd4 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -312,12 +312,9 @@ void SwRedlineAcceptDlg::InitAuthors() !bOnlyFormatedRedlines ); } -OUString SwRedlineAcceptDlg::GetRedlineText( const SwRangeRedline& rRedln, - DateTime &rDateTime, sal_uInt16 nStack) +OUString SwRedlineAcceptDlg::GetRedlineText(const SwRangeRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack) { - OUString sEntry(GetActionText(rRedln, nStack)); - sEntry += "\t"; - sEntry += rRedln.GetAuthorString(nStack); + OUString sEntry(rRedln.GetAuthorString(nStack)); sEntry += "\t"; const DateTime &rDT = rRedln.GetTimeStamp(nStack); @@ -331,6 +328,28 @@ OUString SwRedlineAcceptDlg::GetRedlineText( const SwRangeRedline& rRedln, 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) { switch( rRedln.GetType(nStack) ) @@ -585,7 +604,8 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa pData->bDisabled = true; 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; if (!bValidParent) @@ -731,7 +751,7 @@ void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd) pData->bDisabled = false; sParent = GetRedlineText(rRedln, pData->aDateTime); - pParent = pTable->InsertEntry(sParent, pData, 0, i); + pParent = pTable->InsertEntry(GetActionImage(rRedln), sParent, pData, 0, i); if( pCurrRedline == &rRedln ) { pTable->SetCurEntry( pParent ); |