LCOV - code coverage report
Current view: top level - unotools/source/config - fltrcfg.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 312 0.0 %
Date: 2014-04-14 Functions: 0 77 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <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           0 :     SvtAppFilterOptions_Impl(const OUString& rRoot) :
      59             :         utl::ConfigItem(rRoot),
      60             :         bLoadVBA(false),
      61           0 :         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           0 :     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           0 :     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           0 : SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl()
      84             : {
      85           0 :     if(IsModified())
      86           0 :         Commit();
      87           0 : }
      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           0 : void    SvtAppFilterOptions_Impl::Load()
     111             : {
     112           0 :     Sequence<OUString> aNames(2);
     113           0 :     OUString* pNames = aNames.getArray();
     114           0 :     pNames[0] = "Load";
     115           0 :     pNames[1] = "Save";
     116             : 
     117           0 :     Sequence<Any> aValues = GetProperties(aNames);
     118           0 :     const Any* pValues = aValues.getConstArray();
     119             : 
     120           0 :     if(pValues[0].hasValue())
     121           0 :         bLoadVBA = *(sal_Bool*)pValues[0].getValue();
     122           0 :     if(pValues[1].hasValue())
     123           0 :         bSaveVBA = *(sal_Bool*)pValues[1].getValue();
     124           0 : }
     125             : 
     126           0 : class SvtWriterFilterOptions_Impl : public SvtAppFilterOptions_Impl
     127             : {
     128             :     bool                bLoadExecutable;
     129             : public:
     130           0 :     SvtWriterFilterOptions_Impl(const OUString& rRoot) :
     131             :         SvtAppFilterOptions_Impl(rRoot),
     132           0 :         bLoadExecutable(false)
     133           0 :     {}
     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           0 : void SvtWriterFilterOptions_Impl::Load()
     159             : {
     160           0 :     SvtAppFilterOptions_Impl::Load();
     161             : 
     162           0 :     Sequence<OUString> aNames(1);
     163           0 :     aNames[0] = "Executable";
     164             : 
     165           0 :     Sequence<Any> aValues = GetProperties(aNames);
     166           0 :     const Any* pValues = aValues.getConstArray();
     167           0 :     if(pValues[0].hasValue())
     168           0 :         bLoadExecutable = *(sal_Bool*)pValues[0].getValue();
     169           0 : }
     170             : 
     171           0 : class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl
     172             : {
     173             :     bool                bLoadExecutable;
     174             : public:
     175           0 :     SvtCalcFilterOptions_Impl(const OUString& rRoot) :
     176             :         SvtAppFilterOptions_Impl(rRoot),
     177           0 :         bLoadExecutable(false)
     178           0 :     {}
     179             :     virtual void            Commit() SAL_OVERRIDE;
     180             :     void                    Load();
     181             : 
     182           0 :     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           0 : void SvtCalcFilterOptions_Impl::Load()
     204             : {
     205           0 :     SvtAppFilterOptions_Impl::Load();
     206             : 
     207           0 :     Sequence<OUString> aNames(1);
     208           0 :     aNames[0] = "Executable";
     209             : 
     210           0 :     Sequence<Any> aValues = GetProperties(aNames);
     211           0 :     const Any* pValues = aValues.getConstArray();
     212           0 :     if(pValues[0].hasValue())
     213           0 :         bLoadExecutable = *(sal_Bool*)pValues[0].getValue();
     214           0 : }
     215             : 
     216           0 : struct SvtFilterOptions_Impl
     217             : {
     218             :     sal_uLong nFlags;
     219             :     SvtWriterFilterOptions_Impl aWriterCfg;
     220             :     SvtCalcFilterOptions_Impl aCalcCfg;
     221             :     SvtAppFilterOptions_Impl aImpressCfg;
     222             : 
     223           0 :     SvtFilterOptions_Impl() :
     224             :         aWriterCfg("Office.Writer/Filter/Import/VBA"),
     225             :         aCalcCfg("Office.Calc/Filter/Import/VBA"),
     226           0 :         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           0 :             FILTERCFG_SMARTART_SHAPE_LOAD;
     244           0 :         Load();
     245           0 :     }
     246             : 
     247             :     void SetFlag( sal_uLong nFlag, bool bSet );
     248             :     bool IsFlag( sal_uLong nFlag ) const;
     249           0 :     void Load()
     250             :     {
     251           0 :         aWriterCfg.Load();
     252           0 :         aCalcCfg.Load();
     253           0 :         aImpressCfg.Load();
     254           0 :     }
     255             : };
     256             : 
     257           0 : void SvtFilterOptions_Impl::SetFlag( sal_uLong nFlag, bool bSet )
     258             : {
     259           0 :     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           0 :             if( bSet )
     271           0 :                 nFlags |= nFlag;
     272             :             else
     273           0 :                 nFlags &= ~nFlag;
     274             :     }
     275           0 : }
     276             : 
     277           0 : bool SvtFilterOptions_Impl::IsFlag( sal_uLong nFlag ) const
     278             : {
     279             :     bool bRet;
     280           0 :     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           0 :         case FILTERCFG_EXCEL_CODE       : bRet = aCalcCfg.IsLoad();break;
     286           0 :         case FILTERCFG_EXCEL_STORAGE    : bRet = aCalcCfg.IsSave();break;
     287           0 :         case FILTERCFG_EXCEL_EXECTBL    : bRet = aCalcCfg.IsLoadExecutable();break;
     288           0 :         case FILTERCFG_PPOINT_CODE      : bRet = aImpressCfg.IsLoad();break;
     289           0 :         case FILTERCFG_PPOINT_STORAGE   : bRet = aImpressCfg.IsSave();break;
     290             :         default:
     291           0 :             bRet = 0 != (nFlags & nFlag );
     292             :     }
     293           0 :     return bRet;
     294             : }
     295             : 
     296           0 : SvtFilterOptions::SvtFilterOptions() :
     297             :     ConfigItem( "Office.Common/Filter/Microsoft" ),
     298           0 :     pImp(new SvtFilterOptions_Impl)
     299             : {
     300           0 :     EnableNotification(GetPropertyNames());
     301           0 :     Load();
     302           0 : }
     303             : 
     304           0 : SvtFilterOptions::~SvtFilterOptions()
     305             : {
     306           0 :     delete pImp;
     307           0 : }
     308             : 
     309           0 : const Sequence<OUString>& SvtFilterOptions::GetPropertyNames()
     310             : {
     311           0 :     static Sequence<OUString> aNames;
     312           0 :     if(!aNames.getLength())
     313             :     {
     314           0 :         int nCount = 13;
     315           0 :         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           0 :         OUString* pNames = aNames.getArray();
     333           0 :         for(int i = 0; i < nCount; i++)
     334           0 :             pNames[i] = OUString::createFromAscii(aPropNames[i]);
     335             :     }
     336           0 :     return aNames;
     337             : }
     338             : 
     339           0 : static sal_uLong lcl_GetFlag(sal_Int32 nProp)
     340             : {
     341           0 :     sal_uLong nFlag = 0;
     342           0 :     switch(nProp)
     343             :     {
     344           0 :         case  0: nFlag = FILTERCFG_MATH_LOAD; break;
     345           0 :         case  1: nFlag = FILTERCFG_WRITER_LOAD; break;
     346           0 :         case  2: nFlag = FILTERCFG_IMPRESS_LOAD; break;
     347           0 :         case  3: nFlag = FILTERCFG_CALC_LOAD; break;
     348           0 :         case  4: nFlag = FILTERCFG_MATH_SAVE; break;
     349           0 :         case  5: nFlag = FILTERCFG_WRITER_SAVE; break;
     350           0 :         case  6: nFlag = FILTERCFG_IMPRESS_SAVE; break;
     351           0 :         case  7: nFlag = FILTERCFG_CALC_SAVE; break;
     352           0 :         case  8: nFlag = FILTERCFG_ENABLE_PPT_PREVIEW; break;
     353           0 :         case  9: nFlag = FILTERCFG_ENABLE_EXCEL_PREVIEW; break;
     354           0 :         case 10: nFlag = FILTERCFG_ENABLE_WORD_PREVIEW; break;
     355           0 :         case 11: nFlag = FILTERCFG_USE_ENHANCED_FIELDS; break;
     356           0 :         case 12: nFlag = FILTERCFG_SMARTART_SHAPE_LOAD; break;
     357             : 
     358             :         default: OSL_FAIL("illegal value");
     359             :     }
     360           0 :     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           0 : void SvtFilterOptions::Load()
     386             : {
     387           0 :     pImp->Load();
     388           0 :     const Sequence<OUString>& rNames = GetPropertyNames();
     389           0 :     Sequence<Any> aValues = GetProperties(rNames);
     390           0 :     const Any* pValues = aValues.getConstArray();
     391             :     DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
     392           0 :     if(aValues.getLength() == rNames.getLength())
     393             :     {
     394           0 :         for(int nProp = 0; nProp < rNames.getLength(); nProp++)
     395             :         {
     396           0 :             if(pValues[nProp].hasValue())
     397             :             {
     398           0 :                 bool bVal = *(sal_Bool*)pValues[nProp].getValue();
     399           0 :                 sal_uLong nFlag = lcl_GetFlag(nProp);
     400           0 :                 pImp->SetFlag( nFlag, bVal);
     401             :             }
     402             :         }
     403           0 :     }
     404           0 : }
     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           0 : bool SvtFilterOptions::IsLoadExcelBasicCode() const
     446             : {
     447           0 :     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           0 : bool SvtFilterOptions::IsLoadExcelBasicExecutable() const
     457             : {
     458           0 :     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           0 : bool SvtFilterOptions::IsLoadExcelBasicStorage() const
     468             : {
     469           0 :     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           0 : bool SvtFilterOptions::IsLoadPPointBasicCode() const
     479             : {
     480           0 :     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           0 : bool SvtFilterOptions::IsMathType2Math() const
     495             : {
     496           0 :     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           0 : bool SvtFilterOptions::IsMath2MathType() const
     506             : {
     507           0 :     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           0 : bool SvtFilterOptions::IsWinWord2Writer() const
     517             : {
     518           0 :     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           0 : bool SvtFilterOptions::IsWriter2WinWord() const
     528             : {
     529           0 :     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           0 : bool SvtFilterOptions::IsUseEnhancedFields() const
     539             : {
     540           0 :     return pImp->IsFlag( FILTERCFG_USE_ENHANCED_FIELDS );
     541             : }
     542             : 
     543           0 : bool SvtFilterOptions::IsExcel2Calc() const
     544             : {
     545           0 :     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           0 : bool SvtFilterOptions::IsCalc2Excel() const
     555             : {
     556           0 :     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           0 : bool SvtFilterOptions::IsPowerPoint2Impress() const
     566             : {
     567           0 :     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           0 : bool SvtFilterOptions::IsImpress2PowerPoint() const
     577             : {
     578           0 :     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           0 : 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           0 :     return false;
     598             : #endif
     599             : }
     600             : 
     601           0 : bool SvtFilterOptions::IsSmartArt2Shape() const
     602             : {
     603           0 :     if (lcl_DoTiledRendering())
     604           0 :         return true;
     605           0 :     return pImp->IsFlag( FILTERCFG_SMARTART_SHAPE_LOAD );
     606             : }
     607             : 
     608           0 : void SvtFilterOptions::SetSmartArt2Shape( bool bFlag )
     609             : {
     610           0 :     pImp->SetFlag( FILTERCFG_SMARTART_SHAPE_LOAD, bFlag );
     611           0 :     SetModified();
     612           0 : }
     613             : 
     614             : namespace
     615             : {
     616             :     class theFilterOptions
     617             :          : public rtl::Static<SvtFilterOptions, theFilterOptions>
     618             :     {
     619             :     };
     620             : }
     621             : 
     622           0 : SvtFilterOptions& SvtFilterOptions::Get()
     623             : {
     624           0 :     return theFilterOptions::get();
     625             : }
     626             : 
     627           0 : bool SvtFilterOptions::IsEnablePPTPreview() const
     628             : {
     629           0 :     return pImp->IsFlag( FILTERCFG_ENABLE_PPT_PREVIEW );
     630             : }
     631             : 
     632           0 : bool SvtFilterOptions::IsEnableCalcPreview() const
     633             : {
     634           0 :     return pImp->IsFlag( FILTERCFG_ENABLE_EXCEL_PREVIEW );
     635             : }
     636             : 
     637           0 : bool SvtFilterOptions::IsEnableWordPreview() const
     638             : {
     639           0 :     return pImp->IsFlag( FILTERCFG_ENABLE_WORD_PREVIEW );
     640             : }
     641             : 
     642             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10