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