LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / sd / source / core / cusshow.cxx
blob8b51a613da452f9f03eb145e4b4f6429b84794af
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 <com/sun/star/lang/XComponent.hpp>
22 #include <createunocustomshow.hxx>
23 #include <cusshow.hxx>
24 #include <customshowlist.hxx>
26 using namespace ::com::sun::star;
28 /*************************************************************************
30 |* Ctor
32 \************************************************************************/
33 SdCustomShow::SdCustomShow()
37 /*************************************************************************
39 |* Copy-Ctor
41 \************************************************************************/
42 SdCustomShow::SdCustomShow( const SdCustomShow& rShow )
43 : maPages(rShow.maPages)
45 aName = rShow.GetName();
48 SdCustomShow::SdCustomShow(css::uno::Reference< css::uno::XInterface > const & xShow )
49 : mxUnoCustomShow( xShow )
53 /*************************************************************************
55 |* Dtor
57 \************************************************************************/
58 SdCustomShow::~SdCustomShow()
60 uno::Reference< uno::XInterface > xShow( mxUnoCustomShow );
61 uno::Reference< lang::XComponent > xComponent( xShow, uno::UNO_QUERY );
62 if( xComponent.is() )
63 xComponent->dispose();
66 uno::Reference< uno::XInterface > SdCustomShow::getUnoCustomShow()
68 // try weak reference first
69 uno::Reference< uno::XInterface > xShow( mxUnoCustomShow );
71 if( !xShow.is() )
73 xShow = createUnoCustomShow( this );
76 return xShow;
79 void SdCustomShow::ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage )
81 if( !pNewPage )
83 maPages.erase(::std::remove(maPages.begin(), maPages.end(), pOldPage), maPages.end());
85 else
87 ::std::replace(maPages.begin(), maPages.end(), pOldPage, pNewPage);
91 void SdCustomShow::SetName(const OUString& rName)
93 aName = rName;
96 void SdCustomShowList::erase(std::vector<std::unique_ptr<SdCustomShow>>::iterator it)
98 mShows.erase(it);
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */