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 8 : SdFilter::SdFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress )
51 : : mxModel( rDocShell.GetModel() )
52 : , mrMedium( rMedium )
53 : , mrDocShell( rDocShell )
54 8 : , mrDocument( *rDocShell.GetDoc() )
55 8 : , mbIsDraw( rDocShell.GetDocumentType() == DOCUMENT_TYPE_DRAW )
56 24 : , mbShowProgress( bShowProgress )
57 : {
58 8 : }
59 :
60 : // -----------------------------------------------------------------------------
61 :
62 8 : SdFilter::~SdFilter()
63 : {
64 8 : }
65 :
66 : // -----------------------------------------------------------------------------
67 :
68 6 : ::rtl::OUString SdFilter::ImplGetFullLibraryName( const ::rtl::OUString& rLibraryName ) const
69 : {
70 6 : String aTemp(::rtl::OUString(SVLIBRARY("?")));
71 6 : xub_StrLen nIndex = aTemp.Search( (sal_Unicode)'?' );
72 6 : aTemp.Replace( nIndex, 1, rLibraryName );
73 6 : ::rtl::OUString aLibraryName( aTemp );
74 6 : return aLibraryName;
75 : }
76 :
77 : // -----------------------------------------------------------------------------
78 :
79 : #ifndef DISABLE_DYNLOADING
80 0 : extern "C" { static void SAL_CALL thisModule() {} }
81 :
82 6 : ::osl::Module* SdFilter::OpenLibrary( const ::rtl::OUString& rLibraryName ) const
83 : {
84 6 : std::auto_ptr< osl::Module > mod(new osl::Module);
85 : return mod->loadRelative(&thisModule, ImplGetFullLibraryName(rLibraryName),
86 12 : SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY)
87 12 : ? mod.release() : 0;
88 : }
89 :
90 : #endif
91 :
92 : // -----------------------------------------------------------------------------
93 :
94 0 : void SdFilter::CreateStatusIndicator()
95 : {
96 : // The status indicator must be retrieved from the provided medium arguments
97 : const SfxUnoAnyItem* pStatusBarItem = static_cast<const SfxUnoAnyItem*>(
98 0 : mrMedium.GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
99 :
100 0 : if ( pStatusBarItem )
101 0 : pStatusBarItem->GetValue() >>= mxStatusIndicator;
102 :
103 0 : }
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|