LCOV - code coverage report
Current view: top level - cui/source/options - optbasic.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 84 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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"
      21             : #include <basic/codecompletecache.hxx>
      22             : #include <svtools/miscopt.hxx>
      23             : #include <iostream>
      24             : #include <officecfg/Office/BasicIDE.hxx>
      25             : #include <boost/shared_ptr.hpp>
      26             : #include <cuires.hrc>
      27             : 
      28           0 : SvxBasicIDEOptionsPage::SvxBasicIDEOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet )
      29           0 : : SfxTabPage(pParent, "OptBasicIDEPage", "cui/ui/optbasicidepage.ui", &rSet)
      30             : {
      31           0 :     SvtMiscOptions aMiscOpt;
      32           0 :     if( ! aMiscOpt.IsExperimentalMode() )
      33             :     {
      34           0 :         Disable();
      35             :     }
      36             : 
      37           0 :     get(pCodeCompleteChk, "codecomplete_enable");
      38           0 :     get(pAutocloseProcChk, "autoclose_proc");
      39           0 :     get(pAutocloseParenChk, "autoclose_paren");
      40           0 :     get(pAutocloseQuotesChk, "autoclose_quotes");
      41           0 :     get(pAutoCorrectChk, "autocorrect");
      42           0 :     get(pUseExtendedTypesChk, "extendedtypes_enable");
      43             : 
      44           0 :     LoadConfig();
      45             : 
      46           0 : }
      47             : 
      48           0 : SvxBasicIDEOptionsPage::~SvxBasicIDEOptionsPage()
      49             : {
      50           0 :     disposeOnce();
      51           0 : }
      52             : 
      53           0 : void SvxBasicIDEOptionsPage::dispose()
      54             : {
      55           0 :     pCodeCompleteChk.clear();
      56           0 :     pAutocloseProcChk.clear();
      57           0 :     pAutocloseParenChk.clear();
      58           0 :     pAutocloseQuotesChk.clear();
      59           0 :     pAutoCorrectChk.clear();
      60           0 :     pUseExtendedTypesChk.clear();
      61           0 :     SfxTabPage::dispose();
      62           0 : }
      63             : 
      64           0 : void SvxBasicIDEOptionsPage::LoadConfig()
      65             : {
      66           0 :     bool bProcClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get();
      67           0 :     bool bExtended = officecfg::Office::BasicIDE::Autocomplete::UseExtended::get();
      68           0 :     bool bCodeCompleteOn = officecfg::Office::BasicIDE::Autocomplete::CodeComplete::get();
      69           0 :     bool bParenClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get();
      70           0 :     bool bQuoteClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get();
      71           0 :     bool bCorrect = officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::get();
      72             : 
      73           0 :     pCodeCompleteChk->Check( bCodeCompleteOn );
      74           0 :     pAutocloseProcChk->Check( bProcClose );
      75           0 :     pAutocloseQuotesChk->Check( bQuoteClose );
      76           0 :     pAutocloseParenChk->Check( bParenClose );
      77           0 :     pAutoCorrectChk->Check( bCorrect );
      78           0 :     pUseExtendedTypesChk->Check( bExtended );
      79           0 : }
      80             : 
      81           0 : bool SvxBasicIDEOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
      82             : {
      83           0 :     bool bModified = false;
      84           0 :     std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
      85             : 
      86           0 :     if( pAutocloseProcChk->IsValueChangedFromSaved() )
      87             :     {
      88           0 :         officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::set( pAutocloseProcChk->IsChecked(), batch );
      89           0 :         CodeCompleteOptions::SetProcedureAutoCompleteOn( pAutocloseProcChk->IsChecked() );
      90           0 :         bModified = true;
      91             :     }
      92             : 
      93           0 :     if( pCodeCompleteChk->IsValueChangedFromSaved() )
      94             :     {
      95             :         //std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
      96           0 :         officecfg::Office::BasicIDE::Autocomplete::CodeComplete::set( pCodeCompleteChk->IsChecked(), batch );
      97           0 :         CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() );
      98           0 :         bModified = true;
      99             :     }
     100             : 
     101           0 :     if( pUseExtendedTypesChk->IsValueChangedFromSaved() )
     102             :     {
     103           0 :         officecfg::Office::BasicIDE::Autocomplete::UseExtended::set( pUseExtendedTypesChk->IsChecked(), batch );
     104           0 :         CodeCompleteOptions::SetExtendedTypeDeclaration( pUseExtendedTypesChk->IsChecked() );
     105           0 :         bModified = true;
     106             :     }
     107             : 
     108           0 :     if( pAutocloseParenChk->IsValueChangedFromSaved() )
     109             :     {
     110           0 :         officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::set( pAutocloseParenChk->IsChecked(), batch );
     111           0 :         CodeCompleteOptions::SetAutoCloseParenthesisOn( pAutocloseParenChk->IsChecked() );
     112           0 :         bModified = true;
     113             :     }
     114             : 
     115           0 :     if( pAutocloseQuotesChk->IsValueChangedFromSaved() )
     116             :     {
     117           0 :         officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::set( pAutocloseQuotesChk->IsChecked(), batch );
     118           0 :         CodeCompleteOptions::SetAutoCloseQuotesOn( pAutocloseQuotesChk->IsChecked() );
     119           0 :         bModified = true;
     120             :     }
     121             : 
     122           0 :     if( pAutoCorrectChk->IsValueChangedFromSaved() )
     123             :     {
     124           0 :         officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::set( pAutoCorrectChk->IsChecked(), batch );
     125           0 :         CodeCompleteOptions::SetAutoCorrectOn( pAutoCorrectChk->IsChecked() );
     126           0 :         bModified = true;
     127             :     }
     128             : 
     129           0 :     if( bModified )
     130           0 :         batch->commit();
     131             : 
     132           0 :     return bModified;
     133             : }
     134             : 
     135           0 : void SvxBasicIDEOptionsPage::Reset( const SfxItemSet* /*rSet*/ )
     136             : {
     137           0 :     LoadConfig();
     138           0 :     pCodeCompleteChk->SaveValue();
     139             : 
     140           0 :     pAutocloseProcChk->SaveValue();
     141             : 
     142           0 :     pAutocloseQuotesChk->SaveValue();
     143             : 
     144           0 :     pAutocloseParenChk->SaveValue();
     145             : 
     146           0 :     pAutoCorrectChk->SaveValue();
     147             : 
     148           0 :     pUseExtendedTypesChk->SaveValue();
     149           0 : }
     150             : 
     151           0 : VclPtr<SfxTabPage> SvxBasicIDEOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
     152             : {
     153           0 :     return VclPtr<SvxBasicIDEOptionsPage>::Create( pParent, *rAttrSet );
     154             : }
     155             : 
     156           0 : void SvxBasicIDEOptionsPage::FillUserData()
     157             : {
     158           0 :     OUString aUserData;
     159           0 :     SetUserData( aUserData );
     160           0 : }
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11