summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-07-12 10:00:53 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-07-12 10:07:17 +0200
commit2c409f5a9871941ee380f200872769c62c665784 (patch)
tree5f4564e85c9bf783c60df8a92b0151aaa3ae28f7 /sw
parentec92841fd3ea9ddcaa99d5d352f61971ba9ea5ee (diff)
SwTxtPaintInfo::_DrawBackBrush: color comment ranges
Change-Id: I65f681d9fd5f0e7471da77608279c2dade38d7cb
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/inftxt.cxx27
1 files changed, 25 insertions, 2 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 554ba0f83632..e3f083532023 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -39,6 +39,7 @@
#include <editeng/splwrap.hxx>
#include <editeng/pgrditem.hxx>
#include <editeng/tstpitem.hxx>
+#include <xmloff/odffields.hxx>
#include <SwSmartTagMgr.hxx>
#include <linguistic/lngprops.hxx>
@@ -47,6 +48,9 @@
#include <editeng/forbiddenruleitem.hxx>
#include <txatbase.hxx>
#include <fmtinfmt.hxx>
+#include <fmtfld.hxx>
+#include <fldbas.hxx>
+#include <PostItMgr.hxx>
#include <swmodule.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
@@ -1081,7 +1085,7 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const
if(aIntersect.HasArea())
{
SwTxtNode *pNd = pFrm->GetTxtNode();
- const ::sw::mark::IMark* pFieldmark = NULL;
+ const ::sw::mark::IFieldmark* pFieldmark = NULL;
if(pNd)
{
const SwDoc *doc=pNd->GetDoc();
@@ -1107,7 +1111,26 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const
{
OutputDevice* pOutDev = (OutputDevice*)GetOut();
pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
- pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+ bool bFilled = false;
+ // If this is a comment range, need to look up the color of the comment author.
+ if (pFieldmark->GetFieldname() == ODF_COMMENTRANGE)
+ {
+ // Search for the position of the postit field
+ const sal_Unicode fld[] = { CH_TXTATR_INWORD, 0 };
+ xub_StrLen nEndIdx = GetTxt().SearchChar(fld, GetIdx());
+ if (nEndIdx != STRING_NOTFOUND)
+ {
+ SwTxtAttr* pTxtAttr = pNd->GetTxtAttrForCharAt(nEndIdx, RES_TXTATR_FIELD);
+ const SwFmtFld& rPostItField = pTxtAttr->GetFld();
+ // Look up the author name
+ const rtl::OUString& rAuthor = rPostItField.GetFld()->GetPar1();
+ sal_uInt16 nIndex = pNd->GetDoc()->InsertRedlineAuthor(rAuthor);
+ pOutDev->SetFillColor( SwPostItMgr::GetColorLight(nIndex) );
+ bFilled = true;
+ }
+ }
+ if (!bFilled)
+ pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
pOutDev->SetLineColor( );
pOutDev->DrawRect( aIntersect.SVRect() );
pOutDev->Pop();