LCOV - code coverage report
Current view: top level - unotools/source/config - viewoptions.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 225 375 60.0 %
Date: 2015-06-13 12:38:46 Functions: 27 35 77.1 %
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 <com/sun/star/beans/PropertyValue.hpp>
      24             : #include <com/sun/star/container/XNameContainer.hpp>
      25             : #include <com/sun/star/container/XNameAccess.hpp>
      26             : #include <com/sun/star/beans/XPropertySet.hpp>
      27             : #include <rtl/ustrbuf.hxx>
      28             : #include <osl/diagnose.h>
      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             :         explicit SvtViewOptionsBase_Impl(const OUString& rList);
      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             :                     Normally 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         832 : SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const OUString& sList )
     146         832 :         :   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        1664 :         m_xRoot = css::uno::Reference< css::container::XNameAccess >(
     155             :                         ::comphelper::ConfigurationHelper::openConfig(
     156             :                             ::comphelper::getProcessComponentContext(),
     157             :                             PACKAGE_VIEWS,
     158             :                             ::comphelper::ConfigurationHelper::E_STANDARD),
     159         832 :                         css::uno::UNO_QUERY);
     160         832 :         if (m_xRoot.is())
     161         832 :             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         832 : }
     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        1428 : 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         476 :     m_xRoot.clear();
     191         476 :     m_xSet.clear();
     192             : 
     193             :     #ifdef DEBUG_VIEWOPTIONS
     194             :     _LOG_COUNTER_( m_sListName, m_nReadCount, m_nWriteCount )
     195             :     #endif // DEBUG_VIEWOPTIONS
     196         952 : }
     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      205341 : bool SvtViewOptionsBase_Impl::Exists( const OUString& sName )
     209             : {
     210      205341 :     bool bExists = false;
     211             : 
     212             :     try
     213             :     {
     214      205341 :         if (m_xSet.is())
     215      205341 :             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      205341 :     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      102730 : OUString SvtViewOptionsBase_Impl::GetWindowState( const OUString& sName )
     268             : {
     269             :     #ifdef DEBUG_VIEWOPTIONS
     270             :     ++m_nReadCount;
     271             :     #endif
     272             : 
     273      102730 :     OUString sWindowState;
     274             :     try
     275             :     {
     276             :         css::uno::Reference< css::beans::XPropertySet > xNode(
     277             :             impl_getSetNode(sName, false),
     278      102730 :             css::uno::UNO_QUERY);
     279      102730 :         if (xNode.is())
     280        6603 :             xNode->getPropertyValue(PROPERTY_WINDOWSTATE) >>= sWindowState;
     281             :     }
     282           0 :     catch(const css::uno::Exception& ex)
     283             :         {
     284           0 :             sWindowState.clear();
     285           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     286             :         }
     287             : 
     288      102730 :     return sWindowState;
     289             : }
     290             : 
     291        6841 : 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        6841 :             css::uno::UNO_QUERY_THROW);
     303        6841 :         xNode->setPropertyValue(PROPERTY_WINDOWSTATE, css::uno::makeAny(sState));
     304        6841 :         ::comphelper::ConfigurationHelper::flush(m_xRoot);
     305             :     }
     306           0 :     catch(const css::uno::Exception& ex)
     307             :         {
     308           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     309             :         }
     310        6841 : }
     311             : 
     312      102730 : 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      102730 :             css::uno::UNO_QUERY); // no _THROW ! because we dont create missing items here. So we have to live with zero references .-)
     323      198857 :         css::uno::Reference< css::container::XNameAccess > xUserData;
     324      102730 :         if (xNode.is())
     325        6603 :             xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
     326      102730 :         if (xUserData.is())
     327             :         {
     328        6603 :             const css::uno::Sequence<OUString> lNames = xUserData->getElementNames();
     329        6603 :             const OUString* pNames = lNames.getConstArray();
     330        6603 :             sal_Int32 c = lNames.getLength();
     331        6603 :             sal_Int32 i = 0;
     332       13206 :             css::uno::Sequence< css::beans::NamedValue > lUserData(c);
     333             : 
     334       13100 :             for (i=0; i<c; ++i)
     335             :             {
     336        6497 :                 lUserData[i].Name  = pNames[i];
     337        6497 :                 lUserData[i].Value = xUserData->getByName(pNames[i]);
     338             :             }
     339             : 
     340       13206 :             return lUserData;
     341       96127 :         }
     342             :     }
     343           0 :     catch(const css::uno::Exception& ex)
     344             :         {
     345           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     346             :         }
     347             : 
     348       96127 :     return css::uno::Sequence< css::beans::NamedValue >();
     349             : }
     350             : 
     351        6841 : 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        6841 :             css::uno::UNO_QUERY_THROW);
     363       13682 :         css::uno::Reference< css::container::XNameContainer > xUserData;
     364        6841 :         xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
     365        6841 :         if (xUserData.is())
     366             :         {
     367        6841 :             const css::beans::NamedValue* pData = lData.getConstArray();
     368        6841 :                   sal_Int32               c     = lData.getLength();
     369        6841 :                   sal_Int32               i     = 0;
     370       13682 :             for (i=0; i<c; ++i)
     371             :             {
     372        6841 :                 if (xUserData->hasByName(pData[i].Name))
     373        6579 :                     xUserData->replaceByName(pData[i].Name, pData[i].Value);
     374             :                 else
     375         262 :                     xUserData->insertByName(pData[i].Name, pData[i].Value);
     376             :             }
     377             :         }
     378       13682 :         ::comphelper::ConfigurationHelper::flush(m_xRoot);
     379             :     }
     380           0 :     catch(const css::uno::Exception& ex)
     381             :         {
     382           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     383             :         }
     384        6841 : }
     385             : 
     386       13011 : 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       13011 :     css::uno::Any aItem;
     394             :     try
     395             :     {
     396             :         css::uno::Reference< css::container::XNameAccess > xNode(
     397             :             impl_getSetNode(sName, false),
     398       13011 :             css::uno::UNO_QUERY);
     399       26022 :         css::uno::Reference< css::container::XNameAccess > xUserData;
     400       13011 :         if (xNode.is())
     401       12600 :             xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
     402       13011 :         if (xUserData.is())
     403       25611 :             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       13011 :     return aItem;
     414             : }
     415             : 
     416       13079 : 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       13079 :             css::uno::UNO_QUERY_THROW);
     429       26158 :         css::uno::Reference< css::container::XNameContainer > xUserData;
     430       13079 :         xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
     431       13079 :         if (xUserData.is())
     432             :         {
     433       13079 :             if (xUserData->hasByName(sItem))
     434       12711 :                 xUserData->replaceByName(sItem, aValue);
     435             :             else
     436         368 :                 xUserData->insertByName(sItem, aValue);
     437             :         }
     438       26158 :         ::comphelper::ConfigurationHelper::flush(m_xRoot);
     439             :     }
     440           0 :     catch(const css::uno::Exception& ex)
     441             :         {
     442           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     443             :         }
     444       13079 : }
     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        9763 : SvtViewOptionsBase_Impl::State SvtViewOptionsBase_Impl::GetVisible( const OUString& sName )
     492             : {
     493             :     #ifdef DEBUG_VIEWOPTIONS
     494             :     ++m_nReadCount;
     495             :     #endif
     496             : 
     497        9763 :     State eState = STATE_NONE;
     498             :     try
     499             :     {
     500             :         css::uno::Reference< css::beans::XPropertySet > xNode(
     501             :             impl_getSetNode(sName, false),
     502        9763 :             css::uno::UNO_QUERY);
     503        9763 :         if (xNode.is())
     504             :         {
     505        9763 :             bool bVisible = false;
     506        9763 :             if (xNode->getPropertyValue(PROPERTY_VISIBLE) >>= bVisible)
     507             :             {
     508        6320 :                 eState = bVisible ? STATE_TRUE : STATE_FALSE;
     509             :             }
     510        9763 :         }
     511             :     }
     512           0 :     catch(const css::uno::Exception& ex)
     513             :         {
     514           0 :             SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
     515             :         }
     516             : 
     517        9763 :     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      254995 : css::uno::Reference< css::uno::XInterface > SvtViewOptionsBase_Impl::impl_getSetNode( const OUString& sNode           ,
     551             :                                                                                             bool         bCreateIfMissing)
     552             : {
     553      254995 :     css::uno::Reference< css::uno::XInterface > xNode;
     554             : 
     555             :     try
     556             :     {
     557      254995 :         if (bCreateIfMissing)
     558       26761 :             xNode = ::comphelper::ConfigurationHelper::makeSureSetNodeExists(m_xRoot, m_sListName, sNode);
     559             :         else
     560             :         {
     561      228234 :             if (m_xSet.is() && m_xSet->hasByName(sNode) )
     562       35569 :                 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      254995 :     return xNode;
     574             : }
     575             : 
     576             : //  constructor
     577             : 
     578      232556 : SvtViewOptions::SvtViewOptions(       EViewType        eType     ,
     579             :                                 const OUString& sViewName )
     580             :     :   m_eViewType ( eType     )
     581      232556 :     ,   m_sViewName ( sViewName )
     582             : {
     583             :     // Global access, must be guarded (multithreading!)
     584      232556 :     ::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      232556 :     switch( eType )
     588             :     {
     589             :         case E_DIALOG       :   {
     590             :                                     // Increase ref count for dialog data container first.
     591         208 :                                     ++m_nRefCount_Dialogs;
     592             :                                     // If these instance the first user of the dialog data container - create these impl static container!
     593         208 :                                     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         208 :                                 break;
     601             :         case E_TABDIALOG    :   {
     602             :                                     // Increase ref count for tab-dialog data container first.
     603         208 :                                     ++m_nRefCount_TabDialogs;
     604             :                                     // If these instance the first user of the tab-dialog data container - create these impl static container!
     605         208 :                                     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         208 :                                 break;
     612             :         case E_TABPAGE      :   {
     613             :                                     // Increase ref count for tab-page data container first.
     614         219 :                                     ++m_nRefCount_TabPages;
     615             :                                     // If these instance the first user of the tab-page data container - create these impl static container!
     616         219 :                                     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         219 :                                 break;
     623             :         case E_WINDOW       :   {
     624             :                                     // Increase ref count for window data container first.
     625      231921 :                                     ++m_nRefCount_Windows;
     626             :                                     // If these instance the first user of the window data container - create these impl static container!
     627      231921 :                                     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      231921 :                                 break;
     634             :         default             :   OSL_FAIL( "SvtViewOptions::SvtViewOptions()\nThese view type is unknown! All following calls at these instance will do nothing!\n" );
     635      232556 :     }
     636      232556 : }
     637             : 
     638             : //  destructor
     639             : 
     640      664713 : SvtViewOptions::~SvtViewOptions()
     641             : {
     642             :     // Global access, must be guarded (multithreading!)
     643      232548 :     ::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      232548 :     switch( m_eViewType )
     647             :     {
     648             :         case E_DIALOG       :   {
     649             :                                     // Decrease ref count for dialog data container first.
     650         206 :                                     --m_nRefCount_Dialogs;
     651             :                                     // If these instance the last user of the dialog data container - delete these impl static container!
     652         206 :                                     if( m_nRefCount_Dialogs == 0 )
     653             :                                     {
     654         119 :                                         delete m_pDataContainer_Dialogs;
     655         119 :                                         m_pDataContainer_Dialogs = NULL;
     656             :                                     }
     657             :                                 }
     658         206 :                                 break;
     659             :         case E_TABDIALOG    :   {
     660             :                                     // Decrease ref count for tab-dialog data container first.
     661         206 :                                     --m_nRefCount_TabDialogs;
     662             :                                     // If these instance the last user of the tab-dialog data container - delete these impl static container!
     663         206 :                                     if( m_nRefCount_TabDialogs == 0 )
     664             :                                     {
     665         119 :                                         delete m_pDataContainer_TabDialogs;
     666         119 :                                         m_pDataContainer_TabDialogs = NULL;
     667             :                                     }
     668             :                                 }
     669         206 :                                 break;
     670             :         case E_TABPAGE      :   {
     671             :                                     // Decrease ref count for tab-page data container first.
     672         217 :                                     --m_nRefCount_TabPages;
     673             :                                     // If these instance the last user of the tab-page data container - delete these impl static container!
     674         217 :                                     if( m_nRefCount_TabPages == 0 )
     675             :                                     {
     676         119 :                                         delete m_pDataContainer_TabPages;
     677         119 :                                         m_pDataContainer_TabPages = NULL;
     678             :                                     }
     679             :                                 }
     680         217 :                                 break;
     681             :         case E_WINDOW       :   {
     682             :                                     // Decrease ref count for window data container first.
     683      231919 :                                     --m_nRefCount_Windows;
     684             :                                     // If these instance the last user of the window data container - delete these impl static container!
     685      231919 :                                     if( m_nRefCount_Windows == 0 )
     686             :                                     {
     687         119 :                                         delete m_pDataContainer_Windows;
     688         119 :                                         m_pDataContainer_Windows = NULL;
     689             :                                     }
     690             :                                 }
     691      231919 :                                 break;
     692      232548 :     }
     693      432165 : }
     694             : 
     695             : //  public method
     696             : 
     697      205341 : bool SvtViewOptions::Exists() const
     698             : {
     699             :     // Ready for multithreading
     700      205341 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     701             : 
     702      205341 :     bool bExists = false;
     703      205341 :     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      205341 :                                     bExists = m_pDataContainer_Windows->Exists( m_sViewName );
     719             :                                 }
     720      205341 :                                 break;
     721             :     }
     722      205341 :     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      102730 : OUString SvtViewOptions::GetWindowState() const
     758             : {
     759             :     // Ready for multithreading
     760      102730 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     761             : 
     762      102730 :     OUString sState;
     763      102730 :     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      102730 :                                     sState = m_pDataContainer_Windows->GetWindowState( m_sViewName );
     779             :                                 }
     780      102730 :                                 break;
     781             :     }
     782      102730 :     return sState;
     783             : }
     784             : 
     785             : //  public method
     786             : 
     787        6841 : void SvtViewOptions::SetWindowState( const OUString& sState )
     788             : {
     789             :     // Ready for multithreading
     790        6841 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     791             : 
     792        6841 :     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        6841 :                                     m_pDataContainer_Windows->SetWindowState( m_sViewName, sState );
     808             :                                 }
     809        6841 :                                 break;
     810        6841 :     }
     811        6841 : }
     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        3160 : bool SvtViewOptions::IsVisible() const
     848             : {
     849             :     // Ready for multithreading
     850        3160 :     ::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        3160 :     bool bState = false;
     857        3160 :     if( m_eViewType == E_WINDOW )
     858        3160 :         bState = m_pDataContainer_Windows->GetVisible( m_sViewName ) == SvtViewOptionsBase_Impl::STATE_TRUE;
     859             : 
     860        3160 :     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        6603 : bool SvtViewOptions::HasVisible() const
     881             : {
     882             :     // Ready for multithreading
     883        6603 :     ::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        6603 :     bool bState = false;
     890        6603 :     if( m_eViewType == E_WINDOW )
     891        6603 :         bState = m_pDataContainer_Windows->GetVisible( m_sViewName ) != SvtViewOptionsBase_Impl::STATE_NONE;
     892             : 
     893        6603 :     return bState;
     894             : }
     895             : 
     896      102730 : css::uno::Sequence< css::beans::NamedValue > SvtViewOptions::GetUserData() const
     897             : {
     898             :     // Ready for multithreading
     899      102730 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     900             : 
     901      102730 :     css::uno::Sequence< css::beans::NamedValue > lData;
     902      102730 :     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      102730 :                                     lData = m_pDataContainer_Windows->GetUserData( m_sViewName );
     918             :                                 }
     919      102730 :                                 break;
     920             :     }
     921      102730 :     return lData;
     922             : }
     923             : 
     924        6841 : void SvtViewOptions::SetUserData( const css::uno::Sequence< css::beans::NamedValue >& lData )
     925             : {
     926             :     // Ready for multithreading
     927        6841 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     928             : 
     929        6841 :     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        6841 :                                     m_pDataContainer_Windows->SetUserData( m_sViewName, lData );
     945             :                                 }
     946        6841 :                                 break;
     947        6841 :     }
     948        6841 : }
     949             : 
     950       13011 : css::uno::Any SvtViewOptions::GetUserItem( const OUString& sName ) const
     951             : {
     952             :     // Ready for multithreading
     953       13011 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     954             : 
     955       13011 :     css::uno::Any aItem;
     956       13011 :     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          11 :                                     aItem = m_pDataContainer_TabPages->GetUserItem( m_sViewName, sName );
     968             :                                 }
     969          11 :                                 break;
     970             :         case E_WINDOW       :   {
     971       13000 :                                     aItem = m_pDataContainer_Windows->GetUserItem( m_sViewName, sName );
     972             :                                 }
     973       13000 :                                 break;
     974             :     }
     975       13011 :     return aItem;
     976             : }
     977             : 
     978       13079 : void SvtViewOptions::SetUserItem( const OUString& sName  ,
     979             :                                   const css::uno::Any&   aValue )
     980             : {
     981             :     // Ready for multithreading
     982       13079 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
     983             : 
     984       13079 :     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       13079 :                                     m_pDataContainer_Windows->SetUserItem( m_sViewName, sName, aValue );
    1000             :                                 }
    1001       13079 :                                 break;
    1002       13079 :     }
    1003       13079 : }
    1004             : 
    1005             : namespace
    1006             : {
    1007             :     class theViewOptionsMutex : public rtl::Static<osl::Mutex, theViewOptionsMutex>{};
    1008             : }
    1009             : 
    1010             : //  private method
    1011             : 
    1012      925767 : ::osl::Mutex& SvtViewOptions::GetOwnStaticMutex()
    1013             : {
    1014      925767 :     return theViewOptionsMutex::get();
    1015             : }
    1016             : 
    1017         208 : void SvtViewOptions::AcquireOptions()
    1018             : {
    1019         208 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
    1020         208 :     if( ++m_nRefCount_Dialogs == 1 )
    1021             :     {
    1022         208 :         m_pDataContainer_Dialogs = new SvtViewOptionsBase_Impl( LIST_DIALOGS );
    1023         208 :         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_DIALOG);
    1024             :     }
    1025         208 :     if( ++m_nRefCount_TabDialogs == 1 )
    1026             :     {
    1027         208 :         m_pDataContainer_TabDialogs = new SvtViewOptionsBase_Impl( LIST_TABDIALOGS );
    1028         208 :         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABDIALOG);
    1029             :     }
    1030         208 :     if( ++m_nRefCount_TabPages == 1 )
    1031             :     {
    1032         208 :         m_pDataContainer_TabPages = new SvtViewOptionsBase_Impl( LIST_TABPAGES );
    1033         208 :         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABPAGE);
    1034             :     }
    1035         208 :     if( ++m_nRefCount_Windows == 1 )
    1036             :     {
    1037         208 :         m_pDataContainer_Windows = new SvtViewOptionsBase_Impl( LIST_WINDOWS );
    1038         208 :         ItemHolder1::holdConfigItem(E_VIEWOPTIONS_WINDOW);
    1039         208 :     }
    1040         208 : }
    1041             : 
    1042         119 : void SvtViewOptions::ReleaseOptions()
    1043             : {
    1044         119 :     ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
    1045         119 :     if( --m_nRefCount_Dialogs == 0 )
    1046             :     {
    1047           0 :         delete m_pDataContainer_Dialogs;
    1048           0 :         m_pDataContainer_Dialogs = NULL;
    1049             :     }
    1050         119 :     if( --m_nRefCount_TabDialogs == 0 )
    1051             :     {
    1052           0 :         delete m_pDataContainer_TabDialogs;
    1053           0 :         m_pDataContainer_TabDialogs = NULL;
    1054             :     }
    1055         119 :     if( --m_nRefCount_TabPages == 0 )
    1056             :     {
    1057           0 :         delete m_pDataContainer_TabPages;
    1058           0 :         m_pDataContainer_TabPages = NULL;
    1059             :     }
    1060         119 :     if( --m_nRefCount_Windows == 0 )
    1061             :     {
    1062           0 :         delete m_pDataContainer_Windows;
    1063           0 :         m_pDataContainer_Windows = NULL;
    1064         119 :     }
    1065         119 : }
    1066             : 
    1067             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11