LCOV - code coverage report
Current view: top level - cui/source/options - optbasic.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 74 0.0 %
Date: 2014-04-14 Functions: 0 10 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( 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 : }
      51             : 
      52           0 : void SvxBasicIDEOptionsPage::LoadConfig()
      53             : {
      54           0 :     bool bProcClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get();
      55           0 :     bool bExtended = officecfg::Office::BasicIDE::Autocomplete::UseExtended::get();
      56           0 :     bool bCodeCompleteOn = officecfg::Office::BasicIDE::Autocomplete::CodeComplete::get();
      57           0 :     bool bParenClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get();
      58           0 :     bool bQuoteClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get();
      59           0 :     bool bCorrect = officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::get();
      60             : 
      61           0 :     pCodeCompleteChk->Check( bCodeCompleteOn );
      62           0 :     pAutocloseProcChk->Check( bProcClose );
      63           0 :     pAutocloseQuotesChk->Check( bQuoteClose );
      64           0 :     pAutocloseParenChk->Check( bParenClose );
      65           0 :     pAutoCorrectChk->Check( bCorrect );
      66           0 :     pUseExtendedTypesChk->Check( bExtended );
      67           0 : }
      68             : 
      69           0 : bool SvxBasicIDEOptionsPage::FillItemSet( SfxItemSet& /*rCoreSet*/ )
      70             : {
      71           0 :     bool bModified = false;
      72           0 :     boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
      73             : 
      74           0 :     if( TriState(pAutocloseProcChk->IsChecked()) != pAutocloseProcChk->GetSavedValue() )
      75             :     {
      76           0 :         officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::set( pAutocloseProcChk->IsChecked(), batch );
      77           0 :         CodeCompleteOptions::SetProcedureAutoCompleteOn( pAutocloseProcChk->IsChecked() );
      78           0 :         bModified = true;
      79             :     }
      80             : 
      81           0 :     if( TriState(pCodeCompleteChk->IsChecked()) != pCodeCompleteChk->GetSavedValue() )
      82             :     {
      83             :         //boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
      84           0 :         officecfg::Office::BasicIDE::Autocomplete::CodeComplete::set( pCodeCompleteChk->IsChecked(), batch );
      85           0 :         CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() );
      86           0 :         bModified = true;
      87             :     }
      88             : 
      89           0 :     if( TriState(pUseExtendedTypesChk->IsChecked()) != pUseExtendedTypesChk->GetSavedValue() )
      90             :     {
      91           0 :         officecfg::Office::BasicIDE::Autocomplete::UseExtended::set( pUseExtendedTypesChk->IsChecked(), batch );
      92           0 :         CodeCompleteOptions::SetExtendedTypeDeclaration( pUseExtendedTypesChk->IsChecked() );
      93           0 :         bModified = true;
      94             :     }
      95             : 
      96           0 :     if( TriState(pAutocloseParenChk->IsChecked()) != pAutocloseParenChk->GetSavedValue() )
      97             :     {
      98           0 :         officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::set( pAutocloseParenChk->IsChecked(), batch );
      99           0 :         CodeCompleteOptions::SetAutoCloseParenthesisOn( pAutocloseParenChk->IsChecked() );
     100           0 :         bModified = true;
     101             :     }
     102             : 
     103           0 :     if( TriState(pAutocloseQuotesChk->IsChecked()) != pAutocloseQuotesChk->GetSavedValue() )
     104             :     {
     105           0 :         officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::set( pAutocloseQuotesChk->IsChecked(), batch );
     106           0 :         CodeCompleteOptions::SetAutoCloseQuotesOn( pAutocloseQuotesChk->IsChecked() );
     107           0 :         bModified = true;
     108             :     }
     109             : 
     110           0 :     if( TriState(pAutoCorrectChk->IsChecked()) != pAutoCorrectChk->GetSavedValue() )
     111             :     {
     112           0 :         officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::set( pAutoCorrectChk->IsChecked(), batch );
     113           0 :         CodeCompleteOptions::SetAutoCorrectOn( pAutoCorrectChk->IsChecked() );
     114           0 :         bModified = true;
     115             :     }
     116             : 
     117           0 :     if( bModified )
     118           0 :         batch->commit();
     119             : 
     120           0 :     return bModified;
     121             : }
     122             : 
     123           0 : void SvxBasicIDEOptionsPage::Reset( const SfxItemSet& /*rSet*/ )
     124             : {
     125           0 :     LoadConfig();
     126           0 :     pCodeCompleteChk->SaveValue();
     127             : 
     128           0 :     pAutocloseProcChk->SaveValue();
     129             : 
     130           0 :     pAutocloseQuotesChk->SaveValue();
     131             : 
     132           0 :     pAutocloseParenChk->SaveValue();
     133             : 
     134           0 :     pAutoCorrectChk->SaveValue();
     135             : 
     136           0 :     pUseExtendedTypesChk->SaveValue();
     137           0 : }
     138             : 
     139           0 : SfxTabPage* SvxBasicIDEOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
     140             : {
     141           0 :     return ( new SvxBasicIDEOptionsPage( pParent, rAttrSet ) );
     142             : }
     143             : 
     144           0 : void SvxBasicIDEOptionsPage::FillUserData()
     145             : {
     146           0 :     OUString aUserData;
     147           0 :     SetUserData( aUserData );
     148           0 : }
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10