diff options
author | Thomas Lange <tl@openoffice.org> | 2002-12-12 14:40:33 +0000 |
---|---|---|
committer | Thomas Lange <tl@openoffice.org> | 2002-12-12 14:40:33 +0000 |
commit | 28afa45a097ad9b781ce66bdb3f7b89646e31ea4 (patch) | |
tree | 9d8805422814bf3ee426ae731ee19bc2464614d6 | |
parent | 3489abf77ffd29fd2eb3754d8b5ce28322008873 (diff) |
#105984# use ColorConfig and FONTCOLOR in Math
-rw-r--r-- | starmath/inc/edit.hxx | 9 | ||||
-rw-r--r-- | starmath/inc/smmod.hxx | 20 | ||||
-rw-r--r-- | starmath/inc/view.hxx | 9 | ||||
-rw-r--r-- | starmath/source/edit.cxx | 20 | ||||
-rw-r--r-- | starmath/source/node.cxx | 20 | ||||
-rw-r--r-- | starmath/source/smmod.cxx | 58 | ||||
-rw-r--r-- | starmath/source/view.cxx | 25 |
7 files changed, 132 insertions, 29 deletions
diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index 26158e0658..d093c102af 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -2,9 +2,9 @@ * * $RCSfile: edit.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: tl $ $Date: 2002-06-13 14:44:44 $ + * last change: $Author: tl $ $Date: 2002-12-12 15:39:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,6 +73,9 @@ #ifndef _MyEDITDATA_HXX //autogen #include <svx/editdata.hxx> #endif +#ifndef _SVX_COLORCFG_HXX +#include <svx/colorcfg.hxx> +#endif #ifndef _ACCESSIBILITY_HXX_ #include "accessibility.hxx" @@ -175,6 +178,8 @@ public: void Flush(); void DeleteEditView( SmViewShell &rView ); + void ApplyColorConfigValues( const svx::ColorConfig &rColorCfg ); + // for Accessibility virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > CreateAccessible(); diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index 2e8aa3a102..20370d450d 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -2,9 +2,9 @@ * * $RCSfile: smmod.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: tl $ $Date: 2002-11-06 12:40:24 $ + * last change: $Author: tl $ $Date: 2002-12-12 15:39:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,6 +65,12 @@ #ifndef _SV_RESARY_HXX #include <tools/resary.hxx> #endif +#ifndef _SFXLSTNER_HXX +#include <svtools/lstner.hxx> +#endif +#ifndef _SVX_COLORCFG_HXX +#include <svx/colorcfg.hxx> +#endif #ifndef _SMDLL_HXX #define _SM_DLL // fuer SD_MOD() @@ -149,8 +155,9 @@ public: ///////////////////////////////////////////////////////////////// -class SmModule : public SmModuleDummy +class SmModule : public SmModuleDummy, public SfxListener { + svx::ColorConfig *pColorConfig; SmConfig *pConfig; SmLocalizedSymbolData *pLocSymbolData; SmRectCache *pRectCache; @@ -161,6 +168,8 @@ class SmModule : public SmModuleDummy void _CreateSysLocale() const; void _CreateVirtualDev() const; + void ApplyColorConfigValues( const svx::ColorConfig &rColorCfg ); + public: TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + 0); @@ -171,6 +180,11 @@ public: virtual SfxModule * Load(); virtual void Free(); + // SfxListener + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + svx::ColorConfig & GetColorConfig(); + SmConfig * GetConfig(); SmRectCache * GetRectCache() { return pRectCache; } diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 29d99b90bb..50c8def309 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -2,9 +2,9 @@ * * $RCSfile: view.hxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: tl $ $Date: 2002-09-17 08:28:25 $ + * last change: $Author: tl $ $Date: 2002-12-12 15:39:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,6 +82,9 @@ #ifndef _SFXVIEWFRM_HXX //autogen #include <sfx2/viewfrm.hxx> #endif +#ifndef _SVX_COLORCFG_HXX +#include <svx/colorcfg.hxx> +#endif #ifndef EDIT_HXX #include "edit.hxx" @@ -150,6 +153,8 @@ public: void ShowCursor(BOOL bShow); const SmNode * SetCursorPos(USHORT nRow, USHORT nCol); + void ApplyColorConfigValues( const svx::ColorConfig &rColorCfg ); + // for Accessibility virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > CreateAccessible(); diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index b634a5ed85..62da679c83 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -2,9 +2,9 @@ * * $RCSfile: edit.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: tl $ $Date: 2002-07-22 13:21:44 $ + * last change: $Author: tl $ $Date: 2002-12-12 15:39:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -181,6 +181,9 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) : SetHelpId(HID_SMA_COMMAND_WIN_EDIT); SetMapMode(MAP_PIXEL); + ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + + // compare DataChanged SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); aModifyTimer.SetTimeoutHdl(LINK(this, SmEditWindow, ModifyTimerHdl)); @@ -254,15 +257,26 @@ SfxItemPool * SmEditWindow::GetEditEngineItemPool() return pDoc ? &pDoc->GetEditEngineItemPool() : 0; } +void SmEditWindow::ApplyColorConfigValues( const svx::ColorConfig &rColorCfg ) +{ + // Note: SetBackground still done in SmEditWindow::DataChanged +#ifdef DEBUG + ColorData nVal = rColorCfg.GetColorValue(svx::FONTCOLOR).nColor; +#endif + SetTextColor( rColorCfg.GetColorValue(svx::FONTCOLOR).nColor ); + Invalidate(); +} void SmEditWindow::DataChanged( const DataChangedEvent& ) { const StyleSettings aSettings( GetSettings().GetStyleSettings() ); + + ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); SetBackground( aSettings.GetWindowColor() ); + // edit fields in other Applications use this font instead of // the application font thus we use this one too SetPointFont( aSettings.GetFieldFont() /*aSettings.GetAppFont()*/ ); - SetTextColor( aSettings.GetWindowTextColor() ); EditEngine *pEditEngine = GetEditEngine(); SfxItemPool *pEditEngineItemPool = GetEditEngineItemPool(); diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 1cf80cf8e9..1a2ee37f9b 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -2,9 +2,9 @@ * * $RCSfile: node.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: tl $ $Date: 2002-11-06 12:38:53 $ + * last change: $Author: tl $ $Date: 2002-12-12 15:40:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -176,15 +176,13 @@ Color SmTmpDevice::Impl_GetColor( const Color& rColor ) if (OUTDEV_WINDOW == rOutDev.GetOutDevType()) aBgCol = ((Window &) rOutDev).GetDisplayBackground().GetColor(); - nNewCol = COL_BLACK; - if (aBgCol.IsDark()) - { - SmViewShell *pViewSh = SmGetActiveView(); - const StyleSettings& rS = pViewSh ? - pViewSh->GetGraphicWindow().GetSettings().GetStyleSettings() : - Application::GetSettings().GetStyleSettings(); - nNewCol = rS.GetWindowTextColor().GetColor(); - } + nNewCol = SM_MOD1()->GetColorConfig().GetColorValue(svx::FONTCOLOR).nColor; + + Color aTmpColor( nNewCol ); + if (aBgCol.IsDark() && aTmpColor.IsDark()) + nNewCol = COL_WHITE; + else if (aBgCol.IsBright() && aTmpColor.IsBright()) + nNewCol = COL_BLACK; } } return Color( nNewCol ); diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index afd5071458..50578ca538 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -2,9 +2,9 @@ * * $RCSfile: smmod.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: tl $ $Date: 2002-01-11 15:35:49 $ + * last change: $Author: tl $ $Date: 2002-12-12 15:40:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,9 @@ #ifndef _SFX_HRC //autogen #include <sfx2/sfx.hrc> #endif +#ifndef _SFXVIEWSH_HXX +#include <sfx2/viewsh.hxx> +#endif #ifndef _FACTORY_HXX //autogen #include <so3/factory.hxx> #endif @@ -101,6 +104,9 @@ #ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX #include <svtools/syslocale.hxx> #endif +#ifndef _RTTI_HXX +#include <tools/rtti.hxx> +#endif #ifndef _SMMOD_HXX #include "smmod.hxx" @@ -114,6 +120,12 @@ #ifndef _DIALOG_HXX #include "dialog.hxx" #endif +#ifndef EDIT_HXX +#include "edit.hxx" +#endif +#ifndef VIEW_HXX +#include "view.hxx" +#endif #include "starmath.hrc" TYPEINIT1( SmModuleDummy, SfxModule ); @@ -288,6 +300,7 @@ SFX_IMPL_INTERFACE(SmModule, SfxModule, SmResId(RID_APPLICATION)) SmModule::SmModule(SvFactory* pObjFact) : SmModuleDummy(SFX_APP()->CreateResManager("sm"), FALSE, pObjFact), pConfig( 0 ), + pColorConfig( 0 ), pLocSymbolData( 0 ), pRectCache( new SmRectCache ), pSysLocale( 0 ), @@ -300,6 +313,7 @@ SmModule::SmModule(SvFactory* pObjFact) : SmModule::~SmModule() { delete pConfig; + delete pColorConfig; delete pLocSymbolData; delete pRectCache; delete pSysLocale; @@ -318,6 +332,46 @@ void SmModule::_CreateVirtualDev() const pThis->pVirtualDev = new VirtualDevice; } +void SmModule::ApplyColorConfigValues( const svx::ColorConfig &rColorCfg ) +{ + //invalidate all graphic and edit windows + const TypeId aSmViewTypeId = TYPE(SmViewShell); + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) + { + if ((pViewShell->IsA(aSmViewTypeId))) + { + SmViewShell *pSmView = (SmViewShell *) pViewShell; + pSmView->GetGraphicWindow().ApplyColorConfigValues( rColorCfg ); + SmEditWindow *pEditWin = pSmView->GetEditWindow(); + if (pEditWin) + pEditWin->ApplyColorConfigValues( rColorCfg ); + } + pViewShell = SfxViewShell::GetNext( *pViewShell ); + } +} + +svx::ColorConfig & SmModule::GetColorConfig() +{ + if(!pColorConfig) + { + pColorConfig = new svx::ColorConfig; + ApplyColorConfigValues( *pColorConfig ); + StartListening( *pColorConfig ); + } + return *pColorConfig; +} + +void SmModule::Notify( SfxBroadcaster &rBC, const SfxHint &rHint ) +{ + if (rHint.ISA(SfxSimpleHint)) + { + ULONG nHintId = ((SfxSimpleHint&)rHint).GetId(); + if (SFX_HINT_COLORS_CHANGED == nHintId) + ApplyColorConfigValues(*pColorConfig); + } +} + SmConfig * SmModule::GetConfig() { if(!pConfig) diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 43e6344225..046ad8e6ca 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -2,9 +2,9 @@ * * $RCSfile: view.cxx,v $ * - * $Revision: 1.26 $ + * $Revision: 1.27 $ * - * last change: $Author: tl $ $Date: 2002-09-17 08:28:26 $ + * last change: $Author: tl $ $Date: 2002-12-12 15:40:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -189,7 +189,9 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell): Hide(); const Fraction aFraction (1,1); SetMapMode( MapMode(MAP_100TH_MM, Point(), aFraction, aFraction)); - SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); + + ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + SetTotalSize(); SetHelpId(HID_SMA_WIN_DOCUMENT); @@ -212,11 +214,22 @@ void SmGraphicWindow::StateChanged( StateChangedType eType ) } +void SmGraphicWindow::ApplyColorConfigValues( const svx::ColorConfig &rColorCfg ) +{ + // Note: SetTextColor not necessary since the nodes that + // get painted have the color information. +#ifdef DEBUG + ColorData nVal = rColorCfg.GetColorValue(svx::DOCCOLOR).nColor; +#endif + SetBackground( Color( (ColorData) rColorCfg.GetColorValue(svx::DOCCOLOR).nColor ) ); + Invalidate(); +} + + void SmGraphicWindow::DataChanged( const DataChangedEvent& rEvt ) { - const StyleSettings aSettings( GetSettings().GetStyleSettings() ); - SetBackground( aSettings.GetWindowColor() ); - //SetTextColor( aSettings.GetWindowTextColor() ); + ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + ScrollableWindow::DataChanged( rEvt ); } |