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 <com/sun/star/task/XStatusIndicatorFactory.hpp>
21 :
22 : #include <memory>
23 :
24 : #include <osl/module.hxx>
25 : #include <sfx2/docfile.hxx>
26 : #include <sfx2/viewfrm.hxx>
27 : #include <sfx2/progress.hxx>
28 : #include <svl/itemset.hxx>
29 :
30 : #include "../ui/inc/DrawDocShell.hxx"
31 : #include "../ui/inc/strings.hrc"
32 :
33 : #include "sdresid.hxx"
34 : #include "pres.hxx"
35 : #include "drawdoc.hxx"
36 : #include "sdfilter.hxx"
37 :
38 : // - Namespaces -
39 :
40 : using namespace ::com::sun::star::uno;
41 : using namespace ::com::sun::star::task;
42 : using namespace ::com::sun::star::frame;
43 :
44 : // - SdFilter -
45 :
46 80 : SdFilter::SdFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, bool bShowProgress )
47 : : mxModel( rDocShell.GetModel() )
48 : , mrMedium( rMedium )
49 : , mrDocShell( rDocShell )
50 80 : , mrDocument( *rDocShell.GetDoc() )
51 80 : , mbIsDraw( rDocShell.GetDocumentType() == DOCUMENT_TYPE_DRAW )
52 240 : , mbShowProgress( bShowProgress )
53 : {
54 80 : }
55 :
56 80 : SdFilter::~SdFilter()
57 : {
58 80 : }
59 :
60 24 : OUString SdFilter::ImplGetFullLibraryName( const OUString& rLibraryName ) const
61 : {
62 24 : OUString aTemp(SVLIBRARY("?"));
63 24 : return aTemp.replaceFirst( "?", rLibraryName );
64 : }
65 :
66 : #ifndef DISABLE_DYNLOADING
67 0 : extern "C" { static void SAL_CALL thisModule() {} }
68 :
69 24 : ::osl::Module* SdFilter::OpenLibrary( const OUString& rLibraryName ) const
70 : {
71 24 : std::unique_ptr< osl::Module > mod(new osl::Module);
72 : return mod->loadRelative(&thisModule, ImplGetFullLibraryName(rLibraryName),
73 48 : SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY)
74 48 : ? mod.release() : 0;
75 : }
76 :
77 : #endif
78 :
79 22 : void SdFilter::CreateStatusIndicator()
80 : {
81 : // The status indicator must be retrieved from the provided medium arguments
82 : const SfxUnoAnyItem* pStatusBarItem = static_cast<const SfxUnoAnyItem*>(
83 22 : mrMedium.GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
84 :
85 22 : if ( pStatusBarItem )
86 0 : pStatusBarItem->GetValue() >>= mxStatusIndicator;
87 :
88 136 : }
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|