merge the formfield patch from ooo-build
[ooovba.git] / sd / source / filter / sdfilter.cxx
blob9e6860fc3cc593328825fd45e833360dd83ec908
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sdfilter.cxx,v $
10 * $Revision: 1.17 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
33 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
35 #include <memory>
37 #include <tools/debug.hxx>
38 #include <osl/module.hxx>
39 #include <sfx2/docfile.hxx>
40 #include <sfx2/viewfrm.hxx>
41 #include <sfx2/progress.hxx>
42 #include <svtools/itemset.hxx>
44 #include "../ui/inc/DrawDocShell.hxx"
45 #include "../ui/inc/strings.hrc"
47 #include "sdresid.hxx"
48 #include "pres.hxx"
49 #include "drawdoc.hxx"
50 #include "sdfilter.hxx"
52 // --------------
53 // - Namespaces -
54 // --------------
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::task;
58 using namespace ::com::sun::star::frame;
60 // ------------
61 // - SdFilter -
62 // ------------
64 SdFilter::SdFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress )
65 : mxModel( rDocShell.GetModel() )
66 , mrMedium( rMedium )
67 , mrDocShell( rDocShell )
68 , mrDocument( *rDocShell.GetDoc() )
69 , mbIsDraw( rDocShell.GetDocumentType() == DOCUMENT_TYPE_DRAW )
70 , mbShowProgress( bShowProgress )
74 // -----------------------------------------------------------------------------
76 SdFilter::~SdFilter()
80 // -----------------------------------------------------------------------------
82 ::rtl::OUString SdFilter::ImplGetFullLibraryName( const ::rtl::OUString& rLibraryName ) const
84 String aTemp( ::rtl::OUString::createFromAscii( SVLIBRARY( "?" ) ) );
85 xub_StrLen nIndex = aTemp.Search( (sal_Unicode)'?' );
86 aTemp.Replace( nIndex, 1, rLibraryName );
87 ::rtl::OUString aLibraryName( aTemp );
88 return aLibraryName;
91 // -----------------------------------------------------------------------------
93 extern "C" { static void SAL_CALL thisModule() {} }
95 ::osl::Module* SdFilter::OpenLibrary( const ::rtl::OUString& rLibraryName ) const
97 std::auto_ptr< osl::Module > mod(new osl::Module);
98 return mod->loadRelative(&thisModule, ImplGetFullLibraryName(rLibraryName))
99 ? mod.release() : 0;
102 // -----------------------------------------------------------------------------
104 void SdFilter::CreateStatusIndicator()
106 // The status indicator must be retrieved from the provided medium arguments
107 const SfxUnoAnyItem* pStatusBarItem = static_cast<const SfxUnoAnyItem*>(
108 mrMedium.GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
110 if ( pStatusBarItem )
111 pStatusBarItem->GetValue() >>= mxStatusIndicator;
113 // try
114 // {
115 // if (mxModel.is())
116 // {
117 // Reference< XController > xController( mxModel->getCurrentController());
118 // if( xController.is())
119 // {
120 // Reference< XFrame > xFrame( xController->getFrame());
121 // if( xFrame.is())
122 // {
123 // Reference< XStatusIndicatorFactory > xFactory( xFrame, UNO_QUERY );
124 // if( xFactory.is())
125 // {
126 // mxStatusIndicator = xFactory->createStatusIndicator();
127 // }
128 // }
129 // }
130 // }
131 // }
132 // catch( Exception& )
133 // {
134 // }