tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / framework / source / fwe / helper / configimporter.cxx
blobbc92d180b9ac3423b2544bcbb4146058ee8f2138
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <framework/configimporter.hxx>
21 #include <toolboxconfiguration.hxx>
22 #include <com/sun/star/embed/ElementModes.hpp>
23 #include <com/sun/star/ui/XUIConfigurationManager2.hpp>
25 using namespace ::com::sun::star;
27 namespace framework
30 bool UIConfigurationImporterOOo1x::ImportCustomToolbars(
31 const uno::Reference< ui::XUIConfigurationManager2 >& rContainerFactory,
32 std::vector< uno::Reference< container::XIndexContainer > >& rSeqContainer,
33 const uno::Reference< uno::XComponentContext >& rxContext,
34 const uno::Reference< embed::XStorage >& rToolbarStorage )
36 bool bResult ( false );
37 if ( rToolbarStorage.is() && rContainerFactory.is() )
39 try
41 for ( sal_uInt16 i = 1; i <= 4; i++ )
43 OUString aTbxStreamName = "userdeftoolbox" + OUString::number(i) + ".xml";
44 uno::Reference< io::XStream > xStream = rToolbarStorage->openStreamElement( aTbxStreamName, embed::ElementModes::READ );
45 if ( xStream.is() )
47 uno::Reference< io::XInputStream > xInputStream = xStream->getInputStream();
48 if ( xInputStream.is() )
50 uno::Reference< container::XIndexContainer > xContainer = rContainerFactory->createSettings();
51 if ( ToolBoxConfiguration::LoadToolBox( rxContext, xInputStream, xContainer ))
53 rSeqContainer.push_back( xContainer );
54 bResult = true;
60 catch ( const uno::RuntimeException& )
62 throw;
64 catch ( const uno::Exception& )
69 return bResult;
72 } // namespace framework
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */