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 :
39 : // - Namespaces -
40 :
41 :
42 : using namespace ::com::sun::star::uno;
43 : using namespace ::com::sun::star::task;
44 : using namespace ::com::sun::star::frame;
45 :
46 :
47 : // - SdFilter -
48 :
49 :
50 44 : SdFilter::SdFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress )
51 : : mxModel( rDocShell.GetModel() )
52 : , mrMedium( rMedium )
53 : , mrDocShell( rDocShell )
54 44 : , mrDocument( *rDocShell.GetDoc() )
55 44 : , mbIsDraw( rDocShell.GetDocumentType() == DOCUMENT_TYPE_DRAW )
56 132 : , mbShowProgress( bShowProgress )
57 : {
58 44 : }
59 :
60 :
61 :
62 44 : SdFilter::~SdFilter()
63 : {
64 44 : }
65 :
66 :
67 :
68 10 : OUString SdFilter::ImplGetFullLibraryName( const OUString& rLibraryName ) const
69 : {
70 10 : OUString aTemp(SVLIBRARY("?"));
71 10 : return aTemp.replaceFirst( "?", rLibraryName );
72 : }
73 :
74 :
75 :
76 : #ifndef DISABLE_DYNLOADING
77 0 : extern "C" { static void SAL_CALL thisModule() {} }
78 :
79 10 : ::osl::Module* SdFilter::OpenLibrary( const OUString& rLibraryName ) const
80 : {
81 10 : std::auto_ptr< osl::Module > mod(new osl::Module);
82 : return mod->loadRelative(&thisModule, ImplGetFullLibraryName(rLibraryName),
83 20 : SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY)
84 20 : ? mod.release() : 0;
85 : }
86 :
87 : #endif
88 :
89 :
90 :
91 20 : void SdFilter::CreateStatusIndicator()
92 : {
93 : // The status indicator must be retrieved from the provided medium arguments
94 : const SfxUnoAnyItem* pStatusBarItem = static_cast<const SfxUnoAnyItem*>(
95 20 : mrMedium.GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
96 :
97 20 : if ( pStatusBarItem )
98 0 : pStatusBarItem->GetValue() >>= mxStatusIndicator;
99 :
100 20 : }
101 :
102 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|