LibreOffice Module sd (master) 1
cusshow.cxx
Go to the documentation of this file.
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 <com/sun/star/lang/XComponent.hpp>
21
23#include <cusshow.hxx>
24#include <customshowlist.hxx>
25
26using namespace ::com::sun::star;
27
28/*************************************************************************
29|*
30|* Ctor
31|*
32\************************************************************************/
34{
35}
36
37/*************************************************************************
38|*
39|* Copy-Ctor
40|*
41\************************************************************************/
43 : maPages(rShow.maPages)
44{
45 aName = rShow.GetName();
46}
47
48SdCustomShow::SdCustomShow(css::uno::Reference< css::uno::XInterface > const & xShow )
49 : mxUnoCustomShow( xShow )
50{
51}
52
53/*************************************************************************
54|*
55|* Dtor
56|*
57\************************************************************************/
59{
60 uno::Reference< uno::XInterface > xShow( mxUnoCustomShow );
61 uno::Reference< lang::XComponent > xComponent( xShow, uno::UNO_QUERY );
62 if( xComponent.is() )
63 xComponent->dispose();
64}
65
66uno::Reference< uno::XInterface > SdCustomShow::getUnoCustomShow()
67{
68 // try weak reference first
69 uno::Reference< uno::XInterface > xShow( mxUnoCustomShow );
70
71 if( !xShow.is() )
72 {
73 xShow = createUnoCustomShow( this );
74 }
75
76 return xShow;
77}
78
79void SdCustomShow::ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage )
80{
81 if( !pNewPage )
82 {
83 maPages.erase(::std::remove(maPages.begin(), maPages.end(), pOldPage), maPages.end());
84 }
85 else
86 {
87 ::std::replace(maPages.begin(), maPages.end(), pOldPage, pNewPage);
88 }
89}
90
91void SdCustomShow::SetName(const OUString& rName)
92{
93 aName = rName;
94}
95
96void SdCustomShowList::erase(std::vector<std::unique_ptr<SdCustomShow>>::iterator it)
97{
98 mShows.erase(it);
99}
100
101/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< std::unique_ptr< SdCustomShow > > mShows
void erase(std::vector< std::unique_ptr< SdCustomShow > >::iterator it)
Definition: cusshow.cxx:96
css::uno::Reference< css::uno::XInterface > getUnoCustomShow()
Definition: cusshow.cxx:66
const OUString & GetName() const
Definition: cusshow.hxx:60
css::uno::WeakReference< css::uno::XInterface > mxUnoCustomShow
Definition: cusshow.hxx:38
OUString aName
Definition: cusshow.hxx:35
void ReplacePage(const SdPage *pOldPage, const SdPage *pNewPage)
Replaces all occurrences of pOldPage with pNewPage.
Definition: cusshow.cxx:79
void SetName(const OUString &rName)
Definition: cusshow.cxx:91
PageVec maPages
Definition: cusshow.hxx:34
uno::Reference< uno::XInterface > createUnoCustomShow(SdCustomShow *pShow)
Definition: unocpres.cxx:39