LCOV - code coverage report
Current view: top level - framework/source/fwe/helper - configimporter.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 26 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 1 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 <framework/configimporter.hxx>
      21             : #include <framework/toolboxconfiguration.hxx>
      22             : #include <com/sun/star/embed/ElementModes.hpp>
      23             : 
      24             : #include <rtl/ustrbuf.hxx>
      25             : 
      26             : using namespace ::com::sun::star;
      27             : 
      28             : namespace framework
      29             : {
      30             : 
      31           0 : bool UIConfigurationImporterOOo1x::ImportCustomToolbars(
      32             :     const uno::Reference< ui::XUIConfigurationManager2 >& rContainerFactory,
      33             :     uno::Sequence< uno::Reference< container::XIndexContainer > >& rSeqContainer,
      34             :     const uno::Reference< uno::XComponentContext >& rxContext,
      35             :     const uno::Reference< embed::XStorage >& rToolbarStorage )
      36             : {
      37           0 :     const char USERDEFTOOLBOX[] = "userdeftoolbox0.xml";
      38             : 
      39           0 :     bool bResult ( false );
      40           0 :     if ( rToolbarStorage.is() && rContainerFactory.is() )
      41             :     {
      42             :         try
      43             :         {
      44           0 :             for ( sal_uInt16 i = 1; i <= 4; i++ )
      45             :             {
      46           0 :                 OUStringBuffer aCustomTbxName( 20 );
      47           0 :                 aCustomTbxName.appendAscii( USERDEFTOOLBOX );
      48           0 :                 aCustomTbxName[14] = aCustomTbxName[14] + i;
      49             : 
      50           0 :                 OUString aTbxStreamName( aCustomTbxName.makeStringAndClear() );
      51           0 :                 uno::Reference< io::XStream > xStream = rToolbarStorage->openStreamElement( aTbxStreamName, embed::ElementModes::READ );
      52           0 :                 if ( xStream.is() )
      53             :                 {
      54           0 :                     uno::Reference< io::XInputStream > xInputStream = xStream->getInputStream();
      55           0 :                     if ( xInputStream.is() )
      56             :                     {
      57           0 :                         uno::Reference< container::XIndexContainer > xContainer = rContainerFactory->createSettings();
      58           0 :                         if ( ToolBoxConfiguration::LoadToolBox( rxContext, xInputStream, xContainer ))
      59             :                         {
      60           0 :                             sal_uInt32 nIndex = rSeqContainer.getLength();
      61           0 :                             rSeqContainer.realloc( nIndex+1 );
      62           0 :                             rSeqContainer[nIndex] = xContainer;
      63           0 :                             bResult = true;
      64           0 :                         }
      65           0 :                     }
      66             :                 }
      67           0 :             }
      68             :         }
      69           0 :         catch ( const uno::RuntimeException& )
      70             :         {
      71           0 :             throw;
      72             :         }
      73           0 :         catch ( const uno::Exception& )
      74             :         {
      75             :         }
      76             :     }
      77             : 
      78           0 :     return bResult;
      79             : }
      80             : 
      81             : } // namespace framework
      82             : 
      83             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11