Kaydet (Commit) 2c409f5a authored tarafından Miklos Vajna's avatar Miklos Vajna

SwTxtPaintInfo::_DrawBackBrush: color comment ranges

Change-Id: I65f681d9fd5f0e7471da77608279c2dade38d7cb
üst ec92841f
......@@ -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();
......
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