LCOV - code coverage report
Current view: top level - unotools/source/config - viewoptions.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 375 0.0 %
Date: 2014-04-14 Functions: 0 35 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 <unotools/viewoptions.hxx>
      21             : #include <com/sun/star/uno/Any.hxx>
      22             : 
      23             : #include <boost/unordered_map.hpp>
      24             : #include <com/sun/star/beans/PropertyValue.hpp>
      25             : #include <com/sun/star/container/XNameContainer.hpp>
      26             : #include <com/sun/star/container/XNameAccess.hpp>
      27             : #include <com/sun/star/beans/XPropertySet.hpp>
      28             : #include <rtl/ustrbuf.hxx>
      29             : #include <unotools/configpaths.hxx>
      30             : #include <comphelper/configurationhelper.hxx>
      31             : #include <comphelper/processfactory.hxx>
      32             : 
      33             : #include <itemholder1.hxx>
      34             : 
      35             : #define PACKAGE_VIEWS                           "org.openoffice.Office.Views"
      36             : 
      37             : #define LIST_DIALOGS                            "Dialogs"
      38             : #define LIST_TABDIALOGS                         "TabDialogs"
      39             : #define LIST_TABPAGES                           "TabPages"
      40             : #define LIST_WINDOWS                            "Windows"
      41             : 
      42             : #define PROPERTY_WINDOWSTATE                    "WindowState"
      43             : #define PROPERTY_PAGEID                         "PageID"
      44             : #define PROPERTY_VISIBLE                        "Visible"
      45             : #define PROPERTY_USERDATA                       "UserData"
      46             : 
      47             : //#define DEBUG_VIEWOPTIONS
      48             : 
      49             : #ifdef DEBUG_VIEWOPTIONS
      50             :     #define _LOG_COUNTER_( _SVIEW_, _NREAD_, _NWRITE_ )                                                                                     \
      51             :                 {                                                                                                                           \
      52             :                     FILE* pFile = fopen( "viewdbg.txt", "a" );                                                                              \
      53             :                     fprintf( pFile, "%s[%d, %d]\n", OUStringToOString(_SVIEW_, RTL_TEXTENCODING_UTF8).getStr(), _NREAD_, _NWRITE_ ); \
      54             :                     fclose( pFile );                                                                                                        \
      55             :                 }
      56             : #endif // DEBUG_VIEWOPTIONS
      57             : 
      58             : #define SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION_PARAM_EXCEPTION)            \
      59             :     {                                                                                                               \
      60             :         OUStringBuffer sMsg(256);                                                                            \
      61             :         sMsg.appendAscii("Unexpected exception catched. Original message was:\n\""      );                          \
      62             :         sMsg.append     (SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION_PARAM_EXCEPTION.Message);                          \
      63             :         sMsg.appendAscii("\""                                                           );                          \
      64             :     }
      65             : 
      66             : //  initialization!
      67             : 
      68             : SvtViewOptionsBase_Impl*     SvtViewOptions::m_pDataContainer_Dialogs    =   NULL    ;
      69             : sal_Int32                    SvtViewOptions::m_nRefCount_Dialogs         =   0       ;
      70             : SvtViewOptionsBase_Impl*     SvtViewOptions::m_pDataContainer_TabDialogs =   NULL    ;
      71             : sal_Int32                    SvtViewOptions::m_nRefCount_TabDialogs      =   0       ;
      72             : SvtViewOptionsBase_Impl*     SvtViewOptions::m_pDataContainer_TabPages   =   NULL    ;
      73             : sal_Int32                    SvtViewOptions::m_nRefCount_TabPages        =   0       ;
      74             : SvtViewOptionsBase_Impl*     SvtViewOptions::m_pDataContainer_Windows    =   NULL    ;
      75             : sal_Int32                    SvtViewOptions::m_nRefCount_Windows         =   0       ;
      76             : 
      77             : /*-************************************************************************************************************
      78             :     @descr          Implement base data container for view options elements.
      79             :                     Every item support ALL possible configuration information.
      80             :                     But not every superclass should use them! Because some view types don't
      81             :                     have it really.
      82             : 
      83             :     @attention      We implement a write-througt-cache! We use it for reading - but write all changes directly to
      84             :                     configuration. (changes are made on internal cache too!). So it's easier to distinguish
      85             :                     between added/changed/removed elements without any complex mask or bool flag information.
      86             :                     Caches from configuration and our own one are synchronized every time - if we do so.
      87             : *//*-*************************************************************************************************************/
      88             : class SvtViewOptionsBase_Impl
      89             : {
      90             : 
      91             :     public:
      92             :         enum State { STATE_NONE, STATE_FALSE, STATE_TRUE };
      93             : 
      94             :                                                         SvtViewOptionsBase_Impl ( const OUString&                                sList    );
      95             :         virtual                                        ~SvtViewOptionsBase_Impl (                                                                );
      96             :         bool                                        Exists                  ( const OUString&                                sName    );
      97             :         bool                                        Delete                  ( const OUString&                                sName    );
      98             :         OUString                                 GetWindowState          ( const OUString&                                sName    );
      99             :         void                                            SetWindowState          ( const OUString&                                sName    ,
     100             :                                                                                   const OUString&                                sState   );
     101             :         css::uno::Sequence< css::beans::NamedValue >    GetUserData             ( const OUString&                                sName    );
     102             :         void                                            SetUserData             ( const OUString&                                sName    ,
     103             :                                                                                   const css::uno::Sequence< css::beans::NamedValue >&   lData    );
     104             :         sal_Int32                                       GetPageID               ( const OUString&                                sName    );
     105             :         void                                            SetPageID               ( const OUString&                                sName    ,
     106             :                                                                                         sal_Int32                                       nID      );
     107             :         State                                           GetVisible              ( const OUString&                                sName    );
     108             :         void                                            SetVisible              ( const OUString&                                sName    ,
     109             :                                                                                         bool                                        bVisible );
     110             :         css::uno::Any                                   GetUserItem             ( const OUString&                                sName    ,
     111             :                                                                                   const OUString&                                sItem    );
     112             :         void                                            SetUserItem             ( const OUString&                                sName    ,
     113             :                                                                                   const OUString&                                sItem    ,
     114             :                                                                                   const css::uno::Any&                                  aValue   );
     115             : 
     116             :     private:
     117             :         css::uno::Reference< css::uno::XInterface > impl_getSetNode( const OUString& sNode           ,
     118             :                                                                            bool         bCreateIfMissing);
     119             : 
     120             :     private:
     121             :         OUString                                    m_sListName;
     122             :         css::uno::Reference< css::container::XNameAccess > m_xRoot;
     123             :         css::uno::Reference< css::container::XNameAccess > m_xSet;
     124             : 
     125             :         #ifdef DEBUG_VIEWOPTIONS
     126             :         sal_Int32           m_nReadCount;
     127             :         sal_Int32           m_nWriteCount;
     128             :         #endif
     129             : };
     130             : 
     131             : /*-************************************************************************************************************
     132             :     @descr  Implement the base data container.
     133             : *//*-*************************************************************************************************************/
     134             : 
     135             : /*-************************************************************************************************************
     136             :     @short          ctor
     137             :     @descr          We use it to open right configuration file and let configuration objects fill her caches.
     138             :                     Then we read all existing entries from right list and cached it inside our object too.
     139             :                     Normaly we should enable notifications for changes on these values too ... but these feature
     140             :                     isn't full implemented in the moment.
     141             : 
     142             :     @seealso        baseclass ::utl::ConfigItem
     143             :     @seealso        method Notify()
     144             : *//*-*************************************************************************************************************/
     145           0 : SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const OUString& sList )
     146           0 :         :   m_sListName  ( sList )    // we must know, which view type we must support
     147             :         #ifdef DEBUG_VIEWOPTIONS
     148             :         ,   m_nReadCount ( 0     )
     149             :         ,   m_nWriteCount( 0     )
     150             :         #endif
     151             : {
     152             :     try
     153             :     {
     154           0 :         m_xRoot = css::uno::Reference< css::container::XNameAccess >(
     155             :                         ::comphelper::ConfigurationHelper::openConfig(
     156             :                             ::comphelper::getProcessComponentContext(),
     157             :                             PACKAGE_VIEWS,
     158             :                             ::comphelper::ConfigurationHelper::E_STANDARD),
     159           0 :                         css::uno::UNO_QUERY);
     160           0 :         if (m_xRoot.is())
     161           0 :             m_xRoot->getByName(sList) >>= m_xSet;
     162             :     }
     163           0 :     catch(const css::uno::Exception& ex)
     164             :         {
     165           0 :             m_xRoot.clear();
     166           0 :             m_xSet.clear();
     167             : 
     168           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     169             :         }
     170           0 : }
     171             : 
     172             : /*-************************************************************************************************************
     173             :     @short          dtor
     174             :     @descr          clean up something
     175             : 
     176             :     @attention      We implement a write through cache! So we mustn't do it really. All changes was written to cfg directly.
     177             :                     Commit isn't necessary then.
     178             : 
     179             :     @seealso        baseclass ::utl::ConfigItem
     180             :     @seealso        method IsModified()
     181             :     @seealso        method SetModified()
     182             :     @seealso        method Commit()
     183             : *//*-*************************************************************************************************************/
     184           0 : SvtViewOptionsBase_Impl::~SvtViewOptionsBase_Impl()
     185             : {
     186             :     // dont flush configuration changes here to m_xRoot.
     187             :     // That must be done inside every SetXXX() method already !
     188             :     // Here its to late - DisposedExceptions from used configuration access can occur otherwise.
     189             : 
     190           0 :     m_xRoot.clear();
     191           0 :     m_xSet.clear();
     192             : 
     193             :     #ifdef DEBUG_VIEWOPTIONS
     194             :     _LOG_COUNTER_( m_sListName, m_nReadCount, m_nWriteCount )
     195             :     #endif // DEBUG_VIEWOPTIONS
     196           0 : }
     197             : 
     198             : /*-************************************************************************************************************
     199             :     @short          checks for already existing entries
     200             :     @descr          If user don't know, if an entry already exist - he can get this information by calling this method.
     201             : 
     202             :     @seealso        member m_aList
     203             : 
     204             :     @param          "sName", name of entry to check exist state
     205             :     @return         true , if item exist
     206             :                     false, otherwise
     207             : *//*-*************************************************************************************************************/
     208           0 : bool SvtViewOptionsBase_Impl::Exists( const OUString& sName )
     209             : {
     210           0 :     bool bExists = false;
     211             : 
     212             :     try
     213             :     {
     214           0 :         if (m_xSet.is())
     215           0 :             bExists = m_xSet->hasByName(sName);
     216             :     }
     217           0 :     catch(const css::uno::Exception& ex)
     218             :         {
     219           0 :             bExists = false;
     220           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     221             :         }
     222             : 
     223           0 :     return bExists;
     224             : }
     225             : 
     226             : /*-************************************************************************************************************
     227             :     @short          delete entry
     228             :     @descr          Use it to delete set entry by given name.
     229             : 
     230             :     @seealso        member m_aList
     231             : 
     232             :     @param          "sName", name of entry to delete it
     233             :     @return         true , if item not exist(!) or could be deleted (should be the same!)
     234             :                     false, otherwise
     235             : *//*-*************************************************************************************************************/
     236           0 : bool SvtViewOptionsBase_Impl::Delete( const OUString& sName )
     237             : {
     238             :     #ifdef DEBUG_VIEWOPTIONS
     239             :     ++m_nWriteCount;
     240             :     #endif
     241             : 
     242           0 :     bool bDeleted = false;
     243             :     try
     244             :     {
     245           0 :         css::uno::Reference< css::container::XNameContainer > xSet(m_xSet, css::uno::UNO_QUERY_THROW);
     246           0 :         xSet->removeByName(sName);
     247           0 :         bDeleted = true;
     248           0 :         ::comphelper::ConfigurationHelper::flush(m_xRoot);
     249             :     }
     250           0 :     catch(const css::container::NoSuchElementException&)
     251           0 :         { bDeleted = true; }
     252           0 :     catch(const css::uno::Exception& ex)
     253             :         {
     254           0 :             bDeleted = false;
     255           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     256             :         }
     257             : 
     258           0 :     return bDeleted;
     259             : }
     260             : 
     261             : /*-************************************************************************************************************
     262             :     @short          read/write access to cache view items and her properties
     263             :     @descr          Follow methods support read/write access to all cache view items.
     264             : 
     265             :     @seealso        member m_sList
     266             : *//*-*************************************************************************************************************/
     267           0 : OUString SvtViewOptionsBase_Impl::GetWindowState( const OUString& sName )
     268             : {
     269             :     #ifdef DEBUG_VIEWOPTIONS
     270             :     ++m_nReadCount;
     271             :     #endif
     272             : 
     273           0 :     OUString sWindowState;
     274             :     try
     275             :     {
     276             :         css::uno::Reference< css::beans::XPropertySet > xNode(
     277             :             impl_getSetNode(sName, false),
     278           0 :             css::uno::UNO_QUERY);
     279           0 :         if (xNode.is())
     280           0 :             xNode->getPropertyValue(PROPERTY_WINDOWSTATE) >>= sWindowState;
     281             :     }
     282           0 :     catch(const css::uno::Exception& ex)
     283             :         {
     284           0 :             sWindowState = OUString();
     285           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     286             :         }
     287             : 
     288           0 :     return sWindowState;
     289             : }
     290             : 
     291           0 : void SvtViewOptionsBase_Impl::SetWindowState( const OUString& sName  ,
     292             :                                               const OUString& sState )
     293             : {
     294             :     #ifdef DEBUG_VIEWOPTIONS
     295             :     ++m_nWriteCount;
     296             :     #endif
     297             : 
     298             :     try
     299             :     {
     300             :         css::uno::Reference< css::beans::XPropertySet > xNode(
     301             :             impl_getSetNode(sName, true),
     302           0 :             css::uno::UNO_QUERY_THROW);
     303           0 :         xNode->setPropertyValue(PROPERTY_WINDOWSTATE, css::uno::makeAny(sState));
     304           0 :         ::comphelper::ConfigurationHelper::flush(m_xRoot);
     305             :     }
     306           0 :     catch(const css::uno::Exception& ex)
     307             :         {
     308           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     309             :         }
     310           0 : }
     311             : 
     312           0 : css::uno::Sequence< css::beans::NamedValue > SvtViewOptionsBase_Impl::GetUserData( const OUString& sName )
     313             : {
     314             :     #ifdef DEBUG_VIEWOPTIONS
     315             :     ++m_nReadCount;
     316             :     #endif
     317             : 
     318             :     try
     319             :     {
     320             :         css::uno::Reference< css::container::XNameAccess > xNode(
     321             :             impl_getSetNode(sName, false),
     322           0 :             css::uno::UNO_QUERY); // no _THROW ! because we dont create missing items here. So we have to live with zero references .-)
     323           0 :         css::uno::Reference< css::container::XNameAccess > xUserData;
     324           0 :         if (xNode.is())
     325           0 :             xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
     326           0 :         if (xUserData.is())
     327             :         {
     328           0 :             const css::uno::Sequence< OUString >         lNames = xUserData->getElementNames();
     329           0 :             const OUString*                              pNames = lNames.getConstArray();
     330           0 :                   sal_Int32                                     c      = lNames.getLength();
     331           0 :                   sal_Int32                                     i      = 0;
     332           0 :                   css::uno::Sequence< css::beans::NamedValue >  lUserData(c);
     333             : 
     334           0 :             for (i=0; i<c; ++i)
     335             :             {
     336           0 :                 lUserData[i].Name  = pNames[i];
     337           0 :                 lUserData[i].Value = xUserData->getByName(pNames[i]);
     338             :             }
     339             : 
     340           0 :             return lUserData;
     341           0 :         }
     342             :     }
     343           0 :     catch(const css::uno::Exception& ex)
     344             :         {
     345           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     346             :         }
     347             : 
     348           0 :     return css::uno::Sequence< css::beans::NamedValue >();
     349             : }
     350             : 
     351           0 : void SvtViewOptionsBase_Impl::SetUserData( const OUString&                              sName  ,
     352             :                                            const css::uno::Sequence< css::beans::NamedValue >& lData  )
     353             : {
     354             :     #ifdef DEBUG_VIEWOPTIONS
     355             :     ++m_nWriteCount;
     356             :     #endif
     357             : 
     358             :     try
     359             :     {
     360             :         css::uno::Reference< css::container::XNameAccess > xNode(
     361             :             impl_getSetNode(sName, true),
     362           0 :             css::uno::UNO_QUERY_THROW);
     363           0 :         css::uno::Reference< css::container::XNameContainer > xUserData;
     364           0 :         xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
     365           0 :         if (xUserData.is())
     366             :         {
     367           0 :             const css::beans::NamedValue* pData = lData.getConstArray();
     368           0 :                   sal_Int32               c     = lData.getLength();
     369           0 :                   sal_Int32               i     = 0;
     370           0 :             for (i=0; i<c; ++i)
     371             :             {
     372           0 :                 if (xUserData->hasByName(pData[i].Name))
     373           0 :                     xUserData->replaceByName(pData[i].Name, pData[i].Value);
     374             :                 else
     375           0 :                     xUserData->insertByName(pData[i].Name, pData[i].Value);
     376             :             }
     377             :         }
     378           0 :         ::comphelper::ConfigurationHelper::flush(m_xRoot);
     379             :     }
     380           0 :     catch(const css::uno::Exception& ex)
     381             :         {
     382           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     383             :         }
     384           0 : }
     385             : 
     386           0 : css::uno::Any SvtViewOptionsBase_Impl::GetUserItem( const OUString& sName ,
     387             :                                                     const OUString& sItem )
     388             : {
     389             :     #ifdef DEBUG_VIEWOPTIONS
     390             :     ++m_nReadCount;
     391             :     #endif
     392             : 
     393           0 :     css::uno::Any aItem;
     394             :     try
     395             :     {
     396             :         css::uno::Reference< css::container::XNameAccess > xNode(
     397             :             impl_getSetNode(sName, false),
     398           0 :             css::uno::UNO_QUERY);
     399           0 :         css::uno::Reference< css::container::XNameAccess > xUserData;
     400           0 :         if (xNode.is())
     401           0 :             xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
     402           0 :         if (xUserData.is())
     403           0 :             aItem = xUserData->getByName(sItem);
     404             :     }
     405           0 :     catch(const css::container::NoSuchElementException&)
     406           0 :         { aItem.clear(); }
     407           0 :     catch(const css::uno::Exception& ex)
     408             :         {
     409           0 :             aItem.clear();
     410           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     411             :         }
     412             : 
     413           0 :     return aItem;
     414             : }
     415             : 
     416           0 : void SvtViewOptionsBase_Impl::SetUserItem( const OUString& sName  ,
     417             :                                            const OUString& sItem  ,
     418             :                                            const css::uno::Any&   aValue )
     419             : {
     420             :     #ifdef DEBUG_VIEWOPTIONS
     421             :     ++m_nWriteCount;
     422             :     #endif
     423             : 
     424             :     try
     425             :     {
     426             :         css::uno::Reference< css::container::XNameAccess > xNode(
     427             :             impl_getSetNode(sName, true),
     428           0 :             css::uno::UNO_QUERY_THROW);
     429           0 :         css::uno::Reference< css::container::XNameContainer > xUserData;
     430           0 :         xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
     431           0 :         if (xUserData.is())
     432             :         {
     433           0 :             if (xUserData->hasByName(sItem))
     434           0 :                 xUserData->replaceByName(sItem, aValue);
     435             :             else
     436           0 :                 xUserData->insertByName(sItem, aValue);
     437             :         }
     438           0 :         ::comphelper::ConfigurationHelper::flush(m_xRoot);
     439             :     }
     440           0 :     catch(const css::uno::Exception& ex)
     441             :         {
     442           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     443             :         }
     444           0 : }
     445             : 
     446           0 : sal_Int32 SvtViewOptionsBase_Impl::GetPageID( const OUString& sName )
     447             : {
     448             :     #ifdef DEBUG_VIEWOPTIONS
     449             :     ++m_nReadCount;
     450             :     #endif
     451             : 
     452           0 :     sal_Int32 nID = 0;
     453             :     try
     454             :     {
     455             :         css::uno::Reference< css::beans::XPropertySet > xNode(
     456             :             impl_getSetNode(sName, false),
     457           0 :             css::uno::UNO_QUERY);
     458           0 :         if (xNode.is())
     459           0 :             xNode->getPropertyValue(PROPERTY_PAGEID) >>= nID;
     460             :     }
     461           0 :     catch(const css::uno::Exception& ex)
     462             :         {
     463           0 :             nID = 0;
     464           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     465             :         }
     466             : 
     467           0 :     return nID;
     468             : }
     469             : 
     470           0 : void SvtViewOptionsBase_Impl::SetPageID( const OUString& sName ,
     471             :                                                sal_Int32        nID   )
     472             : {
     473             :     #ifdef DEBUG_VIEWOPTIONS
     474             :     ++m_nWriteCount;
     475             :     #endif
     476             : 
     477             :     try
     478             :     {
     479             :         css::uno::Reference< css::beans::XPropertySet > xNode(
     480             :             impl_getSetNode(sName, true),
     481           0 :             css::uno::UNO_QUERY_THROW);
     482           0 :         xNode->setPropertyValue(PROPERTY_PAGEID, css::uno::makeAny(nID));
     483           0 :         ::comphelper::ConfigurationHelper::flush(m_xRoot);
     484             :     }
     485           0 :     catch(const css::uno::Exception& ex)
     486             :         {
     487           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     488             :         }
     489           0 : }
     490             : 
     491           0 : SvtViewOptionsBase_Impl::State SvtViewOptionsBase_Impl::GetVisible( const OUString& sName )
     492             : {
     493             :     #ifdef DEBUG_VIEWOPTIONS
     494             :     ++m_nReadCount;
     495             :     #endif
     496             : 
     497           0 :     State eState = STATE_NONE;
     498             :     try
     499             :     {
     500             :         css::uno::Reference< css::beans::XPropertySet > xNode(
     501             :             impl_getSetNode(sName, false),
     502           0 :             css::uno::UNO_QUERY);
     503           0 :         if (xNode.is())
     504             :         {
     505           0 :             bool bVisible = false;
     506           0 :             if (xNode->getPropertyValue(PROPERTY_VISIBLE) >>= bVisible)
     507             :             {
     508           0 :                 eState = bVisible ? STATE_TRUE : STATE_FALSE;
     509             :             }
     510           0 :         }
     511             :     }
     512           0 :     catch(const css::uno::Exception& ex)
     513             :         {
     514           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     515             :         }
     516             : 
     517           0 :     return eState;
     518             : }
     519             : 
     520           0 : void SvtViewOptionsBase_Impl::SetVisible( const OUString& sName    ,
     521             :                                                 bool         bVisible )
     522             : {
     523             :     #ifdef DEBUG_VIEWOPTIONS
     524             :     ++m_nWriteCount;
     525             :     #endif
     526             : 
     527             :     try
     528             :     {
     529             :         css::uno::Reference< css::beans::XPropertySet > xNode(
     530             :             impl_getSetNode(sName, true),
     531           0 :             css::uno::UNO_QUERY_THROW);
     532           0 :         xNode->setPropertyValue(PROPERTY_VISIBLE, css::uno::makeAny(bVisible));
     533           0 :         ::comphelper::ConfigurationHelper::flush(m_xRoot);
     534             :     }
     535           0 :     catch(const css::uno::Exception& ex)
     536             :         {
     537           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     538             :         }
     539           0 : }
     540             : 
     541             : /*-************************************************************************************************************
     542             :     @short          create new set node with default values on disk
     543             :     @descr          To create a new UserData item - the super node of these property must already exist!
     544             :                     You can call this method to create these new entry with default values and change UserData then.
     545             : 
     546             :     @seealso        method impl_writeDirectProp()
     547             : 
     548             :     @param          "sNode", name of new entry
     549             : *//*-*************************************************************************************************************/
     550           0 : css::uno::Reference< css::uno::XInterface > SvtViewOptionsBase_Impl::impl_getSetNode( const OUString& sNode           ,
     551             :                                                                                             bool         bCreateIfMissing)
     552             : {
     553           0 :     css::uno::Reference< css::uno::XInterface > xNode;
     554             : 
     555             :     try
     556             :     {
     557           0 :         if (bCreateIfMissing)
     558           0 :             xNode = ::comphelper::ConfigurationHelper::makeSureSetNodeExists(m_xRoot, m_sListName, sNode);
     559             :         else
     560             :         {
     561           0 :             if (m_xSet.is() && m_xSet->hasByName(sNode) )
     562           0 :                 m_xSet->getByName(sNode) >>= xNode;
     563             :         }
     564             :     }
     565           0 :     catch(const css::container::NoSuchElementException&)
     566           0 :         { xNode.clear(); }
     567           0 :     catch(const css::uno::Exception& ex)
     568             :         {
     569           0 :             xNode.clear();
     570           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     571             :         }
     572             : 
     573           0 :     return xNode;
     574             : }
     575             : 
     576             : //  constructor
     577             : 
     578           0 : SvtViewOptions::SvtViewOptions(       EViewType        eType     ,
     579             :                                 const OUString& sViewName )
     580             :     :   m_eViewType ( eType     )
     581           0 :     ,   m_sViewName ( sViewName )
     582             : {
     583             :     // Global access, must be guarded (multithreading!)
     584           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     585             : 
     586             :     // Search for right dat container for this view type and initialize right data container or set right ref count!
     587           0 :     switch( eType )
     588             :     {
     589             :         case E_DIALOG       :   {
     590             :                                     // Increase ref count for dialog data container first.
     591           0 :                                     ++m_nRefCount_Dialogs;
     592             :                                     // If these instance the first user of the dialog data container - create these impl static container!
     593           0 :                                     if( m_nRefCount_Dialogs == 1 )
     594             :                                     {
     595             :                                         //m_pDataContainer_Dialogs = new SvtViewDialogOptions_Impl( LIST_DIALOGS );
     596           0 :                                         m_pDataContainer_Dialogs = new SvtViewOptionsBase_Impl( LIST_DIALOGS );
     597           0 :                                         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_DIALOG);
     598             :                                     }
     599             :                                 }
     600           0 :                                 break;
     601             :         case E_TABDIALOG    :   {
     602             :                                     // Increase ref count for tab-dialog data container first.
     603           0 :                                     ++m_nRefCount_TabDialogs;
     604             :                                     // If these instance the first user of the tab-dialog data container - create these impl static container!
     605           0 :                                     if( m_nRefCount_TabDialogs == 1 )
     606             :                                     {
     607           0 :                                         m_pDataContainer_TabDialogs = new SvtViewOptionsBase_Impl( LIST_TABDIALOGS );
     608           0 :                                         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABDIALOG);
     609             :                                     }
     610             :                                 }
     611           0 :                                 break;
     612             :         case E_TABPAGE      :   {
     613             :                                     // Increase ref count for tab-page data container first.
     614           0 :                                     ++m_nRefCount_TabPages;
     615             :                                     // If these instance the first user of the tab-page data container - create these impl static container!
     616           0 :                                     if( m_nRefCount_TabPages == 1 )
     617             :                                     {
     618           0 :                                         m_pDataContainer_TabPages = new SvtViewOptionsBase_Impl( LIST_TABPAGES );
     619           0 :                                         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABPAGE);
     620             :                                     }
     621             :                                 }
     622           0 :                                 break;
     623             :         case E_WINDOW       :   {
     624             :                                     // Increase ref count for window data container first.
     625           0 :                                     ++m_nRefCount_Windows;
     626             :                                     // If these instance the first user of the window data container - create these impl static container!
     627           0 :                                     if( m_nRefCount_Windows == 1 )
     628             :                                     {
     629           0 :                                         m_pDataContainer_Windows = new SvtViewOptionsBase_Impl( LIST_WINDOWS );
     630           0 :                                         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_WINDOW);
     631             :                                     }
     632             :                                 }
     633           0 :                                 break;
     634             :         default             :   OSL_FAIL( "SvtViewOptions::SvtViewOptions()\nThese view type is unknown! All following calls at these instance will do nothing!\n" );
     635           0 :     }
     636           0 : }
     637             : 
     638             : //  destructor
     639             : 
     640           0 : SvtViewOptions::~SvtViewOptions()
     641             : {
     642             :     // Global access, must be guarded (multithreading!)
     643           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     644             : 
     645             :     // Search for right dat container for this view type and deinitialize right data container or set right ref count!
     646           0 :     switch( m_eViewType )
     647             :     {
     648             :         case E_DIALOG       :   {
     649             :                                     // Decrease ref count for dialog data container first.
     650           0 :                                     --m_nRefCount_Dialogs;
     651             :                                     // If these instance the last user of the dialog data container - delete these impl static container!
     652           0 :                                     if( m_nRefCount_Dialogs == 0 )
     653             :                                     {
     654           0 :                                         delete m_pDataContainer_Dialogs;
     655           0 :                                         m_pDataContainer_Dialogs = NULL;
     656             :                                     }
     657             :                                 }
     658           0 :                                 break;
     659             :         case E_TABDIALOG    :   {
     660             :                                     // Decrease ref count for tab-dialog data container first.
     661           0 :                                     --m_nRefCount_TabDialogs;
     662             :                                     // If these instance the last user of the tab-dialog data container - delete these impl static container!
     663           0 :                                     if( m_nRefCount_TabDialogs == 0 )
     664             :                                     {
     665           0 :                                         delete m_pDataContainer_TabDialogs;
     666           0 :                                         m_pDataContainer_TabDialogs = NULL;
     667             :                                     }
     668             :                                 }
     669           0 :                                 break;
     670             :         case E_TABPAGE      :   {
     671             :                                     // Decrease ref count for tab-page data container first.
     672           0 :                                     --m_nRefCount_TabPages;
     673             :                                     // If these instance the last user of the tab-page data container - delete these impl static container!
     674           0 :                                     if( m_nRefCount_TabPages == 0 )
     675             :                                     {
     676           0 :                                         delete m_pDataContainer_TabPages;
     677           0 :                                         m_pDataContainer_TabPages = NULL;
     678             :                                     }
     679             :                                 }
     680           0 :                                 break;
     681             :         case E_WINDOW       :   {
     682             :                                     // Decrease ref count for window data container first.
     683           0 :                                     --m_nRefCount_Windows;
     684             :                                     // If these instance the last user of the window data container - delete these impl static container!
     685           0 :                                     if( m_nRefCount_Windows == 0 )
     686             :                                     {
     687           0 :                                         delete m_pDataContainer_Windows;
     688           0 :                                         m_pDataContainer_Windows = NULL;
     689             :                                     }
     690             :                                 }
     691           0 :                                 break;
     692           0 :     }
     693           0 : }
     694             : 
     695             : //  public method
     696             : 
     697           0 : bool SvtViewOptions::Exists() const
     698             : {
     699             :     // Ready for multithreading
     700           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     701             : 
     702           0 :     bool bExists = false;
     703           0 :     switch( m_eViewType )
     704             :     {
     705             :         case E_DIALOG       :   {
     706           0 :                                     bExists = m_pDataContainer_Dialogs->Exists( m_sViewName );
     707             :                                 }
     708           0 :                                 break;
     709             :         case E_TABDIALOG    :   {
     710           0 :                                     bExists = m_pDataContainer_TabDialogs->Exists( m_sViewName );
     711             :                                 }
     712           0 :                                 break;
     713             :         case E_TABPAGE      :   {
     714           0 :                                     bExists = m_pDataContainer_TabPages->Exists( m_sViewName );
     715             :                                 }
     716           0 :                                 break;
     717             :         case E_WINDOW       :   {
     718           0 :                                     bExists = m_pDataContainer_Windows->Exists( m_sViewName );
     719             :                                 }
     720           0 :                                 break;
     721             :     }
     722           0 :     return bExists;
     723             : }
     724             : 
     725             : //  public method
     726             : 
     727           0 : bool SvtViewOptions::Delete()
     728             : {
     729             :     // Ready for multithreading
     730           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     731             : 
     732           0 :     bool bState = false;
     733           0 :     switch( m_eViewType )
     734             :     {
     735             :         case E_DIALOG       :   {
     736           0 :                                     bState = m_pDataContainer_Dialogs->Delete( m_sViewName );
     737             :                                 }
     738           0 :                                 break;
     739             :         case E_TABDIALOG    :   {
     740           0 :                                     bState = m_pDataContainer_TabDialogs->Delete( m_sViewName );
     741             :                                 }
     742           0 :                                 break;
     743             :         case E_TABPAGE      :   {
     744           0 :                                     bState = m_pDataContainer_TabPages->Delete( m_sViewName );
     745             :                                 }
     746           0 :                                 break;
     747             :         case E_WINDOW       :   {
     748           0 :                                     bState = m_pDataContainer_Windows->Delete( m_sViewName );
     749             :                                 }
     750           0 :                                 break;
     751             :     }
     752           0 :     return bState;
     753             : }
     754             : 
     755             : //  public method
     756             : 
     757           0 : OUString SvtViewOptions::GetWindowState() const
     758             : {
     759             :     // Ready for multithreading
     760           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     761             : 
     762           0 :     OUString sState;
     763           0 :     switch( m_eViewType )
     764             :     {
     765             :         case E_DIALOG       :   {
     766           0 :                                     sState = m_pDataContainer_Dialogs->GetWindowState( m_sViewName );
     767             :                                 }
     768           0 :                                 break;
     769             :         case E_TABDIALOG    :   {
     770           0 :                                     sState = m_pDataContainer_TabDialogs->GetWindowState( m_sViewName );
     771             :                                 }
     772           0 :                                 break;
     773             :         case E_TABPAGE      :   {
     774           0 :                                     sState = m_pDataContainer_TabPages->GetWindowState( m_sViewName );
     775             :                                 }
     776           0 :                                 break;
     777             :         case E_WINDOW       :   {
     778           0 :                                     sState = m_pDataContainer_Windows->GetWindowState( m_sViewName );
     779             :                                 }
     780           0 :                                 break;
     781             :     }
     782           0 :     return sState;
     783             : }
     784             : 
     785             : //  public method
     786             : 
     787           0 : void SvtViewOptions::SetWindowState( const OUString& sState )
     788             : {
     789             :     // Ready for multithreading
     790           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     791             : 
     792           0 :     switch( m_eViewType )
     793             :     {
     794             :         case E_DIALOG       :   {
     795           0 :                                     m_pDataContainer_Dialogs->SetWindowState( m_sViewName, sState );
     796             :                                 }
     797           0 :                                 break;
     798             :         case E_TABDIALOG    :   {
     799           0 :                                     m_pDataContainer_TabDialogs->SetWindowState( m_sViewName, sState );
     800             :                                 }
     801           0 :                                 break;
     802             :         case E_TABPAGE      :   {
     803           0 :                                     m_pDataContainer_TabPages->SetWindowState( m_sViewName, sState );
     804             :                                 }
     805           0 :                                 break;
     806             :         case E_WINDOW       :   {
     807           0 :                                     m_pDataContainer_Windows->SetWindowState( m_sViewName, sState );
     808             :                                 }
     809           0 :                                 break;
     810           0 :     }
     811           0 : }
     812             : 
     813             : //  public method
     814             : 
     815           0 : sal_Int32 SvtViewOptions::GetPageID() const
     816             : {
     817             :     // Ready for multithreading
     818           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     819             : 
     820             :     // Safe impossible cases.
     821             :     // These call isn't allowed for dialogs, tab-pages or windows!
     822             :     OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABPAGE||m_eViewType==E_WINDOW), "SvtViewOptions::GetPageID()\nCall not allowed for Dialogs, TabPages or Windows! I do nothing!\n" );
     823             : 
     824           0 :     sal_Int32 nID = 0;
     825           0 :     if( m_eViewType == E_TABDIALOG )
     826           0 :         nID = m_pDataContainer_TabDialogs->GetPageID( m_sViewName );
     827           0 :     return nID;
     828             : }
     829             : 
     830             : //  public method
     831             : 
     832           0 : void SvtViewOptions::SetPageID( sal_Int32 nID )
     833             : {
     834             :     // Ready for multithreading
     835           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     836             : 
     837             :     // Safe impossible cases.
     838             :     // These call isn't allowed for dialogs, tab-pages or windows!
     839             :     OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABPAGE||m_eViewType==E_WINDOW), "SvtViewOptions::SetPageID()\nCall not allowed for Dialogs, TabPages or Windows! I do nothing!\n" );
     840             : 
     841           0 :     if( m_eViewType == E_TABDIALOG )
     842           0 :         m_pDataContainer_TabDialogs->SetPageID( m_sViewName, nID );
     843           0 : }
     844             : 
     845             : //  public method
     846             : 
     847           0 : bool SvtViewOptions::IsVisible() const
     848             : {
     849             :     // Ready for multithreading
     850           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     851             : 
     852             :     // Safe impossible cases.
     853             :     // These call isn't allowed for dialogs, tab-dialogs or tab-pages!
     854             :     OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABDIALOG||m_eViewType==E_TABPAGE), "SvtViewOptions::IsVisible()\nCall not allowed for Dialogs, TabDialogs or TabPages! I do nothing!\n" );
     855             : 
     856           0 :     bool bState = false;
     857           0 :     if( m_eViewType == E_WINDOW )
     858           0 :         bState = m_pDataContainer_Windows->GetVisible( m_sViewName ) == SvtViewOptionsBase_Impl::STATE_TRUE;
     859             : 
     860           0 :     return bState;
     861             : }
     862             : 
     863             : //  public method
     864             : 
     865           0 : void SvtViewOptions::SetVisible( bool bState )
     866             : {
     867             :     // Ready for multithreading
     868           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     869             : 
     870             :     // Safe impossible cases.
     871             :     // These call isn't allowed for dialogs, tab-dialogs or tab-pages!
     872             :     OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABDIALOG||m_eViewType==E_TABPAGE), "SvtViewOptions::SetVisible()\nCall not allowed for Dialogs, TabDialogs or TabPages! I do nothing!\n" );
     873             : 
     874           0 :     if( m_eViewType == E_WINDOW )
     875           0 :         m_pDataContainer_Windows->SetVisible( m_sViewName, bState );
     876           0 : }
     877             : 
     878             : //  public method
     879             : 
     880           0 : bool SvtViewOptions::HasVisible() const
     881             : {
     882             :     // Ready for multithreading
     883           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     884             : 
     885             :     // Safe impossible cases.
     886             :     // These call isn't allowed for dialogs, tab-dialogs or tab-pages!
     887             :     OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABDIALOG||m_eViewType==E_TABPAGE), "SvtViewOptions::IsVisible()\nCall not allowed for Dialogs, TabDialogs or TabPages! I do nothing!\n" );
     888             : 
     889           0 :     bool bState = false;
     890           0 :     if( m_eViewType == E_WINDOW )
     891           0 :         bState = m_pDataContainer_Windows->GetVisible( m_sViewName ) != SvtViewOptionsBase_Impl::STATE_NONE;
     892             : 
     893           0 :     return bState;
     894             : }
     895             : 
     896           0 : css::uno::Sequence< css::beans::NamedValue > SvtViewOptions::GetUserData() const
     897             : {
     898             :     // Ready for multithreading
     899           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     900             : 
     901           0 :     css::uno::Sequence< css::beans::NamedValue > lData;
     902           0 :     switch( m_eViewType )
     903             :     {
     904             :         case E_DIALOG       :   {
     905           0 :                                     lData = m_pDataContainer_Dialogs->GetUserData( m_sViewName );
     906             :                                 }
     907           0 :                                 break;
     908             :         case E_TABDIALOG    :   {
     909           0 :                                     lData = m_pDataContainer_TabDialogs->GetUserData( m_sViewName );
     910             :                                 }
     911           0 :                                 break;
     912             :         case E_TABPAGE      :   {
     913           0 :                                     lData = m_pDataContainer_TabPages->GetUserData( m_sViewName );
     914             :                                 }
     915           0 :                                 break;
     916             :         case E_WINDOW       :   {
     917           0 :                                     lData = m_pDataContainer_Windows->GetUserData( m_sViewName );
     918             :                                 }
     919           0 :                                 break;
     920             :     }
     921           0 :     return lData;
     922             : }
     923             : 
     924           0 : void SvtViewOptions::SetUserData( const css::uno::Sequence< css::beans::NamedValue >& lData )
     925             : {
     926             :     // Ready for multithreading
     927           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     928             : 
     929           0 :     switch( m_eViewType )
     930             :     {
     931             :         case E_DIALOG       :   {
     932           0 :                                     m_pDataContainer_Dialogs->SetUserData( m_sViewName, lData );
     933             :                                 }
     934           0 :                                 break;
     935             :         case E_TABDIALOG    :   {
     936           0 :                                     m_pDataContainer_TabDialogs->SetUserData( m_sViewName, lData );
     937             :                                 }
     938           0 :                                 break;
     939             :         case E_TABPAGE      :   {
     940           0 :                                     m_pDataContainer_TabPages->SetUserData( m_sViewName, lData );
     941             :                                 }
     942           0 :                                 break;
     943             :         case E_WINDOW       :   {
     944           0 :                                     m_pDataContainer_Windows->SetUserData( m_sViewName, lData );
     945             :                                 }
     946           0 :                                 break;
     947           0 :     }
     948           0 : }
     949             : 
     950           0 : css::uno::Any SvtViewOptions::GetUserItem( const OUString& sName ) const
     951             : {
     952             :     // Ready for multithreading
     953           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     954             : 
     955           0 :     css::uno::Any aItem;
     956           0 :     switch( m_eViewType )
     957             :     {
     958             :         case E_DIALOG       :   {
     959           0 :                                     aItem = m_pDataContainer_Dialogs->GetUserItem( m_sViewName, sName );
     960             :                                 }
     961           0 :                                 break;
     962             :         case E_TABDIALOG    :   {
     963           0 :                                     aItem = m_pDataContainer_TabDialogs->GetUserItem( m_sViewName, sName );
     964             :                                 }
     965           0 :                                 break;
     966             :         case E_TABPAGE      :   {
     967           0 :                                     aItem = m_pDataContainer_TabPages->GetUserItem( m_sViewName, sName );
     968             :                                 }
     969           0 :                                 break;
     970             :         case E_WINDOW       :   {
     971           0 :                                     aItem = m_pDataContainer_Windows->GetUserItem( m_sViewName, sName );
     972             :                                 }
     973           0 :                                 break;
     974             :     }
     975           0 :     return aItem;
     976             : }
     977             : 
     978           0 : void SvtViewOptions::SetUserItem( const OUString& sName  ,
     979             :                                   const css::uno::Any&   aValue )
     980             : {
     981             :     // Ready for multithreading
     982           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     983             : 
     984           0 :     switch( m_eViewType )
     985             :     {
     986             :         case E_DIALOG       :   {
     987           0 :                                     m_pDataContainer_Dialogs->SetUserItem( m_sViewName, sName, aValue );
     988             :                                 }
     989           0 :                                 break;
     990             :         case E_TABDIALOG    :   {
     991           0 :                                     m_pDataContainer_TabDialogs->SetUserItem( m_sViewName, sName, aValue );
     992             :                                 }
     993           0 :                                 break;
     994             :         case E_TABPAGE      :   {
     995           0 :                                     m_pDataContainer_TabPages->SetUserItem( m_sViewName, sName, aValue );
     996             :                                 }
     997           0 :                                 break;
     998             :         case E_WINDOW       :   {
     999           0 :                                     m_pDataContainer_Windows->SetUserItem( m_sViewName, sName, aValue );
    1000             :                                 }
    1001           0 :                                 break;
    1002           0 :     }
    1003           0 : }
    1004             : 
    1005             : namespace
    1006             : {
    1007             :     class theViewOptionsMutex : public rtl::Static<osl::Mutex, theViewOptionsMutex>{};
    1008             : }
    1009             : 
    1010             : //  private method
    1011             : 
    1012           0 : ::osl::Mutex& SvtViewOptions::GetOwnStaticMutex()
    1013             : {
    1014           0 :     return theViewOptionsMutex::get();
    1015             : }
    1016             : 
    1017           0 : void SvtViewOptions::AcquireOptions()
    1018             : {
    1019           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
    1020           0 :     if( ++m_nRefCount_Dialogs == 1 )
    1021             :     {
    1022           0 :         m_pDataContainer_Dialogs = new SvtViewOptionsBase_Impl( LIST_DIALOGS );
    1023           0 :         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_DIALOG);
    1024             :     }
    1025           0 :     if( ++m_nRefCount_TabDialogs == 1 )
    1026             :     {
    1027           0 :         m_pDataContainer_TabDialogs = new SvtViewOptionsBase_Impl( LIST_TABDIALOGS );
    1028           0 :         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABDIALOG);
    1029             :     }
    1030           0 :     if( ++m_nRefCount_TabPages == 1 )
    1031             :     {
    1032           0 :         m_pDataContainer_TabPages = new SvtViewOptionsBase_Impl( LIST_TABPAGES );
    1033           0 :         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABPAGE);
    1034             :     }
    1035           0 :     if( ++m_nRefCount_Windows == 1 )
    1036             :     {
    1037           0 :         m_pDataContainer_Windows = new SvtViewOptionsBase_Impl( LIST_WINDOWS );
    1038           0 :         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_WINDOW);
    1039           0 :     }
    1040           0 : }
    1041             : 
    1042           0 : void SvtViewOptions::ReleaseOptions()
    1043             : {
    1044           0 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
    1045           0 :     if( --m_nRefCount_Dialogs == 0 )
    1046             :     {
    1047           0 :         delete m_pDataContainer_Dialogs;
    1048           0 :         m_pDataContainer_Dialogs = NULL;
    1049             :     }
    1050           0 :     if( --m_nRefCount_TabDialogs == 0 )
    1051             :     {
    1052           0 :         delete m_pDataContainer_TabDialogs;
    1053           0 :         m_pDataContainer_TabDialogs = NULL;
    1054             :     }
    1055           0 :     if( --m_nRefCount_TabPages == 0 )
    1056             :     {
    1057           0 :         delete m_pDataContainer_TabPages;
    1058           0 :         m_pDataContainer_TabPages = NULL;
    1059             :     }
    1060           0 :     if( --m_nRefCount_Windows == 0 )
    1061             :     {
    1062           0 :         delete m_pDataContainer_Windows;
    1063           0 :         m_pDataContainer_Windows = NULL;
    1064           0 :     }
    1065           0 : }
    1066             : 
    1067             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10