Kaydet (Commit) 66714f18 authored tarafından August Sodora's avatar August Sodora

Remove HelpAgentWindow

üst 881ea547
......@@ -82,7 +82,6 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/dispatch/closedispatcher \
framework/source/dispatch/dispatchinformationprovider \
framework/source/dispatch/dispatchprovider \
framework/source/dispatch/helpagentdispatcher \
framework/source/dispatch/interceptionhelper \
framework/source/dispatch/loaddispatcher \
framework/source/dispatch/menudispatcher \
......
......@@ -29,10 +29,6 @@
#ifndef __FRAMEWORK_DISPATCH_DISPATCHPROVIDER_HXX_
#define __FRAMEWORK_DISPATCH_DISPATCHPROVIDER_HXX_
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <services/frame.hxx>
#include <classes/protocolhandlercache.hxx>
......@@ -45,29 +41,17 @@
#include <macros/generic.hxx>
#include <stdtypes.h>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/frame/DispatchDescriptor.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
#include <cppuhelper/weak.hxx>
#include <cppuhelper/weakref.hxx>
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
/**
@descr We know some special dispatch objects with diffrent functionality.
The can be created internaly by the following DispatchProvider.
......@@ -77,7 +61,6 @@ enum EDispatchHelper
{
E_DEFAULTDISPATCHER ,
E_MENUDISPATCHER ,
E_HELPAGENTDISPATCHER ,
E_CREATEDISPATCHER ,
E_BLANKDISPATCHER ,
E_SELFDISPATCHER ,
......@@ -85,8 +68,6 @@ enum EDispatchHelper
E_STARTMODULEDISPATCHER
};
//_________________________________________________________________________________________________________________
/**
@short implement a helper for XDispatchProvider interface
@descr The result of a queryDispatch() call depends from the owner, which use an instance of this class.
......@@ -124,7 +105,6 @@ class DispatchProvider : // interfaces
css::uno::WeakReference< css::frame::XFrame > m_xFrame;
/// different dispatcher to handle special dispatch calls, protocols or URLs (they will be created on demand.)
css::uno::Reference< css::frame::XDispatch > m_xMenuDispatcher ;
css::uno::Reference< css::frame::XDispatch > m_xHelpAgentDispatcher;
/// cache of some other dispatch provider which are registered inside configuration to handle special URL protocols
HandlerCache m_aProtocolHandlerCache;
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#ifndef __FRAMEWORK_DISPATCH_HELPAGENTDISPATCHER_HXX_
#define __FRAMEWORK_DISPATCH_HELPAGENTDISPATCHER_HXX_
#include <threadhelp/threadhelpbase.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/awt/XWindowListener.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <svtools/helpagentwindow.hxx>
#include <vcl/timer.hxx>
#include <vcl/evntpost.hxx>
#include <cppuhelper/weak.hxx>
//........................................................................
namespace framework
{
// define css alias ... and undefine it at the end of this file !!!
#ifdef css
#error "I tried to use css as namespace define inside non exported header ... but it was already defined by somwhere else. .-)"
#else
#define css ::com::sun::star
#endif
//........................................................................
class HelpAgentDispatcher : public css::lang::XTypeProvider
, public css::frame::XDispatch
, public css::awt::XWindowListener // => css::lang::XEventListener
, public ::svt::IHelpAgentCallback
, private ThreadHelpBase
, public ::cppu::OWeakObject
{
private:
//---------------------------------------
/// @short represent the current active help URL, which must be used to show the right help page
::rtl::OUString m_sCurrentURL;
//---------------------------------------
/// @short parent of the agent window.
css::uno::Reference< css::awt::XWindow > m_xContainerWindow;
//---------------------------------------
/// @short the agent window itself (implemented in svtools)
css::uno::Reference< css::awt::XWindow > m_xAgentWindow;
//---------------------------------------
/// @short the timer for showing the agent window
Timer m_aTimer;
//---------------------------------------
/** @short hold this dispatcher alive till the timer was killed or expired!
@descr Because the vcl timer knows us by using a pointer ... and our instance is used
ref counted normaly it can happen that our reference goes down to 0 ... and the timer
runs into some trouble. So we hold us self alive till the timer could be stopped or expired.
*/
css::uno::Reference< css::uno::XInterface > m_xSelfHold;
public:
HelpAgentDispatcher(const css::uno::Reference< css::frame::XFrame >& xParentFrame);
FWK_DECLARE_XINTERFACE
FWK_DECLARE_XTYPEPROVIDER
// css::frame::XDispatch
virtual void SAL_CALL dispatch(const css::util::URL& sURL ,
const css::uno::Sequence< css::beans::PropertyValue >& lArgs)
throw(css::uno::RuntimeException);
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener,
const css::util::URL& aURL )
throw(css::uno::RuntimeException);
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener,
const css::util::URL& aURL )
throw(css::uno::RuntimeException);
// css::awt::XWindowListener
virtual void SAL_CALL windowResized(const css::awt::WindowEvent& aSource)
throw(css::uno::RuntimeException);
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent& aSource)
throw(css::uno::RuntimeException);
virtual void SAL_CALL windowShown(const css::lang::EventObject& aSource)
throw(css::uno::RuntimeException);
virtual void SAL_CALL windowHidden(const css::lang::EventObject& aSource)
throw(css::uno::RuntimeException);
// css::lang::XEventListener
virtual void SAL_CALL disposing(const css::lang::EventObject& aSource)
throw(css::uno::RuntimeException);
protected:
~HelpAgentDispatcher();
protected:
/// IHelpAgentCallback overridables
virtual void helpRequested();
virtual void closeAgent();
private:
//---------------------------------------
/** @short mark the current set URL as "accepted by user" and show the right help window
*/
void implts_acceptCurrentURL();
//---------------------------------------
/** @short mark the current set URL as "ignored by user"
*/
void implts_ignoreCurrentURL();
//---------------------------------------
/** @short ensures that the agent's window exists
@descr We create the agent window on demand. But afterwards we hold it alive till
this helpagent dispatcher dies. The agent window will be made visible/hidden
in case a new dispatch occures or in case the timer expired.
@return [sal_Bool]
sal_True in case the member m_xAgentWindow is a valid reference;
sal_False otherwise.
*/
css::uno::Reference< css::awt::XWindow > implts_ensureAgentWindow();
//---------------------------------------
/** @short show the agent window.
@descr If the agent window does not exists, it will be created on demand.
(see implts_ensureAgentWindow). Further it's checked if the parent container
window is currently visible or not. Only if its visible the agent window will
be shown too.
*/
void implts_showAgentWindow();
//---------------------------------------
/** @short hide the agent window.
*/
void implts_hideAgentWindow();
//---------------------------------------
/** @short set the new position and size of the agent window.
@descr If the agent window does not exists, it will be created on demand.
(see implts_ensureAgentWindow).
If the agent window exists, its position and size will be calculated
and set.
*/
void implts_positionAgentWindow();
//---------------------------------------
/** @short starts the timer for showing the agent window.
@descr The timer wont be started twice ... this method checks the current running state .-)
*/
void implts_startTimer();
//---------------------------------------
/** @short stop the timer.
@descr The timer wont be stopped twice ... this method checks the current running state .-)
Further this method marks the current help URL (m_xCurrentURL) as "ignorable".
Cause the user ignored it !
*/
void implts_stopTimer();
//---------------------------------------
/** @short callback of our internal timer.
*/
DECL_LINK(implts_timerExpired, void*);
};
#undef css
//........................................................................
} // namespace framework
//........................................................................
#endif // _FRAMEWORK_DISPATCH_HELPAGENTDISPATCHER_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -29,16 +29,8 @@
#ifndef __FRAMEWORK_TARGETS_H_
#define __FRAMEWORK_TARGETS_H_
//_________________________________________________________________________________________________________________
// includes
//_________________________________________________________________________________________________________________
#include <macros/generic.hxx>
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
......@@ -52,7 +44,6 @@ namespace framework{
#define SPECIALTARGET_ASCII_DEFAULT "_default" // Create a new task or recycle an existing one
#define SPECIALTARGET_ASCII_BEAMER "_beamer" // special frame in hierarchy
#define SPECIALTARGET_ASCII_MENUBAR "_menubar" // special target for menubars
#define SPECIALTARGET_ASCII_HELPAGENT "_helpagent" // special target for the help agent window
#define SPECIALTARGET_ASCII_HELPTASK "OFFICE_HELP_TASK" // special name for our help task
#define SPECIALTARGET_SELF DECLARE_ASCII(SPECIALTARGET_ASCII_SELF )
......@@ -62,7 +53,6 @@ namespace framework{
#define SPECIALTARGET_DEFAULT DECLARE_ASCII(SPECIALTARGET_ASCII_DEFAULT )
#define SPECIALTARGET_BEAMER DECLARE_ASCII(SPECIALTARGET_ASCII_BEAMER )
#define SPECIALTARGET_MENUBAR DECLARE_ASCII(SPECIALTARGET_ASCII_MENUBAR )
#define SPECIALTARGET_HELPAGENT DECLARE_ASCII(SPECIALTARGET_ASCII_HELPAGENT )
#define SPECIALTARGET_HELPTASK DECLARE_ASCII(SPECIALTARGET_ASCII_HELPTASK )
} // namespace framework
......
......@@ -26,18 +26,12 @@
*
************************************************************************/
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <stdio.h>
#include <dispatch/dispatchprovider.hxx>
#include <loadenv/loadenv.hxx>
#include <dispatch/loaddispatcher.hxx>
#include <dispatch/closedispatcher.hxx>
#include <dispatch/menudispatcher.hxx>
#include <dispatch/helpagentdispatcher.hxx>
#include <dispatch/startmoduledispatcher.hxx>
#include <pattern/window.hxx>
......@@ -50,41 +44,20 @@
#include <targets.h>
#include <general.h>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/ucb/XContentProviderManager.hpp>
#include <com/sun/star/document/XTypeDetection.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
#include <osl/diagnose.h>
#include <rtl/string.h>
#include <rtl/ustring.hxx>
#include <vcl/svapp.hxx>
#include <rtl/ustrbuf.hxx>
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// non exported definitions
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// declarations
//_________________________________________________________________________________________________________________
//*****************************************************************************************************************
// XInterface, XTypeProvider
//*****************************************************************************************************************
......@@ -99,8 +72,6 @@ DEFINE_XTYPEPROVIDER_2( DispatchProvider ,
css::frame::XDispatchProvider
)
//_________________________________________________________________________________________________________________
/**
@short standard ctor/dtor
@descr These initialize a new instance of tihs class with needed informations for work.
......@@ -128,8 +99,6 @@ DispatchProvider::DispatchProvider( const css::uno::Reference< css::lang::XMulti
{
}
//_________________________________________________________________________________________________________________
/**
@short protected(!) dtor for deinitializing
@descr We made it protected to prevent using of us as base class instead as a member.
......@@ -140,8 +109,6 @@ DispatchProvider::~DispatchProvider()
{
}
//_________________________________________________________________________________________________________________
/**
@interface XDispatchProvider
@short search a dispatcher for given URL
......@@ -184,8 +151,6 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL DispatchProvider::queryDis
return xDispatcher;
}
//_________________________________________________________________________________________________________________
/**
@interface XDispatchProvider
@short do the same like queryDispatch() ... but handle multiple dispatches at the same time
......@@ -220,15 +185,11 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL Disp
return lDispatcher;
}
//_________________________________________________________________________________________________________________
::sal_Bool lcl_isStartModuleDispatch (const css::util::URL& aURL)
{
return (aURL.Complete.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(CMD_UNO_SHOWSTARTMODULE)));
}
//_________________________________________________________________________________________________________________
/**
@short helper for queryDispatch()
@descr Every member of the frame tree (frame, desktop) must handle such request
......@@ -247,7 +208,6 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryDeskt
// ignore wrong requests which are not supported
if (
(sTargetFrameName==SPECIALTARGET_MENUBAR ) || // valid for frame dispatches - not for desktop
(sTargetFrameName==SPECIALTARGET_HELPAGENT) || // valid for frame dispatches - not for desktop
(sTargetFrameName==SPECIALTARGET_PARENT ) || // we have no parent by definition
(sTargetFrameName==SPECIALTARGET_BEAMER ) // beamer frames are allowed as child of tasks only -
// and they exist more then ones. We have no idea which our sub tasks is the right one
......@@ -377,28 +337,6 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrame
xDispatcher = implts_getOrCreateDispatchHelper( E_MENUDISPATCHER, xFrame );
}
//-----------------------------------------------------------------------------------------------------
// I.III) "_helpagent"
// Special mode on frame or task to start the help agent.
// It's defined for top level frames only.
//-----------------------------------------------------------------------------------------------------
else
if (sTargetName==SPECIALTARGET_HELPAGENT)
{
if (WindowHelper::isTopWindow(xFrame->getContainerWindow()))
xDispatcher = implts_getOrCreateDispatchHelper( E_HELPAGENTDISPATCHER, xFrame );
else
{
// Don''t use findFrame() here - because it's not possible to find
// a top lebel frame without knowing his name. And a frame with name
// "" can't be realy searched! That's why forward query to any parent
// explicitly.
css::uno::Reference< css::frame::XDispatchProvider > xProvider( xFrame->getCreator(), css::uno::UNO_QUERY );
if (xProvider.is())
xDispatcher = xProvider->queryDispatch(aURL,SPECIALTARGET_HELPAGENT,0);
}
}
//-----------------------------------------------------------------------------------------------------
// I.IV) "_helpagent"
// Special sub frame of a top frame only. Search or create it. ... OK it's currently a little bit HACKI.
......@@ -697,25 +635,6 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat
}
break;
case E_HELPAGENTDISPATCHER :
{
// Attention: It's not a good idea to create this help agent twice for the same frame (window)
// May it will be shown twice too - and user activate the first one. Then he get the corresponding
// help window ... but there exist another help agent window on bottom side of the frame window.
// It's superflous. Create it on demand - but hold it alive till this provider dies.
/* SAFE { */
WriteGuard aWriteLock( m_aLock );
if ( ! m_xHelpAgentDispatcher.is() )
{
HelpAgentDispatcher* pDispatcher = new HelpAgentDispatcher( xOwner );
m_xHelpAgentDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
xDispatchHelper = m_xHelpAgentDispatcher;
aWriteLock.unlock();
/* } SAFE */
}
break;
case E_CREATEDISPATCHER :
{
LoadDispatcher* pDispatcher = new LoadDispatcher(xFactory, xOwner, sTarget, nSearchFlags);
......
......@@ -26,20 +26,10 @@
*
************************************************************************/
//_______________________________________________
// own includes
#include <loadenv/targethelper.hxx>
//_______________________________________________
// namespace
namespace framework{
//_______________________________________________
// declarations
/*-----------------------------------------------
05.08.2003 09:08
-----------------------------------------------*/
......@@ -72,9 +62,6 @@ sal_Bool TargetHelper::matchSpecialTarget(const ::rtl::OUString& sCheckTarget ,
case E_MENUBAR :
return (sCheckTarget.equals(SPECIALTARGET_MENUBAR));
case E_HELPAGENT :
return (sCheckTarget.equals(SPECIALTARGET_HELPAGENT));
case E_HELPTASK :
return (sCheckTarget.equals(SPECIALTARGET_HELPTASK));
default:
......
......@@ -26,10 +26,6 @@
*
************************************************************************/
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <loadenv/loadenv.hxx>
#include <loadenv/targethelper.hxx>
......@@ -50,9 +46,6 @@
#include <classes/resource.hrc>
#include <classes/fwkresid.hxx>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/awt/XToolkit.hpp>
......@@ -78,9 +71,6 @@
#include <com/sun/star/document/UpdateDocMode.hpp>
#include <com/sun/star/frame/XTerminateListener2.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/factory.hxx>
......@@ -94,24 +84,8 @@
#include <fwkdllapi.h>
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// non exported definitions
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// declarations
//_________________________________________________________________________________________________________________
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
......@@ -1029,7 +1003,6 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const ::r
if (
(sTargetFrameName==SPECIALTARGET_DEFAULT ) || // valid for dispatches - not for findFrame()!
(sTargetFrameName==SPECIALTARGET_MENUBAR ) || // valid for dispatches - not for findFrame()!
(sTargetFrameName==SPECIALTARGET_HELPAGENT) || // valid for dispatches - not for findFrame()!
(sTargetFrameName==SPECIALTARGET_PARENT ) || // we have no parent by definition
(sTargetFrameName==SPECIALTARGET_BEAMER ) // beamer frames are allowed as child of tasks only -
// and they exist more then ones. We have no idea which our sub tasks is the right one
......
......@@ -26,10 +26,6 @@
*
************************************************************************/
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <services/frame.hxx>
#include <dispatch/dispatchprovider.hxx>
......@@ -51,9 +47,6 @@
#include <services.h>
#include <properties.h>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/task/XJobExecutor.hpp>
......@@ -79,9 +72,6 @@
#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
#include <comphelper/sequenceashashmap.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
......@@ -105,26 +95,10 @@
#include <vcl/menu.hxx>
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// non exported definitions
//_________________________________________________________________________________________________________________
css::uno::WeakReference< css::frame::XFrame > Frame::m_xCloserFrame = css::uno::WeakReference< css::frame::XFrame >();
//_________________________________________________________________________________________________________________
// declarations
//_________________________________________________________________________________________________________________
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
......@@ -795,8 +769,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const ::rtl
//-----------------------------------------------------------------------------------------------------
if (
(sTargetFrameName==SPECIALTARGET_DEFAULT ) || // valid for dispatches - not for findFrame()!
(sTargetFrameName==SPECIALTARGET_MENUBAR ) || // valid for dispatches - not for findFrame()!
(sTargetFrameName==SPECIALTARGET_HELPAGENT) // valid for dispatches - not for findFrame()!
(sTargetFrameName==SPECIALTARGET_MENUBAR ) // valid for dispatches - not for findFrame()!
)
{
return NULL;
......
......@@ -205,7 +205,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/misc/embedhlp \
svtools/source/misc/embedtransfer \
svtools/source/misc/filechangedchecker \
svtools/source/misc/helpagentwindow \
svtools/source/misc/imagemgr \
svtools/source/misc/imageresourceaccess \
svtools/source/misc/imap \
......
......@@ -80,7 +80,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/generictoolboxcontroll
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/genericunodialog.hxx,svtools/genericunodialog.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/grfmgr.hxx,svtools/grfmgr.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/headbar.hxx,svtools/headbar.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/helpagentwindow.hxx,svtools/helpagentwindow.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/helpid.hrc,svtools/helpid.hrc))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/helpopt.hxx,svtools/helpopt.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/htmlcfg.hxx,svtools/htmlcfg.hxx))
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#ifndef _SVTOOLS_HELPAGENTWIDNOW_HXX_
#define _SVTOOLS_HELPAGENTWIDNOW_HXX_
#include "svtools/svtdllapi.h"
#include <vcl/floatwin.hxx>
#include <vcl/image.hxx>
//........................................................................
namespace svt
{
//........................................................................
//====================================================================
//= IHelpAgentCallback
//====================================================================
class IHelpAgentCallback
{
public:
virtual void helpRequested() = 0;
virtual void closeAgent() = 0;
};
//====================================================================
//= HelpAgentWindow
//====================================================================
class SVT_DLLPUBLIC HelpAgentWindow : public FloatingWindow
{
protected:
Window* m_pCloser;
IHelpAgentCallback* m_pCallback;
Size m_aPreferredSize;
Image m_aPicture;
public:
HelpAgentWindow( Window* _pParent );
~HelpAgentWindow();
/// returns the preferred size of the window
const Size& getPreferredSizePixel() const { return m_aPreferredSize; }
// callback handler maintainance
void setCallback(IHelpAgentCallback* _pCB) { m_pCallback = _pCB; }
IHelpAgentCallback* getCallback() const { return m_pCallback; }
protected:
virtual void Resize();
virtual void Paint( const Rectangle& rRect );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
DECL_LINK( OnButtonClicked, Window* );
private:
SVT_DLLPRIVATE Size implOptimalButtonSize( const Image& _rButtonImage );
};
//........................................................................
} // namespace svt
//........................................................................
#endif // _SVTOOLS_HELPAGENTWIDNOW_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#include <svtools/helpagentwindow.hxx>
#include <osl/diagnose.h>
#include <vcl/button.hxx>
#include <vcl/bitmap.hxx>
#include <svtools/svtdata.hxx>
#include <svtools/svtools.hrc>
#include <svtools/helpid.hrc>
#define WB_AGENT_STYLE 0
//........................................................................
namespace svt
{
//........................................................................
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
//====================================================================
//= CloserButton_Impl
//= overload of ImageButton, because sometimes vcl doesn't call the click handler
//====================================================================
//--------------------------------------------------------------------
class CloserButton_Impl : public ImageButton
{
public:
CloserButton_Impl( Window* pParent, WinBits nBits ) : ImageButton( pParent, nBits ) {}
virtual void MouseButtonUp( const MouseEvent& rMEvt );
};
//--------------------------------------------------------------------
void CloserButton_Impl::MouseButtonUp( const MouseEvent& rMEvt )
{
ImageButton::MouseButtonUp( rMEvt );
GetClickHdl().Call( this );
}
//====================================================================
//= HelpAgentWindow
//====================================================================
//--------------------------------------------------------------------
HelpAgentWindow::HelpAgentWindow( Window* _pParent )
:FloatingWindow( _pParent, WB_AGENT_STYLE)
,m_pCloser(NULL)
,m_pCallback(NULL)
{
// -----------------
// the closer button
Bitmap aCloserBitmap(SvtResId(BMP_HELP_AGENT_CLOSER));
Image aCloserImage( aCloserBitmap, Color(COL_LIGHTMAGENTA) );
m_pCloser = new CloserButton_Impl( this, WB_NOTABSTOP | WB_NOPOINTERFOCUS );
static_cast<CloserButton_Impl*>(m_pCloser)->SetModeImage( aCloserImage );
static_cast<CloserButton_Impl*>(m_pCloser)->SetClickHdl( LINK(this, HelpAgentWindow, OnButtonClicked) );
m_pCloser->SetSizePixel( implOptimalButtonSize(aCloserImage) );
m_pCloser->Show();
m_pCloser->SetZOrder( NULL, WINDOW_ZORDER_LAST );
// ----------------------------
// calculate our preferred size
Bitmap aHelpAgentBitmap(SvtResId(BMP_HELP_AGENT_IMAGE));
m_aPicture = Image( aHelpAgentBitmap );
m_aPreferredSize = m_aPicture.GetSizePixel();
m_aPreferredSize.Width() += 2;
m_aPreferredSize.Height() += 2;
Size aSize = GetSizePixel();
Size aOutputSize = GetOutputSizePixel();
m_aPreferredSize.Width() += aSize.Width() - aOutputSize.Width();
m_aPreferredSize.Height() += aSize.Height() - aOutputSize.Height();
SetPointer(Pointer(POINTER_REFHAND));
AlwaysEnableInput( sal_True, sal_True );
}
//--------------------------------------------------------------------
HelpAgentWindow::~HelpAgentWindow()
{
if (m_pCloser && m_pCloser->IsTracking())
m_pCloser->EndTracking();
if (m_pCloser && m_pCloser->IsMouseCaptured())
m_pCloser->ReleaseMouse();
delete m_pCloser;
}
//--------------------------------------------------------------------
void HelpAgentWindow::Paint( const Rectangle& rRect )
{
FloatingWindow::Paint(rRect);
Size aOutputSize( GetOutputSizePixel() );
Point aPoint=Point();
Rectangle aOutputRect( aPoint, aOutputSize );
Rectangle aInnerRect( aOutputRect );
// paint the background
SetLineColor( GetSettings().GetStyleSettings().GetFaceColor() );
SetFillColor( GetSettings().GetStyleSettings().GetFaceColor() );
DrawRect( aOutputRect );
// paint the image
Size aPictureSize( m_aPicture.GetSizePixel() );
Point aPicturePos(
aOutputRect.Left() + (aInnerRect.GetWidth() - aPictureSize.Width()) / 2,
aOutputRect.Top() + (aInnerRect.GetHeight() - aPictureSize.Height()) / 2 );
DrawImage( aPicturePos, m_aPicture, 0 );
}
//--------------------------------------------------------------------
void HelpAgentWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
FloatingWindow::MouseButtonUp(rMEvt);
if (m_pCallback)
m_pCallback->helpRequested();
}
//--------------------------------------------------------------------
Size HelpAgentWindow::implOptimalButtonSize( const Image& _rButtonImage )
{
Size aPreferredSize = _rButtonImage.GetSizePixel();
// add a small frame, needed by the button
aPreferredSize.Width() += 5;
aPreferredSize.Height() += 5;
return aPreferredSize;
}
//--------------------------------------------------------------------
void HelpAgentWindow::Resize()
{
FloatingWindow::Resize();
Size aOutputSize = GetOutputSizePixel();
Size aCloserSize = m_pCloser->GetSizePixel();
if (m_pCloser)
m_pCloser->SetPosPixel( Point(aOutputSize.Width() - aCloserSize.Width() - 3, 4) );
}
//--------------------------------------------------------------------
IMPL_LINK( HelpAgentWindow, OnButtonClicked, Window*, _pWhichOne )
{
if (m_pCloser == _pWhichOne)
if (m_pCallback)
m_pCallback->closeAgent();
return 0L;
}
//........................................................................
} // namespace svt
//........................................................................
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment