startcenter: Move BackingComp & BackingWindow to sfx2
BackingWindow will use ThumbnailView from sfx2 and it had to be moved to avoid a circular dependency Change-Id: I33a5982ed9e51307476c837f3f534ded7ed38ee0
This commit is contained in:
committed by
Jan Holesovsky
parent
a9770af052
commit
b60f6da2e1
@@ -108,8 +108,6 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
|
||||
framework/source/register/registerservices \
|
||||
framework/source/services/ContextChangeEventMultiplexer \
|
||||
framework/source/services/autorecovery \
|
||||
framework/source/services/backingcomp \
|
||||
framework/source/services/backingwindow \
|
||||
framework/source/services/desktop \
|
||||
framework/source/services/frame \
|
||||
framework/source/services/modulemanager \
|
||||
|
@@ -83,7 +83,6 @@ namespace framework{
|
||||
#define IMPLEMENTATIONNAME_MODULEMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ModuleManager" )
|
||||
#define IMPLEMENTATIONNAME_MODULEUICONFIGURATIONMANAGERSUPPLIER DECLARE_ASCII("com.sun.star.comp.framework.ModuleUIConfigurationManagerSupplier" )
|
||||
#define IMPLEMENTATIONNAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.MenuBarFactory" )
|
||||
#define IMPLEMENTATIONNAME_STARTMODULE DECLARE_ASCII("com.sun.star.comp.framework.BackingComp" )
|
||||
#define IMPLEMENTATIONNAME_WINDOWSTATECONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.WindowStateConfiguration" )
|
||||
#define IMPLEMENTATIONNAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.ToolBarFactory" )
|
||||
#define IMPLEMENTATIONNAME_ADDONSTOOLBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.AddonsToolBarFactory" )
|
||||
|
@@ -40,7 +40,6 @@
|
||||
#include <services/modulemanager.hxx>
|
||||
#include <jobs/jobexecutor.hxx>
|
||||
#include <jobs/jobdispatch.hxx>
|
||||
#include <services/backingcomp.hxx>
|
||||
#include <services/layoutmanager.hxx>
|
||||
#include <uifactory/uielementfactorymanager.hxx>
|
||||
#include <uifactory/uicontrollerfactory.hxx>
|
||||
@@ -79,7 +78,6 @@ COMPONENTGETFACTORY ( fwk,
|
||||
IFFACTORY( ::framework::Frame ) else
|
||||
IFFACTORY( ::framework::JobExecutor ) else
|
||||
IFFACTORY( ::framework::JobDispatch ) else
|
||||
IFFACTORY( ::framework::BackingComp ) else
|
||||
IFFACTORY( ::framework::LayoutManager ) else
|
||||
IFFACTORY( ::framework::UIElementFactoryManager ) else
|
||||
IFFACTORY( ::framework::PopupMenuControllerFactory ) else
|
||||
|
@@ -1,132 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef FRAMEWORK_BACKINGWINDOW_HXX
|
||||
#define FRAMEWORK_BACKINGWINDOW_HXX
|
||||
|
||||
#include <rtl/ustring.hxx>
|
||||
|
||||
#include <vcl/builder.hxx>
|
||||
#include <vcl/button.hxx>
|
||||
#include <vcl/menubtn.hxx>
|
||||
#include <vcl/bitmapex.hxx>
|
||||
#include <vcl/toolbox.hxx>
|
||||
#include <vcl/layout.hxx>
|
||||
|
||||
#include <svtools/acceleratorexecute.hxx>
|
||||
#include <unotools/moduleoptions.hxx>
|
||||
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <com/sun/star/frame/XUIControllerFactory.hpp>
|
||||
#include <com/sun/star/frame/XPopupMenuController.hpp>
|
||||
#include <com/sun/star/awt/XPopupMenu.hpp>
|
||||
#include <com/sun/star/frame/XDispatchProvider.hpp>
|
||||
#include <com/sun/star/frame/XDesktop.hpp>
|
||||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
#include <com/sun/star/frame/XTerminateListener.hpp>
|
||||
#include <com/sun/star/document/XEventListener.hpp>
|
||||
#include <com/sun/star/document/XEventBroadcaster.hpp>
|
||||
#include <com/sun/star/util/XURLTransformer.hpp>
|
||||
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
|
||||
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
|
||||
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
|
||||
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
||||
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
|
||||
|
||||
#include <set>
|
||||
|
||||
class MnemonicGenerator;
|
||||
|
||||
namespace framework
|
||||
{
|
||||
class BackingWindow : public Window, public VclBuilderContainer
|
||||
{
|
||||
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
|
||||
com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider > mxDesktopDispatchProvider;
|
||||
com::sun::star::uno::Reference<com::sun::star::frame::XFrame> mxFrame;
|
||||
com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory > mxPopupMenuFactory;
|
||||
com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController > mxPopupMenuController;
|
||||
com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > mxPopupMenu;
|
||||
|
||||
PushButton* mpWriterButton;
|
||||
PushButton* mpCalcButton;
|
||||
PushButton* mpImpressButton;
|
||||
MenuButton* mpOpenButton;
|
||||
PushButton* mpDrawButton;
|
||||
PushButton* mpDBButton;
|
||||
PushButton* mpMathButton;
|
||||
PushButton* mpTemplateButton;
|
||||
|
||||
PushButton* mpExtensionsButton;
|
||||
PushButton* mpInfoButton;
|
||||
PushButton* mpTplRepButton;
|
||||
|
||||
VclGrid* mpStartCenterContainer;
|
||||
|
||||
BitmapEx maBackgroundLeft;
|
||||
BitmapEx maBackgroundMiddle;
|
||||
BitmapEx maBackgroundRight;
|
||||
|
||||
Rectangle maStartCentButtons;
|
||||
|
||||
bool mbInitControls;
|
||||
sal_Int32 mnHideExternalLinks;
|
||||
svt::AcceleratorExecute* mpAccExec;
|
||||
|
||||
int mnSCWidth;
|
||||
int mnSCHeight;
|
||||
|
||||
void setupButton( PushButton* pButton, const OUString& rURL, const std::set<OUString>& rURLS,
|
||||
SvtModuleOptions& rOpt, SvtModuleOptions::EModule eMod );
|
||||
|
||||
void setupExternalLink( PushButton* pButton );
|
||||
|
||||
void dispatchURL( const OUString& i_rURL,
|
||||
const OUString& i_rTarget = OUString( "_default" ),
|
||||
const com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >& i_xProv = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >(),
|
||||
const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()
|
||||
);
|
||||
|
||||
DECL_LINK( ClickHdl, Button* );
|
||||
DECL_LINK( ExtLinkClickHdl, Button* );
|
||||
DECL_LINK( ActivateHdl, Button* );
|
||||
DECL_LINK( WindowEventListener, VclSimpleEvent* );
|
||||
|
||||
void initControls();
|
||||
void initBackground();
|
||||
void prepareRecentFileMenu();
|
||||
|
||||
public:
|
||||
BackingWindow( Window* pParent );
|
||||
~BackingWindow();
|
||||
|
||||
virtual void Paint( const Rectangle& rRect );
|
||||
virtual void Resize();
|
||||
virtual long Notify( NotifyEvent& rNEvt );
|
||||
|
||||
virtual Size GetOptimalSize() const;
|
||||
|
||||
void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -28,9 +28,6 @@
|
||||
<implementation name="com.sun.star.comp.framework.AutoRecovery">
|
||||
<service name="com.sun.star.frame.AutoRecovery"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.framework.BackingComp">
|
||||
<service name="com.sun.star.frame.StartModule"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.framework.ControlMenuController">
|
||||
<service name="com.sun.star.frame.PopupMenuController"/>
|
||||
</implementation>
|
||||
|
79
include/sfx2/droptargetlistener.hxx
Normal file
79
include/sfx2/droptargetlistener.hxx
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef _SXF_DROPTARGETLISTENER_HXX
|
||||
#define _SXF_DROPTARGETLISTENER_HXX
|
||||
|
||||
#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
|
||||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
|
||||
#include <sot/exchange.hxx>
|
||||
#include <tools/string.hxx>
|
||||
|
||||
class DropTargetListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDropTargetListener >
|
||||
{
|
||||
//___________________________________________
|
||||
// member
|
||||
private:
|
||||
|
||||
/// uno service manager to create necessary services
|
||||
css::uno::Reference< css::uno::XComponentContext > m_xContext;
|
||||
/// weakreference to target frame (Don't use a hard reference. Owner can't delete us then!)
|
||||
css::uno::WeakReference< css::frame::XFrame > m_xTargetFrame;
|
||||
/// drag/drop info
|
||||
DataFlavorExVector* m_pFormats;
|
||||
|
||||
//___________________________________________
|
||||
// c++ interface
|
||||
public:
|
||||
|
||||
DropTargetListener( const css::uno::Reference< css::uno::XComponentContext >& xContext ,
|
||||
const css::uno::Reference< css::frame::XFrame >& xFrame );
|
||||
~DropTargetListener( );
|
||||
|
||||
//___________________________________________
|
||||
// uno interface
|
||||
public:
|
||||
|
||||
// XEventListener
|
||||
virtual void SAL_CALL disposing ( const css::lang::EventObject& Source ) throw(css::uno::RuntimeException);
|
||||
|
||||
// XDropTargetListener
|
||||
virtual void SAL_CALL drop ( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) throw(css::uno::RuntimeException);
|
||||
virtual void SAL_CALL dragEnter ( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw(css::uno::RuntimeException);
|
||||
virtual void SAL_CALL dragExit ( const css::datatransfer::dnd::DropTargetEvent& dte ) throw(css::uno::RuntimeException);
|
||||
virtual void SAL_CALL dragOver ( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(css::uno::RuntimeException);
|
||||
virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(css::uno::RuntimeException);
|
||||
|
||||
//___________________________________________
|
||||
// internal helper
|
||||
private:
|
||||
|
||||
void implts_BeginDrag ( const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors );
|
||||
void implts_EndDrag ( );
|
||||
sal_Bool implts_IsDropFormatSupported( SotFormatStringId nFormat );
|
||||
void implts_OpenFile ( const String& rFilePath );
|
||||
|
||||
}; // class DropTargetListener
|
||||
|
||||
#endif // _SXF_DROPTARGETLISTENER_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -129,6 +129,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
|
||||
sfx2/source/config/evntconf \
|
||||
sfx2/source/control/bindings \
|
||||
sfx2/source/control/ctrlitem \
|
||||
sfx2/source/control/droptargetlistener \
|
||||
sfx2/source/control/minfitem \
|
||||
sfx2/source/control/msg \
|
||||
sfx2/source/control/msgpool \
|
||||
@@ -150,6 +151,8 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
|
||||
sfx2/source/control/thumbnailview \
|
||||
sfx2/source/control/unoctitm \
|
||||
sfx2/source/dialog/alienwarn \
|
||||
sfx2/source/dialog/backingcomp \
|
||||
sfx2/source/dialog/backingwindow \
|
||||
sfx2/source/dialog/basedlgs \
|
||||
sfx2/source/dialog/checkin \
|
||||
sfx2/source/dialog/dialoghelper \
|
||||
|
@@ -17,12 +17,8 @@
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
|
||||
#define __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
|
||||
|
||||
#include <threadhelp/threadhelpbase.hxx>
|
||||
#include <general.h>
|
||||
#include <stdtypes.h>
|
||||
#ifndef __SFX2_DIALOG_BACKINGCOMP_HXX_
|
||||
#define __SFX2_DIALOG_BACKINGCOMP_HXX_
|
||||
|
||||
#include <com/sun/star/lang/XTypeProvider.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
@@ -44,9 +40,6 @@
|
||||
//__________________________________________
|
||||
// definition
|
||||
|
||||
namespace framework
|
||||
{
|
||||
|
||||
//__________________________________________
|
||||
/**
|
||||
implements the backing component.
|
||||
@@ -64,15 +57,12 @@ class BackingComp : public css::lang::XTypeProvider
|
||||
, public css::lang::XInitialization
|
||||
, public css::frame::XController // => XComponent
|
||||
, public css::awt::XKeyListener // => XEventListener
|
||||
// attention! Must be the first base class to guarantee right initialize lock ...
|
||||
, private ThreadHelpBase
|
||||
, public ::cppu::OWeakObject
|
||||
{
|
||||
//______________________________________
|
||||
// member
|
||||
|
||||
private:
|
||||
|
||||
/** the global uno service manager.
|
||||
Must be used to create own needed services. */
|
||||
css::uno::Reference< css::uno::XComponentContext > m_xContext;
|
||||
@@ -143,8 +133,6 @@ class BackingComp : public css::lang::XTypeProvider
|
||||
static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
|
||||
};
|
||||
|
||||
} // namespace framework
|
||||
|
||||
#endif // __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
|
||||
#endif // __SFX2_DIALOG_BACKINGCOMP_HXX_
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "sfx2/appuno.hxx"
|
||||
|
||||
#include "backingcomp.hxx"
|
||||
#include "SfxDocumentMetaData.hxx"
|
||||
#include "appbaslib.hxx"
|
||||
#include "doctemplates.hxx"
|
||||
@@ -2275,6 +2276,7 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory(
|
||||
// !!! ATTENTION !!!
|
||||
// Write no ";" at end of line and dont forget "else" ! (see macro)
|
||||
//=============================================================================
|
||||
IF_NAME_CREATECOMPONENTFACTORY( BackingComp )
|
||||
IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
|
||||
IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl )
|
||||
IF_NAME_CREATECOMPONENTFACTORY( SfxMacroLoader )
|
||||
|
222
sfx2/source/control/droptargetlistener.cxx
Normal file
222
sfx2/source/control/droptargetlistener.cxx
Normal file
@@ -0,0 +1,222 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <sfx2/droptargetlistener.hxx>
|
||||
|
||||
#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
|
||||
#include <com/sun/star/frame/XDispatch.hpp>
|
||||
#include <com/sun/star/frame/XDispatchProvider.hpp>
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#include <com/sun/star/util/URLTransformer.hpp>
|
||||
#include <com/sun/star/util/XURLTransformer.hpp>
|
||||
|
||||
#include <svtools/transfer.hxx>
|
||||
#include <unotools/localfilehelper.hxx>
|
||||
#include <sot/filelist.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
|
||||
#include <osl/file.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
|
||||
const OUString SPECIALTARGET_DEFAULT("_default");
|
||||
|
||||
DropTargetListener::DropTargetListener( const css::uno::Reference< css::uno::XComponentContext >& xContext,
|
||||
const css::uno::Reference< css::frame::XFrame >& xFrame )
|
||||
: m_xContext ( xContext )
|
||||
, m_xTargetFrame ( xFrame )
|
||||
, m_pFormats ( new DataFlavorExVector )
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
DropTargetListener::~DropTargetListener()
|
||||
{
|
||||
m_xTargetFrame.clear();
|
||||
m_xContext.clear();
|
||||
delete m_pFormats;
|
||||
m_pFormats = NULL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL DropTargetListener::disposing( const css::lang::EventObject& ) throw( css::uno::RuntimeException )
|
||||
{
|
||||
m_xTargetFrame.clear();
|
||||
m_xContext.clear();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL DropTargetListener::drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) throw( css::uno::RuntimeException )
|
||||
{
|
||||
const sal_Int8 nAction = dtde.DropAction;
|
||||
|
||||
try
|
||||
{
|
||||
if ( css::datatransfer::dnd::DNDConstants::ACTION_NONE != nAction )
|
||||
{
|
||||
TransferableDataHelper aHelper( dtde.Transferable );
|
||||
sal_Bool bFormatFound = sal_False;
|
||||
FileList aFileList;
|
||||
|
||||
// at first check filelist format
|
||||
if ( aHelper.GetFileList( SOT_FORMAT_FILE_LIST, aFileList ) )
|
||||
{
|
||||
sal_uLong i, nCount = aFileList.Count();
|
||||
for ( i = 0; i < nCount; ++i )
|
||||
implts_OpenFile( aFileList.GetFile(i) );
|
||||
bFormatFound = sal_True;
|
||||
}
|
||||
|
||||
// then, if necessary, the file format
|
||||
String aFilePath;
|
||||
if ( !bFormatFound && aHelper.GetString( SOT_FORMAT_FILE, aFilePath ) )
|
||||
implts_OpenFile( aFilePath );
|
||||
}
|
||||
dtde.Context->dropComplete( css::datatransfer::dnd::DNDConstants::ACTION_NONE != nAction );
|
||||
}
|
||||
catch( const ::com::sun::star::uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL DropTargetListener::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw( css::uno::RuntimeException )
|
||||
{
|
||||
try
|
||||
{
|
||||
implts_BeginDrag( dtdee.SupportedDataFlavors );
|
||||
}
|
||||
catch( const ::com::sun::star::uno::Exception& )
|
||||
{
|
||||
}
|
||||
|
||||
dragOver( dtdee );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL DropTargetListener::dragExit( const css::datatransfer::dnd::DropTargetEvent& ) throw( css::uno::RuntimeException )
|
||||
{
|
||||
try
|
||||
{
|
||||
implts_EndDrag();
|
||||
}
|
||||
catch( const ::com::sun::star::uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL DropTargetListener::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) throw( css::uno::RuntimeException )
|
||||
{
|
||||
try
|
||||
{
|
||||
sal_Bool bAccept = ( implts_IsDropFormatSupported( SOT_FORMAT_FILE ) ||
|
||||
implts_IsDropFormatSupported( SOT_FORMAT_FILE_LIST ) );
|
||||
|
||||
if ( !bAccept )
|
||||
dtde.Context->rejectDrag();
|
||||
else
|
||||
dtde.Context->acceptDrag( css::datatransfer::dnd::DNDConstants::ACTION_COPY );
|
||||
}
|
||||
catch( const ::com::sun::star::uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL DropTargetListener::dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& ) throw( css::uno::RuntimeException )
|
||||
{
|
||||
}
|
||||
|
||||
void DropTargetListener::implts_BeginDrag( const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors )
|
||||
{
|
||||
/* SAFE { */
|
||||
SolarMutexGuard aGuard;
|
||||
m_pFormats->clear();
|
||||
TransferableDataHelper::FillDataFlavorExVector(rSupportedDataFlavors,*m_pFormats);
|
||||
/* } SAFE */
|
||||
}
|
||||
|
||||
void DropTargetListener::implts_EndDrag()
|
||||
{
|
||||
/* SAFE { */
|
||||
SolarMutexGuard aGuard;
|
||||
m_pFormats->clear();
|
||||
/* } SAFE */
|
||||
}
|
||||
|
||||
sal_Bool DropTargetListener::implts_IsDropFormatSupported( SotFormatStringId nFormat )
|
||||
{
|
||||
/* SAFE { */
|
||||
SolarMutexGuard aGuard;
|
||||
DataFlavorExVector::iterator aIter( m_pFormats->begin() ), aEnd( m_pFormats->end() );
|
||||
sal_Bool bRet = sal_False;
|
||||
|
||||
while ( aIter != aEnd )
|
||||
{
|
||||
if ( nFormat == (*aIter++).mnSotId )
|
||||
{
|
||||
bRet = sal_True;
|
||||
aIter = aEnd;
|
||||
}
|
||||
}
|
||||
|
||||
return bRet;
|
||||
/* } SAFE */
|
||||
}
|
||||
|
||||
void DropTargetListener::implts_OpenFile( const String& rFilePath )
|
||||
{
|
||||
OUString aFileURL;
|
||||
if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( rFilePath, aFileURL ) )
|
||||
aFileURL = rFilePath;
|
||||
|
||||
::osl::FileStatus aStatus( osl_FileStatus_Mask_FileURL );
|
||||
::osl::DirectoryItem aItem;
|
||||
if( ::osl::FileBase::E_None == ::osl::DirectoryItem::get( aFileURL, aItem ) &&
|
||||
::osl::FileBase::E_None == aItem.getFileStatus( aStatus ) )
|
||||
aFileURL = aStatus.getFileURL();
|
||||
|
||||
// open file
|
||||
/* SAFE { */
|
||||
SolarMutexGuard aGuard;
|
||||
css::uno::Reference< css::frame::XFrame > xTargetFrame( m_xTargetFrame.get(), css::uno::UNO_QUERY );
|
||||
css::uno::Reference< css::util::XURLTransformer > xParser ( css::util::URLTransformer::create(m_xContext) );
|
||||
|
||||
if (xTargetFrame.is() && xParser.is())
|
||||
{
|
||||
css::util::URL aURL;
|
||||
aURL.Complete = aFileURL;
|
||||
xParser->parseStrict(aURL);
|
||||
|
||||
css::uno::Reference < css::frame::XDispatchProvider > xProvider( xTargetFrame, css::uno::UNO_QUERY );
|
||||
css::uno::Reference< css::frame::XDispatch > xDispatcher = xProvider->queryDispatch( aURL, SPECIALTARGET_DEFAULT, 0 );
|
||||
if ( xDispatcher.is() )
|
||||
xDispatcher->dispatch( aURL, css::uno::Sequence < css::beans::PropertyValue >() );
|
||||
}
|
||||
/* } SAFE */
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -17,16 +17,11 @@
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include "services/backingcomp.hxx"
|
||||
#include "backingcomp.hxx"
|
||||
|
||||
#include "backingwindow.hxx"
|
||||
|
||||
#include <threadhelp/readguard.hxx>
|
||||
#include <threadhelp/writeguard.hxx>
|
||||
#include <classes/droptargetlistener.hxx>
|
||||
#include <targets.h>
|
||||
#include <properties.h>
|
||||
#include <services.h>
|
||||
#include <sfx2/droptargetlistener.hxx>
|
||||
|
||||
#include <helpid.hrc>
|
||||
|
||||
@@ -58,16 +53,18 @@
|
||||
|
||||
#include <unotools/bootstrap.hxx>
|
||||
|
||||
namespace framework
|
||||
{
|
||||
const char SERVICENAME_FRAMECONTROLLER[] = "com.sun.star.frame.Controller";
|
||||
const char IMPLEMENTATIONNAME_STARTMODULE[] = "com.sun.star.comp.sfx2.BackingComp";
|
||||
const char FRAME_PROPNAME_LAYOUTMANAGER[] = "LayoutManager";
|
||||
const char HID_BACKINGWINDOW[] = "FWK_HID_BACKINGWINDOW";
|
||||
const char SPECIALTARGET_MENUBAR[] = "_menubar";
|
||||
|
||||
//_______________________________________________
|
||||
|
||||
//_______________________________________________
|
||||
|
||||
BackingComp::BackingComp( const css::uno::Reference< css::uno::XComponentContext >& xContext )
|
||||
: ThreadHelpBase (&Application::GetSolarMutex() )
|
||||
, m_xContext (xContext )
|
||||
: m_xContext(xContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -116,10 +113,9 @@ css::uno::Any SAL_CALL BackingComp::queryInterface( /*IN*/ const css::uno::Type&
|
||||
if (!aResult.hasValue())
|
||||
{
|
||||
/* SAFE { */
|
||||
ReadGuard aReadLock(m_aLock);
|
||||
SolarMutexGuard aGuard;
|
||||
if (m_xWindow.is())
|
||||
aResult = m_xWindow->queryInterface(aType);
|
||||
aReadLock.unlock();
|
||||
/* } SAFE */
|
||||
}
|
||||
|
||||
@@ -177,10 +173,8 @@ css::uno::Sequence< css::uno::Type > SAL_CALL BackingComp::getTypes()
|
||||
if (!pTypeCollection)
|
||||
{
|
||||
/* LOCAL SAFE { */
|
||||
ReadGuard aReadLock(m_aLock);
|
||||
SolarMutexGuard aGuard;
|
||||
css::uno::Reference< css::lang::XTypeProvider > xProvider(m_xWindow, css::uno::UNO_QUERY);
|
||||
aReadLock.unlock();
|
||||
/* } LOCAL SAFE */
|
||||
|
||||
css::uno::Sequence< css::uno::Type > lWindowTypes;
|
||||
if (xProvider.is())
|
||||
@@ -195,6 +189,7 @@ css::uno::Sequence< css::uno::Type > SAL_CALL BackingComp::getTypes()
|
||||
lWindowTypes);
|
||||
|
||||
pTypeCollection = &aTypeCollection;
|
||||
/* } LOCAL SAFE */
|
||||
}
|
||||
/* } GLOBAL SAFE */
|
||||
}
|
||||
@@ -307,7 +302,7 @@ css::uno::Sequence< OUString > SAL_CALL BackingComp::getSupportedServiceNames()
|
||||
|
||||
OUString BackingComp::impl_getStaticImplementationName()
|
||||
{
|
||||
return IMPLEMENTATIONNAME_STARTMODULE;
|
||||
return OUString( IMPLEMENTATIONNAME_STARTMODULE );
|
||||
}
|
||||
|
||||
//_______________________________________________
|
||||
@@ -439,7 +434,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f
|
||||
throw (css::uno::RuntimeException)
|
||||
{
|
||||
/* SAFE */
|
||||
WriteGuard aWriteLock(m_aLock);
|
||||
SolarMutexGuard aGuard;
|
||||
|
||||
// check some required states
|
||||
if (m_xFrame.is())
|
||||
@@ -459,7 +454,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f
|
||||
m_xFrame = xFrame;
|
||||
|
||||
// establish drag&drop mode
|
||||
::framework::DropTargetListener* pDropListener = new ::framework::DropTargetListener( m_xContext, m_xFrame);
|
||||
DropTargetListener* pDropListener = new DropTargetListener( m_xContext, m_xFrame);
|
||||
m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >(static_cast< ::cppu::OWeakObject* >(pDropListener), css::uno::UNO_QUERY);
|
||||
|
||||
css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( m_xContext );
|
||||
@@ -489,7 +484,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f
|
||||
if (xLayoutManager.is())
|
||||
{
|
||||
xLayoutManager->lock();
|
||||
xLayoutManager->createElement( DECLARE_ASCII( "private:resource/menubar/menubar" ));
|
||||
xLayoutManager->createElement("private:resource/menubar/menubar");
|
||||
xLayoutManager->unlock();
|
||||
}
|
||||
|
||||
@@ -504,7 +499,6 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f
|
||||
if( pBack )
|
||||
pBack->setOwningFrame( m_xFrame );
|
||||
|
||||
aWriteLock.unlock();
|
||||
/* } SAFE */
|
||||
}
|
||||
|
||||
@@ -580,7 +574,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL BackingComp::getFrame()
|
||||
throw (css::uno::RuntimeException)
|
||||
{
|
||||
/* SAFE { */
|
||||
ReadGuard aReadLock(m_aLock);
|
||||
SolarMutexGuard aGuard;
|
||||
return m_xFrame;
|
||||
/* } SAFE */
|
||||
}
|
||||
@@ -631,7 +625,7 @@ void SAL_CALL BackingComp::disposing( /*IN*/ const css::lang::EventObject& aEven
|
||||
// keyPressed() for further details.
|
||||
|
||||
/* SAFE { */
|
||||
WriteGuard aWriteLock(m_aLock);
|
||||
SolarMutexGuard aGuard;
|
||||
|
||||
if (!aEvent.Source.is() || aEvent.Source!=m_xWindow || !m_xWindow.is())
|
||||
throw css::uno::RuntimeException(
|
||||
@@ -640,7 +634,6 @@ void SAL_CALL BackingComp::disposing( /*IN*/ const css::lang::EventObject& aEven
|
||||
|
||||
m_xWindow = css::uno::Reference< css::awt::XWindow >();
|
||||
|
||||
aWriteLock.unlock();
|
||||
/* } SAFE */
|
||||
}
|
||||
|
||||
@@ -658,11 +651,11 @@ void SAL_CALL BackingComp::dispose()
|
||||
throw(css::uno::RuntimeException)
|
||||
{
|
||||
/* SAFE { */
|
||||
WriteGuard aWriteLock(m_aLock);
|
||||
SolarMutexGuard aGuard;
|
||||
|
||||
// kill the menu
|
||||
css::util::URL aURL;
|
||||
aURL.Complete = DECLARE_ASCII(".uno:close");
|
||||
aURL.Complete = OUString(".uno:close");
|
||||
css::uno::Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create(m_xContext);
|
||||
if (xParser.is())
|
||||
xParser->parseStrict(aURL);
|
||||
@@ -706,7 +699,6 @@ void SAL_CALL BackingComp::dispose()
|
||||
m_xFrame.clear();
|
||||
m_xContext.clear();
|
||||
|
||||
aWriteLock.unlock();
|
||||
/* } SAFE */
|
||||
}
|
||||
|
||||
@@ -769,7 +761,7 @@ void SAL_CALL BackingComp::initialize( /*IN*/ const css::uno::Sequence< css::uno
|
||||
throw(css::uno::Exception, css::uno::RuntimeException)
|
||||
{
|
||||
/* SAFE { */
|
||||
WriteGuard aWriteLock(m_aLock);
|
||||
SolarMutexGuard aGuard;
|
||||
|
||||
if (m_xWindow.is())
|
||||
throw css::uno::Exception(
|
||||
@@ -806,7 +798,6 @@ void SAL_CALL BackingComp::initialize( /*IN*/ const css::uno::Sequence< css::uno
|
||||
|
||||
m_xWindow->setVisible(sal_True);
|
||||
|
||||
aWriteLock.unlock();
|
||||
/* } SAFE */
|
||||
}
|
||||
|
||||
@@ -837,6 +828,4 @@ void SAL_CALL BackingComp::keyReleased( /*IN*/ const css::awt::KeyEvent& )
|
||||
*/
|
||||
}
|
||||
|
||||
} // namespace framework
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include "backingwindow.hxx"
|
||||
#include <services.h>
|
||||
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
@@ -45,7 +44,6 @@ 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;
|
||||
|
||||
const char RECENT_FILE_LIST[] = ".uno:RecentFileList";
|
||||
|
||||
@@ -57,6 +55,7 @@ const char BASE_URL[] = "private:factory/sdatabase?Interactive";
|
||||
const char MATH_URL[] = "private:factory/smath";
|
||||
const char TEMPLATE_URL[] = "slot:5500";
|
||||
const char OPEN_URL[] = ".uno:Open";
|
||||
const char SERVICENAME_CFGREADACCESS[] = "com.sun.star.configuration.ConfigurationAccess";
|
||||
|
||||
const int nItemId_Extensions = 1;
|
||||
const int nItemId_Info = 3;
|
130
sfx2/source/dialog/backingwindow.hxx
Normal file
130
sfx2/source/dialog/backingwindow.hxx
Normal file
@@ -0,0 +1,130 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef SFX2_BACKINGWINDOW_HXX
|
||||
#define SFX2_BACKINGWINDOW_HXX
|
||||
|
||||
#include <rtl/ustring.hxx>
|
||||
|
||||
#include <vcl/builder.hxx>
|
||||
#include <vcl/button.hxx>
|
||||
#include <vcl/menubtn.hxx>
|
||||
#include <vcl/bitmapex.hxx>
|
||||
#include <vcl/toolbox.hxx>
|
||||
#include <vcl/layout.hxx>
|
||||
|
||||
#include <svtools/acceleratorexecute.hxx>
|
||||
#include <unotools/moduleoptions.hxx>
|
||||
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <com/sun/star/frame/XUIControllerFactory.hpp>
|
||||
#include <com/sun/star/frame/XPopupMenuController.hpp>
|
||||
#include <com/sun/star/awt/XPopupMenu.hpp>
|
||||
#include <com/sun/star/frame/XDispatchProvider.hpp>
|
||||
#include <com/sun/star/frame/XDesktop.hpp>
|
||||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
#include <com/sun/star/frame/XTerminateListener.hpp>
|
||||
#include <com/sun/star/document/XEventListener.hpp>
|
||||
#include <com/sun/star/document/XEventBroadcaster.hpp>
|
||||
#include <com/sun/star/util/XURLTransformer.hpp>
|
||||
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
|
||||
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
|
||||
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
|
||||
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
||||
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
|
||||
|
||||
#include <set>
|
||||
|
||||
class MnemonicGenerator;
|
||||
|
||||
class BackingWindow
|
||||
: public Window
|
||||
, public VclBuilderContainer
|
||||
{
|
||||
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
|
||||
com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider > mxDesktopDispatchProvider;
|
||||
com::sun::star::uno::Reference<com::sun::star::frame::XFrame> mxFrame;
|
||||
com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory > mxPopupMenuFactory;
|
||||
com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController > mxPopupMenuController;
|
||||
com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > mxPopupMenu;
|
||||
|
||||
PushButton* mpWriterButton;
|
||||
PushButton* mpCalcButton;
|
||||
PushButton* mpImpressButton;
|
||||
MenuButton* mpOpenButton;
|
||||
PushButton* mpDrawButton;
|
||||
PushButton* mpDBButton;
|
||||
PushButton* mpMathButton;
|
||||
PushButton* mpTemplateButton;
|
||||
|
||||
PushButton* mpExtensionsButton;
|
||||
PushButton* mpInfoButton;
|
||||
PushButton* mpTplRepButton;
|
||||
|
||||
VclGrid* mpStartCenterContainer;
|
||||
|
||||
BitmapEx maBackgroundLeft;
|
||||
BitmapEx maBackgroundMiddle;
|
||||
BitmapEx maBackgroundRight;
|
||||
|
||||
Rectangle maStartCentButtons;
|
||||
|
||||
bool mbInitControls;
|
||||
sal_Int32 mnHideExternalLinks;
|
||||
svt::AcceleratorExecute* mpAccExec;
|
||||
|
||||
int mnSCWidth;
|
||||
int mnSCHeight;
|
||||
|
||||
void setupButton( PushButton* pButton, const OUString& rURL, const std::set<OUString>& rURLS,
|
||||
SvtModuleOptions& rOpt, SvtModuleOptions::EModule eMod );
|
||||
|
||||
void setupExternalLink( PushButton* pButton );
|
||||
|
||||
void dispatchURL( const OUString& i_rURL,
|
||||
const OUString& i_rTarget = OUString( "_default" ),
|
||||
const com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >& i_xProv = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >(),
|
||||
const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()
|
||||
);
|
||||
|
||||
DECL_LINK( ClickHdl, Button* );
|
||||
DECL_LINK( ExtLinkClickHdl, Button* );
|
||||
DECL_LINK( ActivateHdl, Button* );
|
||||
DECL_LINK( WindowEventListener, VclSimpleEvent* );
|
||||
|
||||
void initControls();
|
||||
void initBackground();
|
||||
void prepareRecentFileMenu();
|
||||
|
||||
public:
|
||||
BackingWindow( Window* pParent );
|
||||
~BackingWindow();
|
||||
|
||||
virtual void Paint( const Rectangle& rRect );
|
||||
virtual void Resize();
|
||||
virtual long Notify( NotifyEvent& rNEvt );
|
||||
|
||||
virtual Size GetOptimalSize() const;
|
||||
|
||||
void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -19,6 +19,9 @@
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary" prefix="sfx"
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.comp.sfx2.BackingComp">
|
||||
<service name="com.sun.star.frame.StartModule"/>
|
||||
</implementation>
|
||||
<implementation name="SfxDocumentMetaData">
|
||||
<service name="com.sun.star.document.DocumentProperties"/>
|
||||
</implementation>
|
||||
|
Reference in New Issue
Block a user