diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-11-22 10:17:18 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-11-22 10:17:18 +0100 |
commit | e13b8a69eed7f6dbbd28f49446581bd68f2d500c (patch) | |
tree | 5839810bb605d476ed1f97e995e2aa02bf4d26dd /sfx2/source/view | |
parent | 129551cbd39c8d5c2908bd18750ef5d917d8dfca (diff) | |
parent | 94753953df87e4d761ff9fa30333dc02994f6d3f (diff) |
undoapi: merge after pulling DEV300.m94
Diffstat (limited to 'sfx2/source/view')
-rw-r--r-- | sfx2/source/view/ipclient.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/view/viewimp.hxx | 33 | ||||
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 44 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 136 |
5 files changed, 131 insertions, 94 deletions
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 328d88d8b2b9..997cb584f83d 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -220,6 +220,7 @@ void SAL_CALL SfxInPlaceClient_Impl::notifyEvent( const document::EventObject& a if ( m_pClient && aEvent.EventName.equalsAscii("OnVisAreaChanged") && m_nAspect != embed::Aspects::MSOLE_ICON ) { + m_pClient->FormatChanged(); // for Writer when format of the object is changed with the area m_pClient->ViewChanged(); m_pClient->Invalidate(); } @@ -1082,6 +1083,11 @@ void SfxInPlaceClient::MakeVisible() // dummy implementation } +void SfxInPlaceClient::FormatChanged() +{ + // dummy implementation +} + void SfxInPlaceClient::DeactivateObject() { if ( GetObject().is() ) diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index cda5fd0bdd7d..19aa4b75ee0f 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1052,7 +1052,7 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell ) pFrame->GetFrame().SetIsClosing_Impl(); m_pData->m_pViewShell->DiscardClients_Impl(); - m_pData->m_pViewShell->pImp->bControllerSet = sal_False ; + m_pData->m_pViewShell->pImp->m_bControllerSet = false; if ( pFrame ) { @@ -1438,11 +1438,11 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) try { Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY_THROW ); - Reference< XIndexAccess > xViewData( xViewDataSupplier->getViewData(), UNO_SET_THROW ); + Reference< XIndexAccess > xViewData( xViewDataSupplier->getViewData() ); // find the view data item whose ViewId matches the ID of the view we're just connecting to const SfxObjectFactory& rDocFactory( rDoc.GetFactory() ); - const sal_Int32 nCount = xViewData->getCount(); + const sal_Int32 nCount = xViewData.is() ? xViewData->getCount() : 0; sal_Int32 nViewDataIndex = 0; for ( sal_Int32 i=0; i<nCount; ++i ) { diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index be20cd2f2a47..0826e78870bb 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -25,8 +25,8 @@ * ************************************************************************/ -#ifndef _VIEWIMP_HXX -#define _VIEWIMP_HXX +#ifndef SFX_VIEWIMP_HXX +#define SFX_VIEWIMP_HXX // include --------------------------------------------------------------- @@ -56,28 +56,29 @@ struct SfxViewShell_Impl { ::osl::Mutex aMutex; ::cppu::OInterfaceContainerHelper aInterceptorContainer; - BOOL bControllerSet; + bool m_bControllerSet; SfxShellArr_Impl aArr; SvBorder aBorder; Size aOptimalSize; Size aMargin; - USHORT nPrinterLocks; - BOOL bCanPrint; - BOOL bHasPrintOptions; - BOOL bPlugInsActive; - BOOL bIsShowView; - BOOL bOwnsMenu; - BOOL bGotOwnerShip; - BOOL bGotFrameOwnerShip; - SfxScrollingMode eScroll; - USHORT nFamily; - SfxBaseController* pController; - ::svt::AcceleratorExecute* pAccExec; + USHORT m_nPrinterLocks; + bool m_bCanPrint; + bool m_bHasPrintOptions; + bool m_bPlugInsActive; + bool m_bIsShowView; + // FIXME UNUSED ??? + //bool m_bOwnsMenu; + bool m_bGotOwnership; + bool m_bGotFrameOwnership; + SfxScrollingMode m_eScroll; + USHORT m_nFamily; + ::rtl::Reference<SfxBaseController> m_pController; + ::std::auto_ptr< ::svt::AcceleratorExecute > m_pAccExec; com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts; ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener; ::boost::shared_ptr< vcl::PrinterController > m_pPrinterController; - SfxViewShell_Impl(); + SfxViewShell_Impl(USHORT const nFlags); }; #endif diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 4ed0173be8e1..d1cfd8c2d181 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -143,18 +143,26 @@ SfxPrinterController::SfxPrinterController( const Any& i_rComplete, aRenderOptions[1].Value = i_rViewProp; aRenderOptions[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) ); aRenderOptions[2].Value <<= sal_True; - Sequence< beans::PropertyValue > aRenderParms( mxRenderable->getRenderer( 0 , getSelectionObject(), aRenderOptions ) ); - int nProps = aRenderParms.getLength(); - for( int i = 0; i < nProps; i++ ) + try { - if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) ) + Sequence< beans::PropertyValue > aRenderParms( mxRenderable->getRenderer( 0 , getSelectionObject(), aRenderOptions ) ); + int nProps = aRenderParms.getLength(); + for( int i = 0; i < nProps; i++ ) { - Sequence< beans::PropertyValue > aUIProps; - aRenderParms[i].Value >>= aUIProps; - setUIOptions( aUIProps ); - break; + if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) ) + { + Sequence< beans::PropertyValue > aUIProps; + aRenderParms[i].Value >>= aUIProps; + setUIOptions( aUIProps ); + break; + } } } + catch( lang::IllegalArgumentException& ) + { + // the first renderer should always be available for the UI options, + // but catch the exception to be safe + } } // set some job parameters @@ -234,7 +242,13 @@ Sequence< beans::PropertyValue > SfxPrinterController::getPageParameters( int i_ if( mxRenderable.is() && pPrinter ) { Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() ); - aResult = mxRenderable->getRenderer( i_nPage, getSelectionObject(), aJobOptions ); + try + { + aResult = mxRenderable->getRenderer( i_nPage, getSelectionObject(), aJobOptions ); + } + catch( lang::IllegalArgumentException& ) + { + } } return aResult; } @@ -836,7 +850,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) // execute PrinterSetupDialog PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() ); - if ( pImp->bHasPrintOptions ) + if (pImp->m_bHasPrintOptions) { // additional controls for dialog pExecutor = new SfxDialogExecutor_Impl( this, pPrintSetupDlg ); @@ -985,7 +999,7 @@ ErrCode SfxViewShell::DoPrint( SfxPrinter* /*pPrinter*/, BOOL SfxViewShell::IsPrinterLocked() const { - return pImp->nPrinterLocks > 0; + return pImp->m_nPrinterLocks > 0; } //-------------------------------------------------------------------- @@ -994,9 +1008,13 @@ void SfxViewShell::LockPrinter( BOOL bLock) { BOOL bChanged = FALSE; if ( bLock ) - bChanged = 1 == ++pImp->nPrinterLocks; + { + bChanged = 1 == ++pImp->m_nPrinterLocks; + } else - bChanged = 0 == --pImp->nPrinterLocks; + { + bChanged = 0 == --pImp->m_nPrinterLocks; + } if ( bChanged ) { diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 5c65c967434f..968d0cbe8676 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -240,9 +240,21 @@ static ::rtl::OUString RetrieveLabelFromCommand( } //========================================================================= -SfxViewShell_Impl::SfxViewShell_Impl() +SfxViewShell_Impl::SfxViewShell_Impl(USHORT const nFlags) : aInterceptorContainer( aMutex ) -, pAccExec(0) +, m_bControllerSet(false) +, m_nPrinterLocks(0) +, m_bCanPrint(SFX_VIEW_CAN_PRINT == (nFlags & SFX_VIEW_CAN_PRINT)) +, m_bHasPrintOptions( + SFX_VIEW_HAS_PRINTOPTIONS == (nFlags & SFX_VIEW_HAS_PRINTOPTIONS)) +, m_bPlugInsActive(true) +, m_bIsShowView(SFX_VIEW_NO_SHOW != (nFlags & SFX_VIEW_NO_SHOW)) +, m_bGotOwnership(false) +, m_bGotFrameOwnership(false) +, m_eScroll(SCROLLING_DEFAULT) +, m_nFamily(0xFFFF) // undefined, default set by TemplateDialog +, m_pController(0) +, m_pAccExec(0) {} //========================================================================= @@ -374,7 +386,9 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) { SFX_REQUEST_ARG(rReq, pItem, SfxUInt16Item, nId, FALSE); if (pItem) - pImp->nFamily = pItem->GetValue(); + { + pImp->m_nFamily = pItem->GetValue(); + } break; } @@ -674,7 +688,9 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) case SID_PLUGINS_ACTIVE: { SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nId, FALSE); - BOOL bActive = pShowItem ? pShowItem->GetValue() : !pImp->bPlugInsActive; + bool const bActive = (pShowItem) + ? pShowItem->GetValue() + : !pImp->m_bPlugInsActive; // ggf. recorden if ( !rReq.IsAPI() ) rReq.AppendItem( SfxBoolItem( nId, bActive ) ); @@ -684,7 +700,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) rReq.Done(TRUE); // ausfuehren - if ( !pShowItem || bActive != pImp->bPlugInsActive ) + if (!pShowItem || (bActive != pImp->m_bPlugInsActive)) { SfxFrame* pTopFrame = &GetFrame()->GetTopFrame(); if ( pTopFrame != &GetFrame()->GetFrame() ) @@ -704,7 +720,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) SfxViewShell *pView = pTopFrame->GetCurrentViewFrame()->GetViewShell(); if ( pView ) { - pView->pImp->bPlugInsActive = bActive; + pView->pImp->m_bPlugInsActive = bActive; Rectangle aVisArea = GetObjectShell()->GetVisArea(); VisAreaChanged(aVisArea); @@ -758,7 +774,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) case SID_SETUPPRINTER: case SID_PRINTER_NAME: { - BOOL bEnabled = pImp->bCanPrint && !pImp->nPrinterLocks; + bool bEnabled = pImp->m_bCanPrint && !pImp->m_nPrinterLocks; bEnabled = bEnabled && !Application::GetSettings().GetMiscSettings().GetDisablePrinting(); if ( bEnabled ) { @@ -812,7 +828,8 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) // PlugIns running case SID_PLUGINS_ACTIVE: { - rSet.Put( SfxBoolItem( SID_PLUGINS_ACTIVE, !pImp->bPlugInsActive) ); + rSet.Put( SfxBoolItem( SID_PLUGINS_ACTIVE, + !pImp->m_bPlugInsActive) ); break; } /* @@ -832,7 +849,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) */ case SID_STYLE_FAMILY : { - rSet.Put( SfxUInt16Item( SID_STYLE_FAMILY, pImp->nFamily ) ); + rSet.Put( SfxUInt16Item( SID_STYLE_FAMILY, pImp->m_nFamily ) ); break; } } @@ -1155,8 +1172,10 @@ void SfxViewShell::InvalidateBorder() DBG_ASSERT( GetViewFrame(), "SfxViewShell without SfxViewFrame" ); GetViewFrame()->InvalidateBorderImpl( this ); - if ( pImp->pController ) - pImp->pController->BorderWidthsChanged_Impl(); + if (pImp->m_pController.is()) + { + pImp->m_pController->BorderWidthsChanged_Impl(); + } } //-------------------------------------------------------------------- @@ -1171,8 +1190,10 @@ void SfxViewShell::SetBorderPixel( const SvBorder &rBorder ) GetViewFrame()->SetBorderPixelImpl( this, rBorder ); // notify related controller that border size is changed - if ( pImp->pController ) - pImp->pController->BorderWidthsChanged_Impl(); + if (pImp->m_pController.is()) + { + pImp->m_pController->BorderWidthsChanged_Impl(); + } } } @@ -1247,7 +1268,7 @@ SfxViewShell::SfxViewShell ) : SfxShell(this) - ,pImp( new SfxViewShell_Impl ) +, pImp( new SfxViewShell_Impl(nFlags) ) ,pIPClientList( 0 ) ,pFrame(pViewFrame) ,pSubShell(0) @@ -1257,22 +1278,12 @@ SfxViewShell::SfxViewShell DBG_CTOR(SfxViewShell, 0); //pImp->pPrinterCommandQueue = new SfxAsyncPrintExec_Impl( this ); - pImp->pController = 0; - pImp->bIsShowView = - !(SFX_VIEW_NO_SHOW == (nFlags & SFX_VIEW_NO_SHOW)); - - pImp->bCanPrint = SFX_VIEW_CAN_PRINT == (nFlags & SFX_VIEW_CAN_PRINT); - pImp->bHasPrintOptions = - SFX_VIEW_HAS_PRINTOPTIONS == (nFlags & SFX_VIEW_HAS_PRINTOPTIONS); - pImp->bPlugInsActive = TRUE; - pImp->bGotOwnerShip = FALSE; - pImp->bGotFrameOwnerShip = FALSE; + if ( pViewFrame->GetParentViewFrame() ) - pImp->bPlugInsActive = pViewFrame->GetParentViewFrame()->GetViewShell()->pImp->bPlugInsActive; - pImp->eScroll = SCROLLING_DEFAULT; - pImp->nPrinterLocks = 0; - pImp->bControllerSet = FALSE; - pImp->nFamily = 0xFFFF; // undefined, default set by TemplateDialog + { + pImp->m_bPlugInsActive = pViewFrame->GetParentViewFrame() + ->GetViewShell()->pImp->m_bPlugInsActive; + } SetMargin( pViewFrame->GetMargin_Impl() ); SetPool( &pViewFrame->GetObjectShell()->GetPool() ); @@ -1301,16 +1312,10 @@ SfxViewShell::~SfxViewShell() pImp->xClipboardListener = NULL; } - if ( pImp->pController ) + if (pImp->m_pController.is()) { - pImp->pController->ReleaseShell_Impl(); - pImp->pController->release(); - pImp->pController = NULL; - } - - if (pImp->pAccExec) - { - DELETEZ( pImp->pAccExec ); + pImp->m_pController->ReleaseShell_Impl(); + pImp->m_pController.clear(); } //DELETEZ( pImp->pPrinterCommandQueue ); @@ -1660,7 +1665,8 @@ void SfxViewShell::Notify( SfxBroadcaster& rBC, SFX_ITEMSET_ARG( pSet, pItem, SfxUnoAnyItem, SID_VIEW_DATA, sal_False ); if ( pItem ) { - pImp->pController->restoreViewData( pItem->GetValue() ); + pImp->m_pController->restoreViewData( + pItem->GetValue() ); pSet->ClearItem( SID_VIEW_DATA ); } @@ -1679,13 +1685,15 @@ void SfxViewShell::Notify( SfxBroadcaster& rBC, BOOL SfxViewShell::ExecKey_Impl(const KeyEvent& aKey) { - if (!pImp->pAccExec) + if (!pImp->m_pAccExec.get()) { - pImp->pAccExec = ::svt::AcceleratorExecute::createAcceleratorHelper(); - pImp->pAccExec->init(::comphelper::getProcessServiceFactory(), pFrame->GetFrame().GetFrameInterface()); + pImp->m_pAccExec.reset( + ::svt::AcceleratorExecute::createAcceleratorHelper() ); + pImp->m_pAccExec->init(::comphelper::getProcessServiceFactory(), + pFrame->GetFrame().GetFrameInterface()); } - return pImp->pAccExec->execute(aKey.GetKeyCode()); + return pImp->m_pAccExec->execute(aKey.GetKeyCode()); } //-------------------------------------------------------------------- @@ -1828,7 +1836,7 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient, const Rectan ( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0 ); // this method is called when either a client is created or the "Edit/Plugins" checkbox is checked - if ( !pIPClient->IsObjectInPlaceActive() && pImp->bPlugInsActive ) + if ( !pIPClient->IsObjectInPlaceActive() && pImp->m_bPlugInsActive ) { // object in client is currently not active // check if the object wants to be activated always or when it becomes at least partially visible @@ -1844,7 +1852,7 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient, const Rectan } } } - else if ( !pImp->bPlugInsActive ) + else if (!pImp->m_bPlugInsActive) { // object in client is currently active and "Edit/Plugins" checkbox is selected // check if the object wants to be activated always or when it becomes at least partially visible @@ -1858,7 +1866,7 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient, const Rectan BOOL SfxViewShell::PlugInsActive() const { - return pImp->bPlugInsActive; + return pImp->m_bPlugInsActive; } //-------------------------------------------------------------------- @@ -1884,14 +1892,14 @@ void SfxViewShell::DiscardClients_Impl() SfxScrollingMode SfxViewShell::GetScrollingMode() const { - return pImp->eScroll; + return pImp->m_eScroll; } //-------------------------------------------------------------------- void SfxViewShell::SetScrollingMode( SfxScrollingMode eMode ) { - pImp->eScroll = eMode; + pImp->m_eScroll = eMode; } //-------------------------------------------------------------------- @@ -1958,7 +1966,7 @@ void SfxViewShell::MarginChanged() BOOL SfxViewShell::IsShowView_Impl() const { - return pImp->bIsShowView; + return pImp->m_bIsShowView; } //-------------------------------------------------------------------- @@ -1990,9 +1998,8 @@ SfxInPlaceClientList* SfxViewShell::GetIPClientList_Impl( BOOL bCreate ) const void SfxViewShell::SetController( SfxBaseController* pController ) { - pImp->pController = pController; - pImp->pController->acquire(); - pImp->bControllerSet = TRUE; + pImp->m_pController = pController; + pImp->m_bControllerSet = true; // there should be no old listener, but if there is one, it should be disconnected if ( pImp->xClipboardListener.is() ) @@ -2004,12 +2011,12 @@ void SfxViewShell::SetController( SfxBaseController* pController ) Reference < XController > SfxViewShell::GetController() { - return pImp->pController; + return pImp->m_pController.get(); } SfxBaseController* SfxViewShell::GetBaseController_Impl() const { - return pImp->pController; + return pImp->m_pController.get(); } void SfxViewShell::AddContextMenuInterceptor_Impl( const REFERENCE< XCONTEXTMENUINTERCEPTOR >& xInterceptor ) @@ -2054,6 +2061,7 @@ void Change( Menu* pMenu, SfxViewShell* pView ) if ( pSlot ) { pMenu->InsertItem( pSlot->GetSlotId(), pMenu->GetItemText( nId ), pMenu->GetItemBits( nId ), nPos ); + pMenu->SetItemCommand( pSlot->GetSlotId(), aCmd ); pMenu->RemoveItem( nPos+1 ); break; } @@ -2131,20 +2139,20 @@ void SfxViewShell::TakeOwnerShip_Impl() { // currently there is only one reason to take OwnerShip: a hidden frame is printed // so the ViewShell will check this on EndPrint (->prnmon.cxx) - pImp->bGotOwnerShip = TRUE; + pImp->m_bGotOwnership = true; } void SfxViewShell::TakeFrameOwnerShip_Impl() { // currently there is only one reason to take OwnerShip: a hidden frame is printed // so the ViewShell will check this on EndPrint (->prnmon.cxx) - pImp->bGotFrameOwnerShip = TRUE; + pImp->m_bGotFrameOwnership = true; } void SfxViewShell::CheckOwnerShip_Impl() { BOOL bSuccess = FALSE; - if( pImp->bGotOwnerShip ) + if (pImp->m_bGotOwnership) { com::sun::star::uno::Reference < com::sun::star::util::XCloseable > xModel( GetObjectShell()->GetModel(), com::sun::star::uno::UNO_QUERY ); @@ -2162,7 +2170,7 @@ void SfxViewShell::CheckOwnerShip_Impl() } } - if( !bSuccess && pImp->bGotFrameOwnerShip ) + if (!bSuccess && pImp->m_bGotFrameOwnership) { // document couldn't be closed or it shouldn't, now try at least to close the frame com::sun::star::uno::Reference < com::sun::star::util::XCloseable > xFrame( @@ -2182,19 +2190,23 @@ void SfxViewShell::CheckOwnerShip_Impl() long SfxViewShell::HandleNotifyEvent_Impl( NotifyEvent& rEvent ) { - if ( pImp->pController ) - return pImp->pController->HandleEvent_Impl( rEvent ); + if (pImp->m_pController.is()) + { + return pImp->m_pController->HandleEvent_Impl( rEvent ); + } return 0; } BOOL SfxViewShell::HasKeyListeners_Impl() { - return pImp->pController ? pImp->pController->HasKeyListeners_Impl() : FALSE; + return (pImp->m_pController.is()) + ? pImp->m_pController->HasKeyListeners_Impl() : FALSE; } BOOL SfxViewShell::HasMouseClickListeners_Impl() { - return pImp->pController ? pImp->pController->HasMouseClickListeners_Impl() : FALSE; + return (pImp->m_pController.is()) + ? pImp->m_pController->HasMouseClickListeners_Impl() : FALSE; } void SfxViewShell::SetAdditionalPrintOptions( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rOpts ) |