Better, Faster, Freer

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: i386 ]
Version: HEAD ]

001 /*************************************************************************
002  *
003  *  OpenOffice.org - a multi-platform office productivity suite
004  *
005  *  $RCSfile: SwXFilterOptions.cxx,v $
006  *
007  *  $Revision: 1.11 $
008  *
009  *  last change: $Author: hr $ $Date: 2007/09/27 12:40:21 $
010  *
011  *  The Contents of this file are made available subject to
012  *  the terms of GNU Lesser General Public License Version 2.1.
013  *
014  *
015  *    GNU Lesser General Public License Version 2.1
016  *    =============================================
017  *    Copyright 2005 by Sun Microsystems, Inc.
018  *    901 San Antonio Road, Palo Alto, CA 94303, USA
019  *
020  *    This library is free software; you can redistribute it and/or
021  *    modify it under the terms of the GNU Lesser General Public
022  *    License version 2.1, as published by the Free Software Foundation.
023  *
024  *    This library is distributed in the hope that it will be useful,
025  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
026  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
027  *    Lesser General Public License for more details.
028  *
029  *    You should have received a copy of the GNU Lesser General Public
030  *    License along with this library; if not, write to the Free Software
031  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
032  *    MA  02111-1307  USA
033  *
034  ************************************************************************/
035 
036 // MARKER(update_precomp.py): autogen include statement, do not remove
037 #include "precompiled_sw.hxx"
038 
039 #ifndef _SWXFILTEROPTIONS_HXX
040 #include <SwXFilterOptions.hxx>
041 #endif
042 
043 #ifndef _SHELLIO_HXX
044 #include <shellio.hxx>
045 #endif
046 #ifndef SW_SWDLL_HXX
047 #include <swdll.hxx>
048 #endif
049 #ifndef _UNOPRNMS_HXX
050 #include <unoprnms.hxx>
051 #endif
052 
053 #ifndef _VOS_MUTEX_HXX_ //autogen
054 #include <vos/mutex.hxx>
055 #endif
056 #ifndef _SV_SVAPP_HXX
057 #include <vcl/svapp.hxx>
058 #endif
059 #ifndef _SV_MSGBOX_HXX
060 #include <vcl/msgbox.hxx>
061 #endif
062 
063 #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
064 #include <com/sun/star/lang/XUnoTunnel.hpp>
065 #endif
066 #ifndef _COM_SUN_STAR_UI_DIALOGS_EXECUTABLEDIALOGRESULTS_HPP_
067 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
068 #endif
069 #ifndef _UNTOOLS_UCBSTREAMHELPER_HXX
070 #include <unotools/ucbstreamhelper.hxx>
071 #endif
072 #ifndef _UNOTXDOC_HXX //autogen
073 #include <unotxdoc.hxx>
074 #endif
075 
076 #include "swabstdlg.hxx"
077 #include "dialog.hrc"
078 
079 using namespace ::com::sun::star;
080 using namespace ::com::sun::star::ui::dialogs;
081 using namespace ::com::sun::star::document;
082 using namespace ::com::sun::star::lang;
083 
084 #define SWFILTEROPTIONSOBJ_SERVICE      RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FilterOptionsDialog")
085 #define SWFILTEROPTIONSOBJ_IMPLNAME     RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.FilterOptionsDialog")
086 #define FILTER_OPTIONS_NAME             RTL_CONSTASCII_USTRINGPARAM("FilterOptions")
087 /*-- 2002/06/21 11:01:23---------------------------------------------------
088 
089   -----------------------------------------------------------------------*/
090 SwXFilterOptions::SwXFilterOptions() :
091     bExport( sal_False )
092 {
093 }
094 /*-- 2002/06/21 11:01:24---------------------------------------------------
095 
096   -----------------------------------------------------------------------*/
097 SwXFilterOptions::~SwXFilterOptions()
098 {
099 }
100 /*-- 2002/06/21 11:01:24---------------------------------------------------
101 
102   -----------------------------------------------------------------------*/
103 ::rtl::OUString  SwXFilterOptions::getImplementationName_Static()
104 {
105     return ::rtl::OUString(SWFILTEROPTIONSOBJ_IMPLNAME);
106 }
107 /*-- 2002/06/21 11:01:24---------------------------------------------------
108 
109   -----------------------------------------------------------------------*/
110 uno::Sequence< ::rtl::OUString> SwXFilterOptions::getSupportedServiceNames_Static()
111 {
112     ::rtl::OUString sService(SWFILTEROPTIONSOBJ_SERVICE);
113     return uno::Sequence< ::rtl::OUString> (&sService, 1);
114 }
115 /*-- 2002/06/21 11:01:25---------------------------------------------------
116 
117   -----------------------------------------------------------------------*/
118 uno::Sequence< beans::PropertyValue > SwXFilterOptions::getPropertyValues() throw (uno::RuntimeException)
119 {
120     uno::Sequence<beans::PropertyValue> aRet(1);
121         beans::PropertyValue* pArray = aRet.getArray();
122 
123     pArray[0].Name = rtl::OUString( FILTER_OPTIONS_NAME );
124     pArray[0].Value <<= sFilterOptions;
125 
126         return aRet;
127 }
128 /*-- 2002/06/21 11:01:25---------------------------------------------------
129 
130   -----------------------------------------------------------------------*/
131 void   SwXFilterOptions::setPropertyValues( const uno::Sequence<beans::PropertyValue >& aProps )
132     throw (beans::UnknownPropertyException, beans::PropertyVetoException,
133        IllegalArgumentException, WrappedTargetException, uno::RuntimeException)
134 {
135     const beans::PropertyValue* pPropArray = aProps.getConstArray();
136         long nPropCount = aProps.getLength();
137         for (long i = 0; i < nPropCount; i++)
138         {
139                 const beans::PropertyValue& rProp = pPropArray[i];
140         ::rtl::OUString aPropName = rProp.Name;
141 
142         if ( aPropName.equalsAscii( SW_PROP_NAME_STR(UNO_NAME_FILTER_NAME) ) )
143             rProp.Value >>= sFilterName;
144         else if ( aPropName == ::rtl::OUString(FILTER_OPTIONS_NAME) )
145             rProp.Value >>= sFilterOptions;
146         else if ( aPropName.equalsAscii( "InputStream" ) )
147                         rProp.Value >>= xInputStream;
148         }
149 }
150 /*-- 2002/06/21 11:01:25---------------------------------------------------
151 
152   -----------------------------------------------------------------------*/
153 void   SwXFilterOptions::setTitle( const ::rtl::OUString& /*rTitle*/ )
154     throw (uno::RuntimeException)
155 {
156 }
157 /*-- 2002.06.21 11:01:25---------------------------------------------------
158 
159   -----------------------------------------------------------------------*/
160 sal_Int16 SwXFilterOptions::execute() throw (uno::RuntimeException)
161 {
162     sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL;
163 
164     SvStream* pInStream = NULL;
165     if ( xInputStream.is() )
166         pInStream = utl::UcbStreamHelper::CreateStream( xInputStream );
167 
168     uno::Reference< XUnoTunnel > xTunnel(xModel, uno::UNO_QUERY);
169     SwDocShell* pDocShell = 0;
170     if(xTunnel.is())
171     {
172         SwXTextDocument* pXDoc = reinterpret_cast< SwXTextDocument * >(
173                                 sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextDocument::getUnoTunnelId())));
174         pDocShell = pXDoc ? pXDoc->GetDocShell() : 0;
175     }
176     if(pDocShell)
177     {
178 
179         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
180         DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
181 
182         AbstractSwAsciiFilterDlg* pAsciiDlg = pFact->CreateSwAsciiFilterDlg( NULL, *pDocShell,pInStream,  DLG_ASCII_FILTER );
183         DBG_ASSERT(pAsciiDlg, "Dialogdiet fail!");
184         if(RET_OK == pAsciiDlg->Execute())
185         {
186             SwAsciiOptions aOptions;
187             pAsciiDlg->FillOptions( aOptions );
188             String sTmp;
189             aOptions.WriteUserData(sTmp);
190             sFilterOptions = sTmp;
191             nRet = ui::dialogs::ExecutableDialogResults::OK;
192         }
193                 delete pAsciiDlg;
194     }
195 
196         if( pInStream )
197                 delete pInStream;
198 
199     return nRet;
200 }
201 /*-- 2002/06/21 11:01:26---------------------------------------------------
202 
203   -----------------------------------------------------------------------*/
204 void   SwXFilterOptions::setTargetDocument( const uno::Reference< XComponent >& xDoc )
205     throw (IllegalArgumentException, uno::RuntimeException)
206 {
207     bExport = sal_False;
208     xModel = xDoc;
209 }
210 /*-- 2002/06/21 11:01:26---------------------------------------------------
211 
212   -----------------------------------------------------------------------*/
213 void   SwXFilterOptions::setSourceDocument( const uno::Reference<XComponent >& xDoc )
214         throw (IllegalArgumentException,uno::RuntimeException)
215 {
216     bExport = sal_True;
217     xModel = xDoc;
218 }
219 /*-- 2002/06/21 11:01:26---------------------------------------------------
220 
221   -----------------------------------------------------------------------*/
222 ::rtl::OUString SwXFilterOptions::getImplementationName() throw(uno::RuntimeException)
223 {
224     return ::rtl::OUString(SWFILTEROPTIONSOBJ_IMPLNAME);
225 }
226 /*-- 2002/06/21 11:01:27---------------------------------------------------
227 
228   -----------------------------------------------------------------------*/
229 sal_Bool SwXFilterOptions::supportsService( const ::rtl::OUString& rServiceName )
230     throw(uno::RuntimeException)
231 {
232     return rServiceName == ::rtl::OUString(SWFILTEROPTIONSOBJ_SERVICE);
233 }
234 /*-- 2002/06/21 11:01:28---------------------------------------------------
235 
236   -----------------------------------------------------------------------*/
237 uno::Sequence< ::rtl::OUString > SwXFilterOptions::getSupportedServiceNames()
238                 throw(uno::RuntimeException)
239 {
240     return SwXFilterOptions::getSupportedServiceNames_Static();
241 }
242 
243 
244 uno::Reference<uno::XInterface> SAL_CALL SwXFilterOptions_createInstance(
245                                                 const uno::Reference<lang::XMultiServiceFactory>& )
246 {
247     ::vos::OGuard aGuard(Application::GetSolarMutex());
248         SwDLL::Init();
249     return (::cppu::OWeakObject*) new SwXFilterOptions;
250 }
251 

source navigation ] diff markup ] identifier search ] general search ]

This page was automatically generated by the LXR engine.
The LXR team
Valid HTML 4.01!