diff options
author | Thomas Benisch <tbe@openoffice.org> | 2002-09-09 14:16:04 +0000 |
---|---|---|
committer | Thomas Benisch <tbe@openoffice.org> | 2002-09-09 14:16:04 +0000 |
commit | 7a7b91076bdf2b75bd83ffc03bf796e3274836de (patch) | |
tree | f0d697e425f659af2526f2c190acc3cb7e9b28b4 /basctl/source/basicide | |
parent | a6b7b72f6fdd9de9b64b662bc762c634cb7b7cbd (diff) |
#100372# get font from configuration
Diffstat (limited to 'basctl/source/basicide')
-rw-r--r-- | basctl/source/basicide/baside2.hxx | 13 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 59 |
2 files changed, 56 insertions, 16 deletions
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 993abdb2cac8..674242512234 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -2,9 +2,9 @@ * * $RCSfile: baside2.hxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: sb $ $Date: 2002-07-24 13:01:27 $ + * last change: $Author: tbe $ $Date: 2002-09-09 15:16:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -151,12 +151,19 @@ inline void ProgressInfo::StepProgress() SetState( ++nCurState ); } + +namespace svt { +class SourceViewConfig; +} + class EditorWindow : public Window, public SfxListener { private: ExtTextView* pEditView; ExtTextEngine* pEditEngine; + svt::SourceViewConfig* pSourceViewConfig; + long nCurTextWidth; SyntaxHighlighter aHighlighter; @@ -174,6 +181,8 @@ private: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); void ImpDoHighlight( ULONG nLineOff ); + void ImplSetFont(); + BOOL bHighlightning; BOOL bDoSyntaxHighlight; BOOL bDelayHighlight; diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index b5842ff56c15..06102177da58 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -2,9 +2,9 @@ * * $RCSfile: baside2b.cxx,v $ * - * $Revision: 1.28 $ + * $Revision: 1.29 $ * - * last change: $Author: mt $ $Date: 2002-08-23 10:27:16 $ + * last change: $Author: tbe $ $Date: 2002-09-09 15:16:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,6 +98,10 @@ //#include <sfx2/sfxhelp.hxx> //#endif +#ifndef _SVTOOLS_SOURCEVIEWCONFIG_HXX +#include <svtools/sourceviewconfig.hxx> +#endif + #ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER2_HPP_ #include <com/sun/star/script/XLibraryContainer2.hpp> #endif @@ -341,6 +345,7 @@ EditorWindow::EditorWindow( Window* pParent ) : pModulWindow = 0; pEditView = 0; pEditEngine = 0; + pSourceViewConfig = new svt::SourceViewConfig; bHighlightning = FALSE; pProgress = 0; nCurTextWidth = 0; @@ -349,12 +354,17 @@ EditorWindow::EditorWindow( Window* pParent ) : SetPointer( Pointer( POINTER_TEXT ) ); SetHelpId( HID_BASICIDE_EDITORWINDOW ); + + StartListening( *pSourceViewConfig ); } __EXPORT EditorWindow::~EditorWindow() { + EndListening( *pSourceViewConfig ); + delete pSourceViewConfig; + aSyntaxIdleTimer.Stop(); aHelpAgentTimer.Stop(); @@ -709,17 +719,7 @@ void EditorWindow::CreateEditEngine() pEditEngine->SetUpdateMode( FALSE ); pEditEngine->InsertView( pEditView ); - Font aFont( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, Application::GetSettings().GetUILanguage(), 0 , this ) ); - aFont.SetTransparent( FALSE ); - aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); - Size aFontSize( 0, 10 ); // Points - - aFont.SetSize( aFontSize ); - SetPointFont( aFont ); - aFont = GetFont(); - - pModulWindow->GetBreakPointWindow().SetFont( aFont ); - pEditEngine->SetFont( aFont ); + ImplSetFont(); aSyntaxIdleTimer.SetTimeout( 200 ); aSyntaxIdleTimer.SetTimeoutHdl( LINK( this, EditorWindow, SyntaxTimerHdl ) ); @@ -867,9 +867,12 @@ void EditorWindow::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) DoDelayedSyntaxHighlight( rTextHint.GetValue() ); } } + else if ( &rBC == pSourceViewConfig ) + { + ImplSetFont(); + } } - void EditorWindow::SetScrollBarRanges() { // Extra-Methode, nicht InitScrollBars, da auch fuer EditEngine-Events. @@ -932,6 +935,34 @@ void EditorWindow::ImpDoHighlight( ULONG nLine ) pEditEngine->SetModified( bWasModified ); } +void EditorWindow::ImplSetFont() +{ + if ( pSourceViewConfig ) + { + String sFontName = pSourceViewConfig->GetFontName(); + if ( !sFontName.Len() ) + { + Font aTmpFont( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, Application::GetSettings().GetUILanguage(), 0 , this ) ); + sFontName = aTmpFont.GetName(); + } + Size aFontSize( 0, pSourceViewConfig->GetFontHeight() ); + Font aFont( sFontName, aFontSize ); + aFont.SetColor( GetSettings().GetStyleSettings().GetFieldTextColor() ); + SetPointFont( aFont ); + aFont = GetFont(); + + if ( pModulWindow ) + pModulWindow->GetBreakPointWindow().SetFont( aFont ); + + if ( pEditEngine ) + { + BOOL bModified = pEditEngine->IsModified(); + pEditEngine->SetFont( aFont ); + pEditEngine->SetModified( bModified ); + } + } +} + void EditorWindow::DoSyntaxHighlight( ULONG nPara ) { // Durch das DelayedSyntaxHighlight kann es passieren, |