LCOV - code coverage report
Current view: top level - unotools/source/config - fltrcfg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 147 301 48.8 %
Date: 2012-08-25 Functions: 37 74 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 84 239 35.1 %

           Branch data     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                 :            : 
      21                 :            : #include <unotools/fltrcfg.hxx>
      22                 :            : #include <tools/debug.hxx>
      23                 :            : 
      24                 :            : #include <rtl/logfile.hxx>
      25                 :            : #include <com/sun/star/uno/Any.hxx>
      26                 :            : #include <com/sun/star/uno/Sequence.hxx>
      27                 :            : 
      28                 :            : using namespace utl;
      29                 :            : using namespace com::sun::star::uno;
      30                 :            : 
      31                 :            : using ::rtl::OUString;
      32                 :            : 
      33                 :            : #define C2U(cChar) OUString(RTL_CONSTASCII_USTRINGPARAM(cChar))
      34                 :            : 
      35                 :            : // -----------------------------------------------------------------------
      36                 :            : #define FILTERCFG_WORD_CODE             0x0001
      37                 :            : #define FILTERCFG_WORD_STORAGE          0x0002
      38                 :            : #define FILTERCFG_EXCEL_CODE            0x0004
      39                 :            : #define FILTERCFG_EXCEL_STORAGE         0x0008
      40                 :            : #define FILTERCFG_PPOINT_CODE           0x0010
      41                 :            : #define FILTERCFG_PPOINT_STORAGE        0x0020
      42                 :            : #define FILTERCFG_MATH_LOAD             0x0100
      43                 :            : #define FILTERCFG_MATH_SAVE             0x0200
      44                 :            : #define FILTERCFG_WRITER_LOAD           0x0400
      45                 :            : #define FILTERCFG_WRITER_SAVE           0x0800
      46                 :            : #define FILTERCFG_CALC_LOAD             0x1000
      47                 :            : #define FILTERCFG_CALC_SAVE             0x2000
      48                 :            : #define FILTERCFG_IMPRESS_LOAD          0x4000
      49                 :            : #define FILTERCFG_IMPRESS_SAVE          0x8000
      50                 :            : #define FILTERCFG_EXCEL_EXECTBL         0x10000
      51                 :            : #define FILTERCFG_ENABLE_PPT_PREVIEW    0x20000
      52                 :            : #define FILTERCFG_ENABLE_EXCEL_PREVIEW  0x40000
      53                 :            : #define FILTERCFG_ENABLE_WORD_PREVIEW   0x80000
      54                 :            : #define FILTERCFG_USE_ENHANCED_FIELDS   0x100000
      55                 :            : #define FILTERCFG_WORD_WBCTBL           0x200000
      56                 :            : 
      57                 :            : class SvtAppFilterOptions_Impl : public utl::ConfigItem
      58                 :            : {
      59                 :            :     sal_Bool                bLoadVBA;
      60                 :            :     sal_Bool                bSaveVBA;
      61                 :            : public:
      62                 :        141 :     SvtAppFilterOptions_Impl(const OUString& rRoot) :
      63                 :            :         utl::ConfigItem(rRoot),
      64                 :            :         bLoadVBA(sal_False),
      65                 :        141 :         bSaveVBA(sal_False)  {}
      66                 :            :     ~SvtAppFilterOptions_Impl();
      67                 :            :     virtual void            Commit();
      68                 :            :     virtual void            Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
      69                 :            :     void                    Load();
      70                 :            : 
      71                 :         39 :     sal_Bool                IsLoad() const {return bLoadVBA;}
      72                 :          0 :     void                    SetLoad(sal_Bool bSet)
      73                 :            :                             {
      74         [ #  # ]:          0 :                                 if(bSet != bLoadVBA)
      75                 :          0 :                                     SetModified();
      76                 :          0 :                                 bLoadVBA = bSet;
      77                 :          0 :                             }
      78                 :         19 :     sal_Bool                IsSave() const {return bSaveVBA;}
      79                 :          0 :     void                    SetSave(sal_Bool bSet)
      80                 :            :                             {
      81         [ #  # ]:          0 :                                 if(bSet != bSaveVBA)
      82                 :          0 :                                     SetModified();
      83                 :          0 :                                 bSaveVBA = bSet;
      84                 :          0 :                             }
      85                 :            : };
      86                 :            : 
      87                 :        141 : SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl()
      88                 :            : {
      89 [ +  - ][ -  + ]:        141 :     if(IsModified())
      90         [ #  # ]:          0 :         Commit();
      91         [ -  + ]:        141 : }
      92                 :            : 
      93                 :          0 : void    SvtAppFilterOptions_Impl::Commit()
      94                 :            : {
      95         [ #  # ]:          0 :     Sequence<OUString> aNames(2);
      96         [ #  # ]:          0 :     OUString* pNames = aNames.getArray();
      97         [ #  # ]:          0 :     pNames[0] = C2U("Load");
      98         [ #  # ]:          0 :     pNames[1] = C2U("Save");
      99         [ #  # ]:          0 :     Sequence<Any> aValues(aNames.getLength());
     100         [ #  # ]:          0 :     Any* pValues = aValues.getArray();
     101                 :            : 
     102         [ #  # ]:          0 :     const Type& rType = ::getBooleanCppuType();
     103                 :          0 :     pValues[0].setValue(&bLoadVBA, rType);
     104                 :          0 :     pValues[1].setValue(&bSaveVBA, rType);
     105                 :            : 
     106 [ #  # ][ #  # ]:          0 :     PutProperties(aNames, aValues);
                 [ #  # ]
     107                 :          0 : }
     108                 :            : 
     109                 :          0 : void SvtAppFilterOptions_Impl::Notify( const Sequence< rtl::OUString >&  )
     110                 :            : {
     111                 :            :     // no listeners supported yet
     112                 :          0 : }
     113                 :            : 
     114                 :        282 : void    SvtAppFilterOptions_Impl::Load()
     115                 :            : {
     116         [ +  - ]:        282 :     Sequence<OUString> aNames(2);
     117         [ +  - ]:        282 :     OUString* pNames = aNames.getArray();
     118         [ +  - ]:        282 :     pNames[0] = C2U("Load");
     119         [ +  - ]:        282 :     pNames[1] = C2U("Save");
     120                 :            : 
     121         [ +  - ]:        282 :     Sequence<Any> aValues = GetProperties(aNames);
     122                 :        282 :     const Any* pValues = aValues.getConstArray();
     123                 :            : 
     124         [ +  - ]:        282 :     if(pValues[0].hasValue())
     125                 :        282 :         bLoadVBA = *(sal_Bool*)pValues[0].getValue();
     126         [ +  - ]:        282 :     if(pValues[1].hasValue())
     127 [ +  - ][ +  - ]:        282 :         bSaveVBA = *(sal_Bool*)pValues[1].getValue();
     128                 :        282 : }
     129                 :            : 
     130                 :            : // -----------------------------------------------------------------------
     131         [ -  + ]:         47 : class SvtWriterFilterOptions_Impl : public SvtAppFilterOptions_Impl
     132                 :            : {
     133                 :            :     sal_Bool                bLoadExecutable;
     134                 :            : public:
     135                 :         47 :     SvtWriterFilterOptions_Impl(const OUString& rRoot) :
     136                 :            :         SvtAppFilterOptions_Impl(rRoot),
     137                 :         47 :         bLoadExecutable(sal_False)
     138                 :         47 :     {}
     139                 :            :     virtual void            Commit();
     140                 :            :     void                    Load();
     141                 :            : 
     142                 :          0 :     sal_Bool                IsLoadExecutable() const {return bLoadExecutable;}
     143                 :          0 :     void                    SetLoadExecutable(sal_Bool bSet)
     144                 :            :                             {
     145         [ #  # ]:          0 :                                 if(bSet != bLoadExecutable)
     146                 :          0 :                                     SetModified();
     147                 :          0 :                                 bLoadExecutable = bSet;
     148                 :          0 :                             }
     149                 :            : };
     150                 :            : 
     151                 :          0 : void SvtWriterFilterOptions_Impl::Commit()
     152                 :            : {
     153         [ #  # ]:          0 :     SvtAppFilterOptions_Impl::Commit();
     154                 :            : 
     155         [ #  # ]:          0 :     Sequence<OUString> aNames(1);
     156 [ #  # ][ #  # ]:          0 :     aNames[0] = C2U("Executable");
     157         [ #  # ]:          0 :     Sequence<Any> aValues(1);
     158 [ #  # ][ #  # ]:          0 :     aValues[0] <<= bLoadExecutable;
     159                 :            : 
     160 [ #  # ][ #  # ]:          0 :     PutProperties(aNames, aValues);
                 [ #  # ]
     161                 :          0 : }
     162                 :            : 
     163                 :         94 : void SvtWriterFilterOptions_Impl::Load()
     164                 :            : {
     165         [ +  - ]:         94 :     SvtAppFilterOptions_Impl::Load();
     166                 :            : 
     167         [ +  - ]:         94 :     Sequence<OUString> aNames(1);
     168 [ +  - ][ +  - ]:         94 :     aNames[0] = C2U("Executable");
     169                 :            : 
     170         [ +  - ]:         94 :     Sequence<Any> aValues = GetProperties(aNames);
     171                 :         94 :     const Any* pValues = aValues.getConstArray();
     172         [ +  - ]:         94 :     if(pValues[0].hasValue())
     173 [ +  - ][ +  - ]:         94 :         bLoadExecutable = *(sal_Bool*)pValues[0].getValue();
     174                 :         94 : }
     175                 :            : 
     176                 :            : // -----------------------------------------------------------------------
     177         [ -  + ]:         47 : class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl
     178                 :            : {
     179                 :            :     sal_Bool                bLoadExecutable;
     180                 :            : public:
     181                 :         47 :     SvtCalcFilterOptions_Impl(const OUString& rRoot) :
     182                 :            :         SvtAppFilterOptions_Impl(rRoot),
     183                 :         47 :         bLoadExecutable(sal_False)
     184                 :         47 :     {}
     185                 :            :     virtual void            Commit();
     186                 :            :     void                    Load();
     187                 :            : 
     188                 :         19 :     sal_Bool                IsLoadExecutable() const {return bLoadExecutable;}
     189                 :          0 :     void                    SetLoadExecutable(sal_Bool bSet)
     190                 :            :                             {
     191         [ #  # ]:          0 :                                 if(bSet != bLoadExecutable)
     192                 :          0 :                                     SetModified();
     193                 :          0 :                                 bLoadExecutable = bSet;
     194                 :          0 :                             }
     195                 :            : };
     196                 :            : 
     197                 :          0 : void SvtCalcFilterOptions_Impl::Commit()
     198                 :            : {
     199         [ #  # ]:          0 :     SvtAppFilterOptions_Impl::Commit();
     200                 :            : 
     201         [ #  # ]:          0 :     Sequence<OUString> aNames(1);
     202 [ #  # ][ #  # ]:          0 :     aNames[0] = C2U("Executable");
     203         [ #  # ]:          0 :     Sequence<Any> aValues(1);
     204 [ #  # ][ #  # ]:          0 :     aValues[0] <<= bLoadExecutable;
     205                 :            : 
     206 [ #  # ][ #  # ]:          0 :     PutProperties(aNames, aValues);
                 [ #  # ]
     207                 :          0 : }
     208                 :            : 
     209                 :         94 : void SvtCalcFilterOptions_Impl::Load()
     210                 :            : {
     211         [ +  - ]:         94 :     SvtAppFilterOptions_Impl::Load();
     212                 :            : 
     213         [ +  - ]:         94 :     Sequence<OUString> aNames(1);
     214 [ +  - ][ +  - ]:         94 :     aNames[0] = C2U("Executable");
     215                 :            : 
     216         [ +  - ]:         94 :     Sequence<Any> aValues = GetProperties(aNames);
     217                 :         94 :     const Any* pValues = aValues.getConstArray();
     218         [ +  - ]:         94 :     if(pValues[0].hasValue())
     219 [ +  - ][ +  - ]:         94 :         bLoadExecutable = *(sal_Bool*)pValues[0].getValue();
     220                 :         94 : }
     221                 :            : 
     222 [ +  - ][ +  - ]:         47 : struct SvtFilterOptions_Impl
     223                 :            : {
     224                 :            :     sal_uLong nFlags;
     225                 :            :     SvtWriterFilterOptions_Impl aWriterCfg;
     226                 :            :     SvtCalcFilterOptions_Impl aCalcCfg;
     227                 :            :     SvtAppFilterOptions_Impl aImpressCfg;
     228                 :            : 
     229                 :         47 :     SvtFilterOptions_Impl() :
     230                 :            :         aWriterCfg(C2U("Office.Writer/Filter/Import/VBA")),
     231                 :            :         aCalcCfg(C2U("Office.Calc/Filter/Import/VBA")),
     232 [ +  - ][ +  - ]:         47 :         aImpressCfg(C2U("Office.Impress/Filter/Import/VBA"))
         [ +  - ][ +  - ]
                 [ +  - ]
     233                 :            :     {
     234                 :            :         nFlags = FILTERCFG_WORD_CODE |
     235                 :            :             FILTERCFG_WORD_STORAGE |
     236                 :            :             FILTERCFG_EXCEL_CODE |
     237                 :            :             FILTERCFG_EXCEL_STORAGE |
     238                 :            :             FILTERCFG_PPOINT_CODE |
     239                 :            :             FILTERCFG_PPOINT_STORAGE |
     240                 :            :             FILTERCFG_MATH_LOAD |
     241                 :            :             FILTERCFG_MATH_SAVE |
     242                 :            :             FILTERCFG_WRITER_LOAD |
     243                 :            :             FILTERCFG_WRITER_SAVE |
     244                 :            :             FILTERCFG_CALC_LOAD |
     245                 :            :             FILTERCFG_CALC_SAVE |
     246                 :            :             FILTERCFG_IMPRESS_LOAD |
     247                 :            :             FILTERCFG_IMPRESS_SAVE |
     248                 :         47 :             FILTERCFG_USE_ENHANCED_FIELDS;
     249         [ +  - ]:         47 :         Load();
     250                 :         47 :     }
     251                 :            : 
     252                 :            :     void SetFlag( sal_uLong nFlag, sal_Bool bSet );
     253                 :            :     sal_Bool IsFlag( sal_uLong nFlag ) const;
     254                 :         94 :     void Load()
     255                 :            :     {
     256                 :         94 :         aWriterCfg.Load();
     257                 :         94 :         aCalcCfg.Load();
     258                 :         94 :         aImpressCfg.Load();
     259                 :         94 :     }
     260                 :            : };
     261                 :            : 
     262                 :        564 : void SvtFilterOptions_Impl::SetFlag( sal_uLong nFlag, sal_Bool bSet )
     263                 :            : {
     264   [ -  -  -  -  :        564 :     switch(nFlag)
             -  -  -  -  
                      + ]
     265                 :            :     {
     266                 :          0 :         case FILTERCFG_WORD_CODE:       aWriterCfg.SetLoad(bSet);break;
     267                 :          0 :         case FILTERCFG_WORD_STORAGE:    aWriterCfg.SetSave(bSet);break;
     268                 :          0 :         case FILTERCFG_WORD_WBCTBL: aWriterCfg.SetLoadExecutable(bSet);break;
     269                 :          0 :         case FILTERCFG_EXCEL_CODE:      aCalcCfg.SetLoad(bSet);break;
     270                 :          0 :         case FILTERCFG_EXCEL_STORAGE:   aCalcCfg.SetSave(bSet);break;
     271                 :          0 :         case FILTERCFG_EXCEL_EXECTBL:   aCalcCfg.SetLoadExecutable(bSet);break;
     272                 :          0 :         case FILTERCFG_PPOINT_CODE:     aImpressCfg.SetLoad(bSet);break;
     273                 :          0 :         case FILTERCFG_PPOINT_STORAGE:  aImpressCfg.SetSave(bSet);break;
     274                 :            :         default:
     275         [ +  + ]:        564 :             if( bSet )
     276                 :        470 :                 nFlags |= nFlag;
     277                 :            :             else
     278                 :         94 :                 nFlags &= ~nFlag;
     279                 :            :     }
     280                 :        564 : }
     281                 :            : 
     282                 :       1756 : sal_Bool SvtFilterOptions_Impl::IsFlag( sal_uLong nFlag ) const
     283                 :            : {
     284                 :            :     sal_Bool bRet;
     285   [ -  -  -  +  :       1756 :     switch(nFlag)
             +  +  +  -  
                      + ]
     286                 :            :     {
     287                 :          0 :         case FILTERCFG_WORD_CODE        : bRet = aWriterCfg.IsLoad();break;
     288                 :          0 :         case FILTERCFG_WORD_STORAGE     : bRet = aWriterCfg.IsSave();break;
     289                 :          0 :         case FILTERCFG_WORD_WBCTBL      : bRet = aWriterCfg.IsLoadExecutable();break;
     290                 :         19 :         case FILTERCFG_EXCEL_CODE       : bRet = aCalcCfg.IsLoad();break;
     291                 :         19 :         case FILTERCFG_EXCEL_STORAGE    : bRet = aCalcCfg.IsSave();break;
     292                 :         19 :         case FILTERCFG_EXCEL_EXECTBL    : bRet = aCalcCfg.IsLoadExecutable();break;
     293                 :         20 :         case FILTERCFG_PPOINT_CODE      : bRet = aImpressCfg.IsLoad();break;
     294                 :          0 :         case FILTERCFG_PPOINT_STORAGE   : bRet = aImpressCfg.IsSave();break;
     295                 :            :         default:
     296                 :       1679 :             bRet = 0 != (nFlags & nFlag );
     297                 :            :     }
     298                 :       1756 :     return bRet;
     299                 :            : }
     300                 :            : 
     301                 :            : // -----------------------------------------------------------------------
     302                 :            : 
     303                 :         47 : SvtFilterOptions::SvtFilterOptions() :
     304                 :            :     ConfigItem( C2U("Office.Common/Filter/Microsoft") ),
     305 [ +  - ][ +  - ]:         47 :     pImp(new SvtFilterOptions_Impl)
                 [ +  - ]
     306                 :            : {
     307                 :            :     RTL_LOGFILE_CONTEXT(aLog, "unotools SvtFilterOptions::SvtFilterOptions()");
     308 [ +  - ][ +  - ]:         47 :     EnableNotification(GetPropertyNames());
     309         [ +  - ]:         47 :     Load();
     310                 :         47 : }
     311                 :            : 
     312                 :            : // -----------------------------------------------------------------------
     313                 :         47 : SvtFilterOptions::~SvtFilterOptions()
     314                 :            : {
     315 [ +  - ][ +  - ]:         47 :     delete pImp;
     316         [ -  + ]:         47 : }
     317                 :            : 
     318                 :         94 : const Sequence<OUString>& SvtFilterOptions::GetPropertyNames()
     319                 :            : {
     320 [ +  + ][ +  - ]:         94 :     static Sequence<OUString> aNames;
         [ +  - ][ #  # ]
     321         [ +  + ]:         94 :     if(!aNames.getLength())
     322                 :            :     {
     323                 :         47 :         int nCount = 12;
     324                 :         47 :         aNames.realloc(nCount);
     325                 :            :         static const char* aPropNames[] =
     326                 :            :         {
     327                 :            :             "Import/MathTypeToMath",            //  0
     328                 :            :             "Import/WinWordToWriter",           //  1
     329                 :            :             "Import/PowerPointToImpress",       //  2
     330                 :            :             "Import/ExcelToCalc",               //  3
     331                 :            :             "Export/MathToMathType",            //  4
     332                 :            :             "Export/WriterToWinWord",           //  5
     333                 :            :             "Export/ImpressToPowerPoint",       //  6
     334                 :            :             "Export/CalcToExcel",               //  7
     335                 :            :             "Export/EnablePowerPointPreview",   //  8
     336                 :            :             "Export/EnableExcelPreview",        //  9
     337                 :            :             "Export/EnableWordPreview",         // 10
     338                 :            :             "Import/ImportWWFieldsAsEnhancedFields" // 11
     339                 :            :         };
     340                 :         47 :         OUString* pNames = aNames.getArray();
     341         [ +  + ]:        611 :         for(int i = 0; i < nCount; i++)
     342                 :        564 :             pNames[i] = OUString::createFromAscii(aPropNames[i]);
     343                 :            :     }
     344                 :         94 :     return aNames;
     345                 :            : }
     346                 :            : //-----------------------------------------------------------------------
     347                 :        564 : static sal_uLong lcl_GetFlag(sal_Int32 nProp)
     348                 :            : {
     349                 :        564 :     sal_uLong nFlag = 0;
     350   [ +  +  +  +  :        564 :     switch(nProp)
          +  +  +  +  +  
             +  +  +  - ]
     351                 :            :     {
     352                 :         47 :         case  0: nFlag = FILTERCFG_MATH_LOAD; break;
     353                 :         47 :         case  1: nFlag = FILTERCFG_WRITER_LOAD; break;
     354                 :         47 :         case  2: nFlag = FILTERCFG_IMPRESS_LOAD; break;
     355                 :         47 :         case  3: nFlag = FILTERCFG_CALC_LOAD; break;
     356                 :         47 :         case  4: nFlag = FILTERCFG_MATH_SAVE; break;
     357                 :         47 :         case  5: nFlag = FILTERCFG_WRITER_SAVE; break;
     358                 :         47 :         case  6: nFlag = FILTERCFG_IMPRESS_SAVE; break;
     359                 :         47 :         case  7: nFlag = FILTERCFG_CALC_SAVE; break;
     360                 :         47 :         case  8: nFlag = FILTERCFG_ENABLE_PPT_PREVIEW; break;
     361                 :         47 :         case  9: nFlag = FILTERCFG_ENABLE_EXCEL_PREVIEW; break;
     362                 :         47 :         case 10: nFlag = FILTERCFG_ENABLE_WORD_PREVIEW; break;
     363                 :         47 :         case 11: nFlag = FILTERCFG_USE_ENHANCED_FIELDS; break;
     364                 :            : 
     365                 :            :         default: OSL_FAIL("illegal value");
     366                 :            :     }
     367                 :        564 :     return nFlag;
     368                 :            : }
     369                 :            : 
     370                 :          0 : void SvtFilterOptions::Notify( const Sequence<OUString>& )
     371                 :            : {
     372                 :          0 :     Load();
     373                 :          0 : }
     374                 :            : 
     375                 :          0 : void SvtFilterOptions::Commit()
     376                 :            : {
     377         [ #  # ]:          0 :     const Sequence<OUString>& aNames = GetPropertyNames();
     378         [ #  # ]:          0 :     Sequence<Any> aValues(aNames.getLength());
     379         [ #  # ]:          0 :     Any* pValues = aValues.getArray();
     380                 :            : 
     381         [ #  # ]:          0 :     const Type& rType = ::getBooleanCppuType();
     382         [ #  # ]:          0 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     383                 :            :     {
     384                 :          0 :         sal_uLong nFlag = lcl_GetFlag(nProp);
     385                 :          0 :         sal_Bool bVal = pImp->IsFlag( nFlag);
     386                 :          0 :         pValues[nProp].setValue(&bVal, rType);
     387                 :            : 
     388                 :            :     }
     389 [ #  # ][ #  # ]:          0 :     PutProperties(aNames, aValues);
     390                 :          0 : }
     391                 :            : 
     392                 :         47 : void SvtFilterOptions::Load()
     393                 :            : {
     394         [ +  - ]:         47 :     pImp->Load();
     395         [ +  - ]:         47 :     const Sequence<OUString>& rNames = GetPropertyNames();
     396         [ +  - ]:         47 :     Sequence<Any> aValues = GetProperties(rNames);
     397                 :         47 :     const Any* pValues = aValues.getConstArray();
     398                 :            :     DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
     399         [ +  - ]:         47 :     if(aValues.getLength() == rNames.getLength())
     400                 :            :     {
     401         [ +  + ]:        611 :         for(int nProp = 0; nProp < rNames.getLength(); nProp++)
     402                 :            :         {
     403         [ +  - ]:        564 :             if(pValues[nProp].hasValue())
     404                 :            :             {
     405                 :        564 :                 sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue();
     406                 :        564 :                 sal_uLong nFlag = lcl_GetFlag(nProp);
     407         [ +  - ]:        564 :                 pImp->SetFlag( nFlag, bVal);
     408                 :            :             }
     409                 :            :         }
     410         [ +  - ]:         47 :     }
     411                 :         47 : }
     412                 :            : // -----------------------------------------------------------------------
     413                 :            : 
     414                 :          0 : void SvtFilterOptions::SetLoadWordBasicCode( sal_Bool bFlag )
     415                 :            : {
     416                 :          0 :     pImp->SetFlag( FILTERCFG_WORD_CODE, bFlag );
     417                 :          0 :     SetModified();
     418                 :          0 : }
     419                 :            : 
     420                 :          0 : sal_Bool SvtFilterOptions::IsLoadWordBasicCode() const
     421                 :            : {
     422                 :          0 :     return pImp->IsFlag( FILTERCFG_WORD_CODE );
     423                 :            : }
     424                 :            : 
     425                 :          0 : void SvtFilterOptions::SetLoadWordBasicExecutable( sal_Bool bFlag )
     426                 :            : {
     427                 :          0 :     pImp->SetFlag( FILTERCFG_WORD_WBCTBL, bFlag );
     428                 :          0 :     SetModified();
     429                 :          0 : }
     430                 :            : 
     431                 :          0 : sal_Bool SvtFilterOptions::IsLoadWordBasicExecutable() const
     432                 :            : {
     433                 :          0 :     return pImp->IsFlag( FILTERCFG_WORD_WBCTBL );
     434                 :            : }
     435                 :            : 
     436                 :          0 : void SvtFilterOptions::SetLoadWordBasicStorage( sal_Bool bFlag )
     437                 :            : {
     438                 :          0 :     pImp->SetFlag( FILTERCFG_WORD_STORAGE, bFlag );
     439                 :          0 :     SetModified();
     440                 :          0 : }
     441                 :            : 
     442                 :          0 : sal_Bool SvtFilterOptions::IsLoadWordBasicStorage() const
     443                 :            : {
     444                 :          0 :     return pImp->IsFlag( FILTERCFG_WORD_STORAGE );
     445                 :            : }
     446                 :            : 
     447                 :            : // -----------------------------------------------------------------------
     448                 :            : 
     449                 :          0 : void SvtFilterOptions::SetLoadExcelBasicCode( sal_Bool bFlag )
     450                 :            : {
     451                 :          0 :     pImp->SetFlag( FILTERCFG_EXCEL_CODE, bFlag );
     452                 :          0 :     SetModified();
     453                 :          0 : }
     454                 :            : 
     455                 :         19 : sal_Bool SvtFilterOptions::IsLoadExcelBasicCode() const
     456                 :            : {
     457                 :         19 :     return pImp->IsFlag( FILTERCFG_EXCEL_CODE );
     458                 :            : }
     459                 :            : 
     460                 :          0 : void SvtFilterOptions::SetLoadExcelBasicExecutable( sal_Bool bFlag )
     461                 :            : {
     462                 :          0 :     pImp->SetFlag( FILTERCFG_EXCEL_EXECTBL, bFlag );
     463                 :          0 :     SetModified();
     464                 :          0 : }
     465                 :            : 
     466                 :         19 : sal_Bool SvtFilterOptions::IsLoadExcelBasicExecutable() const
     467                 :            : {
     468                 :         19 :     return pImp->IsFlag( FILTERCFG_EXCEL_EXECTBL );
     469                 :            : }
     470                 :            : 
     471                 :          0 : void SvtFilterOptions::SetLoadExcelBasicStorage( sal_Bool bFlag )
     472                 :            : {
     473                 :          0 :     pImp->SetFlag( FILTERCFG_EXCEL_STORAGE, bFlag );
     474                 :          0 :     SetModified();
     475                 :          0 : }
     476                 :            : 
     477                 :         19 : sal_Bool SvtFilterOptions::IsLoadExcelBasicStorage() const
     478                 :            : {
     479                 :         19 :     return pImp->IsFlag( FILTERCFG_EXCEL_STORAGE );
     480                 :            : }
     481                 :            : 
     482                 :            : // -----------------------------------------------------------------------
     483                 :            : 
     484                 :          0 : void SvtFilterOptions::SetLoadPPointBasicCode( sal_Bool bFlag )
     485                 :            : {
     486                 :          0 :     pImp->SetFlag( FILTERCFG_PPOINT_CODE, bFlag );
     487                 :          0 :     SetModified();
     488                 :          0 : }
     489                 :            : 
     490                 :         20 : sal_Bool SvtFilterOptions::IsLoadPPointBasicCode() const
     491                 :            : {
     492                 :         20 :     return pImp->IsFlag( FILTERCFG_PPOINT_CODE );
     493                 :            : }
     494                 :            : 
     495                 :          0 : void SvtFilterOptions::SetLoadPPointBasicStorage( sal_Bool bFlag )
     496                 :            : {
     497                 :          0 :     pImp->SetFlag( FILTERCFG_PPOINT_STORAGE, bFlag );
     498                 :          0 :     SetModified();
     499                 :          0 : }
     500                 :            : 
     501                 :          0 : sal_Bool SvtFilterOptions::IsLoadPPointBasicStorage() const
     502                 :            : {
     503                 :          0 :     return pImp->IsFlag( FILTERCFG_PPOINT_STORAGE );
     504                 :            : }
     505                 :            : 
     506                 :            : // -----------------------------------------------------------------------
     507                 :            : 
     508                 :        117 : sal_Bool SvtFilterOptions::IsMathType2Math() const
     509                 :            : {
     510                 :        117 :     return pImp->IsFlag( FILTERCFG_MATH_LOAD );
     511                 :            : }
     512                 :            : 
     513                 :          0 : void SvtFilterOptions::SetMathType2Math( sal_Bool bFlag )
     514                 :            : {
     515                 :          0 :     pImp->SetFlag( FILTERCFG_MATH_LOAD, bFlag );
     516                 :          0 :     SetModified();
     517                 :          0 : }
     518                 :            : 
     519                 :        212 : sal_Bool SvtFilterOptions::IsMath2MathType() const
     520                 :            : {
     521                 :        212 :     return pImp->IsFlag( FILTERCFG_MATH_SAVE );
     522                 :            : }
     523                 :            : 
     524                 :          0 : void SvtFilterOptions::SetMath2MathType( sal_Bool bFlag )
     525                 :            : {
     526                 :          0 :     pImp->SetFlag( FILTERCFG_MATH_SAVE, bFlag );
     527                 :          0 :     SetModified();
     528                 :          0 : }
     529                 :            : 
     530                 :            : 
     531                 :            : // -----------------------------------------------------------------------
     532                 :        117 : sal_Bool SvtFilterOptions::IsWinWord2Writer() const
     533                 :            : {
     534                 :        117 :     return pImp->IsFlag( FILTERCFG_WRITER_LOAD );
     535                 :            : }
     536                 :            : 
     537                 :          0 : void SvtFilterOptions::SetWinWord2Writer( sal_Bool bFlag )
     538                 :            : {
     539                 :          0 :     pImp->SetFlag( FILTERCFG_WRITER_LOAD, bFlag );
     540                 :          0 :     SetModified();
     541                 :          0 : }
     542                 :            : 
     543                 :        212 : sal_Bool SvtFilterOptions::IsWriter2WinWord() const
     544                 :            : {
     545                 :        212 :     return pImp->IsFlag( FILTERCFG_WRITER_SAVE );
     546                 :            : }
     547                 :            : 
     548                 :          0 : void SvtFilterOptions::SetWriter2WinWord( sal_Bool bFlag )
     549                 :            : {
     550                 :          0 :     pImp->SetFlag( FILTERCFG_WRITER_SAVE, bFlag );
     551                 :          0 :     SetModified();
     552                 :          0 : }
     553                 :            : 
     554                 :        375 : sal_Bool SvtFilterOptions::IsUseEnhancedFields() const
     555                 :            : {
     556                 :        375 :     return pImp->IsFlag( FILTERCFG_USE_ENHANCED_FIELDS );
     557                 :            : }
     558                 :            : 
     559                 :            : // -----------------------------------------------------------------------
     560                 :         90 : sal_Bool SvtFilterOptions::IsExcel2Calc() const
     561                 :            : {
     562                 :         90 :     return pImp->IsFlag( FILTERCFG_CALC_LOAD );
     563                 :            : }
     564                 :            : 
     565                 :          0 : void SvtFilterOptions::SetExcel2Calc( sal_Bool bFlag )
     566                 :            : {
     567                 :          0 :     pImp->SetFlag( FILTERCFG_CALC_LOAD, bFlag );
     568                 :          0 :     SetModified();
     569                 :          0 : }
     570                 :            : 
     571                 :        212 : sal_Bool SvtFilterOptions::IsCalc2Excel() const
     572                 :            : {
     573                 :        212 :     return pImp->IsFlag( FILTERCFG_CALC_SAVE );
     574                 :            : }
     575                 :            : 
     576                 :          0 : void SvtFilterOptions::SetCalc2Excel( sal_Bool bFlag )
     577                 :            : {
     578                 :          0 :     pImp->SetFlag( FILTERCFG_CALC_SAVE, bFlag );
     579                 :          0 :     SetModified();
     580                 :          0 : }
     581                 :            : 
     582                 :            : 
     583                 :            : // -----------------------------------------------------------------------
     584                 :        117 : sal_Bool SvtFilterOptions::IsPowerPoint2Impress() const
     585                 :            : {
     586                 :        117 :     return pImp->IsFlag( FILTERCFG_IMPRESS_LOAD );
     587                 :            : }
     588                 :            : 
     589                 :          0 : void SvtFilterOptions::SetPowerPoint2Impress( sal_Bool bFlag )
     590                 :            : {
     591                 :          0 :     pImp->SetFlag( FILTERCFG_IMPRESS_LOAD, bFlag );
     592                 :          0 :     SetModified();
     593                 :          0 : }
     594                 :            : 
     595                 :        212 : sal_Bool SvtFilterOptions::IsImpress2PowerPoint() const
     596                 :            : {
     597                 :        212 :     return pImp->IsFlag( FILTERCFG_IMPRESS_SAVE );
     598                 :            : }
     599                 :            : 
     600                 :          0 : void SvtFilterOptions::SetImpress2PowerPoint( sal_Bool bFlag )
     601                 :            : {
     602                 :          0 :     pImp->SetFlag( FILTERCFG_IMPRESS_SAVE, bFlag );
     603                 :          0 :     SetModified();
     604                 :          0 : }
     605                 :            : 
     606                 :            : namespace
     607                 :            : {
     608                 :            :     class theFilterOptions
     609                 :            :          : public rtl::Static<SvtFilterOptions, theFilterOptions>
     610                 :            :     {
     611                 :            :     };
     612                 :            : }
     613                 :            : 
     614                 :        738 : SvtFilterOptions& SvtFilterOptions::Get()
     615                 :            : {
     616                 :        738 :     return theFilterOptions::get();
     617                 :            : }
     618                 :            : 
     619                 :            : // -----------------------------------------------------------------------
     620                 :            : 
     621                 :          0 : sal_Bool SvtFilterOptions::IsEnablePPTPreview() const
     622                 :            : {
     623                 :          0 :     return pImp->IsFlag( FILTERCFG_ENABLE_PPT_PREVIEW );
     624                 :            : }
     625                 :            : 
     626                 :            : 
     627                 :          0 : sal_Bool SvtFilterOptions::IsEnableCalcPreview() const
     628                 :            : {
     629                 :          0 :     return pImp->IsFlag( FILTERCFG_ENABLE_EXCEL_PREVIEW );
     630                 :            : }
     631                 :            : 
     632                 :            : 
     633                 :         15 : sal_Bool SvtFilterOptions::IsEnableWordPreview() const
     634                 :            : {
     635                 :         15 :     return pImp->IsFlag( FILTERCFG_ENABLE_WORD_PREVIEW );
     636                 :            : }
     637                 :            : 
     638                 :            : 
     639                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10