LCOV - code coverage report
Current view: top level - editeng/source/misc - acorrcfg.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 352 0.0 %
Date: 2014-04-14 Functions: 0 19 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 <comphelper/processfactory.hxx>
      21             : #include <editeng/acorrcfg.hxx>
      22             : #include <tools/debug.hxx>
      23             : #include <tools/urlobj.hxx>
      24             : #include <ucbhelper/content.hxx>
      25             : #include <unotools/pathoptions.hxx>
      26             : #include <unotools/ucbhelper.hxx>
      27             : #include <svl/urihelper.hxx>
      28             : 
      29             : #include <editeng/svxacorr.hxx>
      30             : #include <com/sun/star/uno/Any.hxx>
      31             : #include <com/sun/star/uno/Sequence.hxx>
      32             : 
      33             : #include <rtl/instance.hxx>
      34             : 
      35             : using namespace utl;
      36             : using namespace com::sun::star;
      37             : using namespace com::sun::star::uno;
      38             : 
      39             : 
      40           0 : SvxAutoCorrCfg::SvxAutoCorrCfg() :
      41             :     aBaseConfig(*this),
      42             :     aSwConfig(*this),
      43             :     bFileRel(true),
      44             :     bNetRel(true),
      45             :     bAutoTextTip(true),
      46             :     bAutoTextPreview(false),
      47             :     bAutoFmtByInput(true),
      48           0 :     bSearchInAllCategories(false)
      49             : {
      50           0 :     SvtPathOptions aPathOpt;
      51           0 :     OUString sSharePath, sUserPath, sAutoPath( aPathOpt.GetAutoCorrectPath() );
      52             : 
      53           0 :     sSharePath = sAutoPath.getToken(0, ';');
      54           0 :     sUserPath = sAutoPath.getToken(1, ';');
      55             : 
      56             :     //fdo#67743 ensure the userdir exists so that any later attempt to copy the
      57             :     //shared autocorrect file into the user dir will succeed
      58           0 :     ::ucbhelper::Content aContent;
      59           0 :     Reference < ucb::XCommandEnvironment > xEnv;
      60           0 :     ::utl::UCBContentHelper::ensureFolder(comphelper::getProcessComponentContext(), xEnv, sUserPath, aContent);
      61             : 
      62           0 :     OUString* pS = &sSharePath;
      63           0 :     for( sal_uInt16 n = 0; n < 2; ++n, pS = &sUserPath )
      64             :     {
      65           0 :         INetURLObject aPath( *pS );
      66           0 :         aPath.insertName(OUString("acor"));
      67           0 :         *pS = aPath.GetMainURL(INetURLObject::DECODE_TO_IURI);
      68           0 :     }
      69           0 :     pAutoCorrect = new SvxAutoCorrect( sSharePath, sUserPath );
      70             : 
      71           0 :     aBaseConfig.Load(true);
      72           0 :     aSwConfig.Load(true);
      73           0 : }
      74             : 
      75           0 : SvxAutoCorrCfg::~SvxAutoCorrCfg()
      76             : {
      77           0 :     delete pAutoCorrect;
      78           0 : }
      79             : 
      80           0 : void SvxAutoCorrCfg::SetAutoCorrect( SvxAutoCorrect* pNew )
      81             : {
      82           0 :     if( pNew && pNew != pAutoCorrect )
      83             :     {
      84           0 :         if( pAutoCorrect->GetFlags() != pNew->GetFlags() )
      85             :         {
      86           0 :             aBaseConfig.SetModified();
      87           0 :             aSwConfig.SetModified();
      88             :         }
      89           0 :         delete pAutoCorrect;
      90           0 :         pAutoCorrect = pNew;
      91             :     }
      92           0 : }
      93             : 
      94           0 : Sequence<OUString>  SvxBaseAutoCorrCfg::GetPropertyNames()
      95             : {
      96             :     static const char* aPropNames[] =
      97             :     {
      98             :         "Exceptions/TwoCapitalsAtStart",        //  0
      99             :         "Exceptions/CapitalAtStartSentence",    //  1
     100             :         "UseReplacementTable",                  //  2
     101             :         "TwoCapitalsAtStart",                   //  3
     102             :         "CapitalAtStartSentence",               //  4
     103             :         "ChangeUnderlineWeight",                //  5
     104             :         "SetInetAttribute",                     //  6
     105             :         "ChangeOrdinalNumber",                  //  7
     106             :         "AddNonBreakingSpace",                  //  8
     107             :         "ChangeDash",                           //  9
     108             :         "RemoveDoubleSpaces",                   // 10
     109             :         "ReplaceSingleQuote",                   // 11
     110             :         "SingleQuoteAtStart",                   // 12
     111             :         "SingleQuoteAtEnd",                     // 13
     112             :         "ReplaceDoubleQuote",                   // 14
     113             :         "DoubleQuoteAtStart",                   // 15
     114             :         "DoubleQuoteAtEnd",                     // 16
     115             :         "CorrectAccidentalCapsLock"             // 17
     116             :     };
     117           0 :     const int nCount = 18;
     118           0 :     Sequence<OUString> aNames(nCount);
     119           0 :     OUString* pNames = aNames.getArray();
     120           0 :     for(int i = 0; i < nCount; i++)
     121           0 :         pNames[i] = OUString::createFromAscii(aPropNames[i]);
     122           0 :     return aNames;
     123             : }
     124             : 
     125           0 : void SvxBaseAutoCorrCfg::Load(bool bInit)
     126             : {
     127           0 :     Sequence<OUString> aNames = GetPropertyNames();
     128           0 :     Sequence<Any> aValues = GetProperties(aNames);
     129           0 :     if(bInit)
     130           0 :         EnableNotification(aNames);
     131           0 :     const Any* pValues = aValues.getConstArray();
     132             :     DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
     133           0 :     if(aValues.getLength() == aNames.getLength())
     134             :     {
     135           0 :         long nFlags = 0;        // default all off
     136           0 :         sal_Int32 nTemp = 0;
     137           0 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     138             :         {
     139           0 :             if(pValues[nProp].hasValue())
     140             :             {
     141           0 :                 switch(nProp)
     142             :                 {
     143             :                     case  0:
     144           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     145           0 :                             nFlags |= SaveWordCplSttLst;
     146           0 :                     break;//"Exceptions/TwoCapitalsAtStart",
     147             :                     case  1:
     148           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     149           0 :                             nFlags |= SaveWordWrdSttLst;
     150           0 :                     break;//"Exceptions/CapitalAtStartSentence",
     151             :                     case  2:
     152           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     153           0 :                             nFlags |= Autocorrect;
     154           0 :                     break;//"UseReplacementTable",
     155             :                     case  3:
     156           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     157           0 :                             nFlags |= CptlSttWrd;
     158           0 :                     break;//"TwoCapitalsAtStart",
     159             :                     case  4:
     160           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     161           0 :                             nFlags |= CptlSttSntnc;
     162           0 :                     break;//"CapitalAtStartSentence",
     163             :                     case  5:
     164           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     165           0 :                             nFlags |= ChgWeightUnderl;
     166           0 :                     break;//"ChangeUnderlineWeight",
     167             :                     case  6:
     168           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     169           0 :                             nFlags |= SetINetAttr;
     170           0 :                     break;//"SetInetAttribute",
     171             :                     case  7:
     172           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     173           0 :                             nFlags |= ChgOrdinalNumber;
     174           0 :                     break;//"ChangeOrdinalNumber",
     175             :                     case 8:
     176           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     177           0 :                              nFlags |= AddNonBrkSpace;
     178           0 :                     break;//"AddNonBreakingSpace"
     179             :                     case  9:
     180           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     181           0 :                             nFlags |= ChgToEnEmDash;
     182           0 :                     break;//"ChangeDash",
     183             :                     case 10:
     184           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     185           0 :                             nFlags |= IgnoreDoubleSpace;
     186           0 :                     break;//"RemoveDoubleSpaces",
     187             :                     case 11:
     188           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     189           0 :                             nFlags |= ChgSglQuotes;
     190           0 :                     break;//"ReplaceSingleQuote",
     191             :                     case 12:
     192           0 :                         pValues[nProp] >>= nTemp;
     193             :                         rParent.pAutoCorrect->SetStartSingleQuote(
     194           0 :                             sal::static_int_cast< sal_Unicode >( nTemp ) );
     195           0 :                     break;//"SingleQuoteAtStart",
     196             :                     case 13:
     197           0 :                         pValues[nProp] >>= nTemp;
     198             :                         rParent.pAutoCorrect->SetEndSingleQuote(
     199           0 :                             sal::static_int_cast< sal_Unicode >( nTemp ) );
     200           0 :                     break;//"SingleQuoteAtEnd",
     201             :                     case 14:
     202           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     203           0 :                             nFlags |= ChgQuotes;
     204           0 :                     break;//"ReplaceDoubleQuote",
     205             :                     case 15:
     206           0 :                         pValues[nProp] >>= nTemp;
     207             :                         rParent.pAutoCorrect->SetStartDoubleQuote(
     208           0 :                             sal::static_int_cast< sal_Unicode >( nTemp ) );
     209           0 :                     break;//"DoubleQuoteAtStart",
     210             :                     case 16:
     211           0 :                         pValues[nProp] >>= nTemp;
     212             :                         rParent.pAutoCorrect->SetEndDoubleQuote(
     213           0 :                             sal::static_int_cast< sal_Unicode >( nTemp ) );
     214           0 :                     break;//"DoubleQuoteAtEnd"
     215             :                     case 17:
     216           0 :                         if(*(sal_Bool*)pValues[nProp].getValue())
     217           0 :                             nFlags |= CorrectCapsLock;
     218           0 :                     break;//"CorrectAccidentalCapsLock"
     219             :                 }
     220             :             }
     221             :         }
     222           0 :         if( nFlags )
     223           0 :             rParent.pAutoCorrect->SetAutoCorrFlag( nFlags, true );
     224           0 :         rParent.pAutoCorrect->SetAutoCorrFlag( ( 0xffff & ~nFlags ), false );
     225             : 
     226           0 :     }
     227           0 : }
     228             : 
     229           0 : SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rPar) :
     230             :     utl::ConfigItem(OUString("Office.Common/AutoCorrect")),
     231           0 :     rParent(rPar)
     232             : {
     233           0 : }
     234             : 
     235           0 : SvxBaseAutoCorrCfg::~SvxBaseAutoCorrCfg()
     236             : {
     237           0 : }
     238             : 
     239           0 : void SvxBaseAutoCorrCfg::Commit()
     240             : {
     241           0 :     Sequence<OUString> aNames( GetPropertyNames() );
     242             : 
     243           0 :     Sequence<Any> aValues(aNames.getLength());
     244           0 :     Any* pValues = aValues.getArray();
     245             : 
     246           0 :     const Type& rType = ::getBooleanCppuType();
     247             :     sal_Bool bVal;
     248           0 :     const long nFlags = rParent.pAutoCorrect->GetFlags();
     249           0 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     250             :     {
     251           0 :         switch(nProp)
     252             :         {
     253             :             case  0:
     254           0 :                 bVal = 0 != (nFlags & SaveWordCplSttLst);
     255           0 :                 pValues[nProp].setValue(&bVal, rType);
     256           0 :             break;//"Exceptions/TwoCapitalsAtStart",
     257             :             case  1:
     258           0 :                 bVal = 0 != (nFlags & SaveWordWrdSttLst);
     259           0 :                 pValues[nProp].setValue(&bVal, rType);
     260           0 :             break;//"Exceptions/CapitalAtStartSentence",
     261             :             case  2:
     262           0 :                 bVal = 0 != (nFlags & Autocorrect);
     263           0 :                 pValues[nProp].setValue(&bVal, rType);
     264           0 :             break;//"UseReplacementTable",
     265             :             case  3:
     266           0 :                 bVal = 0 != (nFlags & CptlSttWrd);
     267           0 :                 pValues[nProp].setValue(&bVal, rType);
     268           0 :             break;//"TwoCapitalsAtStart",
     269             :             case  4:
     270           0 :                 bVal = 0 != (nFlags & CptlSttSntnc);
     271           0 :                 pValues[nProp].setValue(&bVal, rType);
     272           0 :             break;//"CapitalAtStartSentence",
     273             :             case  5:
     274           0 :                 bVal = 0 != (nFlags & ChgWeightUnderl);
     275           0 :                 pValues[nProp].setValue(&bVal, rType);
     276           0 :             break;//"ChangeUnderlineWeight",
     277             :             case  6:
     278           0 :                 bVal = 0 != (nFlags & SetINetAttr);
     279           0 :                 pValues[nProp].setValue(&bVal, rType);
     280           0 :             break;//"SetInetAttribute",
     281             :             case  7:
     282           0 :                 bVal = 0 != (nFlags & ChgOrdinalNumber);
     283           0 :                 pValues[nProp].setValue(&bVal, rType);
     284           0 :             break;//"ChangeOrdinalNumber",
     285             :             case 8:
     286           0 :                 bVal = 0 != (nFlags & AddNonBrkSpace);
     287           0 :                 pValues[nProp].setValue(&bVal, rType);
     288           0 :             break;//"AddNonBreakingSpace"
     289             :             case  9:
     290           0 :                 bVal = 0 != (nFlags & ChgToEnEmDash);
     291           0 :                 pValues[nProp].setValue(&bVal, rType);
     292           0 :             break;//"ChangeDash",
     293             :             case 10:
     294           0 :                 bVal = 0 != (nFlags & IgnoreDoubleSpace);
     295           0 :                 pValues[nProp].setValue(&bVal, rType);
     296           0 :             break;//"RemoveDoubleSpaces",
     297             :             case 11:
     298           0 :                 bVal = 0 != (nFlags & ChgSglQuotes);
     299           0 :                 pValues[nProp].setValue(&bVal, rType);
     300           0 :             break;//"ReplaceSingleQuote",
     301             :             case 12:
     302           0 :                 pValues[nProp] <<= (sal_Int32)rParent.pAutoCorrect->GetStartSingleQuote();
     303           0 :             break;//"SingleQuoteAtStart",
     304             :             case 13:
     305           0 :                 pValues[nProp] <<= (sal_Int32) rParent.pAutoCorrect->GetEndSingleQuote();
     306           0 :             break;//"SingleQuoteAtEnd",
     307             :             case 14:
     308           0 :                 bVal = 0 != (nFlags & ChgQuotes);
     309           0 :                 pValues[nProp].setValue(&bVal, rType);
     310           0 :             break;//"ReplaceDoubleQuote",
     311             :             case 15:
     312           0 :                 pValues[nProp] <<= (sal_Int32) rParent.pAutoCorrect->GetStartDoubleQuote();
     313           0 :             break;//"DoubleQuoteAtStart",
     314             :             case 16:
     315           0 :                 pValues[nProp] <<= (sal_Int32) rParent.pAutoCorrect->GetEndDoubleQuote();
     316           0 :             break;//"DoubleQuoteAtEnd"
     317             :             case 17:
     318           0 :                 bVal = 0 != (nFlags & CorrectCapsLock);
     319           0 :                 pValues[nProp].setValue(&bVal, rType);
     320           0 :             break;//"CorrectAccidentalCapsLock"
     321             :         }
     322             :     }
     323           0 :     PutProperties(aNames, aValues);
     324           0 : }
     325             : 
     326           0 : void SvxBaseAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */)
     327             : {
     328           0 :     Load(false);
     329           0 : }
     330             : 
     331           0 : Sequence<OUString>  SvxSwAutoCorrCfg::GetPropertyNames()
     332             : {
     333             :     static const char* aPropNames[] =
     334             :     {
     335             :         "Text/FileLinks",                             // 0
     336             :         "Text/InternetLinks",                         // 1
     337             :         "Text/ShowPreview",                           // 2
     338             :         "Text/ShowToolTip",                           // 3
     339             :         "Text/SearchInAllCategories",                                   // 4
     340             :         "Format/Option/UseReplacementTable",                            // 5
     341             :         "Format/Option/TwoCapitalsAtStart",                             // 6
     342             :         "Format/Option/CapitalAtStartSentence",                         // 7
     343             :         "Format/Option/ChangeUnderlineWeight",                          // 8
     344             :         "Format/Option/SetInetAttribute",                               // 9
     345             :         "Format/Option/ChangeOrdinalNumber",                            //10
     346             :         "Format/Option/AddNonBreakingSpace",                            //11
     347             :         "Format/Option/ChangeDash",                                     //12
     348             :         "Format/Option/DelEmptyParagraphs",                             //13
     349             :         "Format/Option/ReplaceUserStyle",                               //14
     350             :         "Format/Option/ChangeToBullets/Enable",                         //15
     351             :         "Format/Option/ChangeToBullets/SpecialCharacter/Char",          //16
     352             :         "Format/Option/ChangeToBullets/SpecialCharacter/Font",          //17
     353             :         "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",    //18
     354             :         "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",   //19
     355             :         "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",     //20
     356             :         "Format/Option/CombineParagraphs",                              //21
     357             :         "Format/Option/CombineValue",                                   //22
     358             :         "Format/Option/DelSpacesAtStartEnd",                            //23
     359             :         "Format/Option/DelSpacesBetween",                               //24
     360             :         "Format/ByInput/Enable",                                        //25
     361             :         "Format/ByInput/ChangeDash",                                    //26
     362             :         "Format/ByInput/ApplyNumbering/Enable",                         //27
     363             :         "Format/ByInput/ChangeToBorders",                               //28
     364             :         "Format/ByInput/ChangeToTable",                                 //29
     365             :         "Format/ByInput/ReplaceStyle",                                  //30
     366             :         "Format/ByInput/DelSpacesAtStartEnd",                           //31
     367             :         "Format/ByInput/DelSpacesBetween",                              //32
     368             :         "Completion/Enable",                                            //33
     369             :         "Completion/MinWordLen",                                        //34
     370             :         "Completion/MaxListLen",                                        //35
     371             :         "Completion/CollectWords",                                      //36
     372             :         "Completion/EndlessList",                                       //37
     373             :         "Completion/AppendBlank",                                       //38
     374             :         "Completion/ShowAsTip",                                         //39
     375             :         "Completion/AcceptKey",                                         //40
     376             :         "Completion/KeepList",                                          //41
     377             :         "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",          //42
     378             :         "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",          //43
     379             :         "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",    //44
     380             :         "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",   //45
     381             :         "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch"      //46
     382             :     };
     383           0 :     const int nCount = 47;
     384           0 :     Sequence<OUString> aNames(nCount);
     385           0 :     OUString* pNames = aNames.getArray();
     386           0 :     for(int i = 0; i < nCount; i++)
     387           0 :         pNames[i] = OUString::createFromAscii(aPropNames[i]);
     388           0 :     return aNames;
     389             : }
     390             : 
     391           0 : void SvxSwAutoCorrCfg::Load(bool bInit)
     392             : {
     393           0 :     Sequence<OUString> aNames = GetPropertyNames();
     394           0 :     Sequence<Any> aValues = GetProperties(aNames);
     395           0 :     if(bInit)
     396           0 :         EnableNotification(aNames);
     397           0 :     const Any* pValues = aValues.getConstArray();
     398             :     DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
     399           0 :     if(aValues.getLength() == aNames.getLength())
     400             :     {
     401           0 :         SvxSwAutoFmtFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
     402           0 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     403             :         {
     404           0 :             if(pValues[nProp].hasValue())
     405             :             {
     406           0 :                 switch(nProp)
     407             :                 {
     408           0 :                     case   0: rParent.bFileRel = *(sal_Bool*)pValues[nProp].getValue(); break; // "Text/FileLinks",
     409           0 :                     case   1: rParent.bNetRel = *(sal_Bool*)pValues[nProp].getValue();  break; // "Text/InternetLinks",
     410           0 :                     case   2: rParent.bAutoTextPreview = *(sal_Bool*)pValues[nProp].getValue(); break; // "Text/ShowPreview",
     411           0 :                     case   3: rParent.bAutoTextTip = *(sal_Bool*)pValues[nProp].getValue();  break; // "Text/ShowToolTip",
     412           0 :                     case   4: rParent.bSearchInAllCategories = *(sal_Bool*)pValues[nProp].getValue();  break; //"Text/SearchInAllCategories"
     413           0 :                     case   5: rSwFlags.bAutoCorrect = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/UseReplacementTable",
     414           0 :                     case   6: rSwFlags.bCptlSttSntnc = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/TwoCapitalsAtStart",
     415           0 :                     case   7: rSwFlags.bCptlSttWrd = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/CapitalAtStartSentence",
     416           0 :                     case   8: rSwFlags.bChgWeightUnderl = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeUnderlineWeight",
     417           0 :                     case   9: rSwFlags.bSetINetAttr = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/SetInetAttribute",
     418           0 :                     case  10: rSwFlags.bChgOrdinalNumber = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeOrdinalNumber",
     419           0 :                     case  11: rSwFlags.bAddNonBrkSpace = *(sal_Bool*)pValues[nProp].getValue( ); break; // "Format/Option/AddNonBreakingSpace",
     420             : // it doesn't exist here - the common flags are used for that -> LM
     421             : //                  case  12: rSwFlags.bChgToEnEmDash = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeDash",
     422           0 :                     case  13: rSwFlags.bDelEmptyNode = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelEmptyParagraphs",
     423           0 :                     case  14: rSwFlags.bChgUserColl = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ReplaceUserStyle",
     424           0 :                     case  15: rSwFlags.bChgEnumNum = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeToBullets/Enable",
     425             :                     case  16:
     426             :                     {
     427           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     428             :                         rSwFlags.cBullet =
     429           0 :                             sal::static_int_cast< sal_Unicode >(nVal);
     430             :                     }
     431           0 :                     break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
     432             :                     case  17:
     433             :                     {
     434           0 :                         OUString sTemp; pValues[nProp] >>= sTemp;
     435           0 :                         rSwFlags.aBulletFont.SetName(sTemp);
     436             :                     }
     437           0 :                     break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
     438             :                     case  18:
     439             :                     {
     440           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     441           0 :                         rSwFlags.aBulletFont.SetFamily(FontFamily(nVal));
     442             :                     }
     443           0 :                     break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
     444             :                     case  19:
     445             :                     {
     446           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     447           0 :                         rSwFlags.aBulletFont.SetCharSet(rtl_TextEncoding(nVal));
     448             :                     }
     449           0 :                     break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
     450             :                     case  20:
     451             :                     {
     452           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     453           0 :                         rSwFlags.aBulletFont.SetPitch(FontPitch(nVal));
     454             :                     }
     455           0 :                     break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
     456           0 :                     case  21: rSwFlags.bRightMargin = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/CombineParagraphs",
     457             :                     case  22:
     458             :                     {
     459           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     460             :                         rSwFlags.nRightMargin =
     461           0 :                             sal::static_int_cast< sal_uInt8 >(nVal);
     462             :                     }
     463           0 :                     break; // "Format/Option/CombineValue",
     464           0 :                     case  23: rSwFlags.bAFmtDelSpacesAtSttEnd =  *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesAtStartEnd",
     465           0 :                     case  24: rSwFlags.bAFmtDelSpacesBetweenLines = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesBetween",
     466           0 :                     case  25: rParent.bAutoFmtByInput = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/Enable",
     467           0 :                     case  26: rSwFlags.bChgToEnEmDash = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeDash",
     468           0 :                     case  27: rSwFlags.bSetNumRule = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ApplyNumbering/Enable",
     469           0 :                     case  28: rSwFlags.bSetBorder = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeToBorders",
     470           0 :                     case  29: rSwFlags.bCreateTable = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeToTable",
     471           0 :                     case  30: rSwFlags.bReplaceStyles =  *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ReplaceStyle",
     472           0 :                     case  31: rSwFlags.bAFmtByInpDelSpacesAtSttEnd =  *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/DelSpacesAtStartEnd",
     473           0 :                     case  32: rSwFlags.bAFmtByInpDelSpacesBetweenLines = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/DelSpacesBetween",
     474           0 :                     case  33: rSwFlags.bAutoCompleteWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/Enable",
     475             :                     case  34:
     476             :                     {
     477           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     478             :                         rSwFlags.nAutoCmpltWordLen =
     479           0 :                             sal::static_int_cast< sal_uInt16 >(nVal);
     480             :                     }
     481           0 :                     break; // "Completion/MinWordLen",
     482             :                     case  35:
     483             :                     {
     484           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     485             :                         rSwFlags.nAutoCmpltListLen =
     486           0 :                             sal::static_int_cast< sal_uInt16 >(nVal);
     487             :                     }
     488           0 :                     break; // "Completion/MaxListLen",
     489           0 :                     case  36: rSwFlags.bAutoCmpltCollectWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/CollectWords",
     490           0 :                     case  37: rSwFlags.bAutoCmpltEndless = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/EndlessList",
     491           0 :                     case  38: rSwFlags.bAutoCmpltAppendBlanc = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/AppendBlank",
     492           0 :                     case  39: rSwFlags.bAutoCmpltShowAsTip = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/ShowAsTip",
     493             :                     case  40:
     494             :                     {
     495           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     496             :                         rSwFlags.nAutoCmpltExpandKey =
     497           0 :                             sal::static_int_cast< sal_uInt16 >(nVal);
     498             :                     }
     499           0 :                     break; // "Completion/AcceptKey"
     500           0 :                     case 41 :rSwFlags.bAutoCmpltKeepList = *(sal_Bool*)pValues[nProp].getValue(); break;//"Completion/KeepList"
     501             :                     case 42 :
     502             :                     {
     503           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     504             :                         rSwFlags.cByInputBullet =
     505           0 :                             sal::static_int_cast< sal_Unicode >(nVal);
     506             :                     }
     507           0 :                     break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
     508             :                     case 43 :
     509             :                     {
     510           0 :                         OUString sTemp; pValues[nProp] >>= sTemp;
     511           0 :                         rSwFlags.aByInputBulletFont.SetName(sTemp);
     512             :                     }
     513           0 :                     break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
     514             :                     case 44 :
     515             :                     {
     516           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     517           0 :                         rSwFlags.aByInputBulletFont.SetFamily(FontFamily(nVal));
     518             :                     }
     519           0 :                     break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
     520             :                     case 45 :
     521             :                     {
     522           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     523           0 :                         rSwFlags.aByInputBulletFont.SetCharSet(rtl_TextEncoding(nVal));
     524             :                     }
     525           0 :                     break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
     526             :                     case 46 :
     527             :                     {
     528           0 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     529           0 :                         rSwFlags.aByInputBulletFont.SetPitch(FontPitch(nVal));
     530             :                     }
     531           0 :                     break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
     532             :                 }
     533             :             }
     534             :         }
     535           0 :     }
     536           0 : }
     537             : 
     538           0 : SvxSwAutoCorrCfg::SvxSwAutoCorrCfg(SvxAutoCorrCfg& rPar) :
     539             :     utl::ConfigItem(OUString("Office.Writer/AutoFunction")),
     540           0 :     rParent(rPar)
     541             : {
     542           0 : }
     543             : 
     544           0 : SvxSwAutoCorrCfg::~SvxSwAutoCorrCfg()
     545             : {
     546           0 : }
     547             : 
     548           0 : void SvxSwAutoCorrCfg::Commit()
     549             : {
     550           0 :     Sequence<OUString> aNames = GetPropertyNames();
     551             : 
     552           0 :     Sequence<Any> aValues(aNames.getLength());
     553           0 :     Any* pValues = aValues.getArray();
     554             : 
     555           0 :     const Type& rType = ::getBooleanCppuType();
     556             :     sal_Bool bVal;
     557           0 :     SvxSwAutoFmtFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
     558           0 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     559             :     {
     560           0 :         switch(nProp)
     561             :         {
     562           0 :             case   0: pValues[nProp].setValue(&rParent.bFileRel, rType); break; // "Text/FileLinks",
     563           0 :             case   1: pValues[nProp].setValue(&rParent.bNetRel, rType);   break; // "Text/InternetLinks",
     564           0 :             case   2: pValues[nProp].setValue(&rParent.bAutoTextPreview, rType); break; // "Text/ShowPreview",
     565           0 :             case   3: pValues[nProp].setValue(&rParent.bAutoTextTip, rType); break; // "Text/ShowToolTip",
     566           0 :             case   4: pValues[nProp].setValue(&rParent.bSearchInAllCategories, rType );break; //"Text/SearchInAllCategories"
     567           0 :             case   5: bVal = rSwFlags.bAutoCorrect; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/UseReplacementTable",
     568           0 :             case   6: bVal = rSwFlags.bCptlSttSntnc; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/TwoCapitalsAtStart",
     569           0 :             case   7: bVal = rSwFlags.bCptlSttWrd; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/CapitalAtStartSentence",
     570           0 :             case   8: bVal = rSwFlags.bChgWeightUnderl; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeUnderlineWeight",
     571           0 :             case   9: bVal = rSwFlags.bSetINetAttr; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/SetInetAttribute",
     572           0 :             case  10: bVal = rSwFlags.bChgOrdinalNumber; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeOrdinalNumber",
     573           0 :             case  11: bVal = rSwFlags.bAddNonBrkSpace;  pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/AddNonBreakingSpace",
     574             : // it doesn't exist here - the common flags are used for that -> LM
     575             :             case  12:
     576           0 :                 bVal = sal_True;  pValues[nProp].setValue(&bVal, rType);
     577           0 :             break; // "Format/Option/ChangeDash",
     578           0 :             case  13: bVal = rSwFlags.bDelEmptyNode; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelEmptyParagraphs",
     579           0 :             case  14: bVal = rSwFlags.bChgUserColl; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ReplaceUserStyle",
     580           0 :             case  15: bVal = rSwFlags.bChgEnumNum; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeToBullets/Enable",
     581             :             case  16:
     582           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.cBullet;
     583           0 :             break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
     584             :             case  17:
     585           0 :                 pValues[nProp] <<= OUString(rSwFlags.aBulletFont.GetName());
     586           0 :             break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
     587             :             case  18:
     588           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetFamily();
     589           0 :             break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
     590             :             case  19:
     591           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetCharSet();
     592           0 :             break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
     593             :             case  20:
     594           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetPitch();
     595           0 :             break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
     596           0 :             case  21: bVal = rSwFlags.bRightMargin; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/CombineParagraphs",
     597             :             case  22:
     598           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.nRightMargin;
     599           0 :             break; // "Format/Option/CombineValue",
     600           0 :             case  23: bVal = rSwFlags.bAFmtDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesAtStartEnd",
     601           0 :             case  24: bVal = rSwFlags.bAFmtDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesBetween",
     602           0 :             case  25: bVal = rParent.bAutoFmtByInput; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/Enable",
     603           0 :             case  26: bVal = rSwFlags.bChgToEnEmDash; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeDash",
     604           0 :             case  27: bVal = rSwFlags.bSetNumRule; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ApplyNumbering/Enable",
     605           0 :             case  28: bVal = rSwFlags.bSetBorder; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToBorders",
     606           0 :             case  29: bVal = rSwFlags.bCreateTable; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToTable",
     607           0 :             case  30: bVal = rSwFlags.bReplaceStyles; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ReplaceStyle",
     608           0 :             case  31: bVal = rSwFlags.bAFmtByInpDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesAtStartEnd",
     609           0 :             case  32: bVal = rSwFlags.bAFmtByInpDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesBetween",
     610           0 :             case  33: bVal = rSwFlags.bAutoCompleteWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/Enable",
     611             :             case  34:
     612           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltWordLen;
     613           0 :             break; // "Completion/MinWordLen",
     614             :             case  35:
     615           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltListLen;
     616           0 :             break; // "Completion/MaxListLen",
     617           0 :             case  36: bVal = rSwFlags.bAutoCmpltCollectWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/CollectWords",
     618           0 :             case  37: bVal = rSwFlags.bAutoCmpltEndless; pValues[nProp].setValue(&bVal, rType); break; // "Completion/EndlessList",
     619           0 :             case  38: bVal = rSwFlags.bAutoCmpltAppendBlanc; pValues[nProp].setValue(&bVal, rType); break; // "Completion/AppendBlank",
     620           0 :             case  39: bVal = rSwFlags.bAutoCmpltShowAsTip; pValues[nProp].setValue(&bVal, rType); break; // "Completion/ShowAsTip",
     621             :             case  40:
     622           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltExpandKey;
     623           0 :             break; // "Completion/AcceptKey"
     624           0 :             case 41 :bVal = rSwFlags.bAutoCmpltKeepList; pValues[nProp].setValue(&bVal, rType); break;// "Completion/KeepList"
     625             :             case 42 :
     626           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.cByInputBullet;
     627           0 :             break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
     628             :             case 43 :
     629           0 :                 pValues[nProp] <<= OUString(rSwFlags.aByInputBulletFont.GetName());
     630           0 :             break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
     631             :             case 44 :
     632           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetFamily();
     633           0 :             break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
     634             :             case 45 :
     635           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetCharSet();
     636           0 :             break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
     637             :             case 46 :
     638           0 :                 pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetPitch();
     639           0 :             break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
     640             :         }
     641             :     }
     642           0 :     PutProperties(aNames, aValues);
     643           0 : }
     644             : 
     645           0 : void SvxSwAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */ )
     646             : {
     647           0 :     Load(false);
     648           0 : }
     649             : 
     650             : namespace
     651             : {
     652             :     class theSvxAutoCorrCfg : public rtl::Static<SvxAutoCorrCfg, theSvxAutoCorrCfg>{};
     653             : }
     654             : 
     655           0 : SvxAutoCorrCfg& SvxAutoCorrCfg::Get()
     656             : {
     657           0 :     return theSvxAutoCorrCfg::get();
     658             : }
     659             : 
     660             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10