Kaydet (Commit) ffca779f authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Create an UNO controller object for the preview shell.

üst 654d9eb4
......@@ -52,6 +52,7 @@
#include "address.hxx"
class ScTabViewShell;
class ScPreviewShell;
#define SC_VIEWPANE_ACTIVE 0xFFFF
......@@ -399,6 +400,15 @@ public:
virtual void SAL_CALL insertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::uno::RuntimeException);
};
class ScPreviewObj : public SfxBaseController, SfxListener
{
ScPreviewShell* mpViewShell;
public:
ScPreviewObj(ScPreviewShell* pViewSh);
virtual ~ScPreviewObj();
virtual void Notify(SfxBroadcaster&, const SfxHint& rHint);
};
#endif
......
......@@ -60,6 +60,7 @@
#include "cellsuno.hxx"
#include "miscuno.hxx"
#include "tabvwsh.hxx"
#include "prevwsh.hxx"
#include "docsh.hxx"
#include "drwlayer.hxx"
#include "drawview.hxx"
......@@ -562,23 +563,24 @@ ScTabViewObj::ScTabViewObj( ScTabViewShell* pViewSh ) :
nPreviousTab( 0 ),
bDrawSelModeSet(false)
{
if (pViewSh)
{
nPreviousTab = pViewSh->GetViewData()->GetTabNo();
if (!pViewSh)
return;
nPreviousTab = pViewSh->GetViewData()->GetTabNo();
ScViewData* pViewData = pViewSh->GetViewData();
if( pViewData )
{
uno::Reference< script::vba::XVBAEventProcessor > xVbaEventsHelper (pViewData->GetDocument()->GetVbaEventProcessor(), uno::UNO_QUERY );
if ( xVbaEventsHelper.is() )
{
ScTabViewEventListener* pEventListener = new ScTabViewEventListener( this, xVbaEventsHelper );
uno::Reference< awt::XEnhancedMouseClickHandler > aMouseClickHandler( *pEventListener, uno::UNO_QUERY );
addEnhancedMouseClickHandler( aMouseClickHandler );
uno::Reference< view::XSelectionChangeListener > aSelectionChangeListener( *pEventListener, uno::UNO_QUERY );
addSelectionChangeListener( aSelectionChangeListener );
}
}
}
if (!pViewData)
return;
uno::Reference< script::vba::XVBAEventProcessor > xVbaEventsHelper(
pViewData->GetDocument()->GetVbaEventProcessor(), uno::UNO_QUERY );
if (!xVbaEventsHelper.is())
return;
ScTabViewEventListener* pEventListener = new ScTabViewEventListener( this, xVbaEventsHelper );
uno::Reference< awt::XEnhancedMouseClickHandler > aMouseClickHandler( *pEventListener, uno::UNO_QUERY );
addEnhancedMouseClickHandler( aMouseClickHandler );
uno::Reference< view::XSelectionChangeListener > aSelectionChangeListener( *pEventListener, uno::UNO_QUERY );
addSelectionChangeListener( aSelectionChangeListener );
}
ScTabViewObj::~ScTabViewObj()
......@@ -2369,9 +2371,25 @@ void SAL_CALL ScTabViewObj::insertTransferable( const ::com::sun::star::uno::Ref
}
}
//------------------------------------------------------------------------
ScPreviewObj::ScPreviewObj(ScPreviewShell* pViewSh) :
SfxBaseController(pViewSh),
mpViewShell(pViewSh)
{
if (mpViewShell)
StartListening(*mpViewShell);
}
ScPreviewObj::~ScPreviewObj()
{
if (mpViewShell)
EndListening(*mpViewShell);
}
void ScPreviewObj::Notify(SfxBroadcaster&, const SfxHint& rHint)
{
const SfxSimpleHint* p = dynamic_cast<const SfxSimpleHint*>(&rHint);
if (p && p->GetId() == SFX_HINT_DYING)
mpViewShell = NULL;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -67,6 +67,7 @@
#include "ViewSettingsSequenceDefines.hxx"
#include "tpprint.hxx"
#include "printopt.hxx"
#include "viewuno.hxx"
#include <sax/tools/converter.hxx>
#include <rtl/ustrbuf.hxx>
......@@ -167,6 +168,8 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame,
if ( pDrawView )
nSourceDesignMode = pDrawView->IsDesignMode();
}
new ScPreviewObj(this);
}
ScPreviewShell::~ScPreviewShell()
......
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