2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2008-03-05 16:23:15 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 07:53:57 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2008-03-05 16:23:15 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2008-03-05 16:23:15 +00:00
|
|
|
*
|
2008-04-11 07:53:57 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2008-03-05 16:23:15 +00:00
|
|
|
*
|
2008-04-11 07:53:57 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2008-03-05 16:23:15 +00:00
|
|
|
*
|
2008-04-11 07:53:57 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2008-03-05 16:23:15 +00:00
|
|
|
*
|
2008-04-11 07:53:57 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2008-03-05 16:23:15 +00:00
|
|
|
*
|
2008-04-11 07:53:57 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2008-03-05 16:23:15 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
// autogen include statement, do not remove
|
|
|
|
|
|
|
|
#include "backingwindow.hxx"
|
2010-10-18 17:00:27 +02:00
|
|
|
#include "classes/resource.hrc"
|
2008-03-05 16:23:15 +00:00
|
|
|
#include "framework.hrc"
|
|
|
|
#include "classes/fwkresid.hxx"
|
2009-09-08 04:57:32 +00:00
|
|
|
#include <services.h>
|
2008-03-05 16:23:15 +00:00
|
|
|
|
2010-10-14 22:33:33 +01:00
|
|
|
#include <sal/macros.h>
|
|
|
|
|
2008-03-05 16:23:15 +00:00
|
|
|
#include "vcl/metric.hxx"
|
2008-04-03 16:11:36 +00:00
|
|
|
#include "vcl/mnemonic.hxx"
|
|
|
|
#include "vcl/menu.hxx"
|
2008-05-30 06:37:16 +00:00
|
|
|
#include "vcl/svapp.hxx"
|
2012-06-08 22:04:48 +03:00
|
|
|
#include "vcl/virdev.hxx"
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
#include "tools/urlobj.hxx"
|
|
|
|
|
2009-10-06 07:38:24 +02:00
|
|
|
#include "unotools/dynamicmenuoptions.hxx"
|
2010-04-13 18:47:19 +02:00
|
|
|
#include "unotools/historyoptions.hxx"
|
2008-03-05 16:23:15 +00:00
|
|
|
#include "svtools/imagemgr.hxx"
|
2010-04-09 11:05:09 +02:00
|
|
|
#include "svtools/svtools.hrc"
|
2010-10-07 12:29:30 +02:00
|
|
|
#include "svtools/langhelp.hxx"
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
#include "comphelper/processfactory.hxx"
|
|
|
|
#include "comphelper/sequenceashashmap.hxx"
|
2009-10-30 17:29:27 +01:00
|
|
|
#include "comphelper/configurationhelper.hxx"
|
2008-03-05 16:23:15 +00:00
|
|
|
|
2010-04-13 18:47:19 +02:00
|
|
|
#include "cppuhelper/implbase1.hxx"
|
|
|
|
|
2008-03-05 16:23:15 +00:00
|
|
|
#include "rtl/strbuf.hxx"
|
|
|
|
#include "rtl/ustrbuf.hxx"
|
2010-04-13 18:47:19 +02:00
|
|
|
#include "osl/file.h"
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
|
|
|
|
#include "com/sun/star/container/XNameAccess.hpp"
|
2012-08-29 07:45:05 +02:00
|
|
|
#include "com/sun/star/system/SystemShellExecute.hpp"
|
2008-03-05 16:23:15 +00:00
|
|
|
#include "com/sun/star/system/SystemShellExecuteFlags.hpp"
|
2008-08-01 08:02:44 +00:00
|
|
|
#include "com/sun/star/task/XJobExecutor.hpp"
|
2010-04-13 18:47:19 +02:00
|
|
|
#include "com/sun/star/util/XStringWidth.hpp"
|
2012-06-01 15:15:25 +02:00
|
|
|
#include <com/sun/star/util/URLTransformer.hpp>
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::frame;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace framework;
|
|
|
|
|
|
|
|
#define WRITER_URL "private:factory/swriter"
|
|
|
|
#define CALC_URL "private:factory/scalc"
|
|
|
|
#define IMPRESS_WIZARD_URL "private:factory/simpress?slot=6686"
|
|
|
|
#define DRAW_URL "private:factory/sdraw"
|
|
|
|
#define BASE_URL "private:factory/sdatabase?Interactive"
|
2008-07-11 06:17:22 +00:00
|
|
|
#define MATH_URL "private:factory/smath"
|
2008-03-05 16:23:15 +00:00
|
|
|
#define TEMPLATE_URL "slot:5500"
|
2008-04-03 16:11:36 +00:00
|
|
|
#define OPEN_URL ".uno:Open"
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
DecoToolBox::DecoToolBox( Window* pParent, WinBits nStyle ) :
|
|
|
|
ToolBox( pParent, nStyle )
|
|
|
|
{
|
2008-03-12 09:09:47 +00:00
|
|
|
SetBackground();
|
2010-11-05 10:31:15 +08:00
|
|
|
SetPaintTransparent( sal_True );
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DecoToolBox::DataChanged( const DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
Window::DataChanged( rDCEvt );
|
|
|
|
|
|
|
|
if ( rDCEvt.GetFlags() & SETTINGS_STYLE )
|
|
|
|
{
|
|
|
|
calcMinSize();
|
|
|
|
SetBackground();
|
2010-11-05 10:31:15 +08:00
|
|
|
SetPaintTransparent( sal_True );
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DecoToolBox::calcMinSize()
|
|
|
|
{
|
|
|
|
ToolBox aTbx( GetParent() );
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_uInt16 nItems = GetItemCount();
|
|
|
|
for( sal_uInt16 i = 0; i < nItems; i++ )
|
2008-03-05 16:23:15 +00:00
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_uInt16 nId = GetItemId( i );
|
2008-03-05 16:23:15 +00:00
|
|
|
aTbx.InsertItem( nId, GetItemImage( nId ) );
|
|
|
|
}
|
|
|
|
aTbx.SetOutStyle( TOOLBOX_STYLE_FLAT );
|
|
|
|
maMinSize = aTbx.CalcWindowSizePixel();
|
|
|
|
}
|
|
|
|
|
|
|
|
Size DecoToolBox::getMinSize()
|
|
|
|
{
|
|
|
|
return maMinSize;
|
|
|
|
}
|
|
|
|
|
2010-04-13 18:47:19 +02:00
|
|
|
class RecentFilesStringLength : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XStringWidth >
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RecentFilesStringLength() {}
|
|
|
|
virtual ~RecentFilesStringLength() {}
|
|
|
|
|
|
|
|
// XStringWidth
|
|
|
|
sal_Int32 SAL_CALL queryStringWidth( const ::rtl::OUString& aString )
|
|
|
|
throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return aString.getLength();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-03-26 17:21:42 +01:00
|
|
|
#define STC_BUTTON_STYLE (WB_LEFT | WB_VCENTER | WB_FLATBUTTON | WB_BEVELBUTTON)
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
BackingWindow::BackingWindow( Window* i_pParent ) :
|
|
|
|
Window( i_pParent, FwkResId( DLG_BACKING ) ),
|
2010-03-26 17:21:42 +01:00
|
|
|
maWriterButton( this, STC_BUTTON_STYLE ),
|
|
|
|
maCalcButton( this, STC_BUTTON_STYLE ),
|
|
|
|
maImpressButton( this, STC_BUTTON_STYLE ),
|
2010-03-30 13:51:42 +02:00
|
|
|
maOpenButton( this, STC_BUTTON_STYLE ),
|
2010-03-26 17:21:42 +01:00
|
|
|
maDrawButton( this, STC_BUTTON_STYLE ),
|
|
|
|
maDBButton( this, STC_BUTTON_STYLE ),
|
|
|
|
maMathButton( this, STC_BUTTON_STYLE ),
|
|
|
|
maTemplateButton( this, STC_BUTTON_STYLE ),
|
2008-03-05 16:23:15 +00:00
|
|
|
maToolbox( this, WB_DIALOGCONTROL ),
|
|
|
|
maOpenString( FwkResId( STR_BACKING_FILE ) ),
|
|
|
|
maTemplateString( FwkResId( STR_BACKING_TEMPLATE ) ),
|
2008-04-03 16:11:36 +00:00
|
|
|
maButtonImageSize( 10, 10 ),
|
|
|
|
mbInitControls( false ),
|
2012-03-06 11:16:07 +01:00
|
|
|
mnHideExternalLinks( 0 ),
|
2010-03-26 16:18:10 +01:00
|
|
|
mpAccExec( NULL ),
|
2010-05-05 14:27:57 +02:00
|
|
|
mnBtnPos( 120 ),
|
2010-05-20 16:06:12 +02:00
|
|
|
mnBtnTop( 150 ),
|
2010-04-13 18:47:19 +02:00
|
|
|
mpRecentMenu( NULL )
|
2008-03-05 16:23:15 +00:00
|
|
|
{
|
|
|
|
mnColumnWidth[0] = mnColumnWidth[1] = 0;
|
2010-03-26 17:30:54 +01:00
|
|
|
mnTextColumnWidth[0] = mnTextColumnWidth[1] = 0;
|
2008-03-05 16:23:15 +00:00
|
|
|
|
2010-03-26 16:18:10 +01:00
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY);
|
|
|
|
if( xConfig.is() )
|
|
|
|
{
|
|
|
|
Sequence<Any> args(1);
|
|
|
|
PropertyValue val(
|
2012-06-02 20:41:34 -05:00
|
|
|
rtl::OUString( "nodepath" ),
|
2010-03-26 16:18:10 +01:00
|
|
|
0,
|
2012-06-02 20:41:34 -05:00
|
|
|
Any(rtl::OUString( "/org.openoffice.Office.Common/Help/StartCenter")),
|
2010-03-26 16:18:10 +01:00
|
|
|
PropertyState_DIRECT_VALUE);
|
|
|
|
args.getArray()[0] <<= val;
|
|
|
|
Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY);
|
|
|
|
if( xNameAccess.is() )
|
|
|
|
{
|
|
|
|
//throws css::container::NoSuchElementException, css::lang::WrappedTargetException
|
2012-06-02 20:41:34 -05:00
|
|
|
Any value( xNameAccess->getByName(rtl::OUString("StartCenterHideExternalLinks")) );
|
2012-03-06 11:16:07 +01:00
|
|
|
mnHideExternalLinks = value.get<sal_Int32>();
|
2010-03-26 16:18:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-06-19 22:48:52 +01:00
|
|
|
catch (const Exception&)
|
2010-03-26 16:18:10 +01:00
|
|
|
{
|
|
|
|
}
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
String aExtHelpText( FwkResId( STR_BACKING_EXTHELP ) );
|
|
|
|
String aInfoHelpText( FwkResId( STR_BACKING_INFOHELP ) );
|
2008-06-03 13:45:57 +00:00
|
|
|
String aTplRepHelpText( FwkResId( STR_BACKING_TPLREP ) );
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
// clean up resource stack
|
|
|
|
FreeResource();
|
|
|
|
|
2009-08-27 15:44:10 +00:00
|
|
|
EnableChildTransparentMode();
|
|
|
|
|
2008-03-05 16:23:15 +00:00
|
|
|
SetStyle( GetStyle() | WB_DIALOGCONTROL );
|
|
|
|
|
2008-06-25 13:41:59 +00:00
|
|
|
// force tab cycling in toolbox
|
|
|
|
maToolbox.SetStyle( maToolbox.GetStyle() | WB_FORCETABCYCLE );
|
|
|
|
|
2008-04-03 16:11:36 +00:00
|
|
|
// insert toolbox items
|
2010-03-30 13:51:42 +02:00
|
|
|
maToolbox.InsertItem( nItemId_TplRep, Image() );
|
2008-06-03 13:45:57 +00:00
|
|
|
maToolbox.SetItemText( nItemId_TplRep, aTplRepHelpText );
|
|
|
|
maToolbox.SetQuickHelpText( nItemId_TplRep, aTplRepHelpText );
|
2012-06-02 20:41:34 -05:00
|
|
|
maToolbox.SetItemCommand( nItemId_TplRep, String( ".HelpId:StartCenter:TemplateRepository" ) );
|
2008-06-03 13:45:57 +00:00
|
|
|
maToolbox.ShowItem( nItemId_TplRep );
|
|
|
|
|
2010-03-30 13:51:42 +02:00
|
|
|
maToolbox.InsertItem( nItemId_Extensions, Image() );
|
2008-04-03 16:11:36 +00:00
|
|
|
maToolbox.SetQuickHelpText( nItemId_Extensions, aExtHelpText );
|
2008-05-14 08:42:49 +00:00
|
|
|
maToolbox.SetItemText( nItemId_Extensions, aExtHelpText );
|
2012-06-02 20:41:34 -05:00
|
|
|
maToolbox.SetItemCommand( nItemId_Extensions, String( ".HelpId:StartCenter:Extensions" ) );
|
2008-04-03 16:11:36 +00:00
|
|
|
maToolbox.ShowItem( nItemId_Extensions );
|
|
|
|
|
2010-03-30 13:51:42 +02:00
|
|
|
maToolbox.InsertItem( nItemId_Info, Image() );
|
2008-05-14 08:42:49 +00:00
|
|
|
maToolbox.SetItemText( nItemId_Info, aInfoHelpText );
|
2008-04-03 16:11:36 +00:00
|
|
|
maToolbox.SetQuickHelpText( nItemId_Info, aInfoHelpText );
|
2012-06-02 20:41:34 -05:00
|
|
|
maToolbox.SetItemCommand( nItemId_Info, String( ".HelpId:StartCenter:Info" ) );
|
2008-04-03 16:11:36 +00:00
|
|
|
maToolbox.ShowItem( nItemId_Info );
|
|
|
|
|
|
|
|
// get dispatch provider
|
2009-09-08 04:57:32 +00:00
|
|
|
mxDesktop = Reference<XDesktop>( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_DESKTOP ),UNO_QUERY );
|
2008-03-05 16:23:15 +00:00
|
|
|
if( mxDesktop.is() )
|
|
|
|
mxDesktopDispatchProvider = Reference< XDispatchProvider >( mxDesktop, UNO_QUERY );
|
|
|
|
|
2010-06-04 13:46:22 +02:00
|
|
|
maWriterButton.SetHelpId( ".HelpId:StartCenter:WriterButton" );
|
|
|
|
maCalcButton.SetHelpId( ".HelpId:StartCenter:CalcButton" );
|
|
|
|
maImpressButton.SetHelpId( ".HelpId:StartCenter:ImpressButton" );
|
|
|
|
maDrawButton.SetHelpId( ".HelpId:StartCenter:DrawButton" );
|
|
|
|
maDBButton.SetHelpId( ".HelpId:StartCenter:DBButton" );
|
|
|
|
maMathButton.SetHelpId( ".HelpId:StartCenter:MathButton" );
|
|
|
|
maTemplateButton.SetHelpId( ".HelpId:StartCenter:TemplateButton" );
|
|
|
|
maOpenButton.SetHelpId( ".HelpId:StartCenter:OpenButton" );
|
|
|
|
maToolbox.SetHelpId( ".HelpId:StartCenter:Toolbox" );
|
2008-04-17 06:55:36 +00:00
|
|
|
|
|
|
|
// init background
|
|
|
|
initBackground();
|
2010-05-10 11:39:38 +02:00
|
|
|
|
|
|
|
// add some breathing space for the images
|
|
|
|
maButtonImageSize.Width() += 12;
|
|
|
|
maButtonImageSize.Height() += 12;
|
|
|
|
|
2012-04-03 20:40:14 +04:00
|
|
|
// set a slighly larger font than normal labels on the texts
|
|
|
|
maTextFont.SetSize( Size( 0, 11 ) );
|
|
|
|
maTextFont.SetWeight( WEIGHT_NORMAL );
|
2008-04-03 16:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BackingWindow::~BackingWindow()
|
|
|
|
{
|
2010-04-13 18:47:19 +02:00
|
|
|
delete mpRecentMenu;
|
2008-04-03 16:11:36 +00:00
|
|
|
delete mpAccExec;
|
|
|
|
}
|
|
|
|
|
2009-10-22 16:23:16 +02:00
|
|
|
void BackingWindow::GetFocus()
|
|
|
|
{
|
|
|
|
if( IsVisible() )
|
|
|
|
maWriterButton.GrabFocus();
|
|
|
|
Window::GetFocus();
|
|
|
|
}
|
|
|
|
|
2008-04-17 06:55:36 +00:00
|
|
|
class ImageContainerRes : public Resource
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ImageContainerRes( const ResId& i_rId ) : Resource( i_rId ) {}
|
|
|
|
~ImageContainerRes() { FreeResource(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
void BackingWindow::DataChanged( const DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
Window::DataChanged( rDCEvt );
|
|
|
|
|
|
|
|
if ( rDCEvt.GetFlags() & SETTINGS_STYLE )
|
|
|
|
{
|
|
|
|
initBackground();
|
2009-09-11 11:10:31 +00:00
|
|
|
Invalidate();
|
2012-04-12 14:08:02 +02:00
|
|
|
// fdo#34392: Resize buttons to match the new text size.
|
|
|
|
Resize();
|
2008-04-17 06:55:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-13 18:47:19 +02:00
|
|
|
void BackingWindow::prepareRecentFileMenu()
|
|
|
|
{
|
|
|
|
if( ! mpRecentMenu )
|
|
|
|
mpRecentMenu = new PopupMenu();
|
|
|
|
mpRecentMenu->Clear();
|
|
|
|
maRecentFiles.clear();
|
|
|
|
|
|
|
|
// get recent file list and dispatch arguments
|
|
|
|
Sequence< Sequence< PropertyValue > > aHistoryList( SvtHistoryOptions().GetList( ePICKLIST ) );
|
|
|
|
|
|
|
|
sal_Int32 nPickListMenuItems = ( aHistoryList.getLength() > 99 ) ? 99 : aHistoryList.getLength();
|
|
|
|
|
|
|
|
if( ( nPickListMenuItems > 0 ) )
|
|
|
|
{
|
|
|
|
maRecentFiles.reserve( nPickListMenuItems );
|
|
|
|
for ( sal_Int32 i = 0; i < nPickListMenuItems; i++ )
|
|
|
|
{
|
|
|
|
Sequence< PropertyValue >& rPickListEntry = aHistoryList[i];
|
|
|
|
rtl::OUString aURL, aFilter, aFilterOpt, aTitle;
|
|
|
|
|
|
|
|
for ( sal_Int32 j = 0; j < rPickListEntry.getLength(); j++ )
|
|
|
|
{
|
|
|
|
const Any& a = rPickListEntry[j].Value;
|
|
|
|
|
|
|
|
if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_URL )
|
|
|
|
a >>= aURL;
|
|
|
|
else if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_FILTER )
|
|
|
|
{
|
|
|
|
a >>= aFilter;
|
|
|
|
sal_Int32 nPos = aFilter.indexOf( '|' );
|
|
|
|
if ( nPos >= 0 )
|
|
|
|
{
|
|
|
|
if ( nPos < ( aFilter.getLength() - 1 ) )
|
|
|
|
aFilterOpt = aFilter.copy( nPos+1 );
|
|
|
|
aFilter = aFilter.copy( 0, nPos-1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_TITLE )
|
|
|
|
a >>= aTitle;
|
|
|
|
}
|
|
|
|
maRecentFiles.push_back( LoadRecentFile() );
|
|
|
|
maRecentFiles.back().aTargetURL = aURL;
|
|
|
|
|
2011-12-26 14:20:50 -02:00
|
|
|
sal_Int32 nArgs = aFilterOpt.isEmpty() ? 3 : 4;
|
2010-04-13 18:47:19 +02:00
|
|
|
Sequence< PropertyValue >& rArgsList( maRecentFiles.back().aArgSeq );
|
|
|
|
rArgsList.realloc( nArgs );
|
|
|
|
|
|
|
|
nArgs--;
|
2012-06-02 20:41:34 -05:00
|
|
|
rArgsList[nArgs].Name = rtl::OUString( "FilterName" );
|
2010-04-13 18:47:19 +02:00
|
|
|
rArgsList[nArgs].Value = makeAny( aFilter );
|
|
|
|
|
2011-12-26 14:20:50 -02:00
|
|
|
if( !aFilterOpt.isEmpty() )
|
2010-04-13 18:47:19 +02:00
|
|
|
{
|
|
|
|
nArgs--;
|
2012-06-02 20:41:34 -05:00
|
|
|
rArgsList[nArgs].Name = rtl::OUString( "FilterOptions" );
|
2010-04-13 18:47:19 +02:00
|
|
|
rArgsList[nArgs].Value = makeAny( aFilterOpt );
|
|
|
|
}
|
|
|
|
|
|
|
|
// documents in the picklist will never be opened as templates
|
|
|
|
nArgs--;
|
2012-06-02 20:41:34 -05:00
|
|
|
rArgsList[nArgs].Name = rtl::OUString( "AsTemplate" );
|
2010-04-13 18:47:19 +02:00
|
|
|
rArgsList[nArgs].Value = makeAny( (sal_Bool) sal_False );
|
|
|
|
|
|
|
|
nArgs--;
|
2012-06-02 20:41:34 -05:00
|
|
|
rArgsList[nArgs].Name = rtl::OUString( "Referer" );
|
|
|
|
rArgsList[nArgs].Value = makeAny( rtl::OUString( "private:user" ) );
|
2010-04-13 18:47:19 +02:00
|
|
|
|
|
|
|
// and finally create an entry in the popupmenu
|
|
|
|
rtl::OUString aMenuTitle;
|
|
|
|
INetURLObject aURLObj( aURL );
|
|
|
|
|
|
|
|
if ( aURLObj.GetProtocol() == INET_PROT_FILE )
|
|
|
|
{
|
|
|
|
// Do handle file URL differently => convert it to a system
|
|
|
|
// path and abbreviate it with a special function:
|
|
|
|
String aFileSystemPath( aURLObj.getFSysPath( INetURLObject::FSYS_DETECT ) );
|
|
|
|
|
|
|
|
rtl::OUString aSystemPath( aFileSystemPath );
|
|
|
|
rtl::OUString aCompactedSystemPath;
|
|
|
|
|
|
|
|
oslFileError nError = osl_abbreviateSystemPath( aSystemPath.pData, &aCompactedSystemPath.pData, 46, NULL );
|
|
|
|
if ( !nError )
|
|
|
|
aMenuTitle = String( aCompactedSystemPath );
|
|
|
|
else
|
|
|
|
aMenuTitle = aSystemPath;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Use INetURLObject to abbreviate all other URLs
|
2010-05-31 13:57:10 +02:00
|
|
|
Reference< util::XStringWidth > xStringLength( new RecentFilesStringLength() );
|
2010-04-13 18:47:19 +02:00
|
|
|
aMenuTitle = aURLObj.getAbbreviated( xStringLength, 46, INetURLObject::DECODE_UNAMBIGUOUS );
|
|
|
|
}
|
|
|
|
rtl::OUStringBuffer aBuf( aMenuTitle.getLength() + 5 );
|
|
|
|
if( i < 9 )
|
|
|
|
{
|
|
|
|
aBuf.append( sal_Unicode( '~' ) );
|
|
|
|
aBuf.append( i+1 );
|
|
|
|
}
|
|
|
|
else if( i == 9 )
|
|
|
|
aBuf.appendAscii( "1~0" );
|
|
|
|
else
|
|
|
|
aBuf.append( i+1 );
|
|
|
|
aBuf.appendAscii( ": " );
|
|
|
|
aBuf.append( aMenuTitle );
|
2010-11-05 10:31:15 +08:00
|
|
|
mpRecentMenu->InsertItem( static_cast<sal_uInt16>(i+1), aBuf.makeStringAndClear() );
|
2010-04-13 18:47:19 +02:00
|
|
|
}
|
|
|
|
}
|
2010-10-18 17:00:27 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
String aNoDoc( FwkResId( STR_NODOCUMENT ) );
|
|
|
|
mpRecentMenu->InsertItem( 0xffff, aNoDoc );
|
|
|
|
}
|
|
|
|
maOpenButton.SetPopupMenu( mpRecentMenu );
|
2010-04-13 18:47:19 +02:00
|
|
|
}
|
|
|
|
|
2008-04-17 06:55:36 +00:00
|
|
|
void BackingWindow::initBackground()
|
|
|
|
{
|
2011-03-14 11:15:36 +01:00
|
|
|
SetBackground();
|
2008-06-25 13:41:59 +00:00
|
|
|
|
2009-09-11 11:10:31 +00:00
|
|
|
bool bDark = GetSettings().GetStyleSettings().GetHighContrastMode();
|
2010-03-26 17:39:11 +01:00
|
|
|
|
2008-04-17 06:55:36 +00:00
|
|
|
Color aTextBGColor( bDark ? COL_BLACK : COL_WHITE );
|
|
|
|
|
|
|
|
// select image set
|
2010-11-05 19:24:42 -07:00
|
|
|
ImageContainerRes aRes( FwkResId( RES_BACKING_IMAGES ) );
|
2008-04-17 06:55:36 +00:00
|
|
|
|
|
|
|
// scale middle segment
|
|
|
|
Size aMiddleSize;
|
|
|
|
if( !! maBackgroundMiddle )
|
|
|
|
aMiddleSize = maBackgroundMiddle.GetSizePixel();
|
|
|
|
// load middle segment
|
2010-10-11 12:46:39 +01:00
|
|
|
|
|
|
|
Application::LoadBrandBitmap ("shell/backing_space", maBackgroundMiddle);
|
|
|
|
|
2008-04-17 06:55:36 +00:00
|
|
|
// and scale it to previous size
|
|
|
|
if( aMiddleSize.Width() && aMiddleSize.Height() )
|
|
|
|
maBackgroundMiddle.Scale( aMiddleSize );
|
|
|
|
|
|
|
|
if( GetSettings().GetLayoutRTL() )
|
|
|
|
{
|
|
|
|
// replace images by RTL versions
|
2010-10-11 12:46:39 +01:00
|
|
|
Application::LoadBrandBitmap ("shell/backing_rtl_right", maBackgroundLeft);
|
|
|
|
Application::LoadBrandBitmap ("shell/backing_rtl_left", maBackgroundRight);
|
2008-04-17 06:55:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-11 12:46:39 +01:00
|
|
|
Application::LoadBrandBitmap ("shell/backing_left", maBackgroundLeft);
|
|
|
|
Application::LoadBrandBitmap ("shell/backing_right", maBackgroundRight);
|
2008-04-17 06:55:36 +00:00
|
|
|
}
|
2010-03-30 13:51:42 +02:00
|
|
|
maToolbox.SetItemImage( nItemId_Extensions, BitmapEx( FwkResId( BMP_BACKING_EXT ) ) );
|
|
|
|
maToolbox.SetItemImage( nItemId_Info, BitmapEx( FwkResId( BMP_BACKING_INFO ) ) );
|
|
|
|
maToolbox.SetItemImage( nItemId_TplRep, BitmapEx( FwkResId( BMP_BACKING_TPLREP ) ) );
|
2008-04-17 06:55:36 +00:00
|
|
|
|
2010-05-10 11:39:38 +02:00
|
|
|
// get icon images from fwk resource and set them on the appropriate buttons
|
|
|
|
loadImage( FwkResId( BMP_BACKING_WRITER ), maWriterButton );
|
|
|
|
loadImage( FwkResId( BMP_BACKING_CALC ), maCalcButton );
|
|
|
|
loadImage( FwkResId( BMP_BACKING_IMPRESS ), maImpressButton );
|
|
|
|
loadImage( FwkResId( BMP_BACKING_DRAW ), maDrawButton );
|
|
|
|
loadImage( FwkResId( BMP_BACKING_DATABASE ), maDBButton );
|
|
|
|
loadImage( FwkResId( BMP_BACKING_FORMULA ), maMathButton );
|
|
|
|
loadImage( FwkResId( BMP_BACKING_OPENFILE ), maOpenButton );
|
|
|
|
loadImage( FwkResId( BMP_BACKING_OPENTEMPLATE ), maTemplateButton );
|
|
|
|
|
2010-04-13 18:47:19 +02:00
|
|
|
maOpenButton.SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
|
|
|
|
maOpenButton.SetSelectHdl( LINK( this, BackingWindow, SelectHdl ) );
|
2010-06-04 18:53:06 +02:00
|
|
|
maOpenButton.SetActivateHdl( LINK( this, BackingWindow, ActivateHdl ) );
|
2008-04-17 06:55:36 +00:00
|
|
|
}
|
|
|
|
|
2008-04-03 16:11:36 +00:00
|
|
|
void BackingWindow::initControls()
|
|
|
|
{
|
|
|
|
if( mbInitControls )
|
|
|
|
return;
|
|
|
|
|
|
|
|
mbInitControls = true;
|
|
|
|
|
2008-03-05 16:23:15 +00:00
|
|
|
// calculate dialog size
|
|
|
|
// begin with background bitmap
|
|
|
|
maControlRect = Rectangle( Point(), maBackgroundLeft.GetSizePixel() );
|
|
|
|
maControlRect.Left() += nShadowLeft;
|
|
|
|
maControlRect.Right() -= nShadowRight;
|
|
|
|
maControlRect.Top() += nShadowTop;
|
|
|
|
maControlRect.Bottom() -= nShadowBottom;
|
|
|
|
|
|
|
|
long nYPos = 0;
|
|
|
|
|
2012-03-06 11:16:07 +01:00
|
|
|
if( maControlRect.GetWidth() < mnBtnPos + 20 )
|
|
|
|
maControlRect.Right() = maControlRect.Left() + mnBtnPos + 20;
|
2008-03-05 16:23:15 +00:00
|
|
|
|
2012-03-06 11:16:07 +01:00
|
|
|
if( maControlRect.GetWidth() < mnBtnPos + 10 )
|
|
|
|
maControlRect.Right() = maControlRect.Left() + mnBtnPos + 10;
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
// collect the URLs of the entries in the File/New menu
|
|
|
|
SvtModuleOptions aModuleOptions;
|
|
|
|
std::set< rtl::OUString > aFileNewAppsAvailable;
|
|
|
|
SvtDynamicMenuOptions aOpt;
|
|
|
|
Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( E_NEWMENU );
|
2012-06-02 20:41:34 -05:00
|
|
|
const rtl::OUString sURLKey( "URL" );
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
const Sequence< PropertyValue >* pNewMenu = aNewMenu.getConstArray();
|
|
|
|
const Sequence< PropertyValue >* pNewMenuEnd = aNewMenu.getConstArray() + aNewMenu.getLength();
|
|
|
|
for ( ; pNewMenu != pNewMenuEnd; ++pNewMenu )
|
|
|
|
{
|
|
|
|
comphelper::SequenceAsHashMap aEntryItems( *pNewMenu );
|
|
|
|
rtl::OUString sURL( aEntryItems.getUnpackedValueOrDefault( sURLKey, rtl::OUString() ) );
|
2011-12-26 14:20:50 -02:00
|
|
|
if ( !sURL.isEmpty() )
|
2008-03-05 16:23:15 +00:00
|
|
|
aFileNewAppsAvailable.insert( sURL );
|
|
|
|
}
|
|
|
|
|
2008-04-03 16:11:36 +00:00
|
|
|
// create mnemonics on the fly, preregister the mnemonics of the menu
|
|
|
|
MnemonicGenerator aMnemns;
|
|
|
|
maTemplateString = MnemonicGenerator::EraseAllMnemonicChars( maTemplateString );
|
|
|
|
maOpenString = MnemonicGenerator::EraseAllMnemonicChars( maOpenString );
|
|
|
|
|
|
|
|
SystemWindow* pSysWin = GetSystemWindow();
|
|
|
|
if( pSysWin )
|
|
|
|
{
|
|
|
|
MenuBar* pMBar = pSysWin->GetMenuBar();
|
|
|
|
if( pMBar )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
for( sal_uInt16 i = 0; i < pMBar->GetItemCount(); i++ )
|
2008-04-03 16:11:36 +00:00
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_uInt16 nItemId = pMBar->GetItemId( i );
|
2008-04-03 16:11:36 +00:00
|
|
|
String aItemText( pMBar->GetItemText( nItemId ) );
|
|
|
|
if( aItemText.Len() )
|
|
|
|
aMnemns.RegisterMnemonic( aItemText );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// layout the buttons
|
2012-01-14 00:14:45 +01:00
|
|
|
layoutButton( WRITER_URL, 0, 0, aFileNewAppsAvailable,
|
2010-03-29 13:36:43 +02:00
|
|
|
aModuleOptions, SvtModuleOptions::E_SWRITER,
|
|
|
|
maWriterButton, aMnemns );
|
2012-01-14 00:14:45 +01:00
|
|
|
layoutButton( DRAW_URL, 1, 0, aFileNewAppsAvailable,
|
2010-03-29 13:36:43 +02:00
|
|
|
aModuleOptions, SvtModuleOptions::E_SDRAW,
|
|
|
|
maDrawButton, aMnemns );
|
2008-03-05 16:23:15 +00:00
|
|
|
nYPos += maButtonImageSize.Height() + 10;
|
2012-01-14 00:14:45 +01:00
|
|
|
layoutButton( CALC_URL, 0, 0, aFileNewAppsAvailable,
|
2010-03-29 13:36:43 +02:00
|
|
|
aModuleOptions, SvtModuleOptions::E_SCALC,
|
|
|
|
maCalcButton, aMnemns );
|
2012-01-14 00:14:45 +01:00
|
|
|
layoutButton( BASE_URL, 1, 0, aFileNewAppsAvailable,
|
2010-03-29 13:36:43 +02:00
|
|
|
aModuleOptions, SvtModuleOptions::E_SDATABASE,
|
|
|
|
maDBButton, aMnemns );
|
2010-03-26 17:21:42 +01:00
|
|
|
nYPos += maButtonImageSize.Height() + 10;
|
2012-01-14 00:14:45 +01:00
|
|
|
layoutButton( IMPRESS_WIZARD_URL, 0, 0, aFileNewAppsAvailable,
|
2010-03-29 13:36:43 +02:00
|
|
|
aModuleOptions, SvtModuleOptions::E_SIMPRESS,
|
|
|
|
maImpressButton, aMnemns );
|
2012-01-14 00:14:45 +01:00
|
|
|
layoutButton( MATH_URL, 1, 0, aFileNewAppsAvailable,
|
2010-03-29 13:36:43 +02:00
|
|
|
aModuleOptions, SvtModuleOptions::E_SMATH,
|
|
|
|
maMathButton, aMnemns );
|
2008-07-11 06:17:22 +00:00
|
|
|
|
|
|
|
nYPos += 3*maButtonImageSize.Height() / 2;
|
2008-03-12 09:09:47 +00:00
|
|
|
|
2012-01-14 00:14:45 +01:00
|
|
|
layoutButton( NULL, 0, 18, aFileNewAppsAvailable,
|
2010-03-29 13:36:43 +02:00
|
|
|
aModuleOptions, SvtModuleOptions::E_SWRITER,
|
|
|
|
maOpenButton, aMnemns, maOpenString );
|
2012-01-14 00:14:45 +01:00
|
|
|
layoutButton( NULL, 1, 0, aFileNewAppsAvailable,
|
2010-03-29 13:36:43 +02:00
|
|
|
aModuleOptions, SvtModuleOptions::E_SWRITER,
|
|
|
|
maTemplateButton, aMnemns, maTemplateString );
|
2008-03-05 16:23:15 +00:00
|
|
|
nYPos += 10;
|
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ASSERT( nYPos < maControlRect.GetHeight(), "misformatting !" );
|
2010-03-26 16:18:10 +01:00
|
|
|
if( mnColumnWidth[0] + mnColumnWidth[1] + mnBtnPos + 20 > maControlRect.GetWidth() )
|
|
|
|
maControlRect.Right() = maControlRect.Left() + mnColumnWidth[0] + mnColumnWidth[1] + mnBtnPos + 20;
|
|
|
|
|
2010-03-26 17:30:54 +01:00
|
|
|
mnTextColumnWidth[0] = mnColumnWidth[0];
|
|
|
|
mnTextColumnWidth[1] = mnColumnWidth[1];
|
|
|
|
|
2010-03-30 13:51:42 +02:00
|
|
|
if( mnTextColumnWidth[1] > mnTextColumnWidth[0] )
|
2010-03-26 16:18:10 +01:00
|
|
|
{
|
2010-03-30 13:51:42 +02:00
|
|
|
mnColumnWidth[0] = mnColumnWidth[1];
|
|
|
|
mnTextColumnWidth[0] = mnTextColumnWidth[1];
|
2010-03-26 16:18:10 +01:00
|
|
|
}
|
2010-03-26 17:30:54 +01:00
|
|
|
else
|
|
|
|
{
|
2010-03-30 13:51:42 +02:00
|
|
|
mnColumnWidth[1] = mnColumnWidth[0];
|
|
|
|
mnTextColumnWidth[1] = mnTextColumnWidth[0];
|
|
|
|
}
|
|
|
|
if( maControlRect.GetWidth() < maControlRect.GetHeight() * 3 / 2 )
|
|
|
|
{
|
|
|
|
maControlRect.Right() = maControlRect.Left() + maControlRect.GetHeight() * 3 / 2;
|
|
|
|
long nDelta = (maControlRect.GetWidth() - mnBtnPos - mnColumnWidth[1] - mnColumnWidth[0] - 20);
|
|
|
|
mnColumnWidth[0] += nDelta/2;
|
|
|
|
mnColumnWidth[1] += nDelta/2;
|
2010-03-26 17:30:54 +01:00
|
|
|
}
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
maToolbox.SetSelectHdl( LINK( this, BackingWindow, ToolboxHdl ) );
|
2012-03-06 11:16:07 +01:00
|
|
|
if( mnHideExternalLinks == 0 )
|
2010-03-26 16:18:10 +01:00
|
|
|
maToolbox.Show();
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
// scale middle map to formatted width
|
|
|
|
Size aMiddleSegmentSize( maControlRect.GetSize().Width() + nShadowLeft + nShadowRight,
|
|
|
|
maBackgroundMiddle.GetSizePixel().Height() );
|
|
|
|
|
|
|
|
long nLW = maBackgroundLeft.GetSizePixel().Width();
|
|
|
|
long nRW = maBackgroundRight.GetSizePixel().Width();
|
|
|
|
if( aMiddleSegmentSize.Width() > nLW + nRW )
|
|
|
|
{
|
|
|
|
aMiddleSegmentSize.Width() -= nLW;
|
|
|
|
aMiddleSegmentSize.Width() -= nRW;
|
|
|
|
maBackgroundMiddle.Scale( aMiddleSegmentSize );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
maBackgroundMiddle = BitmapEx();
|
|
|
|
|
2008-04-03 16:11:36 +00:00
|
|
|
Resize();
|
2010-03-29 14:06:42 +02:00
|
|
|
|
|
|
|
maWriterButton.GrabFocus();
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
|
2010-04-13 18:47:19 +02:00
|
|
|
void BackingWindow::loadImage( const ResId& i_rId, PushButton& i_rButton )
|
2008-03-05 16:23:15 +00:00
|
|
|
{
|
|
|
|
BitmapEx aBmp( i_rId );
|
|
|
|
Size aImgSize( aBmp.GetSizePixel() );
|
|
|
|
if( aImgSize.Width() > maButtonImageSize.Width() )
|
|
|
|
maButtonImageSize.Width() = aImgSize.Width();
|
|
|
|
if( aImgSize.Height() > maButtonImageSize.Height() )
|
|
|
|
maButtonImageSize.Height() = aImgSize.Height();
|
|
|
|
i_rButton.SetModeImage( aBmp );
|
|
|
|
}
|
|
|
|
|
2010-03-29 13:36:43 +02:00
|
|
|
void BackingWindow::layoutButton(
|
2012-01-14 00:14:45 +01:00
|
|
|
const char* i_pURL, int nColumn, int i_nExtraWidth,
|
2008-03-05 16:23:15 +00:00
|
|
|
const std::set<rtl::OUString>& i_rURLS,
|
|
|
|
SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod,
|
2010-05-20 16:06:12 +02:00
|
|
|
PushButton& i_rBtn,
|
2008-04-03 16:11:36 +00:00
|
|
|
MnemonicGenerator& i_rMnemns,
|
2008-03-05 16:23:15 +00:00
|
|
|
const String& i_rStr
|
|
|
|
)
|
|
|
|
{
|
2010-11-20 14:10:32 +01:00
|
|
|
rtl::OUString aURL( i_pURL ? rtl::OUString::createFromAscii( i_pURL ) : rtl::OUString() );
|
2008-03-05 16:23:15 +00:00
|
|
|
// setup button
|
2010-11-05 10:31:15 +08:00
|
|
|
i_rBtn.SetPaintTransparent( sal_True );
|
2008-03-05 16:23:15 +00:00
|
|
|
i_rBtn.SetClickHdl( LINK( this, BackingWindow, ClickHdl ) );
|
|
|
|
if( i_pURL && (! i_rOpt.IsModuleInstalled( i_eMod ) || i_rURLS.find( aURL ) == i_rURLS.end()) )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
i_rBtn.Enable( sal_False );
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// setup text
|
2010-03-26 17:21:42 +01:00
|
|
|
i_rBtn.SetFont( maTextFont );
|
|
|
|
i_rBtn.SetControlFont( maTextFont );
|
2008-04-03 16:11:36 +00:00
|
|
|
String aText( i_rStr.Len() ? i_rStr : SvFileInformationManager::GetDescription( INetURLObject( aURL ) ) );
|
|
|
|
i_rMnemns.CreateMnemonic( aText );
|
2010-03-26 17:21:42 +01:00
|
|
|
i_rBtn.SetText( aText );
|
2008-04-03 16:11:36 +00:00
|
|
|
|
2010-03-26 17:21:42 +01:00
|
|
|
long nTextWidth = i_rBtn.GetTextWidth( i_rBtn.GetText() );
|
2008-03-05 16:23:15 +00:00
|
|
|
|
2012-01-14 00:14:45 +01:00
|
|
|
nTextWidth += maButtonImageSize.Width() + 8 + i_nExtraWidth; // add some fuzz to be on the safe side
|
2012-05-29 17:23:51 +01:00
|
|
|
if( nColumn >= 0 && nColumn < static_cast<int>(sizeof (mnColumnWidth) / sizeof (mnColumnWidth[0])) )
|
2008-03-05 16:23:15 +00:00
|
|
|
{
|
|
|
|
if( nTextWidth > mnColumnWidth[nColumn] )
|
|
|
|
mnColumnWidth[nColumn] = nTextWidth;
|
|
|
|
}
|
|
|
|
|
2010-03-26 17:21:42 +01:00
|
|
|
i_rBtn.SetImageAlign( IMAGEALIGN_LEFT );
|
2008-03-05 16:23:15 +00:00
|
|
|
// show the controls
|
|
|
|
i_rBtn.Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BackingWindow::Paint( const Rectangle& )
|
|
|
|
{
|
2012-06-05 16:00:51 +02:00
|
|
|
Wallpaper aBack( GetSettings().GetStyleSettings().GetWorkspaceColor() );
|
2011-03-14 11:15:36 +01:00
|
|
|
Region aClip( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) );
|
|
|
|
Rectangle aBmpRect(maControlRect);
|
|
|
|
aBmpRect.Left() -= nShadowLeft;
|
|
|
|
aBmpRect.Top() -= nShadowTop;
|
|
|
|
aBmpRect.Right() += nShadowRight;
|
|
|
|
aBmpRect.Bottom() += nShadowBottom;
|
|
|
|
aClip.Exclude( aBmpRect );
|
|
|
|
Push( PUSH_CLIPREGION );
|
|
|
|
IntersectClipRegion( aClip );
|
|
|
|
DrawWallpaper( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ), aBack );
|
|
|
|
Pop();
|
|
|
|
|
|
|
|
VirtualDevice aDev( *this );
|
|
|
|
aDev.EnableRTL( IsRTLEnabled() );
|
|
|
|
aDev.SetOutputSizePixel( aBmpRect.GetSize() );
|
|
|
|
Point aOffset( Point( 0, 0 ) - aBmpRect.TopLeft() );
|
|
|
|
aDev.DrawWallpaper( Rectangle( aOffset, GetOutputSizePixel() ), aBack );
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
// draw bitmap
|
2011-03-14 11:15:36 +01:00
|
|
|
Point aTL( 0, 0 );
|
|
|
|
aDev.DrawBitmapEx( aTL, maBackgroundLeft );
|
|
|
|
aTL.X() += maBackgroundLeft.GetSizePixel().Width();
|
|
|
|
if( !!maBackgroundMiddle )
|
2008-03-05 16:23:15 +00:00
|
|
|
{
|
2011-03-14 11:15:36 +01:00
|
|
|
aDev.DrawBitmapEx( aTL, maBackgroundMiddle );
|
|
|
|
aTL.X() += maBackgroundMiddle.GetSizePixel().Width();
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
2011-03-14 11:15:36 +01:00
|
|
|
aDev.DrawBitmapEx( aTL, maBackgroundRight );
|
|
|
|
|
|
|
|
DrawOutDev( aBmpRect.TopLeft(), aBmpRect.GetSize(),
|
|
|
|
Point( 0, 0 ), aBmpRect.GetSize(),
|
|
|
|
aDev );
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
|
2008-04-03 16:11:36 +00:00
|
|
|
long BackingWindow::Notify( NotifyEvent& rNEvt )
|
|
|
|
{
|
|
|
|
if( rNEvt.GetType() == EVENT_KEYINPUT )
|
|
|
|
{
|
|
|
|
if( ! mpAccExec )
|
|
|
|
{
|
|
|
|
mpAccExec = svt::AcceleratorExecute::createAcceleratorHelper();
|
|
|
|
mpAccExec->init( comphelper::getProcessServiceFactory(), mxFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
const KeyEvent* pEvt = rNEvt.GetKeyEvent();
|
2010-03-29 13:36:43 +02:00
|
|
|
const KeyCode& rKeyCode(pEvt->GetKeyCode());
|
|
|
|
if( pEvt && mpAccExec->execute(rKeyCode) )
|
2008-04-03 16:11:36 +00:00
|
|
|
return 1;
|
2010-03-29 13:36:43 +02:00
|
|
|
// #i110344# extrawurst: specialized arrow key control
|
|
|
|
if( rKeyCode.GetModifier() == 0 )
|
|
|
|
{
|
|
|
|
if( rKeyCode.GetCode() == KEY_RIGHT )
|
|
|
|
{
|
|
|
|
if( maWriterButton.HasFocus() )
|
|
|
|
maDrawButton.GrabFocus();
|
|
|
|
else if( maCalcButton.HasFocus() )
|
|
|
|
maDBButton.GrabFocus();
|
|
|
|
else if( maImpressButton.HasFocus() )
|
|
|
|
maMathButton.GrabFocus();
|
|
|
|
else if( maOpenButton.HasFocus() )
|
|
|
|
maTemplateButton.GrabFocus();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if( rKeyCode.GetCode() == KEY_LEFT )
|
|
|
|
{
|
|
|
|
if( maDrawButton.HasFocus() )
|
|
|
|
maWriterButton.GrabFocus();
|
|
|
|
else if( maDBButton.HasFocus() )
|
|
|
|
maCalcButton.GrabFocus();
|
|
|
|
else if( maMathButton.HasFocus() )
|
|
|
|
maImpressButton.GrabFocus();
|
|
|
|
else if( maTemplateButton.HasFocus() )
|
|
|
|
maOpenButton.GrabFocus();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if( rKeyCode.GetCode() == KEY_UP )
|
|
|
|
{
|
|
|
|
// first column
|
|
|
|
if( maOpenButton.HasFocus() )
|
|
|
|
maImpressButton.GrabFocus();
|
|
|
|
else if( maImpressButton.HasFocus() )
|
|
|
|
maCalcButton.GrabFocus();
|
|
|
|
else if( maCalcButton.HasFocus() )
|
|
|
|
maWriterButton.GrabFocus();
|
|
|
|
// second column
|
|
|
|
else if( maTemplateButton.HasFocus() )
|
|
|
|
maMathButton.GrabFocus();
|
|
|
|
else if( maMathButton.HasFocus() )
|
|
|
|
maDBButton.GrabFocus();
|
|
|
|
else if( maDBButton.HasFocus() )
|
|
|
|
maDrawButton.GrabFocus();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if( rKeyCode.GetCode() == KEY_DOWN )
|
|
|
|
{
|
|
|
|
// first column
|
|
|
|
if( maWriterButton.HasFocus() )
|
|
|
|
maCalcButton.GrabFocus();
|
|
|
|
else if( maCalcButton.HasFocus() )
|
|
|
|
maImpressButton.GrabFocus();
|
|
|
|
else if( maImpressButton.HasFocus() )
|
|
|
|
maOpenButton.GrabFocus();
|
|
|
|
// second column
|
|
|
|
else if( maDrawButton.HasFocus() )
|
|
|
|
maDBButton.GrabFocus();
|
|
|
|
else if( maDBButton.HasFocus() )
|
|
|
|
maMathButton.GrabFocus();
|
|
|
|
else if( maMathButton.HasFocus() )
|
|
|
|
maTemplateButton.GrabFocus();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2008-04-03 16:11:36 +00:00
|
|
|
}
|
|
|
|
return Window::Notify( rNEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
void BackingWindow::setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame )
|
|
|
|
{
|
|
|
|
mxFrame = xFrame;
|
|
|
|
if( ! mbInitControls )
|
|
|
|
initControls();
|
|
|
|
}
|
|
|
|
|
2008-03-05 16:23:15 +00:00
|
|
|
void BackingWindow::Resize()
|
|
|
|
{
|
|
|
|
Size aWindowSize( GetSizePixel() );
|
|
|
|
Size aControlSize = maControlRect.GetSize();
|
|
|
|
maControlRect = Rectangle( Point( (aWindowSize.Width() - aControlSize.Width()) / 2,
|
|
|
|
(aWindowSize.Height() - aControlSize.Height()) / 2 ),
|
|
|
|
aControlSize );
|
2009-02-11 10:53:35 +00:00
|
|
|
|
|
|
|
maToolbox.calcMinSize();
|
|
|
|
Size aTBSize( maToolbox.getMinSize() );
|
2010-03-30 13:51:42 +02:00
|
|
|
Point aTBPos( maControlRect.Left() + mnBtnPos,
|
2009-02-11 10:53:35 +00:00
|
|
|
maControlRect.Bottom() - aTBSize.Height() - 10 );
|
2010-03-30 13:51:42 +02:00
|
|
|
if( Application::GetSettings().GetLayoutRTL() )
|
|
|
|
aTBPos.X() = maControlRect.Right() - aTBSize.Width() - mnBtnPos;
|
2009-02-11 10:53:35 +00:00
|
|
|
maToolbox.SetPosSizePixel( aTBPos, aTBSize );
|
|
|
|
|
|
|
|
// #i93631# squeeze controls so they fit into the box
|
|
|
|
// this can be necessary due to application font height which has small deviations
|
|
|
|
// from the size set
|
|
|
|
const long nBDelta = maButtonImageSize.Height() + 10;
|
|
|
|
const long nB2Delta = 3*maButtonImageSize.Height()/2;
|
|
|
|
const long nLastDelta = maButtonImageSize.Height();
|
|
|
|
long nDiff = 0;
|
2012-03-06 20:21:39 +01:00
|
|
|
while( ( maControlRect.Top() -
|
|
|
|
3 * nDiff +
|
2009-02-11 10:53:35 +00:00
|
|
|
3 * (nBDelta - nDiff) +
|
|
|
|
(nB2Delta- nDiff) +
|
|
|
|
nLastDelta
|
|
|
|
) > aTBPos.Y() )
|
|
|
|
{
|
|
|
|
nDiff++;
|
|
|
|
}
|
|
|
|
|
2012-03-06 20:21:39 +01:00
|
|
|
long nYPos = maControlRect.Top() + mnBtnTop;
|
2010-05-05 14:27:57 +02:00
|
|
|
|
2012-04-12 14:08:02 +02:00
|
|
|
// Recompute column widths
|
|
|
|
mnTextColumnWidth[0] = maWriterButton.GetTextWidth( maWriterButton.GetText() ) + maButtonImageSize.Width() + 8;
|
|
|
|
if( mnTextColumnWidth[0] < maCalcButton.GetTextWidth( maCalcButton.GetText() ) + maButtonImageSize.Width() + 8 )
|
|
|
|
mnTextColumnWidth[0] = maCalcButton.GetTextWidth( maCalcButton.GetText() ) + maButtonImageSize.Width() + 8;
|
|
|
|
if( mnTextColumnWidth[0] < maImpressButton.GetTextWidth( maImpressButton.GetText() ) + maButtonImageSize.Width() + 8 )
|
|
|
|
mnTextColumnWidth[0] = maImpressButton.GetTextWidth( maImpressButton.GetText() ) + maButtonImageSize.Width() + 8;
|
|
|
|
if( mnTextColumnWidth[0] < maOpenButton.GetTextWidth( maOpenButton.GetText() ) + maButtonImageSize.Width() + 26 )
|
|
|
|
mnTextColumnWidth[0] = maOpenButton.GetTextWidth( maOpenButton.GetText() ) + maButtonImageSize.Width() + 26;
|
|
|
|
|
|
|
|
mnTextColumnWidth[1] = maDrawButton.GetTextWidth( maDrawButton.GetText() ) + maButtonImageSize.Width() + 8;
|
|
|
|
if( mnTextColumnWidth[1] < maDBButton.GetTextWidth( maDBButton.GetText() ) + maButtonImageSize.Width() + 8 )
|
|
|
|
mnTextColumnWidth[1] = maDBButton.GetTextWidth( maDBButton.GetText() ) + maButtonImageSize.Width() + 8;
|
|
|
|
if( mnTextColumnWidth[1] < maMathButton.GetTextWidth( maMathButton.GetText() ) + maButtonImageSize.Width() + 8 )
|
|
|
|
mnTextColumnWidth[1] = maMathButton.GetTextWidth( maMathButton.GetText() ) + maButtonImageSize.Width() + 8;
|
|
|
|
if( mnTextColumnWidth[1] < maTemplateButton.GetTextWidth( maTemplateButton.GetText() ) + maButtonImageSize.Width() + 8 )
|
|
|
|
mnTextColumnWidth[1] = maTemplateButton.GetTextWidth( maTemplateButton.GetText() ) + maButtonImageSize.Width() + 8;
|
|
|
|
|
2010-03-26 17:30:54 +01:00
|
|
|
maWriterButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) );
|
|
|
|
maDrawButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) );
|
2009-02-11 10:53:35 +00:00
|
|
|
nYPos += nBDelta - nDiff;
|
2010-03-26 17:30:54 +01:00
|
|
|
maCalcButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) );
|
|
|
|
maDBButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) );
|
2009-02-11 10:53:35 +00:00
|
|
|
nYPos += nBDelta - nDiff;
|
2010-03-26 17:30:54 +01:00
|
|
|
maImpressButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) );
|
|
|
|
maMathButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) );
|
2008-07-11 06:17:22 +00:00
|
|
|
|
2009-02-11 10:53:35 +00:00
|
|
|
nYPos += nB2Delta - nDiff;
|
2010-03-30 13:51:42 +02:00
|
|
|
maOpenButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) );
|
|
|
|
maTemplateButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) );
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(BackingWindow, ToolboxHdl)
|
2008-03-05 16:23:15 +00:00
|
|
|
{
|
|
|
|
const char* pNodePath = NULL;
|
|
|
|
const char* pNode = NULL;
|
|
|
|
|
|
|
|
switch( maToolbox.GetCurItemId() )
|
|
|
|
{
|
|
|
|
case nItemId_Extensions:
|
|
|
|
pNodePath = "/org.openoffice.Office.Common/Help/StartCenter";
|
|
|
|
pNode = "AddFeatureURL";
|
|
|
|
break;
|
|
|
|
case nItemId_Info:
|
|
|
|
pNodePath = "/org.openoffice.Office.Common/Help/StartCenter";
|
|
|
|
pNode = "InfoURL";
|
2008-06-03 13:45:57 +00:00
|
|
|
break;
|
|
|
|
case nItemId_TplRep:
|
|
|
|
pNodePath = "/org.openoffice.Office.Common/Help/StartCenter";
|
|
|
|
pNode = "TemplateRepositoryURL";
|
|
|
|
break;
|
2008-03-05 16:23:15 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if( pNodePath && pNode )
|
|
|
|
{
|
2008-03-12 09:09:47 +00:00
|
|
|
try
|
2008-03-05 16:23:15 +00:00
|
|
|
{
|
2009-09-08 04:57:32 +00:00
|
|
|
Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY);
|
2008-03-12 09:09:47 +00:00
|
|
|
if( xConfig.is() )
|
2008-03-05 16:23:15 +00:00
|
|
|
{
|
2008-03-12 09:09:47 +00:00
|
|
|
Sequence<Any> args(1);
|
|
|
|
PropertyValue val(
|
2012-06-02 20:41:34 -05:00
|
|
|
rtl::OUString( "nodepath" ),
|
2008-03-12 09:09:47 +00:00
|
|
|
0,
|
|
|
|
Any(rtl::OUString::createFromAscii(pNodePath)),
|
|
|
|
PropertyState_DIRECT_VALUE);
|
|
|
|
args.getArray()[0] <<= val;
|
2009-09-08 04:57:32 +00:00
|
|
|
Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY);
|
2008-03-12 09:09:47 +00:00
|
|
|
if( xNameAccess.is() )
|
|
|
|
{
|
|
|
|
rtl::OUString sURL;
|
|
|
|
//throws css::container::NoSuchElementException, css::lang::WrappedTargetException
|
2008-03-05 16:23:15 +00:00
|
|
|
Any value( xNameAccess->getByName(rtl::OUString::createFromAscii(pNode)) );
|
|
|
|
sURL = value.get<rtl::OUString> ();
|
2010-10-07 12:29:30 +02:00
|
|
|
localizeWebserviceURI(sURL);
|
2009-10-30 17:29:27 +01:00
|
|
|
|
2012-09-03 18:27:13 +02:00
|
|
|
Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
|
|
|
|
com::sun::star::system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
|
2008-03-12 09:09:47 +00:00
|
|
|
//throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
|
2012-03-16 11:16:14 +01:00
|
|
|
xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY);
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-06-19 22:48:52 +01:00
|
|
|
catch (const Exception&)
|
2008-03-12 09:09:47 +00:00
|
|
|
{
|
|
|
|
}
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
|
|
|
|
{
|
|
|
|
// dispatch the appropriate URL and end the dialog
|
|
|
|
if( pButton == &maWriterButton )
|
2012-06-02 20:41:34 -05:00
|
|
|
dispatchURL( rtl::OUString( WRITER_URL ) );
|
2008-03-05 16:23:15 +00:00
|
|
|
else if( pButton == &maCalcButton )
|
2012-06-02 20:41:34 -05:00
|
|
|
dispatchURL( rtl::OUString( CALC_URL ) );
|
2008-03-05 16:23:15 +00:00
|
|
|
else if( pButton == &maImpressButton )
|
2012-06-02 20:41:34 -05:00
|
|
|
dispatchURL( rtl::OUString( IMPRESS_WIZARD_URL ) );
|
2008-03-05 16:23:15 +00:00
|
|
|
else if( pButton == &maDrawButton )
|
2012-06-02 20:41:34 -05:00
|
|
|
dispatchURL( rtl::OUString( DRAW_URL ) );
|
2008-03-05 16:23:15 +00:00
|
|
|
else if( pButton == &maDBButton )
|
2012-06-02 20:41:34 -05:00
|
|
|
dispatchURL( rtl::OUString( BASE_URL ) );
|
2008-07-11 06:17:22 +00:00
|
|
|
else if( pButton == &maMathButton )
|
2012-06-02 20:41:34 -05:00
|
|
|
dispatchURL( rtl::OUString( MATH_URL ) );
|
2008-03-05 16:23:15 +00:00
|
|
|
else if( pButton == &maOpenButton )
|
2008-04-03 16:11:36 +00:00
|
|
|
{
|
|
|
|
Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
|
|
|
|
|
|
|
|
Sequence< com::sun::star::beans::PropertyValue > aArgs(1);
|
|
|
|
PropertyValue* pArg = aArgs.getArray();
|
2012-06-02 20:41:34 -05:00
|
|
|
pArg[0].Name = rtl::OUString("Referer");
|
|
|
|
pArg[0].Value <<= rtl::OUString("private:user");
|
2008-04-03 16:11:36 +00:00
|
|
|
|
2012-06-02 20:41:34 -05:00
|
|
|
dispatchURL( rtl::OUString( OPEN_URL ), rtl::OUString(), xFrame, aArgs );
|
2008-04-03 16:11:36 +00:00
|
|
|
}
|
2008-03-05 16:23:15 +00:00
|
|
|
else if( pButton == &maTemplateButton )
|
|
|
|
{
|
2008-04-03 16:11:36 +00:00
|
|
|
Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
|
2008-03-05 16:23:15 +00:00
|
|
|
|
|
|
|
Sequence< com::sun::star::beans::PropertyValue > aArgs(1);
|
|
|
|
PropertyValue* pArg = aArgs.getArray();
|
2012-06-02 20:41:34 -05:00
|
|
|
pArg[0].Name = rtl::OUString("Referer");
|
|
|
|
pArg[0].Value <<= rtl::OUString("private:user");
|
2008-03-05 16:23:15 +00:00
|
|
|
|
2012-06-02 20:41:34 -05:00
|
|
|
dispatchURL( rtl::OUString( TEMPLATE_URL ), rtl::OUString(), xFrame, aArgs );
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-13 18:47:19 +02:00
|
|
|
IMPL_LINK( BackingWindow, SelectHdl, Button*, pButton )
|
|
|
|
{
|
|
|
|
if( pButton == &maOpenButton )
|
|
|
|
{
|
|
|
|
sal_Int32 nItem = sal_Int32(maOpenButton.GetCurItemId())-1;
|
|
|
|
if( nItem >= 0 && nItem < sal_Int32(maRecentFiles.size()) )
|
|
|
|
{
|
|
|
|
Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
|
|
|
|
dispatchURL( maRecentFiles[nItem].aTargetURL, rtl::OUString(), xFrame, maRecentFiles[nItem].aArgSeq );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-04 18:53:06 +02:00
|
|
|
IMPL_LINK( BackingWindow, ActivateHdl, Button*, pButton )
|
|
|
|
{
|
|
|
|
if( pButton == &maOpenButton )
|
|
|
|
prepareRecentFileMenu();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-05-30 06:37:16 +00:00
|
|
|
struct ImplDelayedDispatch
|
|
|
|
{
|
|
|
|
Reference< XDispatch > xDispatch;
|
|
|
|
com::sun::star::util::URL aDispatchURL;
|
|
|
|
Sequence< PropertyValue > aArgs;
|
|
|
|
|
|
|
|
ImplDelayedDispatch( const Reference< XDispatch >& i_xDispatch,
|
|
|
|
const com::sun::star::util::URL& i_rURL,
|
|
|
|
const Sequence< PropertyValue >& i_rArgs )
|
|
|
|
: xDispatch( i_xDispatch ),
|
|
|
|
aDispatchURL( i_rURL ),
|
|
|
|
aArgs( i_rArgs )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
~ImplDelayedDispatch() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
static long implDispatchDelayed( void*, void* pArg )
|
|
|
|
{
|
|
|
|
struct ImplDelayedDispatch* pDispatch = reinterpret_cast<ImplDelayedDispatch*>(pArg);
|
|
|
|
try
|
|
|
|
{
|
|
|
|
pDispatch->xDispatch->dispatch( pDispatch->aDispatchURL, pDispatch->aArgs );
|
|
|
|
}
|
2011-06-19 22:48:52 +01:00
|
|
|
catch (const Exception&)
|
2008-05-30 06:37:16 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// clean up
|
|
|
|
delete pDispatch;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-05 16:23:15 +00:00
|
|
|
void BackingWindow::dispatchURL( const rtl::OUString& i_rURL,
|
|
|
|
const rtl::OUString& rTarget,
|
|
|
|
const Reference< XDispatchProvider >& i_xProv,
|
|
|
|
const Sequence< PropertyValue >& i_rArgs )
|
|
|
|
{
|
|
|
|
// if no special dispatch provider is given, get the desktop
|
|
|
|
Reference< XDispatchProvider > xProvider( i_xProv.is() ? i_xProv : mxDesktopDispatchProvider );
|
|
|
|
|
|
|
|
// check for dispatch provider
|
|
|
|
if( !xProvider.is())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// get an URL transformer to clean up the URL
|
|
|
|
com::sun::star::util::URL aDispatchURL;
|
|
|
|
aDispatchURL.Complete = i_rURL;
|
|
|
|
|
|
|
|
Reference < com::sun::star::util::XURLTransformer > xURLTransformer(
|
2012-06-01 15:15:25 +02:00
|
|
|
com::sun::star::util::URLTransformer::create( comphelper::getProcessComponentContext() ) );
|
|
|
|
try
|
2008-03-05 16:23:15 +00:00
|
|
|
{
|
2012-06-01 15:15:25 +02:00
|
|
|
// clean up the URL
|
|
|
|
xURLTransformer->parseStrict( aDispatchURL );
|
|
|
|
// get a Dispatch for the URL and target
|
|
|
|
Reference< XDispatch > xDispatch(
|
|
|
|
xProvider->queryDispatch( aDispatchURL, rTarget, 0 )
|
|
|
|
);
|
|
|
|
// dispatch the URL
|
|
|
|
if ( xDispatch.is() )
|
2008-03-05 16:23:15 +00:00
|
|
|
{
|
2012-06-01 15:15:25 +02:00
|
|
|
ImplDelayedDispatch* pDisp = new ImplDelayedDispatch( xDispatch, aDispatchURL, i_rArgs );
|
|
|
|
sal_uLong nEventId = 0;
|
|
|
|
if( ! Application::PostUserEvent( nEventId, Link( NULL, implDispatchDelayed ), pDisp ) )
|
|
|
|
delete pDisp; // event could not be posted for unknown reason, at least don't leak
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-01 15:15:25 +02:00
|
|
|
catch (const com::sun::star::uno::RuntimeException&)
|
|
|
|
{
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
catch (const com::sun::star::uno::Exception&)
|
|
|
|
{
|
|
|
|
}
|
2008-03-05 16:23:15 +00:00
|
|
|
}
|
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|