summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorChristian Lippka <christian.lippka@sun.com>2010-05-26 15:47:54 +0200
committerChristian Lippka <christian.lippka@sun.com>2010-05-26 15:47:54 +0200
commitf383c9a98f285dbe51bcd5990aa7b3c9ba962659 (patch)
tree185654fe715c0e097d8ac281c1a4a30a91015b54 /sd/source
parent58dd850178eb0151f03351b0599fcb88e6b499a8 (diff)
#i111538# fix high contrast rendering for annotations in impress
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/ui/annotations/annotationwindow.cxx104
1 files changed, 55 insertions, 49 deletions
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 3ba99307fd41..a4642bb68096 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -136,14 +136,25 @@ AnnotationTextWindow::~AnnotationTextWindow()
void AnnotationTextWindow::Paint( const Rectangle& rRect)
{
- if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ if ( !bHighContrast )
{
DrawGradient(Rectangle(Point(0,0),PixelToLogic(GetSizePixel())),
Gradient(GRADIENT_LINEAR,mpAnnotationWindow->maColorLight,mpAnnotationWindow->maColor));
}
if( mpOutlinerView )
+ {
+ Color aBackgroundColor( mpAnnotationWindow->maColor );
+ if( bHighContrast )
+ {
+ aBackgroundColor = GetSettings().GetStyleSettings().GetWindowColor();
+ }
+
+ mpOutlinerView->SetBackgroundColor( aBackgroundColor );
+
mpOutlinerView->Paint( rRect );
+ }
}
void AnnotationTextWindow::KeyInput( const KeyEvent& rKeyEvt )
@@ -609,16 +620,34 @@ void AnnotationWindow::SetColor()
{
sal_uInt16 nAuthorIdx = mpDoc->GetAnnotationAuthorIndex( mxAnnotation->getAuthor() );
- maColor = mrManager.GetColor( nAuthorIdx );
- maColorDark = mrManager.GetColorDark( nAuthorIdx );
- maColorLight = mrManager.GetColorLight( nAuthorIdx );
+ const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ if( bHighContrast )
+ {
+ StyleSettings aStyleSettings = GetSettings().GetStyleSettings();
+
+ maColor = aStyleSettings.GetWindowColor();
+ maColorDark = maColor;
+ maColorLight = aStyleSettings.GetWindowTextColor();
+ }
+ else
+ {
+ maColor = mrManager.GetColor( nAuthorIdx );
+ maColorDark = mrManager.GetColorDark( nAuthorIdx );
+ maColorLight = mrManager.GetColorLight( nAuthorIdx );
+ }
mpOutlinerView->SetBackgroundColor(maColor);
+ Engine()->SetBackgroundColor(maColor);
+
+ {
+ SvtAccessibilityOptions aOptions;
+ Engine()->ForceAutoColor( bHighContrast || aOptions.GetIsAutomaticFontColor() );
+ }
mpMeta->SetControlBackground(maColor);
AllSettings aSettings = mpMeta->GetSettings();
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- aStyleSettings.SetFieldTextColor(maColorDark);
+ aStyleSettings.SetFieldTextColor( bHighContrast ? maColorLight : maColorDark);
aSettings.SetStyleSettings(aStyleSettings);
mpMeta->SetSettings(aSettings);
@@ -635,59 +664,35 @@ void AnnotationWindow::SetColor()
void AnnotationWindow::Deactivate()
{
Reference< XAnnotation > xAnnotation( mxAnnotation );
-/*
- // check if text is empty
- Paragraph* p1stPara=Engine()->GetParagraph( 0 );
- ULONG nParaAnz=Engine()->GetParagraphCount();
- if(p1stPara==NULL)
- nParaAnz=0;
- if(nParaAnz==1)
+ // write changed text back to annotation
+ if ( Engine()->IsModified() )
{
- // if it is only one paragraph, check if that paragraph is empty
- XubString aStr(Engine()->GetText(p1stPara));
-
- if(!aStr.Len())
- nParaAnz = 0;
- }
+ TextApiObject* pTextApi = getTextApiObject( xAnnotation );
- if( nParaAnz == 0 )
- {
- // text is empty, delete postit
- DeleteAnnotation( xAnnotation );
- }
- else
-*/
- {
- // write changed text back to annotation
- if ( Engine()->IsModified() )
+ if( pTextApi )
{
- TextApiObject* pTextApi = getTextApiObject( xAnnotation );
-
- if( pTextApi )
+ OutlinerParaObject* pOPO = Engine()->CreateParaObject();
+ if( pOPO )
{
- OutlinerParaObject* pOPO = Engine()->CreateParaObject();
- if( pOPO )
- {
- if( mpDoc->IsUndoEnabled() )
- mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_EDIT ) ) );
-
- pTextApi->SetText( *pOPO );
- delete pOPO;
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_EDIT ) ) );
- // set current time to changed annotation
- xAnnotation->setDateTime( getCurrentDateTime() );
+ pTextApi->SetText( *pOPO );
+ delete pOPO;
- if( mpDoc->IsUndoEnabled() )
- mpDoc->EndUndo();
+ // set current time to changed annotation
+ xAnnotation->setDateTime( getCurrentDateTime() );
- DocView()->GetDocSh()->SetModified(sal_True);
- }
+ if( mpDoc->IsUndoEnabled() )
+ mpDoc->EndUndo();
+ DocView()->GetDocSh()->SetModified(sal_True);
}
+
}
- Engine()->ClearModifyFlag();
}
+ Engine()->ClearModifyFlag();
Engine()->GetUndoManager().Clear();
}
@@ -698,15 +703,16 @@ void AnnotationWindow::Paint( const Rectangle& rRect)
if(mpMeta->IsVisible() && !mbReadonly)
{
+ const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
//draw left over space
- if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ if ( bHighContrast )
SetFillColor(COL_BLACK);
else
SetFillColor(maColor);
SetLineColor();
DrawRect(PixelToLogic(Rectangle(Point(mpMeta->GetPosPixel().X()+mpMeta->GetSizePixel().Width(),mpMeta->GetPosPixel().Y()),Size(METABUTTON_AREA_WIDTH,mpMeta->GetSizePixel().Height()))));
- if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ if ( bHighContrast )
{
//draw rect around button
SetFillColor(COL_BLACK);
@@ -728,7 +734,7 @@ void AnnotationWindow::Paint( const Rectangle& rRect)
DrawRect(maRectMetaButton);
//draw arrow
- if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ if( bHighContrast )
SetFillColor(COL_WHITE);
else
SetFillColor(COL_BLACK);