xref: /aoo41x/main/sd/source/filter/sdfilter.cxx (revision 79aad27f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
27 
28 #include <memory>
29 
30 #include <tools/debug.hxx>
31 #include <osl/module.hxx>
32 #include <sfx2/docfile.hxx>
33 #include <sfx2/viewfrm.hxx>
34 #include <sfx2/progress.hxx>
35 #include <svl/itemset.hxx>
36 
37 #include "../ui/inc/DrawDocShell.hxx"
38 #include "../ui/inc/strings.hrc"
39 
40 #include "sdresid.hxx"
41 #include "pres.hxx"
42 #include "drawdoc.hxx"
43 #include "sdfilter.hxx"
44 
45 // --------------
46 // - Namespaces -
47 // --------------
48 
49 using namespace ::com::sun::star::uno;
50 using namespace ::com::sun::star::task;
51 using namespace ::com::sun::star::frame;
52 
53 // ------------
54 // - SdFilter -
55 // ------------
56 
SdFilter(SfxMedium & rMedium,::sd::DrawDocShell & rDocShell,sal_Bool bShowProgress)57 SdFilter::SdFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool	bShowProgress )
58 :	mxModel( rDocShell.GetModel() )
59 ,	mrMedium( rMedium )
60 ,	mrDocShell( rDocShell )
61 ,	mrDocument( *rDocShell.GetDoc() )
62 ,	mbIsDraw( rDocShell.GetDocumentType() == DOCUMENT_TYPE_DRAW )
63 ,	mbShowProgress( bShowProgress )
64 {
65 }
66 
67 // -----------------------------------------------------------------------------
68 
~SdFilter()69 SdFilter::~SdFilter()
70 {
71 }
72 
73 // -----------------------------------------------------------------------------
74 
ImplGetFullLibraryName(const::rtl::OUString & rLibraryName) const75 ::rtl::OUString SdFilter::ImplGetFullLibraryName( const ::rtl::OUString& rLibraryName ) const
76 {
77 	String aTemp( ::rtl::OUString::createFromAscii( SVLIBRARY( "?" ) ) );
78 	xub_StrLen nIndex = aTemp.Search( (sal_Unicode)'?' );
79 	aTemp.Replace( nIndex, 1, rLibraryName );
80 	::rtl::OUString aLibraryName( aTemp );
81 	return aLibraryName;
82 }
83 
84 // -----------------------------------------------------------------------------
85 
thisModule()86 extern "C" { static void SAL_CALL thisModule() {} }
87 
OpenLibrary(const::rtl::OUString & rLibraryName) const88 ::osl::Module* SdFilter::OpenLibrary( const ::rtl::OUString& rLibraryName ) const
89 {
90     std::auto_ptr< osl::Module > mod(new osl::Module);
91     return mod->loadRelative(&thisModule, ImplGetFullLibraryName(rLibraryName))
92         ? mod.release() : 0;
93 }
94 
95 // -----------------------------------------------------------------------------
96 
CreateStatusIndicator()97 void SdFilter::CreateStatusIndicator()
98 {
99 	// The status indicator must be retrieved from the provided medium arguments
100 	const SfxUnoAnyItem* pStatusBarItem = static_cast<const SfxUnoAnyItem*>(
101 			mrMedium.GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
102 
103 	if ( pStatusBarItem )
104 		pStatusBarItem->GetValue() >>= mxStatusIndicator;
105 
106 //	try
107 //	{
108 //		if (mxModel.is())
109 //		{
110 //			Reference< XController > xController( mxModel->getCurrentController());
111 //			if( xController.is())
112 //			{
113 //				Reference< XFrame > xFrame( xController->getFrame());
114 //				if( xFrame.is())
115 //				{
116 //					Reference< XStatusIndicatorFactory > xFactory( xFrame, UNO_QUERY );
117 //					if( xFactory.is())
118 //					{
119 //						mxStatusIndicator = xFactory->createStatusIndicator();
120 //					}
121 //				}
122 //			}
123 //		}
124 //	}
125 //	catch( Exception& )
126 //	{
127 //	}
128 }
129 
130