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