~ubuntu-branches/ubuntu/karmic/openoffice.org-l10n/karmic

« back to all changes in this revision

Viewing changes to ooo-build/patches/vba/sc-source-ui-vba-vbahelper-cxx.diff

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-04-27 19:29:22 UTC
  • Revision ID: james.westby@ubuntu.com-20060427192922-2dburxv3b63f8v0u
Tags: 2.0.2-2ubuntu5
* Copy of the openoffice.org source.
  - debian/control.in: Change source name.
  - debian/changelog: Change source name.
  - debian/control: Regenerate control file.
* Add kurdish translations exported from Rosetta (2006-04-18).
* Workaround bad message strings in recently included GSI files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
--- /dev/null   
2
2
+++ sc/source/ui/vba/vbahelper.cxx      
3
 
@@ -0,0 +1,311 @@
 
3
@@ -0,0 +1,326 @@
4
4
+#include <cppuhelper/bootstrap.hxx>
5
5
+#include <com/sun/star/util/XURLTransformer.hpp>
6
6
+#include <com/sun/star/frame/XDispatchProvider.hpp>
7
7
+#include <com/sun/star/frame/XModel.hpp>
8
8
+#include <com/sun/star/frame/XFrame.hpp>
 
9
+#include <com/sun/star/frame/XDesktop.hpp>
9
10
+#include <com/sun/star/frame/XController.hpp>
10
11
+#include <com/sun/star/uno/XComponentContext.hpp>
11
12
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
257
258
+               if ( sal_False == ( aModel >>= xModel ) ||
258
259
+                       !xModel.is() )
259
260
+               {
260
 
+                       OSL_TRACE("Failed to extract model from thisComponent ");
 
261
+                       // trying last gasp try the current component
 
262
+                       uno::Reference<uno::XComponentContext > xCtx( ::cppu::defaultBootstrap_InitialComponentContext(), uno::UNO_QUERY_THROW );
 
263
+                       uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
 
264
+                       uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
 
265
+                       xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
 
266
+                       if ( !xModel.is() )
 
267
+                       {
 
268
+                               throw uno::RuntimeException( 
 
269
+                                       rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
 
270
+                       }
261
271
+                       return xModel;
262
272
+               }
263
273
+               else
270
280
+       else
271
281
+       {
272
282
+               OSL_TRACE("Failed to get ThisComponent");
 
283
+               throw uno::RuntimeException( 
 
284
+                       rtl::OUString( 
 
285
+                               RTL_CONSTASCII_USTRINGPARAM(
 
286
+                                       "Can't determine the currently selected document") ),
 
287
+                       uno::Reference< uno::XInterface >() );
273
288
+       }
274
289
+       return xModel;
275
290
+}