LibreOffice Module cui (master) 1
optbasic.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "optbasic.hxx"
22#include <officecfg/Office/BasicIDE.hxx>
23
25 : SfxTabPage(pPage, pController, "cui/ui/optbasicidepage.ui", "OptBasicIDEPage", &rSet)
26 , m_xCodeCompleteChk(m_xBuilder->weld_check_button("codecomplete_enable"))
27 , m_xAutocloseProcChk(m_xBuilder->weld_check_button("autoclose_proc"))
28 , m_xAutocloseParenChk(m_xBuilder->weld_check_button("autoclose_paren"))
29 , m_xAutocloseQuotesChk(m_xBuilder->weld_check_button("autoclose_quotes"))
30 , m_xAutoCorrectChk(m_xBuilder->weld_check_button("autocorrect"))
31 , m_xUseExtendedTypesChk(m_xBuilder->weld_check_button("extendedtypes_enable"))
32{
33 LoadConfig();
34}
35
37{
38}
39
41{
42 m_xCodeCompleteChk->set_active( officecfg::Office::BasicIDE::Autocomplete::CodeComplete::get() );
43 m_xCodeCompleteChk->set_sensitive( !officecfg::Office::BasicIDE::Autocomplete::CodeComplete::isReadOnly() );
44 m_xAutocloseProcChk->set_active( officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get() );
45 m_xAutocloseProcChk->set_sensitive( !officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::isReadOnly() );
46 m_xAutocloseQuotesChk->set_active( officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get() );
47 m_xAutocloseQuotesChk->set_sensitive( !officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::isReadOnly() );
48 m_xAutocloseParenChk->set_active( officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get() );
49 m_xAutocloseParenChk->set_sensitive( !officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::isReadOnly() );
50 m_xAutoCorrectChk->set_active( officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::get() );
51 m_xAutoCorrectChk->set_sensitive( !officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::isReadOnly() );
52 m_xUseExtendedTypesChk->set_active( officecfg::Office::BasicIDE::Autocomplete::UseExtended::get() );
53 m_xUseExtendedTypesChk->set_sensitive( !officecfg::Office::BasicIDE::Autocomplete::UseExtended::isReadOnly() );
54}
55
57{
58 bool bModified = false;
59 std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
60
61 if( m_xAutocloseProcChk->get_state_changed_from_saved() )
62 {
63 officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::set( m_xAutocloseProcChk->get_active(), batch );
65 bModified = true;
66 }
67
68 if( m_xCodeCompleteChk->get_state_changed_from_saved() )
69 {
70 //std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
71 officecfg::Office::BasicIDE::Autocomplete::CodeComplete::set( m_xCodeCompleteChk->get_active(), batch );
73 bModified = true;
74 }
75
76 if( m_xUseExtendedTypesChk->get_state_changed_from_saved() )
77 {
78 officecfg::Office::BasicIDE::Autocomplete::UseExtended::set( m_xUseExtendedTypesChk->get_active(), batch );
80 bModified = true;
81 }
82
83 if( m_xAutocloseParenChk->get_state_changed_from_saved() )
84 {
85 officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::set( m_xAutocloseParenChk->get_active(), batch );
87 bModified = true;
88 }
89
90 if( m_xAutocloseQuotesChk->get_state_changed_from_saved() )
91 {
92 officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::set( m_xAutocloseQuotesChk->get_active(), batch );
94 bModified = true;
95 }
96
97 if( m_xAutoCorrectChk->get_state_changed_from_saved() )
98 {
99 officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::set( m_xAutoCorrectChk->get_active(), batch );
101 bModified = true;
102 }
103
104 if( bModified )
105 batch->commit();
106
107 return bModified;
108}
109
111{
112 LoadConfig();
113 m_xCodeCompleteChk->save_state();
114 m_xAutocloseProcChk->save_state();
115 m_xAutocloseQuotesChk->save_state();
116 m_xAutocloseParenChk->save_state();
117 m_xAutoCorrectChk->save_state();
118 m_xUseExtendedTypesChk->save_state();
119}
120
121std::unique_ptr<SfxTabPage> SvxBasicIDEOptionsPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet )
122{
123 return std::make_unique<SvxBasicIDEOptionsPage>(pPage, pController, *rAttrSet);
124}
125
127{
128 SetUserData( OUString() );
129}
130
131/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void SetAutoCloseQuotesOn(bool b)
static void SetAutoCloseParenthesisOn(bool b)
static void SetProcedureAutoCompleteOn(bool b)
static void SetAutoCorrectOn(bool b)
static void SetCodeCompleteOn(bool b)
static void SetExtendedTypeDeclaration(bool b)
void SetUserData(const OUString &rString)
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: optbasic.cxx:56
std::unique_ptr< weld::CheckButton > m_xCodeCompleteChk
Definition: optbasic.hxx:27
std::unique_ptr< weld::CheckButton > m_xAutoCorrectChk
Definition: optbasic.hxx:31
std::unique_ptr< weld::CheckButton > m_xAutocloseProcChk
Definition: optbasic.hxx:28
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optbasic.cxx:121
virtual ~SvxBasicIDEOptionsPage() override
Definition: optbasic.cxx:36
std::unique_ptr< weld::CheckButton > m_xAutocloseQuotesChk
Definition: optbasic.hxx:30
virtual void Reset(const SfxItemSet *rSet) override
Definition: optbasic.cxx:110
virtual void FillUserData() override
Definition: optbasic.cxx:126
std::unique_ptr< weld::CheckButton > m_xAutocloseParenChk
Definition: optbasic.hxx:29
SvxBasicIDEOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: optbasic.cxx:24
std::unique_ptr< weld::CheckButton > m_xUseExtendedTypesChk
Definition: optbasic.hxx:32
static std::shared_ptr< ConfigurationChanges > create()
static SfxItemSet & rSet