summaryrefslogtreecommitdiff
path: root/cui/source/options
diff options
context:
space:
mode:
authorGergo Mocsi <gmocsi91@gmail.com>2013-08-12 13:53:09 +0200
committerGergo Mocsi <gmocsi91@gmail.com>2013-09-02 18:16:58 +0200
commit8a1e19f4ff627d9ac15bbdf7ef04d27158b45569 (patch)
tree367e8ce733814024e545bde64428a6ace3e3755c /cui/source/options
parent6cb452f36649762e3cc0e477d0a543eeff741bbd (diff)
GSOC work, Tool/Options/Basic IDE Options created
Created a new tab in Tools/Options/Basic IDE options instead of the ModalDialog. The original dialog under Basic IDE/View/IDE Options was removed. Tab page is disabled when experimetal flag is off, entry node in the treebox is visible. Change-Id: Iaad1ea5fadc3f05ca81f2240dceb513f25be35b9
Diffstat (limited to 'cui/source/options')
-rw-r--r--cui/source/options/optbasic.cxx158
-rw-r--r--cui/source/options/optbasic.hxx52
-rw-r--r--cui/source/options/treeopt.cxx3
-rw-r--r--cui/source/options/treeopt.src1
4 files changed, 214 insertions, 0 deletions
diff --git a/cui/source/options/optbasic.cxx b/cui/source/options/optbasic.cxx
new file mode 100644
index 000000000000..93d8fc58c3e2
--- /dev/null
+++ b/cui/source/options/optbasic.cxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "optbasic.hxx"
+#include <basic/codecompletecache.hxx>
+#include <svtools/miscopt.hxx>
+#include <iostream>
+#include <officecfg/Office/BasicIDE.hxx>
+#include <boost/shared_ptr.hpp>
+#include <cuires.hrc>
+#include <svtools/miscopt.hxx>
+
+SvxBasicIDEOptionsPage::SvxBasicIDEOptionsPage( Window* pParent, const SfxItemSet& rSet )
+: SfxTabPage(pParent, "OptBasicIDEPage", "cui/ui/optbasicidepage.ui", rSet)
+{
+ SvtMiscOptions aMiscOpt;
+ if( ! aMiscOpt.IsExperimentalMode() )
+ {
+ Disable();
+ }
+
+ get(pCodeCompleteChk, "codecomplete_enable");
+ get(pAutocloseProcChk, "autoclose_proc");
+ get(pAutocloseParenChk, "autoclose_paren");
+ get(pAutocloseQuotesChk, "autoclose_quotes");
+ get(pAutoCorrectKeywordsChk, "autocorrect_keywords");
+ get(pUseExtendedTypesChk, "extendedtypes_enable");
+
+ LoadConfig();
+
+}
+
+SvxBasicIDEOptionsPage::~SvxBasicIDEOptionsPage()
+{
+}
+
+void SvxBasicIDEOptionsPage::LoadConfig()
+{
+ bool bProcClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get();
+ bool bExtended = officecfg::Office::BasicIDE::Autocomplete::UseExtended::get();
+ bool bCodeCompleteOn = officecfg::Office::BasicIDE::Autocomplete::CodeComplete::get();
+ bool bParenClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get();
+ bool bQuoteClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get();
+ bool bCorrect = officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::get();
+
+ pCodeCompleteChk->Check( bCodeCompleteOn );
+ pAutocloseProcChk->Check( bProcClose );
+ pAutocloseQuotesChk->Check( bQuoteClose );
+ pAutocloseParenChk->Check( bParenClose );
+ pAutoCorrectKeywordsChk->Check( bCorrect );
+ pUseExtendedTypesChk->Check( bExtended );
+}
+
+void SvxBasicIDEOptionsPage::SaveConfig()
+{
+ boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
+ officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::set( pAutocloseProcChk->IsChecked(), batch );
+ officecfg::Office::BasicIDE::Autocomplete::CodeComplete::set( pCodeCompleteChk->IsChecked(), batch );
+ officecfg::Office::BasicIDE::Autocomplete::UseExtended::set( pUseExtendedTypesChk->IsChecked(), batch );
+ officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::set( pAutocloseParenChk->IsChecked(), batch );
+ officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::set( pAutocloseQuotesChk->IsChecked(), batch );
+ officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::set( pAutoCorrectKeywordsChk->IsChecked(), batch );
+ batch->commit();
+}
+
+sal_Bool SvxBasicIDEOptionsPage::FillItemSet( SfxItemSet& /*rCoreSet*/ )
+{
+ sal_Bool bModified = sal_False;
+
+ if( pAutocloseProcChk->IsChecked() != pAutocloseProcChk->GetSavedValue() )
+ {
+ boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
+ officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::set( pAutocloseProcChk->IsChecked(), batch );
+ batch->commit();
+ bModified = sal_True;
+ }
+
+ if( pCodeCompleteChk->IsChecked() != pCodeCompleteChk->GetSavedValue() )
+ {
+ boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
+ officecfg::Office::BasicIDE::Autocomplete::CodeComplete::set( pCodeCompleteChk->IsChecked(), batch );
+ batch->commit();
+ bModified = sal_True;
+ }
+
+ if( pUseExtendedTypesChk->IsChecked() != pUseExtendedTypesChk->GetSavedValue() )
+ {
+ boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
+ officecfg::Office::BasicIDE::Autocomplete::UseExtended::set( pUseExtendedTypesChk->IsChecked(), batch );
+ batch->commit();
+ bModified = sal_True;
+ }
+
+ if( pAutocloseParenChk->IsChecked() != pAutocloseParenChk->GetSavedValue() )
+ {
+ boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
+ officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::set( pAutocloseParenChk->IsChecked(), batch );
+ batch->commit();
+ bModified = sal_True;
+ }
+
+ if( pAutocloseQuotesChk->IsChecked() != pAutocloseQuotesChk->GetSavedValue() )
+ {
+ boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
+ officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::set( pAutocloseQuotesChk->IsChecked(), batch );
+ batch->commit();
+ bModified = sal_True;
+ }
+
+ if( pAutoCorrectKeywordsChk->IsChecked() != pAutoCorrectKeywordsChk->GetSavedValue() )
+ {
+ boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
+ officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::set( pAutoCorrectKeywordsChk->IsChecked(), batch );
+ batch->commit();
+ bModified = sal_True;
+ }
+
+ return bModified;
+}
+
+void SvxBasicIDEOptionsPage::Reset( const SfxItemSet& /*rSet*/ )
+{
+ LoadConfig();
+ pCodeCompleteChk->SaveValue();
+
+ pAutocloseProcChk->SaveValue();
+
+ pAutocloseQuotesChk->SaveValue();
+
+ pAutocloseParenChk->SaveValue();
+
+ pAutoCorrectKeywordsChk->SaveValue();
+
+ pUseExtendedTypesChk->SaveValue();
+}
+
+SfxTabPage* SvxBasicIDEOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new SvxBasicIDEOptionsPage( pParent, rAttrSet ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optbasic.hxx b/cui/source/options/optbasic.hxx
new file mode 100644
index 000000000000..4265f57fc419
--- /dev/null
+++ b/cui/source/options/optbasic.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_OPTBASIC_HXX
+#define _SVX_OPTBASIC_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <sfx2/tabdlg.hxx>
+
+class SvxBasicIDEOptionsPage: public SfxTabPage
+{
+private:
+ CheckBox* pCodeCompleteChk;
+ CheckBox* pAutocloseProcChk;
+ CheckBox* pAutocloseParenChk;
+ CheckBox* pAutocloseQuotesChk;
+ CheckBox* pAutoCorrectKeywordsChk;
+ CheckBox* pUseExtendedTypesChk;
+
+ void LoadConfig();
+ void SaveConfig();
+
+public:
+ SvxBasicIDEOptionsPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxBasicIDEOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ virtual sal_Bool FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+
+#endif //_SVX_OPTBASIC_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index fde7cbdb4cc1..4fd3d8716a4e 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -51,6 +51,7 @@
#include "optupdt.hxx"
#include "personalization.hxx"
#include "treeopt.hxx"
+#include "optbasic.hxx"
#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
#include <com/sun/star/awt/ContainerWindowProvider.hpp>
@@ -319,6 +320,7 @@ SfxTabPage* CreateGeneralTabPage( sal_uInt16 nId, Window* pParent, const SfxItem
case RID_SVXPAGE_ONLINEUPDATE: fnCreate = &SvxOnlineUpdateTabPage::Create; break;
case RID_OPTPAGE_CHART_DEFCOLORS: fnCreate = &SvxDefaultColorOptPage::Create; break;
case RID_SVXPAGE_ABOUT_CONFIG: fnCreate = &CuiAboutConfigTabPage::Create; break;
+ case RID_SVXPAGE_BASICIDE_OPTIONS: fnCreate = &SvxBasicIDEOptionsPage::Create; break;
}
SfxTabPage* pRet = fnCreate ? (*fnCreate)( pParent, rSet ) : NULL;
@@ -349,6 +351,7 @@ static OptionsMapping_Impl const OptionsMap_Impl[] =
{ "ProductName", "Appearance", RID_SVXPAGE_COLORCONFIG },
{ "ProductName", "Accessibility", RID_SVXPAGE_ACCESSIBILITYCONFIG },
{ "ProductName", "Java", RID_SVXPAGE_OPTIONS_JAVA },
+ { "ProductName", "BasicIDEOptions", RID_SVXPAGE_BASICIDE_OPTIONS },
{ "ProductName", "OnlineUpdate", RID_SVXPAGE_ONLINEUPDATE },
{ "ProductName", "AboutConfig", RID_SVXPAGE_ABOUT_CONFIG },
{ "LanguageSettings", NULL, SID_LANGUAGE_OPTIONS },
diff --git a/cui/source/options/treeopt.src b/cui/source/options/treeopt.src
index e9de970b4f58..a8bb91fee139 100644
--- a/cui/source/options/treeopt.src
+++ b/cui/source/options/treeopt.src
@@ -100,6 +100,7 @@ Resource RID_OFADLG_OPTIONS_TREE_PAGES
< "Appearance" ; RID_SVXPAGE_COLORCONFIG ; > ;
< "Accessibility" ; RID_SVXPAGE_ACCESSIBILITYCONFIG ; > ;
< "Advanced" ; RID_SVXPAGE_OPTIONS_JAVA ; > ;
+ < "Basic IDE Options" ; RID_SVXPAGE_BASICIDE_OPTIONS ; > ;
< "Online Update" ; RID_SVXPAGE_ONLINEUPDATE ; > ;
< "Expert Config" ; RID_SVXPAGE_ABOUT_CONFIG ; > ;
};