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

Generated by: LCOV version 1.10