LCOV - code coverage report
Current view: top level - editeng/source/misc - acorrcfg.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 198 352 56.2 %
Date: 2015-06-13 12:38:46 Functions: 12 19 63.2 %
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          60 : SvxAutoCorrCfg::SvxAutoCorrCfg() :
      41             :     aBaseConfig(*this),
      42             :     aSwConfig(*this),
      43             :     bFileRel(true),
      44             :     bNetRel(true),
      45             :     bAutoTextTip(true),
      46             :     bAutoTextPreview(false),
      47             :     bAutoFmtByInput(true),
      48          60 :     bSearchInAllCategories(false)
      49             : {
      50          60 :     SvtPathOptions aPathOpt;
      51         120 :     OUString sSharePath, sUserPath, sAutoPath( aPathOpt.GetAutoCorrectPath() );
      52             : 
      53          60 :     sSharePath = sAutoPath.getToken(0, ';');
      54          60 :     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         120 :     ::ucbhelper::Content aContent;
      59         120 :     Reference < ucb::XCommandEnvironment > xEnv;
      60          60 :     ::utl::UCBContentHelper::ensureFolder(comphelper::getProcessComponentContext(), xEnv, sUserPath, aContent);
      61             : 
      62          60 :     OUString* pS = &sSharePath;
      63         180 :     for( sal_uInt16 n = 0; n < 2; ++n, pS = &sUserPath )
      64             :     {
      65         120 :         INetURLObject aPath( *pS );
      66         120 :         aPath.insertName(OUString("acor"));
      67         120 :         *pS = aPath.GetMainURL(INetURLObject::DECODE_TO_IURI);
      68         120 :     }
      69          60 :     pAutoCorrect = new SvxAutoCorrect( sSharePath, sUserPath );
      70             : 
      71          60 :     aBaseConfig.Load(true);
      72         120 :     aSwConfig.Load(true);
      73          60 : }
      74             : 
      75         120 : SvxAutoCorrCfg::~SvxAutoCorrCfg()
      76             : {
      77          60 :     delete pAutoCorrect;
      78          60 : }
      79             : 
      80         118 : void SvxAutoCorrCfg::SetAutoCorrect(SvxAutoCorrect *const pNew)
      81             : {
      82         118 :     if (pNew != pAutoCorrect)
      83             :     {
      84         118 :         if (pNew && (pAutoCorrect->GetFlags() != pNew->GetFlags()))
      85             :         {
      86           0 :             aBaseConfig.SetModified();
      87           0 :             aSwConfig.SetModified();
      88             :         }
      89         118 :         delete pAutoCorrect;
      90         118 :         pAutoCorrect = pNew;
      91             :     }
      92         118 : }
      93             : 
      94          60 : 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          60 :     const int nCount = 18;
     118          60 :     Sequence<OUString> aNames(nCount);
     119          60 :     OUString* pNames = aNames.getArray();
     120        1140 :     for(int i = 0; i < nCount; i++)
     121        1080 :         pNames[i] = OUString::createFromAscii(aPropNames[i]);
     122          60 :     return aNames;
     123             : }
     124             : 
     125          60 : void SvxBaseAutoCorrCfg::Load(bool bInit)
     126             : {
     127          60 :     Sequence<OUString> aNames = GetPropertyNames();
     128         120 :     Sequence<Any> aValues = GetProperties(aNames);
     129          60 :     if(bInit)
     130          60 :         EnableNotification(aNames);
     131          60 :     const Any* pValues = aValues.getConstArray();
     132             :     DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
     133          60 :     if(aValues.getLength() == aNames.getLength())
     134             :     {
     135          60 :         long nFlags = 0;        // default all off
     136          60 :         sal_Int32 nTemp = 0;
     137        1140 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     138             :         {
     139        1080 :             if(pValues[nProp].hasValue())
     140             :             {
     141         840 :                 switch(nProp)
     142             :                 {
     143             :                     case  0:
     144          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     145          60 :                             nFlags |= SaveWordCplSttLst;
     146          60 :                     break;//"Exceptions/TwoCapitalsAtStart",
     147             :                     case  1:
     148          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     149          60 :                             nFlags |= SaveWordWrdSttLst;
     150          60 :                     break;//"Exceptions/CapitalAtStartSentence",
     151             :                     case  2:
     152          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     153          60 :                             nFlags |= Autocorrect;
     154          60 :                     break;//"UseReplacementTable",
     155             :                     case  3:
     156          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     157          60 :                             nFlags |= CapitalStartWord;
     158          60 :                     break;//"TwoCapitalsAtStart",
     159             :                     case  4:
     160          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     161          60 :                             nFlags |= CapitalStartSentence;
     162          60 :                     break;//"CapitalAtStartSentence",
     163             :                     case  5:
     164          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     165          60 :                             nFlags |= ChgWeightUnderl;
     166          60 :                     break;//"ChangeUnderlineWeight",
     167             :                     case  6:
     168          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     169          60 :                             nFlags |= SetINetAttr;
     170          60 :                     break;//"SetInetAttribute",
     171             :                     case  7:
     172          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     173          60 :                             nFlags |= ChgOrdinalNumber;
     174          60 :                     break;//"ChangeOrdinalNumber",
     175             :                     case 8:
     176          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     177          60 :                              nFlags |= AddNonBrkSpace;
     178          60 :                     break;//"AddNonBreakingSpace"
     179             :                     case  9:
     180          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     181          60 :                             nFlags |= ChgToEnEmDash;
     182          60 :                     break;//"ChangeDash",
     183             :                     case 10:
     184          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     185           0 :                             nFlags |= IgnoreDoubleSpace;
     186          60 :                     break;//"RemoveDoubleSpaces",
     187             :                     case 11:
     188          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     189           0 :                             nFlags |= ChgSglQuotes;
     190          60 :                     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          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     203          60 :                             nFlags |= ChgQuotes;
     204          60 :                     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          60 :                         if(*static_cast<sal_Bool const *>(pValues[nProp].getValue()))
     217          60 :                             nFlags |= CorrectCapsLock;
     218          60 :                     break;//"CorrectAccidentalCapsLock"
     219             :                 }
     220             :             }
     221             :         }
     222          60 :         if( nFlags )
     223          60 :             rParent.pAutoCorrect->SetAutoCorrFlag( nFlags, true );
     224          60 :         rParent.pAutoCorrect->SetAutoCorrFlag( ( 0xffff & ~nFlags ), false );
     225             : 
     226          60 :     }
     227          60 : }
     228             : 
     229          60 : SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rPar) :
     230             :     utl::ConfigItem(OUString("Office.Common/AutoCorrect")),
     231          60 :     rParent(rPar)
     232             : {
     233          60 : }
     234             : 
     235          60 : SvxBaseAutoCorrCfg::~SvxBaseAutoCorrCfg()
     236             : {
     237          60 : }
     238             : 
     239           0 : void SvxBaseAutoCorrCfg::ImplCommit()
     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 = cppu::UnoType<bool>::get();
     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 & CapitalStartWord);
     267           0 :                 pValues[nProp].setValue(&bVal, rType);
     268           0 :             break;//"TwoCapitalsAtStart",
     269             :             case  4:
     270           0 :                 bVal = 0 != (nFlags & CapitalStartSentence);
     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          60 : 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          60 :     const int nCount = 47;
     384          60 :     Sequence<OUString> aNames(nCount);
     385          60 :     OUString* pNames = aNames.getArray();
     386        2880 :     for(int i = 0; i < nCount; i++)
     387        2820 :         pNames[i] = OUString::createFromAscii(aPropNames[i]);
     388          60 :     return aNames;
     389             : }
     390             : 
     391          60 : void SvxSwAutoCorrCfg::Load(bool bInit)
     392             : {
     393          60 :     Sequence<OUString> aNames = GetPropertyNames();
     394         120 :     Sequence<Any> aValues = GetProperties(aNames);
     395          60 :     if(bInit)
     396          60 :         EnableNotification(aNames);
     397          60 :     const Any* pValues = aValues.getConstArray();
     398             :     DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
     399          60 :     if(aValues.getLength() == aNames.getLength())
     400             :     {
     401          60 :         SvxSwAutoFormatFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
     402        2880 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     403             :         {
     404        2820 :             if(pValues[nProp].hasValue())
     405             :             {
     406        2820 :                 switch(nProp)
     407             :                 {
     408          60 :                     case   0: rParent.bFileRel = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Text/FileLinks",
     409          60 :                     case   1: rParent.bNetRel = *static_cast<sal_Bool const *>(pValues[nProp].getValue());  break; // "Text/InternetLinks",
     410          60 :                     case   2: rParent.bAutoTextPreview = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Text/ShowPreview",
     411          60 :                     case   3: rParent.bAutoTextTip = *static_cast<sal_Bool const *>(pValues[nProp].getValue());  break; // "Text/ShowToolTip",
     412          60 :                     case   4: rParent.bSearchInAllCategories = *static_cast<sal_Bool const *>(pValues[nProp].getValue());  break; //"Text/SearchInAllCategories"
     413          60 :                     case   5: rSwFlags.bAutoCorrect = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/UseReplacementTable",
     414          60 :                     case   6: rSwFlags.bCapitalStartSentence = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/TwoCapitalsAtStart",
     415          60 :                     case   7: rSwFlags.bCapitalStartWord = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/CapitalAtStartSentence",
     416          60 :                     case   8: rSwFlags.bChgWeightUnderl = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/ChangeUnderlineWeight",
     417          60 :                     case   9: rSwFlags.bSetINetAttr = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/SetInetAttribute",
     418          60 :                     case  10: rSwFlags.bChgOrdinalNumber = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/ChangeOrdinalNumber",
     419          60 :                     case  11: rSwFlags.bAddNonBrkSpace = *static_cast<sal_Bool const *>(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 = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/ChangeDash",
     422          60 :                     case  13: rSwFlags.bDelEmptyNode = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/DelEmptyParagraphs",
     423          60 :                     case  14: rSwFlags.bChgUserColl = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/ReplaceUserStyle",
     424          60 :                     case  15: rSwFlags.bChgEnumNum = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/ChangeToBullets/Enable",
     425             :                     case  16:
     426             :                     {
     427          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     428             :                         rSwFlags.cBullet =
     429          60 :                             sal::static_int_cast< sal_Unicode >(nVal);
     430             :                     }
     431          60 :                     break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
     432             :                     case  17:
     433             :                     {
     434          60 :                         OUString sTemp; pValues[nProp] >>= sTemp;
     435          60 :                         rSwFlags.aBulletFont.SetName(sTemp);
     436             :                     }
     437          60 :                     break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
     438             :                     case  18:
     439             :                     {
     440          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     441          60 :                         rSwFlags.aBulletFont.SetFamily(FontFamily(nVal));
     442             :                     }
     443          60 :                     break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
     444             :                     case  19:
     445             :                     {
     446          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     447          60 :                         rSwFlags.aBulletFont.SetCharSet(rtl_TextEncoding(nVal));
     448             :                     }
     449          60 :                     break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
     450             :                     case  20:
     451             :                     {
     452          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     453          60 :                         rSwFlags.aBulletFont.SetPitch(FontPitch(nVal));
     454             :                     }
     455          60 :                     break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
     456          60 :                     case  21: rSwFlags.bRightMargin = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/CombineParagraphs",
     457             :                     case  22:
     458             :                     {
     459          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     460             :                         rSwFlags.nRightMargin =
     461          60 :                             sal::static_int_cast< sal_uInt8 >(nVal);
     462             :                     }
     463          60 :                     break; // "Format/Option/CombineValue",
     464          60 :                     case  23: rSwFlags.bAFormatDelSpacesAtSttEnd =  *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/DelSpacesAtStartEnd",
     465          60 :                     case  24: rSwFlags.bAFormatDelSpacesBetweenLines = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/Option/DelSpacesBetween",
     466          60 :                     case  25: rParent.bAutoFmtByInput = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/ByInput/Enable",
     467          60 :                     case  26: rSwFlags.bChgToEnEmDash = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/ByInput/ChangeDash",
     468          60 :                     case  27: rSwFlags.bSetNumRule = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/ByInput/ApplyNumbering/Enable",
     469          60 :                     case  28: rSwFlags.bSetBorder = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/ByInput/ChangeToBorders",
     470          60 :                     case  29: rSwFlags.bCreateTable = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/ByInput/ChangeToTable",
     471          60 :                     case  30: rSwFlags.bReplaceStyles =  *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/ByInput/ReplaceStyle",
     472          60 :                     case  31: rSwFlags.bAFormatByInpDelSpacesAtSttEnd =  *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/ByInput/DelSpacesAtStartEnd",
     473          60 :                     case  32: rSwFlags.bAFormatByInpDelSpacesBetweenLines = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Format/ByInput/DelSpacesBetween",
     474          60 :                     case  33: rSwFlags.bAutoCompleteWords = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Completion/Enable",
     475             :                     case  34:
     476             :                     {
     477          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     478             :                         rSwFlags.nAutoCmpltWordLen =
     479          60 :                             sal::static_int_cast< sal_uInt16 >(nVal);
     480             :                     }
     481          60 :                     break; // "Completion/MinWordLen",
     482             :                     case  35:
     483             :                     {
     484          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     485             :                         rSwFlags.nAutoCmpltListLen =
     486          60 :                             sal::static_int_cast< sal_uInt16 >(nVal);
     487             :                     }
     488          60 :                     break; // "Completion/MaxListLen",
     489          60 :                     case  36: rSwFlags.bAutoCmpltCollectWords = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Completion/CollectWords",
     490          60 :                     case  37: rSwFlags.bAutoCmpltEndless = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Completion/EndlessList",
     491          60 :                     case  38: rSwFlags.bAutoCmpltAppendBlanc = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Completion/AppendBlank",
     492          60 :                     case  39: rSwFlags.bAutoCmpltShowAsTip = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; // "Completion/ShowAsTip",
     493             :                     case  40:
     494             :                     {
     495          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     496             :                         rSwFlags.nAutoCmpltExpandKey =
     497          60 :                             sal::static_int_cast< sal_uInt16 >(nVal);
     498             :                     }
     499          60 :                     break; // "Completion/AcceptKey"
     500          60 :                     case 41 :rSwFlags.bAutoCmpltKeepList = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;//"Completion/KeepList"
     501             :                     case 42 :
     502             :                     {
     503          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     504             :                         rSwFlags.cByInputBullet =
     505          60 :                             sal::static_int_cast< sal_Unicode >(nVal);
     506             :                     }
     507          60 :                     break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
     508             :                     case 43 :
     509             :                     {
     510          60 :                         OUString sTemp; pValues[nProp] >>= sTemp;
     511          60 :                         rSwFlags.aByInputBulletFont.SetName(sTemp);
     512             :                     }
     513          60 :                     break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
     514             :                     case 44 :
     515             :                     {
     516          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     517          60 :                         rSwFlags.aByInputBulletFont.SetFamily(FontFamily(nVal));
     518             :                     }
     519          60 :                     break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
     520             :                     case 45 :
     521             :                     {
     522          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     523          60 :                         rSwFlags.aByInputBulletFont.SetCharSet(rtl_TextEncoding(nVal));
     524             :                     }
     525          60 :                     break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
     526             :                     case 46 :
     527             :                     {
     528          60 :                         sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
     529          60 :                         rSwFlags.aByInputBulletFont.SetPitch(FontPitch(nVal));
     530             :                     }
     531          60 :                     break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
     532             :                 }
     533             :             }
     534             :         }
     535          60 :     }
     536          60 : }
     537             : 
     538          60 : SvxSwAutoCorrCfg::SvxSwAutoCorrCfg(SvxAutoCorrCfg& rPar) :
     539             :     utl::ConfigItem(OUString("Office.Writer/AutoFunction")),
     540          60 :     rParent(rPar)
     541             : {
     542          60 : }
     543             : 
     544          60 : SvxSwAutoCorrCfg::~SvxSwAutoCorrCfg()
     545             : {
     546          60 : }
     547             : 
     548           0 : void SvxSwAutoCorrCfg::ImplCommit()
     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 = cppu::UnoType<bool>::get();
     556             :     sal_Bool bVal;
     557           0 :     SvxSwAutoFormatFlags& 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.bCapitalStartSentence; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/TwoCapitalsAtStart",
     569           0 :             case   7: bVal = rSwFlags.bCapitalStartWord; 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.bAFormatDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesAtStartEnd",
     601           0 :             case  24: bVal = rSwFlags.bAFormatDelSpacesBetweenLines; 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.bAFormatByInpDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesAtStartEnd",
     609           0 :             case  32: bVal = rSwFlags.bAFormatByInpDelSpacesBetweenLines; 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    75310094 : SvxAutoCorrCfg& SvxAutoCorrCfg::Get()
     656             : {
     657    75310094 :     return theSvxAutoCorrCfg::get();
     658             : }
     659             : 
     660             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11