From a87991a36587f4d86ea87a0389749409cc1982b7 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 17 Dec 2014 22:25:45 +0100 Subject: implement the ui part for the OpenGL config variables Change-Id: I46e2de444d38f1f93eb68ffd50b7a283d05d1738 --- cui/source/options/optgdlg.cxx | 83 ++++++++++++++++++++++++++++++++++++++++++ cui/source/options/optgdlg.hxx | 7 ++++ 2 files changed, 90 insertions(+) (limited to 'cui') diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index d66fc7474bfb..fb8919fe34a9 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -68,6 +68,7 @@ #include #include #include +#include #include #include @@ -102,6 +103,81 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::util; using namespace ::utl; +namespace svt { + +class OpenGLCfg +{ +private: + bool mbUseOpenGL; + bool mbForceOpenGL; + bool mbModified; + +public: + OpenGLCfg(); + ~OpenGLCfg(); + + bool useOpenGL() const; + bool forceOpenGL() const; + + void setUseOpenGL(bool bOpenGL); + void setForceOpenGL(bool bOpenGL); + + void reset(); +}; + +OpenGLCfg::OpenGLCfg(): + mbModified(false) +{ + reset(); +} + +void OpenGLCfg::reset() +{ + mbUseOpenGL = officecfg::Office::Common::VCL::UseOpenGL::get(); + mbForceOpenGL = officecfg::Office::Common::VCL::ForceOpenGL::get(); +} + +OpenGLCfg::~OpenGLCfg() +{ + if (mbModified) + { + boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() ); + officecfg::Office::Common::VCL::UseOpenGL::set(mbUseOpenGL, batch); + officecfg::Office::Common::VCL::ForceOpenGL::set(mbForceOpenGL, batch); + + } +} + +bool OpenGLCfg::useOpenGL() const +{ + return mbUseOpenGL; +} + +bool OpenGLCfg::forceOpenGL() const +{ + return mbForceOpenGL; +} + +void OpenGLCfg::setUseOpenGL(bool bOpenGL) +{ + if (bOpenGL != mbUseOpenGL) + { + mbUseOpenGL = bOpenGL; + mbModified = true; + } +} + +void OpenGLCfg::setForceOpenGL(bool bOpenGL) +{ + if (mbForceOpenGL != bOpenGL) + { + mbForceOpenGL = bOpenGL; + mbModified = true; + } +} + +} + // class OfaMiscTabPage -------------------------------------------------- int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ ) @@ -556,6 +632,7 @@ OfaViewTabPage::OfaViewTabPage(vcl::Window* pParent, const SfxItemSet& rSet) , pAppearanceCfg(new SvtTabAppearanceCfg) , pCanvasSettings(new CanvasSettings) , mpDrawinglayerOpt(new SvtOptionsDrawinglayer) + , mpOpenGLConfig(new svt::OpenGLCfg) { get(m_pWindowSizeMF, "windowsize"); get(m_pIconSizeLB, "iconsize"); @@ -803,6 +880,9 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* ) } } + mpOpenGLConfig->setUseOpenGL(m_pUseOpenGL->IsChecked()); + mpOpenGLConfig->setForceOpenGL(m_pForceOpenGL->IsChecked()); + // #i97672# if(m_pSelectionCB->IsEnabled()) { @@ -870,6 +950,7 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* ) void OfaViewTabPage::Reset( const SfxItemSet* ) { SvtMiscOptions aMiscOptions; + mpOpenGLConfig->reset(); if( aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO ) nSizeLB_InitialSelection = ( aMiscOptions.AreCurrentSymbolsLarge() )? 2 : 1; @@ -945,6 +1026,8 @@ void OfaViewTabPage::Reset( const SfxItemSet* ) m_pUseAntiAliase->SaveValue(); } + m_pUseOpenGL->Check(mpOpenGLConfig->useOpenGL()); + m_pForceOpenGL->Check(mpOpenGLConfig->forceOpenGL()); { // #i97672# Selection diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx index 18e42978818c..8e4aee7bb684 100644 --- a/cui/source/options/optgdlg.hxx +++ b/cui/source/options/optgdlg.hxx @@ -25,6 +25,8 @@ #include #include +#include + // predeclarations class CanvasSettings; class SvtOptionsDrawinglayer; @@ -32,6 +34,10 @@ namespace vcl { class IconThemeInfo; } +namespace svt { + class OpenGLCfg; +} + // class OfaMiscTabPage -------------------------------------------------- class OfaMiscTabPage : public SfxTabPage @@ -114,6 +120,7 @@ private: SvtTabAppearanceCfg* pAppearanceCfg; CanvasSettings* pCanvasSettings; SvtOptionsDrawinglayer* mpDrawinglayerOpt; + boost::scoped_ptr mpOpenGLConfig; std::vector mInstalledIconThemes; -- cgit v1.2.3