diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-09-25 21:47:16 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-09-25 21:47:16 +0200 |
commit | 490d78bd02a134714ad78b4de22d08a9f5e9e8fa (patch) | |
tree | 5991c6f7f323b5c1cd14caf18fcd8a6b0ee5a625 /starmath | |
parent | d8d0f19821b9a0a4046519a369260e4ad5c5ee73 (diff) | |
parent | 850ec5b34c7d8d77061267f4f4020b9512269cc5 (diff) |
merge commit
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/edit.hxx | 1 | ||||
-rw-r--r-- | starmath/inc/view.hxx | 3 | ||||
-rw-r--r-- | starmath/sdi/makefile.mk | 3 | ||||
-rw-r--r-- | starmath/sdi/smath.sdi | 20 | ||||
-rw-r--r-- | starmath/source/document.cxx | 12 | ||||
-rw-r--r-- | starmath/source/edit.cxx | 13 | ||||
-rw-r--r-- | starmath/source/makefile.mk | 2 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 26 | ||||
-rw-r--r-- | starmath/source/smdetect.cxx | 2 | ||||
-rw-r--r-- | starmath/source/view.cxx | 26 | ||||
-rw-r--r-- | starmath/source/viewhdl.cxx | 170 |
11 files changed, 83 insertions, 195 deletions
diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index fe3b61a96485..d453fc6216e5 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -99,6 +99,7 @@ class SmEditWindow : public Window, public DropTargetHelper Rectangle AdjustScrollBars(); void SetScrollBarRanges(); void InitScrollBars(); + void InvalidateSlots(); public: SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ); diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 305f5ac873d8..8c89d9517898 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -228,9 +228,8 @@ class SmViewShell: public SfxViewShell SmViewShell_Impl* pImpl; BOOL bPasteState; - void AddRemoveClipboardListener( BOOL bAdd ); - DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* ); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); protected: diff --git a/starmath/sdi/makefile.mk b/starmath/sdi/makefile.mk index 098f1bc74f32..f868756f5990 100644 --- a/starmath/sdi/makefile.mk +++ b/starmath/sdi/makefile.mk @@ -39,7 +39,7 @@ SVSDIINC=$(PRJ)$/inc # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk - +.IF "$(L10N_framework)"=="" # --- Files -------------------------------------------------------- @@ -56,6 +56,7 @@ SVSDI1DEPEND= \ $(SVSDIINC)$/starmath.hrc # --- Targets ------------------------------------------------------- +.ENDIF .INCLUDE : target.mk diff --git a/starmath/sdi/smath.sdi b/starmath/sdi/smath.sdi index c3d10fe5e104..04c061359ada 100644 --- a/starmath/sdi/smath.sdi +++ b/starmath/sdi/smath.sdi @@ -32,7 +32,7 @@ SfxVoidItem Adjust SID_ADJUST [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -259,7 +259,7 @@ SfxVoidItem Draw SID_DRAW [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -488,7 +488,7 @@ SfxVoidItem NextError SID_NEXTERR [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -513,7 +513,7 @@ SfxVoidItem NextMark SID_NEXTMARK [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -563,7 +563,7 @@ SfxVoidItem PrevError SID_PREVERR [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -588,7 +588,7 @@ SfxVoidItem PrevMark SID_PREVMARK [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -612,8 +612,8 @@ SfxBoolItem RedrawAutomatic SID_AUTO_REDRAW [ /* flags: */ - AutoUpdate = FALSE, - Cachable = Volatile, + AutoUpdate = TRUE, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -740,7 +740,7 @@ SfxBoolItem Textmode SID_TEXTMODE [ /* flags: */ AutoUpdate = TRUE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -819,7 +819,7 @@ SfxBoolItem ToolBox SID_TOOLBOX [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 33fa49bdb4ef..ab467fc034e3 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -1176,9 +1176,21 @@ void SmDocShell::Execute(SfxRequest& rReq) (pTmpUndoMgr->*fnDo)( 0 ); } Repaint(); + SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this ); + while( pFrm ) + { + SfxBindings& rBind = pFrm->GetBindings(); + rBind.Invalidate(SID_UNDO); + rBind.Invalidate(SID_REDO); + rBind.Invalidate(SID_REPEAT); + rBind.Invalidate(SID_CLEARHISTORY); + pFrm = SfxViewFrame::GetNext( *pFrm, this ); + } } break; } + + rReq.Done(); } diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index d9c333611071..8435b7b5f35a 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -60,7 +60,7 @@ #include <svx/lrspitem.hxx> #include <svtools/itemset.hxx> #include <svx/fontitem.hxx> - +#include <sfx2/viewfrm.hxx> #include "edit.hxx" #include "view.hxx" @@ -163,6 +163,13 @@ SmEditWindow::~SmEditWindow() delete pScrollBox; } +void SmEditWindow::InvalidateSlots() +{ + SfxBindings& rBind = GetView()->GetViewFrame()->GetBindings(); + rBind.Invalidate(SID_COPY); + rBind.Invalidate(SID_CUT); + rBind.Invalidate(SID_DELETE); +} SmViewShell * SmEditWindow::GetView() { @@ -317,6 +324,7 @@ void SmEditWindow::MouseButtonUp(const MouseEvent &rEvt) // ggf FormulaCursor neu positionieren CursorMoveTimerHdl(&aCursorMoveTimer); + InvalidateSlots(); } void SmEditWindow::MouseButtonDown(const MouseEvent &rEvt) @@ -460,6 +468,8 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt) aModifyTimer.Start(); } + + InvalidateSlots(); } } @@ -855,6 +865,7 @@ void SmEditWindow::SetSelection(const ESelection &rSel) DBG_ASSERT( pEditView, "NULL pointer" ); if (pEditView) pEditView->SetSelection(rSel); + InvalidateSlots(); } BOOL SmEditWindow::IsEmpty() const diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk index 0f604a22b346..53f6569dcf9c 100644 --- a/starmath/source/makefile.mk +++ b/starmath/source/makefile.mk @@ -73,7 +73,6 @@ SLO1FILES = \ $(SLO)$/smmod.obj \ $(SLO)$/types.obj \ $(SLO)$/view.obj \ - $(SLO)$/viewhdl.obj \ $(SLO)$/edit.obj \ $(SLO)$/rect.obj \ $(SLO)$/unomodel.obj \ @@ -99,7 +98,6 @@ EXCEPTIONSFILES = \ $(SLO)$/mathmlexport.obj \ $(SLO)$/mathtype.obj \ $(SLO)$/view.obj \ - $(SLO)$/viewhdl.obj \ $(SLO)$/unomodel.obj \ $(SLO)$/smdetect.obj \ $(SLO)$/symbol.obj \ diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index bf719d661dad..1f7336db6d3c 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -318,13 +318,35 @@ ULONG SmXMLImportWrapper::ReadThroughComponent( if ( pFilter && pFilter->GetSuccess() )
nError = 0;
}
- catch( xml::sax::SAXParseException& )
+ catch( xml::sax::SAXParseException& r )
{
+ // sax parser sends wrapped exceptions,
+ // try to find the original one
+ xml::sax::SAXException aSaxEx = *(xml::sax::SAXException*)(&r);
+ sal_Bool bTryChild = sal_True;
+
+ while( bTryChild )
+ {
+ xml::sax::SAXException aTmp;
+ if ( aSaxEx.WrappedException >>= aTmp )
+ aSaxEx = aTmp;
+ else
+ bTryChild = sal_False;
+ }
+
+ packages::zip::ZipIOException aBrokenPackage;
+ if ( aSaxEx.WrappedException >>= aBrokenPackage )
+ return ERRCODE_IO_BROKENPACKAGE;
+
if ( bEncrypted )
nError = ERRCODE_SFX_WRONGPASSWORD;
}
- catch( xml::sax::SAXException& )
+ catch( xml::sax::SAXException& r )
{
+ packages::zip::ZipIOException aBrokenPackage;
+ if ( r.WrappedException >>= aBrokenPackage )
+ return ERRCODE_IO_BROKENPACKAGE;
+
if ( bEncrypted )
nError = ERRCODE_SFX_WRONGPASSWORD;
}
diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx index 66746afea728..f65b7fcdc764 100644 --- a/starmath/source/smdetect.cxx +++ b/starmath/source/smdetect.cxx @@ -220,7 +220,7 @@ SmFilterDetect::~SmFilterDetect() if ( bIsStorage ) { //TODO/LATER: factor this out! - uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage(); + uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage( sal_False ); if ( aMedium.GetLastStorageCreationState() != ERRCODE_NONE ) { // error during storage creation means _here_ that the medium diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 22f186fbcb76..5492553e46fe 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1211,6 +1211,9 @@ SfxPrinter* SmViewShell::GetPrinter(BOOL bCreate) USHORT SmViewShell::SetPrinter(SfxPrinter *pNewPrinter, USHORT nDiffFlags, bool ) { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::SetPrinter" ); + SfxPrinter *pOld = GetDoc()->GetPrinter(); + if ( pOld && pOld->IsPrinting() ) + return SFX_PRINTERROR_BUSY; if ((nDiffFlags & SFX_PRINTER_PRINTER) == SFX_PRINTER_PRINTER) GetDoc()->SetPrinter( pNewPrinter ); @@ -1586,7 +1589,7 @@ void SmViewShell::Execute(SfxRequest& rReq) pImpl->pDocInserter = new ::sfx2::DocumentInserter( 0, GetDoc()->GetFactory().GetFactoryName(), 0 ); pImpl->pDocInserter->StartExecuteModal( LINK( this, SmViewShell, DialogClosedHdl ) ); - return; + break; } case SID_NEXTERR: @@ -1714,8 +1717,6 @@ void SmViewShell::Execute(SfxRequest& rReq) SmSymbolDialog( NULL, pDev, pp->GetSymSetManager(), *this ).Execute(); } break; - - } rReq.Done(); } @@ -1742,7 +1743,6 @@ void SmViewShell::GetState(SfxItemSet &rSet) case SID_PASTE: if( !xClipEvtLstnr.is() && pEditWin) { - AddRemoveClipboardListener( TRUE ); TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pEditWin) ); @@ -1832,8 +1832,6 @@ SmViewShell::~SmViewShell() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::~SmViewShell" ); - AddRemoveClipboardListener( FALSE ); - //!! this view shell is not active anymore !! // Thus 'SmGetActiveView' will give a 0 pointer. // Thus we need to supply this view as argument @@ -1910,3 +1908,19 @@ IMPL_LINK( SmViewShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg ) return 0; } +void SmViewShell::Notify( SfxBroadcaster& , const SfxHint& rHint ) +{ + if ( rHint.IsA(TYPE(SfxSimpleHint)) ) + { + switch( ( (SfxSimpleHint&) rHint ).GetId() ) + { + case SFX_HINT_MODECHANGED: + case SFX_HINT_DOCCHANGED: + GetViewFrame()->GetBindings().InvalidateAll(FALSE); + break; + default: + break; + } + } +} + diff --git a/starmath/source/viewhdl.cxx b/starmath/source/viewhdl.cxx deleted file mode 100644 index b99b2f320cf9..000000000000 --- a/starmath/source/viewhdl.cxx +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: viewhdl.cxx,v $ - * $Revision: 1.10 $ - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_starmath.hxx" - - -#include <view.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp> -#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp> -#include <vos/mutex.hxx> -#include <cppuhelper/implbase1.hxx> -#include <svtools/transfer.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/sfxsids.hrc> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::datatransfer::clipboard; - -// --------------------------- Clipboard EventListener ------------------ - -class SmClipboardChangeListener : public ::cppu::WeakImplHelper1< - ::com::sun::star::datatransfer::clipboard::XClipboardListener > -{ - SmViewShell* pView; - - // XEventListener - virtual void SAL_CALL disposing( - const lang::EventObject& rEventObject ) throw ( ::com::sun::star::uno::RuntimeException) -;// throw( UNO_NMSPC::RuntimeException ); - - // XClipboardListener - virtual void SAL_CALL changedContents( - const datatransfer::clipboard::ClipboardEvent& rEventObject ) throw ( ::com::sun::star::uno::RuntimeException) -;// throw( UNO_NMSPC::RuntimeException ); - -public: - SmClipboardChangeListener( SmViewShell& rView ) : pView( &rView ) {} - virtual ~SmClipboardChangeListener(); - - void ViewDestroyed() { pView = 0; } - - void AddRemoveListener( BOOL bAdd ); -}; - - - -// ------------------------- SmClipboardChangeListener --------------------- - -SmClipboardChangeListener::~SmClipboardChangeListener() -{ -} - -void SAL_CALL SmClipboardChangeListener::disposing( - const lang::EventObject& /*rEventObject*/ ) throw ( ::com::sun::star::uno::RuntimeException) -{ -} - -void SAL_CALL SmClipboardChangeListener::changedContents( - const ClipboardEvent& rEventObject ) throw ( ::com::sun::star::uno::RuntimeException) -{ - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if( pView ) - { - { - TransferableDataHelper aDataHelper( rEventObject.Contents ); - sal_Bool bHasTransferable = aDataHelper.GetTransferable().is(); - - //! according to CD the above call to GetTransferable may create a (new) - //! message loop and thus result in re-entrant code. - //! Thus it was suggested to check 'pView' here again. - if (pView) - { - pView->bPasteState = bHasTransferable && - ( aDataHelper.HasFormat( FORMAT_STRING ) || - aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBEDDED_OBJ ) || - (aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) - && aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ))); - } - } - - if (pView) - { - SfxBindings& rBind = pView->GetViewFrame()->GetBindings(); - rBind.Invalidate( SID_PASTE ); - } - } -} - -void SmClipboardChangeListener::AddRemoveListener( BOOL bAdd ) -{ - try - { - do { - Window* pW; - Reference< XClipboard > xClipboard; - if( pView && 0 != ( pW = pView->GetEditWindow()) ) - xClipboard = pW->GetClipboard(); - if( !xClipboard.is() ) - break; - - Reference< XClipboardNotifier > xClpbrdNtfr( xClipboard, UNO_QUERY ); - if( xClpbrdNtfr.is() ) - { - Reference< XClipboardListener > xClipEvtLstnr( this ); - if( bAdd ) - xClpbrdNtfr->addClipboardListener( xClipEvtLstnr ); - else - xClpbrdNtfr->removeClipboardListener( xClipEvtLstnr ); - } - } while ( FALSE ); - } - catch( const ::com::sun::star::uno::Exception& ) - { - } -} - -// ------------------------- SmViewShell --------------------- - -void SmViewShell::AddRemoveClipboardListener( BOOL bAdd ) -{ - // AddRemoveListener and ViewDestroyed below should be an - // atomic operation and must not be 'interrupted' by other code - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if( bAdd && !xClipEvtLstnr.is() ) - { - xClipEvtLstnr = pClipEvtLstnr = new SmClipboardChangeListener( *this ); - pClipEvtLstnr->AddRemoveListener( TRUE ); - } - else if( !bAdd && xClipEvtLstnr.is() ) - { - pClipEvtLstnr->AddRemoveListener( FALSE ); - pClipEvtLstnr->ViewDestroyed(); - } -} - - - |