From 68493b03eee03e7cab5ddabe24e673329c7fd09d Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 16 Feb 2010 11:18:37 +0100 Subject: cws ppp02: #i109321#: return correct IsBusy property in XPrintable::getPrinter() call --- sfx2/inc/sfx2/viewsh.hxx | 7 +++---- sfx2/source/doc/printhelper.cxx | 20 +++++++++++++------- sfx2/source/view/viewimp.hxx | 26 ++------------------------ sfx2/source/view/viewprn.cxx | 10 ++++++++++ 4 files changed, 28 insertions(+), 35 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index e3a5ae5adb8e..bfda282b7797 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -62,6 +62,7 @@ class SfxTabPage; class SfxPrintMonitor; class SfxFrameSetDescriptor; class PrintDialog; +class Printer; class SfxPrinter; class SfxProgress; class SvStringsDtor; @@ -168,6 +169,7 @@ friend class SfxInternalFrame; friend class SfxExternalTopViewFrame_Impl; friend class SfxOfficeDocController; friend class SfxBaseController; +friend class SfxPrinterController; #endif struct SfxViewShell_Impl* pImp; @@ -207,10 +209,6 @@ public: SfxViewShell( SfxViewFrame *pFrame, USHORT nFlags = 0 ); virtual ~SfxViewShell(); - // In-Place - // should be superfluous - //virtual SfxInPlaceClient* CreateIPClient( WorkWindow * pTop, WorkWindow * pDoc, Window * pDraw ); - SfxInPlaceClient* GetIPClient() const; SfxInPlaceClient* GetUIActiveClient() const; SfxInPlaceClient* FindIPClient( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, Window *pObjParentWin ) const; @@ -272,6 +270,7 @@ public: void LockPrinter( BOOL bLock = TRUE ); BOOL IsPrinterLocked() const; virtual JobSetup GetJobSetup() const; + Printer* GetActivePrinter() const; // Workingset virtual void WriteUserData( String&, BOOL bBrowse = FALSE ); diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 103dcf505846..ff21de94ae59 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -269,17 +269,23 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro // object already disposed? ::vos::OGuard aGuard( Application::GetSolarMutex() ); - // Printer beschaffen - SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; - if ( !pViewFrm ) - return uno::Sequence< beans::PropertyValue >(); + // search for any view of this document that is currently printing + const Printer *pPrinter = NULL; + SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame* pFirst = pViewFrm; + while ( pViewFrm && !pPrinter ) + { + pPrinter = pViewFrm->GetViewShell()->GetActivePrinter(); + pViewFrm = SfxViewFrame::GetNext( *pViewFrm, m_pData->m_pObjectShell, 0, sal_False ); + } + + // if no view is printing currently, use the permanent SfxPrinter instance + if ( !pPrinter && pFirst ) + pPrinter = pFirst->GetViewShell()->GetPrinter(sal_True); - const SfxPrinter *pPrinter = pViewFrm->GetViewShell()->GetPrinter(sal_True); if ( !pPrinter ) return uno::Sequence< beans::PropertyValue >(); - // Printer Eigenschaften uebertragen uno::Sequence< beans::PropertyValue > aPrinter(8); aPrinter.getArray()[7].Name = DEFINE_CONST_UNICODE( "CanSetPaperSize" ); diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 9e3791340daa..e3e0085c52d1 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -33,20 +33,16 @@ // include --------------------------------------------------------------- -#ifndef __SBX_SBXOBJ_HXX #include -#endif #include #include // SvBorder #include #include - #include #include #include - #include - +#include #include // forward --------------------------------------------------------------- @@ -57,24 +53,6 @@ class SfxBaseController; typedef SfxShell* SfxShellPtr_Impl; SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 ) -// struct SfxViewShell_Impl ---------------------------------------------- -#if 0 -class SfxAsyncPrintExec_Impl : public SfxListener -{ - SfxViewShell* pView; - ::std::queue < SfxRequest*> aReqs; - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - -public: - SfxAsyncPrintExec_Impl( SfxViewShell* pShell) - : pView( pShell ) - {} - - void AddRequest( SfxRequest& rReq ); -}; -#endif - class SfxClipboardChangeListener; struct SfxViewShell_Impl @@ -100,9 +78,9 @@ struct SfxViewShell_Impl USHORT nFamily; SfxBaseController* pController; ::svt::AcceleratorExecute* pAccExec; -// SfxAsyncPrintExec_Impl* pPrinterCommandQueue; com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts; ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener; + vcl::PrinterController* pPrinterController; SfxViewShell_Impl(); }; diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 24d31337a662..afb2b46edf47 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -332,6 +332,9 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt if ( m_bNeedsChange ) mpObjectShell->EnableSetModified( m_bOrigStatus ); + + if ( mpViewShell ) + mpViewShell->pImp->pPrinterController = 0; } } @@ -642,6 +645,8 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro this, rProps ) ); + pImp->pPrinterController = pController.get(); + SfxObjectShell *pObjShell = GetObjectShell(); pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ), makeAny( rtl::OUString( pObjShell->GetTitle(0) ) ) ); @@ -656,6 +661,11 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro Printer::PrintJob( pController, aJobSetup ); } +Printer* SfxViewShell::GetActivePrinter() const +{ + return pImp->pPrinterController ? pImp->pPrinterController->getPrinter().get() : 0; +} + void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { // USHORT nCopies=1; -- cgit From 4d192b537074cc1f23b11107653a352f610d5b25 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Thu, 11 Mar 2010 07:21:46 +0100 Subject: dtardon02: #i108506# remove empty file in sfx2 --- sfx2/source/view/view.hxx | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 sfx2/source/view/view.hxx (limited to 'sfx2') diff --git a/sfx2/source/view/view.hxx b/sfx2/source/view/view.hxx deleted file mode 100644 index 20e542d90bc7..000000000000 --- a/sfx2/source/view/view.hxx +++ /dev/null @@ -1,27 +0,0 @@ -/************************************************************************* - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -- cgit From a22ce943407b6a925baa626a067b438b2e58724f Mon Sep 17 00:00:00 2001 From: David Tardon Date: Thu, 11 Mar 2010 07:48:51 +0100 Subject: dtardon02: #i110035# remove unused files in sfx2 --- sfx2/source/doc/commitlistener.cxx | 81 ---- sfx2/source/doc/commitlistener.hxx | 57 --- sfx2/source/doc/opostponedtruncationstream.cxx | 491 ------------------------- sfx2/source/doc/opostponedtruncationstream.hxx | 122 ------ 4 files changed, 751 deletions(-) delete mode 100644 sfx2/source/doc/commitlistener.cxx delete mode 100644 sfx2/source/doc/commitlistener.hxx delete mode 100644 sfx2/source/doc/opostponedtruncationstream.cxx delete mode 100644 sfx2/source/doc/opostponedtruncationstream.hxx (limited to 'sfx2') diff --git a/sfx2/source/doc/commitlistener.cxx b/sfx2/source/doc/commitlistener.cxx deleted file mode 100644 index 9ca11a9eef82..000000000000 --- a/sfx2/source/doc/commitlistener.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" - -#include "commitlistener.hxx" - -using namespace ::com::sun::star; - -OChildCommitListen_Impl::OChildCommitListen_Impl( SfxBaseModel& aModel ) -: m_pModel( &aModel ) -{} - -OChildCommitListen_Impl::~OChildCommitListen_Impl() -{} - -void OChildCommitListen_Impl::OwnerIsDisposed() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_pModel = NULL; -} - -void SAL_CALL OChildCommitListen_Impl::preCommit( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - -void SAL_CALL OChildCommitListen_Impl::commited( const ::com::sun::star::lang::EventObject& /*aEvent*/ ) - throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - // StorageIsModified_Impl must not contain any locking! - if ( m_pModel ) - m_pModel->StorageIsModified_Impl(); -} - -void SAL_CALL OChildCommitListen_Impl::preRevert( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - -void SAL_CALL OChildCommitListen_Impl::reverted( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - - -void SAL_CALL OChildCommitListen_Impl::disposing( const lang::EventObject& ) - throw ( uno::RuntimeException ) -{ - // not interesting -} - diff --git a/sfx2/source/doc/commitlistener.hxx b/sfx2/source/doc/commitlistener.hxx deleted file mode 100644 index 572da034cef1..000000000000 --- a/sfx2/source/doc/commitlistener.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __COMMITLISTENER_HXX_ -#define __COMMITLISTENER_HXX_ - -#include -#include -#include - -#include - -class OChildCommitListen_Impl : public ::cppu::WeakImplHelper1 < ::com::sun::star::embed::XTransactionListener > -{ - ::osl::Mutex m_aMutex; - SfxBaseModel* m_pModel; - -public: - OChildCommitListen_Impl( SfxBaseModel& aStorage ); - virtual ~OChildCommitListen_Impl(); - - void OwnerIsDisposed(); - - virtual void SAL_CALL preCommit( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL commited( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL preRevert( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reverted( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif - diff --git a/sfx2/source/doc/opostponedtruncationstream.cxx b/sfx2/source/doc/opostponedtruncationstream.cxx deleted file mode 100644 index 84b1d6a3906a..000000000000 --- a/sfx2/source/doc/opostponedtruncationstream.cxx +++ /dev/null @@ -1,491 +0,0 @@ -/************************************************************************* - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" -#include - -#include - -using namespace ::com::sun::star; - -// ======================================================================== -struct PTFStreamData_Impl -{ - uno::Reference< ucb::XSimpleFileAccess > m_xFileAccess; - sal_Bool m_bDelete; - ::rtl::OUString m_aURL; - - // the streams below are not visible from outside so there is no need to remember position - - // original stream related members - uno::Reference< io::XStream > m_xOrigStream; - uno::Reference< io::XTruncate > m_xOrigTruncate; - uno::Reference< io::XSeekable > m_xOrigSeekable; - uno::Reference< io::XInputStream > m_xOrigInStream; - uno::Reference< io::XOutputStream > m_xOrigOutStream; - - sal_Bool m_bInOpen; - sal_Bool m_bOutOpen; - - sal_Bool m_bPostponedTruncate; - - - PTFStreamData_Impl( - const uno::Reference< ucb::XSimpleFileAccess >& xFileAccess, - sal_Bool bDelete, - const ::rtl::OUString& aURL, - const uno::Reference< io::XStream >& xOrigStream, - const uno::Reference< io::XTruncate >& xOrigTruncate, - const uno::Reference< io::XSeekable >& xOrigSeekable, - const uno::Reference< io::XInputStream >& xOrigInStream, - const uno::Reference< io::XOutputStream >& xOrigOutStream ) - : m_xFileAccess( xFileAccess ) - , m_bDelete( bDelete ) - , m_aURL( aURL ) - , m_xOrigStream( xOrigStream ) - , m_xOrigTruncate( xOrigTruncate ) - , m_xOrigSeekable( xOrigSeekable ) - , m_xOrigInStream( xOrigInStream ) - , m_xOrigOutStream( xOrigOutStream ) - , m_bInOpen( sal_False ) - , m_bOutOpen( sal_False ) - , m_bPostponedTruncate( sal_True ) - {} - - void NoPostponing() - { - m_bDelete = sal_False; - m_bPostponedTruncate = sal_False; - } -}; - -// ======================================================================== -// ------------------------------------------------------------------------ -OPostponedTruncationFileStream::OPostponedTruncationFileStream( - const ::rtl::OUString& aURL, - const uno::Reference< lang::XMultiServiceFactory >& /*xFactory*/, - const uno::Reference< ucb::XSimpleFileAccess >& xFileAccess, - const uno::Reference< io::XStream >& xOrigStream, - sal_Bool bDelete ) -: m_pStreamData( NULL ) -{ - if ( !xFileAccess.is() || !xOrigStream.is() ) - throw uno::RuntimeException(); - - uno::Reference< io::XTruncate > xOrigTruncate( xOrigStream, uno::UNO_QUERY_THROW ); - uno::Reference< io::XSeekable > xOrigSeekable( xOrigStream, uno::UNO_QUERY_THROW ); - uno::Reference< io::XInputStream > xOrigInStream = xOrigStream->getInputStream(); - uno::Reference< io::XOutputStream > xOrigOutStream = xOrigStream->getOutputStream(); - if ( !xOrigInStream.is() || !xOrigOutStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData = new PTFStreamData_Impl( xFileAccess, bDelete, aURL, - xOrigStream, xOrigTruncate, xOrigSeekable, xOrigInStream, xOrigOutStream ); -} - -// ------------------------------------------------------------------------ -OPostponedTruncationFileStream::~OPostponedTruncationFileStream() -{ - CloseAll_Impl(); -} - -// ------------------------------------------------------------------------ -void OPostponedTruncationFileStream::CloseAll_Impl() -{ - if ( m_pStreamData ) - { - sal_Bool bDelete = m_pStreamData->m_bDelete; - ::rtl::OUString aURL = m_pStreamData->m_aURL; - uno::Reference< ucb::XSimpleFileAccess > xFileAccess = m_pStreamData->m_xFileAccess; - - delete m_pStreamData; - m_pStreamData = NULL; - - if ( bDelete && xFileAccess.is() && aURL.getLength() ) - { - // delete the file - try - { - xFileAccess->kill( aURL ); - } catch( uno::Exception& ) - { - OSL_ENSURE( sal_False, "Could not remove the file!" ); - } - } - } -} - -// ------------------------------------------------------------------------ -void OPostponedTruncationFileStream::CheckScheduledTruncation_Impl() -{ - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigTruncate.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigTruncate->truncate(); - m_pStreamData->NoPostponing(); - } -} - -// com::sun::star::io::XStream -// ------------------------------------------------------------------------ -uno::Reference< io::XInputStream > SAL_CALL OPostponedTruncationFileStream::getInputStream( ) - throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_pStreamData ) - m_pStreamData->m_bInOpen = sal_True; - return static_cast< io::XInputStream* >( this ); -} - - -// ------------------------------------------------------------------------ -uno::Reference< io::XOutputStream > SAL_CALL OPostponedTruncationFileStream::getOutputStream( ) - throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_pStreamData ) - m_pStreamData->m_bOutOpen = sal_True; - return static_cast< io::XOutputStream* >( this ); -} - - - -// com::sun::star::io::XInputStream -// ------------------------------------------------------------------------ -::sal_Int32 SAL_CALL OPostponedTruncationFileStream::readBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - aData.realloc( 0 ); - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigInStream->readBytes( aData, nBytesToRead ); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int32 SAL_CALL OPostponedTruncationFileStream::readSomeBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - aData.realloc( 0 ); - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigInStream->readBytes( aData, nMaxBytesToRead ); - } -} - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::skipBytes( ::sal_Int32 nBytesToSkip ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - if ( nBytesToSkip > 0 ) - throw io::BufferSizeExceededException(); - - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigInStream->skipBytes( nBytesToSkip ); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int32 SAL_CALL OPostponedTruncationFileStream::available( ) - throw (io::NotConnectedException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigInStream->available(); - } -} - - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::closeInput() - throw (io::NotConnectedException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - m_pStreamData->m_bInOpen = sal_False; - if ( !m_pStreamData->m_bOutOpen ) - CloseAll_Impl(); -} - - - -// com::sun::star::io::XOutputStream -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::writeBytes( const uno::Sequence< ::sal_Int8 >& aData ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - // writing method must check the truncation - CheckScheduledTruncation_Impl(); - - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigOutStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigOutStream->writeBytes( aData ); -} - - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::flush( ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - { - OSL_ENSURE( sal_False, "flush() call on closed stream!\n" ); - return; - // in future throw exception, for now some code might call flush() on closed stream - // since file ucp implementation allows it - // throw io::NotConnectedException(); - } - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // it is no writing call, thus must be ignored - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigOutStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigOutStream->flush(); - } -} - - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::closeOutput( ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - m_pStreamData->m_bOutOpen = sal_False; - if ( !m_pStreamData->m_bInOpen ) - CloseAll_Impl(); -} - - - -// com::sun::star::io::XTruncate -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::truncate( ) - throw (io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the truncation is already scheduled, ignore - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigTruncate.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigTruncate->truncate(); - } -} - - - -// com::sun::star::io::XSeekable -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::seek( ::sal_Int64 location ) - throw (lang::IllegalArgumentException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - if ( location > 0 ) - throw lang::IllegalArgumentException(); - - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigSeekable.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigSeekable->seek( location ); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int64 SAL_CALL OPostponedTruncationFileStream::getPosition( ) - throw (io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigSeekable.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigSeekable->getPosition(); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int64 SAL_CALL OPostponedTruncationFileStream::getLength( ) - throw (io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigSeekable.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigSeekable->getLength(); - } -} - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::waitForCompletion() - throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - return; - - uno::Reference< io::XAsyncOutputMonitor > asyncOutputMonitor( m_pStreamData->m_xOrigOutStream, uno::UNO_QUERY ); - if ( asyncOutputMonitor.is() ) - asyncOutputMonitor->waitForCompletion(); -} - diff --git a/sfx2/source/doc/opostponedtruncationstream.hxx b/sfx2/source/doc/opostponedtruncationstream.hxx deleted file mode 100644 index fe67319fbbe0..000000000000 --- a/sfx2/source/doc/opostponedtruncationstream.hxx +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_OPOSTPONEDTRUNCATIONFILESTREAM_HXX -#define _SFX_OPOSTPONEDTRUNCATIONFILESTREAM_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "sfx2/dllapi.h" - -//================================================================== -// OPostponedTruncationFileStream -// -// Allows to get stream access to a file, where the first truncation -// of the file is postponed till the first writing. If no writing happens -// after the first truncation/creation, it has no effect. ( The postponing of -// the creation can be switched off during initialization. Here the postponing -// of the creation means that the file will be created immediatelly, but -// if nothing is written into it, it will be removed during destruction -// of the object. ) -// -// On creation of this object the target file is scheduled for -// creation/truncation. But the action happens only during the first -// write access. After the first write access the object behaves -// itself as the original stream. -//================================================================== - -struct PTFStreamData_Impl; -class SFX2_DLLPUBLIC OPostponedTruncationFileStream - : public ::cppu::WeakImplHelper6 < - ::com::sun::star::io::XStream, - ::com::sun::star::io::XInputStream, - ::com::sun::star::io::XOutputStream, - ::com::sun::star::io::XTruncate, - ::com::sun::star::io::XSeekable, - ::com::sun::star::io::XAsyncOutputMonitor > -{ - ::osl::Mutex m_aMutex; - PTFStreamData_Impl* m_pStreamData; - - void CloseAll_Impl(); - - void CheckScheduledTruncation_Impl(); - -public: - - OPostponedTruncationFileStream( - const ::rtl::OUString& aURL, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, - const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream, - sal_Bool bDelete ); - - ~OPostponedTruncationFileStream(); - -// com::sun::star::io::XStream - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XInputStream - virtual ::sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL skipBytes( ::sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL available( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeInput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XOutputStream - virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XTruncate - virtual void SAL_CALL truncate( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XSeekable - virtual void SAL_CALL seek( ::sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int64 SAL_CALL getPosition( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int64 SAL_CALL getLength( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::io::XAsyncOutputMonitor - virtual void SAL_CALL waitForCompletion( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -}; - -#endif //_SFX_OPOSTPONEDTRUNCATIONFILESTREAM_HXX - - -- cgit From bbcce61e3561c9f6afb2e320928bf49b7e6fb417 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 12 Mar 2010 13:16:09 +0100 Subject: dtardon02: #i108503# #i108505# #i108507# #i108508# #i110035# clean up makefiles and #includes --- sfx2/source/doc/docfile.cxx | 1 - sfx2/source/doc/makefile.mk | 1 - 2 files changed, 2 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 0b535088b0bd..c12e63025e47 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -133,7 +133,6 @@ using namespace ::com::sun::star::io; #include #include -#include "opostponedtruncationstream.hxx" #include "helper.hxx" #include // SFX_ITEMSET_SET #include // GetFilterMatcher diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index 7da456ebaa36..b766921e346b 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -75,7 +75,6 @@ SLOFILES = \ $(SLO)$/objembed.obj\ $(SLO)$/graphhelp.obj \ $(SLO)$/QuerySaveDocument.obj \ - $(SLO)$/opostponedtruncationstream.obj \ $(SLO)$/docinsert.obj \ $(SLO)$/docmacromode.obj \ $(SLO)$/SfxDocumentMetaData.obj \ -- cgit From 89af58843bff4f6e17b267542c90ed682ff5363b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 18 Mar 2010 14:21:16 +0100 Subject: sw321bf01: #i109015# to not use the old base URL --- sfx2/source/doc/objstor.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sfx2') diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 6d8deb85b687..6e1d89f2a8cd 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2548,6 +2548,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) // is a new medium "from scratch", so no version should be stored into it SfxItemSet* pSet = new SfxAllItemSet(*pRetrMedium->GetItemSet()); pSet->ClearItem( SID_VERSION ); + pSet->ClearItem( SID_DOC_BASEURL ); // create a medium as a copy; this medium is only for writingm, because it uses the same name as the original one // writing is done through a copy, that will be transferred to the target ( of course after calling HandsOff ) @@ -2833,6 +2834,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl pMergedParams->ClearItem( SID_STREAM ); pMergedParams->ClearItem( SID_CONTENT ); pMergedParams->ClearItem( SID_DOC_READONLY ); + pMergedParams->ClearItem( SID_DOC_BASEURL ); pMergedParams->ClearItem( SID_REPAIRPACKAGE ); -- cgit From 233f8693159884407027678e229805867274d63f Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Tue, 23 Mar 2010 14:51:17 +0100 Subject: sw321bf01: #i109363# Fix crash with quickstarter and OOo file dialogs --- sfx2/source/appl/shutdownicon.cxx | 23 +++++++++++++++++++++-- sfx2/source/appl/shutdownicon.hxx | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 1d85552e47ae..3fce25e7e0d6 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -33,6 +33,7 @@ #include #include #include +#include // #include #include #include @@ -235,6 +236,7 @@ ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) : ShutdownIconServiceBase( m_aMutex ), m_bVeto ( false ), m_bListenForTermination ( false ), + m_bSystemDialogs( false ), m_pResMgr( NULL ), m_pFileDlg( NULL ), m_xServiceManager( aSMgr ), @@ -243,6 +245,7 @@ ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) : m_pPlugin( 0 ), m_bInitialized( false ) { + m_bSystemDialogs = SvtMiscOptions().UseSystemFileDialog(); } ShutdownIcon::~ShutdownIcon() @@ -376,6 +379,16 @@ void ShutdownIcon::StartFileDialog() { ::vos::OGuard aGuard( Application::GetSolarMutex() ); + bool bDirty = ( m_bSystemDialogs != static_cast(SvtMiscOptions().UseSystemFileDialog()) ); + + if ( m_pFileDlg && bDirty ) + { + // Destroy instance as changing the system file dialog setting + // forces us to create a new FileDialogHelper instance! + delete m_pFileDlg; + m_pFileDlg = NULL; + } + if ( !m_pFileDlg ) m_pFileDlg = new FileDialogHelper( WB_OPEN | SFXWB_MULTISELECTION, String() ); m_pFileDlg->StartExecuteModal( STATIC_LINK( this, ShutdownIcon, DialogClosedHdl_Impl ) ); @@ -512,8 +525,14 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR #ifdef WNT // #103346 Destroy dialog to prevent problems with custom controls - delete pThis->m_pFileDlg; - pThis->m_pFileDlg = NULL; + // This fix is dependent on the dialog settings. Destroying the dialog here will + // crash the non-native dialog implementation! Therefore make this dependent on + // the settings. + if ( SvtMiscOptions().UseSystemFileDialog() ) + { + delete pThis->m_pFileDlg; + pThis->m_pFileDlg = NULL; + } #endif LeaveModalMode(); diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index 4e7cc6ecc247..d702f2a50977 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -52,6 +52,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase ::osl::Mutex m_aMutex; bool m_bVeto; bool m_bListenForTermination; + bool m_bSystemDialogs; ResMgr* m_pResMgr; sfx2::FileDialogHelper* m_pFileDlg; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; -- cgit From e6823163e3aa6117f6ee87954b238be2b0e4fa22 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 27 Jan 2010 16:23:59 +0100 Subject: sb118: changed tools/debug to never fall back from writing to shell to writing to file, and read DBGSV_INIT from rtl::Bootstrap; the latter causes problems if tools/debug is called from static code executing before SAL_MAIN has called osl_setCommandArgs -> removed statics from code and added assertions to osl/process; various improvements to smoketests.cxx (incl. passing an appropriate dbgsv.ini for non-pro builds) --- sfx2/source/appl/appuno.cxx | 292 +++++++++++++++++++++---------------------- sfx2/source/appl/sfxhelp.cxx | 15 +-- 2 files changed, 152 insertions(+), 155 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 7fb6ef35167f..e14a65290a16 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -147,54 +147,54 @@ using namespace ::com::sun::star::io; #define FRAMELOADER_SERVICENAME "com.sun.star.frame.FrameLoader" #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler" -static const String sTemplateRegionName = String::CreateFromAscii( "TemplateRegionName" ); -static const String sTemplateName = String::CreateFromAscii( "TemplateName" ); -static const String sAsTemplate = String::CreateFromAscii( "AsTemplate" ); -static const String sOpenNewView = String::CreateFromAscii( "OpenNewView" ); -static const String sViewId = String::CreateFromAscii( "ViewId" ); -static const String sPluginMode = String::CreateFromAscii( "PluginMode" ); -static const String sReadOnly = String::CreateFromAscii( "ReadOnly" ); -static const String sStartPresentation = String::CreateFromAscii( "StartPresentation" ); -static const String sFrameName = String::CreateFromAscii( "FrameName" ); -static const String sMediaType = String::CreateFromAscii( "MediaType" ); -static const String sPostData = String::CreateFromAscii( "PostData" ); -static const String sCharacterSet = String::CreateFromAscii( "CharacterSet" ); -static const String sInputStream = String::CreateFromAscii( "InputStream" ); -static const String sStream = String::CreateFromAscii( "Stream" ); -static const String sOutputStream = String::CreateFromAscii( "OutputStream" ); -static const String sHidden = String::CreateFromAscii( "Hidden" ); -static const String sPreview = String::CreateFromAscii( "Preview" ); -static const String sViewOnly = String::CreateFromAscii( "ViewOnly" ); -static const String sDontEdit = String::CreateFromAscii( "DontEdit" ); -static const String sSilent = String::CreateFromAscii( "Silent" ); -static const String sJumpMark = String::CreateFromAscii( "JumpMark" ); -static const String sFileName = String::CreateFromAscii( "FileName" ); -static const String sSalvageURL = String::CreateFromAscii( "SalvagedFile" ); -static const String sStatusInd = String::CreateFromAscii( "StatusIndicator" ); -static const String sModel = String::CreateFromAscii( "Model" ); -static const String sFrame = String::CreateFromAscii( "Frame" ); -static const String sViewData = String::CreateFromAscii( "ViewData" ); -static const String sFilterData = String::CreateFromAscii( "FilterData" ); -static const String sSelectionOnly = String::CreateFromAscii( "SelectionOnly" ); -static const String sFilterFlags = String::CreateFromAscii( "FilterFlags" ); -static const String sMacroExecMode = String::CreateFromAscii( "MacroExecutionMode" ); -static const String sUpdateDocMode = String::CreateFromAscii( "UpdateDocMode" ); -static const String sMinimized = String::CreateFromAscii( "Minimized" ); -static const String sInteractionHdl = String::CreateFromAscii( "InteractionHandler" ); -static const String sWindowState = String::CreateFromAscii( "WindowState" ); -static const String sUCBContent = String::CreateFromAscii( "UCBContent" ); -static const String sRepairPackage = String::CreateFromAscii( "RepairPackage" ); -static const String sDocumentTitle = String::CreateFromAscii( "DocumentTitle" ); -static const String sComponentData = String::CreateFromAscii( "ComponentData" ); -static const String sComponentContext = String::CreateFromAscii( "ComponentContext" ); -static const String sDocumentBaseURL = String::CreateFromAscii( "DocumentBaseURL" ); -static const String sHierarchicalDocumentName = String::CreateFromAscii( "HierarchicalDocumentName" ); -static const String sCopyStreamIfPossible = String::CreateFromAscii( "CopyStreamIfPossible" ); -static const String sNoAutoSave = String::CreateFromAscii( "NoAutoSave" ); -static const String sFolderName = String::CreateFromAscii( "FolderName" ); -static const String sUseSystemDialog = String::CreateFromAscii( "UseSystemDialog" ); -static const String sStandardDir = String::CreateFromAscii( "StandardDir" ); -static const String sBlackList = String::CreateFromAscii( "BlackList" ); +static char const sTemplateRegionName[] = "TemplateRegionName"; +static char const sTemplateName[] = "TemplateName"; +static char const sAsTemplate[] = "AsTemplate"; +static char const sOpenNewView[] = "OpenNewView"; +static char const sViewId[] = "ViewId"; +static char const sPluginMode[] = "PluginMode"; +static char const sReadOnly[] = "ReadOnly"; +static char const sStartPresentation[] = "StartPresentation"; +static char const sFrameName[] = "FrameName"; +static char const sMediaType[] = "MediaType"; +static char const sPostData[] = "PostData"; +static char const sCharacterSet[] = "CharacterSet"; +static char const sInputStream[] = "InputStream"; +static char const sStream[] = "Stream"; +static char const sOutputStream[] = "OutputStream"; +static char const sHidden[] = "Hidden"; +static char const sPreview[] = "Preview"; +static char const sViewOnly[] = "ViewOnly"; +static char const sDontEdit[] = "DontEdit"; +static char const sSilent[] = "Silent"; +static char const sJumpMark[] = "JumpMark"; +static char const sFileName[] = "FileName"; +static char const sSalvageURL[] = "SalvagedFile"; +static char const sStatusInd[] = "StatusIndicator"; +static char const sModel[] = "Model"; +static char const sFrame[] = "Frame"; +static char const sViewData[] = "ViewData"; +static char const sFilterData[] = "FilterData"; +static char const sSelectionOnly[] = "SelectionOnly"; +static char const sFilterFlags[] = "FilterFlags"; +static char const sMacroExecMode[] = "MacroExecutionMode"; +static char const sUpdateDocMode[] = "UpdateDocMode"; +static char const sMinimized[] = "Minimized"; +static char const sInteractionHdl[] = "InteractionHandler"; +static char const sWindowState[] = "WindowState"; +static char const sUCBContent[] = "UCBContent"; +static char const sRepairPackage[] = "RepairPackage"; +static char const sDocumentTitle[] = "DocumentTitle"; +static char const sComponentData[] = "ComponentData"; +static char const sComponentContext[] = "ComponentContext"; +static char const sDocumentBaseURL[] = "DocumentBaseURL"; +static char const sHierarchicalDocumentName[] = "HierarchicalDocumentName"; +static char const sCopyStreamIfPossible[] = "CopyStreamIfPossible"; +static char const sNoAutoSave[] = "NoAutoSave"; +static char const sFolderName[] = "FolderName"; +static char const sUseSystemDialog[] = "UseSystemDialog"; +static char const sStandardDir[] = "StandardDir"; +static char const sBlackList[] = "BlackList"; void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -469,11 +469,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque for ( sal_uInt16 n=0; n>= bVal) @@ -490,18 +490,18 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque ++nFoundArgs; #endif const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; - String aName = rProp.Name; - if ( aName == sModel ) + rtl::OUString aName = rProp.Name; + if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModel)) ) rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) ); - else if ( aName == sComponentData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentData)) ) { rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) ); } - else if ( aName == sComponentContext ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentContext)) ) { rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) ); } - else if ( aName == sStatusInd ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStatusInd)) ) { Reference< ::com::sun::star::task::XStatusIndicator > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -509,7 +509,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) ); } - else if ( aName == sInteractionHdl ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInteractionHdl)) ) { Reference< ::com::sun::star::task::XInteractionHandler > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -517,11 +517,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) ); } - else if ( aName == sViewData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewData)) ) rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) ); - else if ( aName == sFilterData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterData)) ) rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) ); - else if ( aName == sInputStream ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInputStream)) ) { Reference< XInputStream > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -529,7 +529,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) ); } - else if ( aName == sStream ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStream)) ) { Reference< XInputStream > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -537,7 +537,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) ); } - else if ( aName == sUCBContent ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUCBContent)) ) { Reference< XContent > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -545,7 +545,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) ); } - else if ( aName == sOutputStream ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOutputStream)) ) { Reference< XOutputStream > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -553,7 +553,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) ); } - else if ( aName == sPostData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPostData)) ) { Reference< XInputStream > xVal; sal_Bool bOK = (rProp.Value >>= xVal); @@ -561,7 +561,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) ); } - else if ( aName == sFrame ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) ) { Reference< XFrame > xVal; sal_Bool bOK = (rProp.Value >>= xVal); @@ -569,7 +569,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_FILLFRAME, rProp.Value ) ); } - else if ( aName == sAsTemplate ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sAsTemplate)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -577,7 +577,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) ); } - else if ( aName == sOpenNewView ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOpenNewView)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -585,7 +585,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) ); } - else if ( aName == sViewId ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewId)) ) { sal_Int16 nVal = -1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -593,7 +593,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) ); } - else if ( aName == sPluginMode ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPluginMode)) ) { sal_Int16 nVal = -1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -601,7 +601,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) ); } - else if ( aName == sReadOnly ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sReadOnly)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -609,7 +609,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) ); } - else if ( aName == sStartPresentation ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStartPresentation)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -617,7 +617,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) ); } - else if ( aName == sSelectionOnly ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSelectionOnly)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -625,7 +625,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) ); } - else if ( aName == sHidden ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -633,7 +633,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) ); } - else if ( aName == sMinimized ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMinimized)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -641,7 +641,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) ); } - else if ( aName == sSilent ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSilent)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -649,7 +649,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_SILENT, bVal ) ); } - else if ( aName == sPreview ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPreview)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -657,7 +657,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) ); } - else if ( aName == sViewOnly ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewOnly)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -665,7 +665,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) ); } - else if ( aName == sDontEdit ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDontEdit)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -673,7 +673,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) ); } - else if ( aName == sUseSystemDialog ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUseSystemDialog)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -681,7 +681,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) ); } - else if ( aName == sStandardDir ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStandardDir)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -689,7 +689,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) ); } - else if ( aName == sBlackList ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBlackList)) ) { ::com::sun::star::uno::Sequence< ::rtl::OUString > xVal; sal_Bool bOK = (rProp.Value >>= xVal); @@ -701,7 +701,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque rSet.Put( stringList ); } } - else if ( aName == sFileName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFileName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -709,7 +709,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) ); } - else if ( aName == sSalvageURL ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSalvageURL)) ) { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); @@ -717,7 +717,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) ); } - else if ( aName == sFolderName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFolderName)) ) { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); @@ -725,7 +725,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_PATH, sVal ) ); } - else if ( aName == sFrameName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrameName)) ) { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); @@ -733,7 +733,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK && sVal.getLength()) rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) ); } - else if ( aName == sMediaType ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMediaType)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -741,7 +741,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) ); } - else if ( aName == sWindowState ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sWindowState)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -749,7 +749,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_WIN_POSSIZE, sVal ) ); } - else if ( aName == sTemplateName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -757,7 +757,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) ); } - else if ( aName == sTemplateRegionName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateRegionName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -765,7 +765,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) ); } - else if ( aName == sJumpMark ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sJumpMark)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -773,7 +773,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) ); } - else if ( aName == sCharacterSet ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCharacterSet)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -781,7 +781,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_CHARSET, sVal ) ); } - else if ( aName == sFilterFlags ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterFlags)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -789,7 +789,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) ); } - else if ( aName == sMacroExecMode ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMacroExecMode)) ) { sal_Int16 nVal =-1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -797,7 +797,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) ); } - else if ( aName == sUpdateDocMode ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUpdateDocMode)) ) { sal_Int16 nVal =-1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -805,7 +805,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) ); } - else if ( aName == sRepairPackage ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sRepairPackage)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -813,7 +813,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) ); } - else if ( aName == sDocumentTitle ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentTitle)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -821,7 +821,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) ); } - else if ( aName == sDocumentBaseURL ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentBaseURL)) ) { ::rtl::OUString sVal; // the base url can be set to empty ( for embedded objects for example ) @@ -830,7 +830,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) ); } - else if ( aName == sHierarchicalDocumentName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHierarchicalDocumentName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -838,7 +838,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) ); } - else if ( aName == sCopyStreamIfPossible ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCopyStreamIfPossible)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -846,7 +846,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) ); } - else if ( aName == sNoAutoSave ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNoAutoSave)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -1334,147 +1334,147 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta const SfxPoolItem *pItem=0; if ( rSet.GetItemState( SID_COMPONENTDATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sComponentData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_COMPONENTCONTEXT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sComponentContext; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentContext)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStatusInd; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStatusInd)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_INTERACTIONHANDLER, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sInteractionHdl; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInteractionHdl)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_VIEW_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sViewData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_FILTER_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFilterData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFilterData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOCUMENT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sModel; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModel)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_CONTENT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sUCBContent; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUCBContent)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_INPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sInputStream; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInputStream)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_STREAM, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStream; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStream)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_OUTPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sOutputStream; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOutputStream)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_POSTDATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sPostData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPostData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFrame; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrame)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sAsTemplate; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sAsTemplate)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sOpenNewView; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOpenNewView)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_VIEW_ID, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sViewId; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewId)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_PLUGIN_MODE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sPluginMode; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPluginMode)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOC_READONLY, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sReadOnly; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sReadOnly)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStartPresentation; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStartPresentation)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_SELECTION, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sSelectionOnly; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSelectionOnly)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_HIDDEN, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sHidden; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHidden)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_MINIMIZED, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sMinimized; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMinimized)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_SILENT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sSilent; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSilent)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_PREVIEW, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sPreview; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPreview)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_VIEWONLY, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sViewOnly; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewOnly)); pValue[nActProp++].Value <<= (sal_Bool) (( ((SfxBoolItem*)pItem)->GetValue() )); } if ( rSet.GetItemState( SID_EDITDOC, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sDontEdit; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDontEdit)); pValue[nActProp++].Value <<= (sal_Bool) (!( ((SfxBoolItem*)pItem)->GetValue() )); } if ( rSet.GetItemState( SID_FILE_DIALOG, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sUseSystemDialog; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUseSystemDialog)); pValue[nActProp++].Value <<= (sal_Bool) ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_STANDARD_DIR, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStandardDir; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStandardDir)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_BLACK_LIST, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sBlackList; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sBlackList)); com::sun::star::uno::Sequence< rtl::OUString > aList; ((SfxStringListItem*)pItem)->GetStringList( aList ); @@ -1482,42 +1482,42 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta } if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFrameName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrameName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_DOC_SALVAGE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sSalvageURL; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSalvageURL)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_PATH, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFolderName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFolderName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_CONTENTTYPE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sMediaType; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMediaType)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_WIN_POSSIZE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sWindowState; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sWindowState)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sTemplateName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sTemplateRegionName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateRegionName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_JUMPMARK, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sJumpMark; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sJumpMark)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } @@ -1529,47 +1529,47 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sCharacterSet; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCharacterSet)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_MACROEXECMODE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sMacroExecMode; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMacroExecMode)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_UPDATEDOCMODE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sUpdateDocMode; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUpdateDocMode)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_REPAIRPACKAGE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sRepairPackage; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sRepairPackage)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOCINFO_TITLE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sDocumentTitle; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentTitle)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_DOC_BASEURL, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sDocumentBaseURL; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentBaseURL)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sHierarchicalDocumentName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHierarchicalDocumentName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sCopyStreamIfPossible; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCopyStreamIfPossible)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_NOAUTOSAVE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sNoAutoSave; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sNoAutoSave)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 491de2138917..b24322b09447 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -721,9 +721,6 @@ String SfxHelp::CreateHelpURL_Impl( const String& aCommandURL, const String& rM return aHelpURL; } -static ::rtl::OUString OFFICE_HELP_TASK = ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")); -static ::rtl::OUString OFFICE_HELP = ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP" )); - SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , Reference< XFrame >& rHelpContent) { @@ -732,7 +729,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , // otherwhise - create new help task Reference< XFrame > xHelpTask = xDesktop->findFrame( - OFFICE_HELP_TASK, + ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")), FrameSearchFlag::TASKS | FrameSearchFlag::CREATE); if (!xHelpTask.is()) return 0; @@ -747,7 +744,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , if (xHelpTask->setComponent( xHelpWindow, Reference< XController >() )) { // Customize UI ... - xHelpTask->setName( OFFICE_HELP_TASK ); + xHelpTask->setName( ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")) ); Reference< XPropertySet > xProps(xHelpTask, UNO_QUERY); if (xProps.is()) @@ -761,13 +758,13 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , // This sub frame is created internaly (if we called new SfxHelpWindow_Impl() ...) // It should exist :-) - xHelpContent = xHelpTask->findFrame(OFFICE_HELP, FrameSearchFlag::CHILDREN); + xHelpContent = xHelpTask->findFrame(::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP")), FrameSearchFlag::CHILDREN); } if (!xHelpContent.is()) delete pHelpWindow; - xHelpContent->setName(OFFICE_HELP); + xHelpContent->setName(::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP"))); rHelpTask = xHelpTask; rHelpContent = xHelpContent; @@ -837,10 +834,10 @@ BOOL SfxHelp::Start( const String& rURL, const Window* pWindow ) // in both cases)! Reference< XFrame > xHelp = xDesktop->findFrame( - OFFICE_HELP_TASK, + ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")), FrameSearchFlag::CHILDREN); Reference< XFrame > xHelpContent = xDesktop->findFrame( - OFFICE_HELP, + ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP")), FrameSearchFlag::CHILDREN); SfxHelpWindow_Impl* pHelpWindow = 0; -- cgit From f8e5730d9966d33983de11377ee1ba3f1e8ad987 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 12 Feb 2010 21:44:58 +0100 Subject: sb118: introduced JAVAIFLAGS so that Java interpreter matches OOo jnilibs --- sfx2/qa/complex/docinfo/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/qa/complex/docinfo/makefile.mk b/sfx2/qa/complex/docinfo/makefile.mk index 7c074ccbe838..0ab561b970ef 100644 --- a/sfx2/qa/complex/docinfo/makefile.mk +++ b/sfx2/qa/complex/docinfo/makefile.mk @@ -57,4 +57,4 @@ JARCOMPRESS = TRUE run: - $(JAVAI) -cp $(CLASSPATH) org.openoffice.Runner -TestBase java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b) + $(JAVAI) $(JAVAIFLAGS) -cp $(CLASSPATH) org.openoffice.Runner -TestBase java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b) -- cgit From e3f3cc2d7f5dc477a01eef94601ca3082e82e3a9 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 16 Feb 2010 11:53:58 +0100 Subject: sb118: adapted remaining */qa/unoapi tests to new framework --- sfx2/prj/build.lst | 1 + sfx2/qa/unoapi/Test.java | 51 ++++++++++++++++++++++++++++++++++++++++++++++ sfx2/qa/unoapi/makefile.mk | 36 +++++++++++++++++--------------- 3 files changed, 72 insertions(+), 16 deletions(-) create mode 100644 sfx2/qa/unoapi/Test.java (limited to 'sfx2') diff --git a/sfx2/prj/build.lst b/sfx2/prj/build.lst index 89e618e8fc12..3e791fbc2000 100644 --- a/sfx2/prj/build.lst +++ b/sfx2/prj/build.lst @@ -21,3 +21,4 @@ sf sfx2\source\toolbox nmake - all sf_tbox sf_sdi sf_inc NULL sf sfx2\source\inet nmake - all sf_inet sf_sdi sf_inc NULL sf sfx2\source\explorer nmake - all sf_expl sf_sdi sf_inc NULL sf sfx2\util nmake - all sf_util sf_appl sf_bast sf_cnfg sf_ctrl sf_dlg sf_doc sf_expl sf_inet sf_menu sf_layout sf_noti sf_sbar sf_tbox sf_view NULL +sf sfx2\qa\unoapi nmake - all sf_qa_unoapi NULL diff --git a/sfx2/qa/unoapi/Test.java b/sfx2/qa/unoapi/Test.java new file mode 100644 index 000000000000..4263985c133f --- /dev/null +++ b/sfx2/qa/unoapi/Test.java @@ -0,0 +1,51 @@ +/************************************************************************* +* 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 +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +package org.openoffice.sfx2.qa.unoapi; + +import org.openoffice.Runner; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +public final class Test { + @org.junit.Before public void setUp() throws Exception { + connection.setUp(); + } + + @org.junit.After public void tearDown() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + @org.junit.Test public void test() { + assertTrue( + Runner.run( + "-sce", "sfx.sce", "-xcl", "knownissues.xcl", "-tdoc", + "testdocuments", "-cs", connection.getDescription())); + } + + private final OfficeConnection connection = new OfficeConnection(); +} diff --git a/sfx2/qa/unoapi/makefile.mk b/sfx2/qa/unoapi/makefile.mk index 9d5403bb7c01..ea91ba4d1c44 100644 --- a/sfx2/qa/unoapi/makefile.mk +++ b/sfx2/qa/unoapi/makefile.mk @@ -1,14 +1,9 @@ #************************************************************************* -# # 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: makefile.mk,v $ +# Copyright 2000, 2010 Oracle and/or its affiliates. # -# $Revision: 1.6 $ +# OpenOffice.org - a multi-platform office productivity suite # # This file is part of OpenOffice.org. # @@ -26,19 +21,28 @@ # version 3 along with OpenOffice.org. If not, see # # for a copy of the LGPLv3 License. -# -#************************************************************************* +#***********************************************************************/ -PRJ=..$/.. +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -PRJNAME=sfx2 -TARGET=qa_unoapi +PRJ = ../.. +PRJNAME = sfx2 +TARGET = qa_unoapi -.INCLUDE: settings.mk +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = org/openoffice/sfx2/qa/unoapi +JAVATESTFILES = Test.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END +.INCLUDE: settings.mk .INCLUDE: target.mk +.INCLUDE: installationtest.mk -ALLTAR : UNOAPI_TEST +ALLTAR : javatest -UNOAPI_TEST: - +$(SOLARENV)$/bin$/checkapi -sce sfx.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments +.END -- cgit From ef28bb3801a3970169c5b86f8ced32ef59ce1379 Mon Sep 17 00:00:00 2001 From: npower Developer Date: Mon, 1 Mar 2010 12:29:56 +0000 Subject: npower14miscfixes: #i109699# --- sfx2/inc/sfx2/objsh.hxx | 6 ++++-- sfx2/source/doc/objmisc.cxx | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index e0142e9ba140..fafc5b40679c 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -406,7 +406,8 @@ public: const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam, + bool bRaiseError = true ); static ErrCode CallXScript( @@ -415,7 +416,8 @@ public: const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam, + bool bRaiseError = true ); /** adjusts the internal macro mode, according to the current security settings diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 1cb88e98f59f..5c6bc72e9707 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1690,7 +1690,7 @@ namespace } ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL, - const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) + const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError ) { OSL_TRACE( "in CallXScript" ); ErrCode nErr = ERRCODE_NONE; @@ -1731,7 +1731,7 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon nErr = ERRCODE_BASIC_INTERNAL_ERROR; } - if ( bCaughtException ) + if ( bCaughtException && bRaiseError ) { ::std::auto_ptr< VclAbstractDialog > pScriptErrDlg; SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); @@ -1754,8 +1754,8 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL, aParams, ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& - aOutParam) + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam + , bool bRaiseError ) { return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam ); } -- cgit From 92f22b7636d7c18c6830e7da1298a5aa93537fa1 Mon Sep 17 00:00:00 2001 From: npower Developer Date: Thu, 4 Mar 2010 23:07:14 +0000 Subject: npower14miscfixes: wae removal --- sfx2/source/doc/objmisc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 5c6bc72e9707..259bf2699825 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1757,7 +1757,7 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam , bool bRaiseError ) { - return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam ); + return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError ); } //------------------------------------------------------------------------- -- cgit From d4656e889e0aec1c8d2316ddcedb3bbf5d36df5a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 12 Mar 2010 09:49:07 +0100 Subject: slidecopy: use ::Window instead of Window, useful in contexts where somebody had the idea of defining another (namespaced) class Window ... --- sfx2/inc/sfx2/childwin.hxx | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/childwin.hxx b/sfx2/inc/sfx2/childwin.hxx index 2c240dae89af..f2f759a0278b 100644 --- a/sfx2/inc/sfx2/childwin.hxx +++ b/sfx2/inc/sfx2/childwin.hxx @@ -90,13 +90,13 @@ struct SfxChildWinInfo }; // Factory-Methode eines ChildWindows -typedef SfxChildWindow* (*SfxChildWinCtor)( Window *pParentWindow, +typedef SfxChildWindow* (*SfxChildWinCtor)( ::Window *pParentWindow, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo); // Factory-Methode eines ChildWindowsContexts -typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( Window *pParentWindow, +typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( ::Window *pParentWindow, SfxBindings *pBindings, SfxChildWinInfo *pInfo); struct SfxChildWinContextFactory @@ -146,8 +146,8 @@ struct SfxChildWindow_Impl; class SFX2_DLLPUBLIC SfxChildWindowContext { friend class SfxChildWindow; - Window* pWindow; - sal_uInt16 nContextId; + ::Window* pWindow; + sal_uInt16 nContextId; protected: SfxChildWindowContext( sal_uInt16 nId ); @@ -155,9 +155,9 @@ protected: public: virtual ~SfxChildWindowContext(); - void SetWindow( Window* pWin ) + void SetWindow( ::Window* pWin ) { pWindow=pWin; } - Window* GetWindow() const + ::Window* GetWindow() const { return pWindow; } sal_uInt16 GetContextId() const { return nContextId; } @@ -172,12 +172,12 @@ public: class SFX2_DLLPUBLIC SfxChildWindow { - Window* pParent; // parent window ( Topwindow ) - sal_uInt16 nType; // ChildWindow-Id + ::Window* pParent; // parent window ( Topwindow ) + sal_uInt16 nType; // ChildWindow-Id protected: SfxChildAlignment eChildAlignment;// aktuelles ::com::sun::star::drawing::Alignment - Window* pWindow; // eigentlicher Inhalt + ::Window* pWindow; // eigentlicher Inhalt SfxChildWindow_Impl* pImp; // Imp-Daten private: @@ -188,14 +188,14 @@ private: { return pContext; } protected: - SfxChildWindow(Window *pParentWindow, sal_uInt16 nId); + SfxChildWindow(::Window *pParentWindow, sal_uInt16 nId); public: virtual ~SfxChildWindow(); void Destroy(); - Window* GetWindow() const + ::Window* GetWindow() const { return pWindow; } - Window* GetParent() const + ::Window* GetParent() const { return pParent; } SfxChildAlignment GetAlignment() const { return eChildAlignment; } @@ -220,17 +220,17 @@ public: sal_uInt16 GetContextId() const { return pContext ? pContext->GetContextId(): 0; } - Window* GetContextWindow() const + ::Window* GetContextWindow() const { return pContext ? pContext->GetWindow(): 0; } - Window* GetContextWindow( SfxModule *pModule ) const; + ::Window* GetContextWindow( SfxModule *pModule ) const; virtual SfxChildWinInfo GetInfo() const; void SaveStatus(const SfxChildWinInfo& rInfo); static void RegisterChildWindow(SfxModule*, SfxChildWinFactory*); - static SfxChildWindow* CreateChildWindow( sal_uInt16, Window*, SfxBindings*, SfxChildWinInfo&); + static SfxChildWindow* CreateChildWindow( sal_uInt16, ::Window*, SfxBindings*, SfxChildWinInfo&); void SetHideNotDelete( sal_Bool bOn ); sal_Bool IsHideNotDelete() const; void SetHideAtToggle( sal_Bool bOn ); @@ -261,19 +261,19 @@ public: //------------------------------------------------------------------ //! demn"achst hinf"allig ! #define SFX_DECL_CHILDWINDOW_CONTEXT(Class) \ - static SfxChildWindowContext* CreateImpl(Window *pParent, \ + static SfxChildWindowContext* CreateImpl(::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ static void RegisterChildWindowContext(SfxModule *pMod=0); \ //! Das Macro der Zukunft ... #define SFX_DECL_CHILDWINDOWCONTEXT(Class) \ - static SfxChildWindowContext* CreateImpl(Window *pParent, \ + static SfxChildWindowContext* CreateImpl(::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ static void RegisterChildWindowContext(sal_uInt16, SfxModule *pMod=0); \ //! demn"achst hinf"allig ! #define SFX_IMPL_CHILDWINDOW_CONTEXT(Class, MyID, ShellClass) \ - SfxChildWindowContext* __EXPORT Class::CreateImpl( Window *pParent, \ + SfxChildWindowContext* __EXPORT Class::CreateImpl( ::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ { \ SfxChildWindowContext *pContext = new Class(pParent, \ @@ -293,7 +293,7 @@ public: // CreateImpl mu\s noch als Parameter die Factory mitbekommen wg. ContextId // Solange wird diese Id auf 0 gesetzt und in SfxChildWindow::CreateContext gepatched #define SFX_IMPL_CHILDWINDOWCONTEXT(Class, MyID) \ - SfxChildWindowContext* __EXPORT Class::CreateImpl( Window *pParent, \ + SfxChildWindowContext* __EXPORT Class::CreateImpl( ::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ { \ SfxChildWindowContext *pContext = new Class(pParent,0,pBindings,pInfo);\ @@ -308,7 +308,7 @@ public: #define SFX_DECL_CHILDWINDOW(Class) \ public : \ - static SfxChildWindow* CreateImpl(Window *pParent, sal_uInt16 nId, \ + static SfxChildWindow* CreateImpl(::Window *pParent, sal_uInt16 nId, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ static void RegisterChildWindow (sal_Bool bVisible=sal_False, SfxModule *pMod=NULL, sal_uInt16 nFlags=0); \ static sal_uInt16 GetChildWindowId ();\ @@ -318,7 +318,7 @@ public: SFX_IMPL_POS_CHILDWINDOW(Class, MyID, CHILDWIN_NOPOS) #define SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \ - SfxChildWindow* __EXPORT Class::CreateImpl( Window *pParent, \ + SfxChildWindow* __EXPORT Class::CreateImpl( ::Window *pParent, \ sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ { \ SfxChildWindow *pWin = new Class(pParent, nId, pBindings, pInfo);\ -- cgit From 9fed38e7d84614ba7000a19ad868af15b63ec720 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 15 Mar 2010 11:34:42 +0100 Subject: odfmetadata4: #i110033#: API change: remove rdfs:label statements for RDFa. css.rdf.XDocumentRepository: method getStatementRDFa() also returns a bool. librdf_repository: setStatementRDFa() no longer generates the rdfs:label statement. getStatementRDFa() no longer handles the rdfs:label statement. add a set to store elements with xhtml:content. RDFaExportHelper: adapt export to new getStatementRDFa() and lack of rdfs:label statement. --- sfx2/qa/complex/DocumentMetadataAccessTest.java | 125 +++++++++++++----------- 1 file changed, 66 insertions(+), 59 deletions(-) (limited to 'sfx2') diff --git a/sfx2/qa/complex/DocumentMetadataAccessTest.java b/sfx2/qa/complex/DocumentMetadataAccessTest.java index 05dc523d6f8b..a61280c45fe5 100644 --- a/sfx2/qa/complex/DocumentMetadataAccessTest.java +++ b/sfx2/qa/complex/DocumentMetadataAccessTest.java @@ -42,6 +42,7 @@ import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.WrappedTargetRuntimeException; import com.sun.star.beans.XPropertySet; import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.Pair; import com.sun.star.beans.StringPair; import com.sun.star.container.XEnumerationAccess; import com.sun.star.container.XEnumeration; @@ -689,23 +690,25 @@ public class DocumentMetadataAccessTest extends ComplexTestCase log.println("Checking RDFa in loaded test document..."); XMetadatable xPara; - Statement[] stmts; + Pair result; Statement x_FooBarLit1 = new Statement(foo, bar, mkLit("1"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 1", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FooBarLit1 })); Statement x_FooBarLit2 = new Statement(foo, bar, mkLit("2"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 2", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FooBarLit2 })); @@ -713,37 +716,40 @@ public class DocumentMetadataAccessTest extends ComplexTestCase new Statement(blank1, bar, mkLit("3"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 3", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_BlankBarLit3 })); XBlankNode b3 = (XBlankNode) UnoRuntime.queryInterface( - XBlankNode.class, stmts[0].Subject); + XBlankNode.class, result.First[0].Subject); Statement x_BlankBarLit4 = new Statement(blank2, bar, mkLit("4"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 4", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_BlankBarLit4 })); XBlankNode b4 = (XBlankNode) UnoRuntime.queryInterface( - XBlankNode.class, stmts[0].Subject); + XBlankNode.class, result.First[0].Subject); Statement x_BlankBarLit5 = new Statement(blank1, bar, mkLit("5"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 5", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_BlankBarLit5 })); XBlankNode b5 = (XBlankNode) UnoRuntime.queryInterface( - XBlankNode.class, stmts[0].Subject); + XBlankNode.class, result.First[0].Subject); assure("RDFa: 3 != 4", !b3.getStringValue().equals(b4.getStringValue())); @@ -754,9 +760,10 @@ public class DocumentMetadataAccessTest extends ComplexTestCase Statement x_FooBazLit6 = new Statement(foo, baz, mkLit("6"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 6", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FooBarLit6, x_FooBazLit6 })); @@ -765,9 +772,10 @@ public class DocumentMetadataAccessTest extends ComplexTestCase Statement x_FooFooLit7 = new Statement(foo, foo, mkLit("7"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 7", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FooBarLit7, x_FooBazLit7, x_FooFooLit7 })); @@ -776,43 +784,41 @@ public class DocumentMetadataAccessTest extends ComplexTestCase Statement x_FooBarLit = new Statement(foo, bar, lit, null); Statement x_FooBarLittype = new Statement(foo, bar, lit_type, null); - Statement x_FooLabelLit8 = - new Statement(foo, rdfs_label, mkLit("8"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 8", - eq(stmts, new Statement[] { - x_FooBarLit, x_FooLabelLit8 + result.Second && + eq(result.First, new Statement[] { + x_FooBarLit })); - Statement x_FooLabelLit9 = - new Statement(foo, rdfs_label, mkLit("9"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 9", - eq(stmts, new Statement[] { - x_FooBarLit, x_FooLabelLit9 + result.Second && + eq(result.First, new Statement[] { + x_FooBarLit })); - Statement x_FooLabelLit10 = - new Statement(foo, rdfs_label, mkLit("10"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 10", - eq(stmts, new Statement[] { - x_FooBarLittype, x_FooLabelLit10 + result.Second && + eq(result.First, new Statement[] { + x_FooBarLittype })); Statement x_FooBarLit11 = new Statement(foo, bar, mkLit("11", bar), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 11", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FooBarLit11 })); @@ -821,66 +827,67 @@ public class DocumentMetadataAccessTest extends ComplexTestCase new Statement(xFile, bar, mkLit("12"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 12", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FileBarLit12 })); - Statement x_FooLabelLit13 = - new Statement(foo, rdfs_label, mkLit("13"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 13", - eq(stmts, new Statement[] { - x_FooBarLit, x_FooLabelLit13 + result.Second && + eq(result.First, new Statement[] { + x_FooBarLit })); Statement x_FooLabelLit14 = new Statement(foo, rdfs_label, mkLit("14"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 14", - eq(stmts, new Statement[] { - x_FooBarLit, x_FooLabelLit14 + result.Second && + eq(result.First, new Statement[] { + x_FooBarLit })); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 15", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 15", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 16", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 16", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 17", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 17", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 18", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 18", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 19", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 19", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 20", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 20", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 21", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 21", eq(result.First, new Statement[] { } )); log.println("...done"); -- cgit From 880c875024df2b8cd73056a7f91258f27b91c674 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 15 Mar 2010 12:53:14 +0100 Subject: odfmetadata4: sfx2::Metadatable: split CreateUndo() into 2 methods --- sfx2/inc/sfx2/Metadatable.hxx | 4 +-- sfx2/source/doc/Metadatable.cxx | 60 ++++++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 30 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/Metadatable.hxx b/sfx2/inc/sfx2/Metadatable.hxx index 068a6c4a4544..273eb1afef87 100644 --- a/sfx2/inc/sfx2/Metadatable.hxx +++ b/sfx2/inc/sfx2/Metadatable.hxx @@ -98,8 +98,8 @@ public: const bool i_bCopyPrecedesSource = false); /** create an Undo Metadatable, which remembers this' reference */ - ::boost::shared_ptr CreateUndo( - const bool i_isDelete = false); + ::boost::shared_ptr CreateUndo() const; + ::boost::shared_ptr CreateUndoForDelete(); /** restore this from Undo Metadatable */ void RestoreMetadata(::boost::shared_ptr const& i_pUndo); diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index b1b69e5ac74f..b220182d21f1 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -1488,8 +1488,7 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, } } -::boost::shared_ptr Metadatable::CreateUndo( - const bool i_isDelete) +::boost::shared_ptr Metadatable::CreateUndo() const { OSL_ENSURE(!IsInUndo(), "CreateUndo called for object in undo?"); OSL_ENSURE(!IsInClipboard(), "CreateUndo called for object in clipboard?"); @@ -1503,11 +1502,6 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, pRegDoc->CreateUndo(*this) ); pRegDoc->RegisterCopy(*this, *pUndo, false); pUndo->m_pReg = pRegDoc; - - if (i_isDelete) - { - RemoveMetadataReference(); - } return pUndo; } } @@ -1518,6 +1512,13 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, return ::boost::shared_ptr(); } +::boost::shared_ptr Metadatable::CreateUndoForDelete() +{ + ::boost::shared_ptr const pUndo( CreateUndo() ); + RemoveMetadataReference(); + return pUndo; +} + void Metadatable::RestoreMetadata( ::boost::shared_ptr const& i_pUndo) { @@ -1624,15 +1625,16 @@ MetadatableMixin::getMetadataReference() throw (uno::RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Metadatable* pObject( GetCoreObject() ); - if (pObject) - { - return pObject->GetMetadataReference(); - } - else + + Metadatable *const pObject( GetCoreObject() ); + if (!pObject) { - throw uno::RuntimeException(); + throw uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "MetadatableMixin: cannot get core object; not inserted?")), + *this); } + return pObject->GetMetadataReference(); } void SAL_CALL @@ -1641,30 +1643,32 @@ MetadatableMixin::setMetadataReference( throw (uno::RuntimeException, lang::IllegalArgumentException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Metadatable* pObject( GetCoreObject() ); - if (pObject) - { - return pObject->SetMetadataReference(i_rReference); - } - else + + Metadatable *const pObject( GetCoreObject() ); + if (!pObject) { - throw uno::RuntimeException(); + throw uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "MetadatableMixin: cannot get core object; not inserted?")), + *this); } + return pObject->SetMetadataReference(i_rReference); } void SAL_CALL MetadatableMixin::ensureMetadataReference() throw (uno::RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Metadatable* pObject( GetCoreObject() ); - if (pObject) - { - return pObject->EnsureMetadataReference(); - } - else + + Metadatable *const pObject( GetCoreObject() ); + if (!pObject) { - throw uno::RuntimeException(); + throw uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "MetadatableMixin: cannot get core object; not inserted?")), + *this); } + return pObject->EnsureMetadataReference(); } } // namespace sfx2 -- cgit From b164e350dec6d682834e997cf8aae6471ec6afee Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 15 Mar 2010 12:53:14 +0100 Subject: odfmetadata4: Metadatable: improve generation of xml:ids: replace rand(), which only produces 0..2^31 on solaris, with a rtlRandomPool. --- sfx2/source/doc/Metadatable.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index b220182d21f1..1a51bee5024f 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -33,6 +33,8 @@ #include #include // solarmutex +#include + #include #include @@ -401,14 +403,16 @@ template< typename T > /*static*/ ::rtl::OUString create_id(const ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > & i_rXmlIdMap) { + static rtlRandomPool s_Pool( rtl_random_createPool() ); const ::rtl::OUString prefix( ::rtl::OUString::createFromAscii(s_prefix) ); typename ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > ::const_iterator iter; ::rtl::OUString id; do { - const int n( rand() ); - id = prefix + ::rtl::OUString::valueOf(static_cast(n)); + sal_Int32 n; + rtl_random_getBytes(s_Pool, & n, sizeof(n)); + id = prefix + ::rtl::OUString::valueOf(static_cast(abs(n))); iter = i_rXmlIdMap.find(id); } while (iter != i_rXmlIdMap.end()); -- cgit From 5b84b9f616734dca66bce10eac11e62462fcf26a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 16 Mar 2010 23:15:08 +0100 Subject: slidecopy: minor edit ... let GetImage/ByURL take a 'const Reference&', not a 'Reference&' --- sfx2/inc/imagemgr.hxx | 2 +- sfx2/source/appl/imagemgr.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/imagemgr.hxx b/sfx2/inc/imagemgr.hxx index faceb7bf846e..65235a7a66e5 100644 --- a/sfx2/inc/imagemgr.hxx +++ b/sfx2/inc/imagemgr.hxx @@ -36,4 +36,4 @@ #include #include -SFX2_DLLPUBLIC Image SAL_CALL GetImage( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ); +SFX2_DLLPUBLIC Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ); diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx index 6f226bad8040..3978153a48f0 100644 --- a/sfx2/source/appl/imagemgr.cxx +++ b/sfx2/source/appl/imagemgr.cxx @@ -74,7 +74,7 @@ static WeakReference< XModuleUIConfigurationManagerSupplier > m_xModuleCfgMgrSup static WeakReference< XURLTransformer > m_xURLTransformer; static ModuleIdToImagegMgr m_aModuleIdToImageMgrMap; -Image SAL_CALL GetImage( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ) +Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ) { // TODO/LATeR: shouldn't this become a method at SfxViewFrame?! That would save the UnoTunnel if ( !rFrame.is() ) -- cgit From fbf42f650eca6002756deb47d051257a4672c680 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 17 Mar 2010 11:59:34 +0100 Subject: #i109668# let the default filter be used for export --- sfx2/source/doc/guisaveas.cxx | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index cbd269b41516..6ee4d7f78e17 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -836,9 +836,16 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, ::rtl::OUString aAdjustToType; - // bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format - if ( !(( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED )) && - ( bSetStandardName || GetStorable()->hasLocation() )) + if ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) + { + // it is export, set the preselected filter + ::rtl::OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( + ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString() ); + pFileDlg->SetCurrentFilter( aFilterUIName ); + } + // it is no export, bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format + else if ( bSetStandardName || GetStorable()->hasLocation() ) { uno::Sequence< beans::PropertyValue > aOldFilterProps; ::rtl::OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault( @@ -1570,8 +1577,10 @@ uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter( uno::Reference< container::XEnumeration > xFilterEnum = xFilterQuery->createSubSetEnumerationByProperties( aSearchRequest ); - // use the first filter that is found + // the first default filter will be taken, + // if there is no filter with flag default the first acceptable filter will be taken if ( xFilterEnum.is() ) + { while ( xFilterEnum->hasMoreElements() ) { uno::Sequence< beans::PropertyValue > aProps; @@ -1582,11 +1591,17 @@ uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter( (sal_Int32)0 ); if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) ) { - aFilterProps = aProps; - break; + if ( ( nFlags & SFX_FILTER_DEFAULT ) == SFX_FILTER_DEFAULT ) + { + aFilterProps = aProps; + break; + } + else if ( !aFilterProps.getLength() ) + aFilterProps = aProps; } } } + } return aFilterProps; } -- cgit From 212d8ff7d4f100c5d72893a59c1e37d11c9582ca Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Mon, 22 Mar 2010 13:07:57 +0100 Subject: npower14miscfixes: crlf removed --- sfx2/source/doc/objmisc.cxx | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 sfx2/source/doc/objmisc.cxx (limited to 'sfx2') diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx old mode 100644 new mode 100755 -- cgit From 67d5e1f85b4681f14e501b34a12f13e4575ac310 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Tue, 30 Mar 2010 16:44:06 +0200 Subject: nativea: #161787# Use folder icon from Windows shell library --- sfx2/source/appl/shutdowniconw32.cxx | 40 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index c334fd750fc6..d5d52a02fda5 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -109,7 +109,7 @@ using namespace ::osl; #define ICON_TEMPLATE 16 #define ICON_MACROLIBRARY 17 #define ICON_CONFIGURATION 18 -#define ICON_OPEN 19 +#define ICON_OPEN 5 // See index of open folder icon in shell32.dll #define ICON_SETUP 500 #define SFX_TASKBAR_NOTIFICATION WM_USER+1 @@ -124,6 +124,7 @@ static void OnDrawItem(HWND hwnd, LPDRAWITEMSTRUCT lpdis); typedef struct tagMYITEM { OUString text; + OUString module; UINT iconId; } MYITEM; @@ -152,7 +153,7 @@ static bool isNT() // ------------------------------- -static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, int bOwnerdraw ) +static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, int bOwnerdraw, const OUString& module ) { MENUITEMINFOW mi; memset( &mi, 0, sizeof( MENUITEMINFOW ) ); @@ -175,6 +176,7 @@ static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text MYITEM *pMyItem = new MYITEM; pMyItem->text = text; pMyItem->iconId = iconId; + pMyItem->module = module; mi.dwItemData = (DWORD) pMyItem; } else @@ -245,6 +247,8 @@ static HMENU createSystrayMenu( ) { SvtModuleOptions::E_SMATH, IDM_MATH, ICON_MATH_DOCUMENT, MATH_URL }, }; + OUString aEmpty; + // insert the menu entries for launching the applications for ( size_t i = 0; i < sizeof( aMenuItems ) / sizeof( aMenuItems[0] ); ++i ) { @@ -260,19 +264,21 @@ static HMENU createSystrayMenu( ) continue; addMenuItem( hMenu, aMenuItems[i].nMenuItemID, aMenuItems[i].nMenuIconID, - pShutdownIcon->GetUrlDescription( sURL ), pos, true ); + pShutdownIcon->GetUrlDescription( sURL ), pos, true, aEmpty ); } + + // insert the remaining menu entries addMenuItem( hMenu, IDM_TEMPLATE, ICON_TEMPLATE, - pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true); - addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false ); - addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true ); - addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false ); + pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true, aEmpty); + addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); + addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString::createFromAscii( "shell32" )); + addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); #endif - addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false ); - addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false ); - addMenuItem( hMenu, IDM_EXIT, 0, pShutdownIcon->GetResString( STR_QUICKSTART_EXIT ), pos, false ); + addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false, aEmpty ); + addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); + addMenuItem( hMenu, IDM_EXIT, 0, pShutdownIcon->GetResString( STR_QUICKSTART_EXIT ), pos, false, aEmpty ); // indicate status of autostart folder CheckMenuItem( hMenu, IDM_INSTALL, MF_BYCOMMAND | (ShutdownIcon::GetAutostart() ? MF_CHECKED : MF_UNCHECKED) ); @@ -738,9 +744,17 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) int cx = GetSystemMetrics( SM_CXSMICON ); int cy = GetSystemMetrics( SM_CYSMICON ); - HICON hIcon = (HICON) LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( pMyItem->iconId ), - IMAGE_ICON, cx, cy, - LR_DEFAULTCOLOR | LR_SHARED ); + HICON hIcon( 0 ); + + if ( pMyItem->module.getLength() > 0 ) + hIcon = (HICON) LoadImageA( GetModuleHandleW( reinterpret_cast( pMyItem->module.getStr() )), + MAKEINTRESOURCE( pMyItem->iconId ), + IMAGE_ICON, cx, cy, + LR_DEFAULTCOLOR | LR_SHARED ); + else + hIcon = (HICON) LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( pMyItem->iconId ), + IMAGE_ICON, cx, cy, + LR_DEFAULTCOLOR | LR_SHARED ); // DrawIconEx( lpdis->hDC, x, y+(height-cy)/2, hIcon, cx, cy, 0, NULL, DI_NORMAL ); -- cgit From 7a9501c430ba465163b9b97c7ccec032eb6c9fc3 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 30 Mar 2010 18:37:32 +0200 Subject: fwk138: #i97378#: publish DocumentProperties: publish css.document.{,X}DocumentProperties{,Supplier}. css.document.OfficeDocument: add XDocumentPropertiesSupplier. css.document.XDocumentProperties: remove css.uno.Exception from signatures. --- sfx2/source/doc/SfxDocumentMetaData.cxx | 37 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index adad9cbcbf51..bde5ef6efae7 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -38,7 +38,6 @@ #include "com/sun/star/util/XModifiable.hpp" #include "com/sun/star/xml/sax/XSAXSerializable.hpp" -#include "com/sun/star/lang/NullPointerException.hpp" #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/lang/EventObject.hpp" #include "com/sun/star/beans/XPropertySet.hpp" @@ -248,25 +247,21 @@ public: const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); virtual void SAL_CALL loadFromMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); virtual void SAL_CALL storeToStorage( const css::uno::Reference< css::embed::XStorage > & Storage, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); virtual void SAL_CALL storeToMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); // ::com::sun::star::lang::XInitialization: virtual void SAL_CALL initialize( @@ -1862,8 +1857,7 @@ SfxDocumentMetaData::loadFromStorage( const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { if (!xStorage.is()) throw css::lang::IllegalArgumentException( ::rtl::OUString::createFromAscii("SfxDocumentMetaData::loadFromStorage:" @@ -1875,10 +1869,10 @@ SfxDocumentMetaData::loadFromStorage( xStorage->openStreamElement( ::rtl::OUString::createFromAscii(s_metaXml), css::embed::ElementModes::READ) ); - if (!xStream.is()) throw css::lang::NullPointerException(); + if (!xStream.is()) throw css::uno::RuntimeException(); css::uno::Reference xInStream = xStream->getInputStream(); - if (!xInStream.is()) throw css::lang::NullPointerException(); + if (!xInStream.is()) throw css::uno::RuntimeException(); // create DOM parser service css::uno::Reference xMsf ( @@ -1942,8 +1936,7 @@ SfxDocumentMetaData::storeToStorage( const css::uno::Reference< css::embed::XStorage > & xStorage, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { if (!xStorage.is()) throw css::lang::IllegalArgumentException( ::rtl::OUString::createFromAscii("SfxDocumentMetaData::storeToStorage:" @@ -1959,7 +1952,7 @@ SfxDocumentMetaData::storeToStorage( xStorage->openStreamElement(::rtl::OUString::createFromAscii(s_metaXml), css::embed::ElementModes::WRITE | css::embed::ElementModes::TRUNCATE); - if (!xStream.is()) throw css::lang::NullPointerException(); + if (!xStream.is()) throw css::uno::RuntimeException(); css::uno::Reference< css::beans::XPropertySet > xStreamProps(xStream, css::uno::UNO_QUERY_THROW); xStreamProps->setPropertyValue( @@ -1973,7 +1966,7 @@ SfxDocumentMetaData::storeToStorage( css::uno::makeAny(static_cast (sal_False))); css::uno::Reference xOutStream = xStream->getOutputStream(); - if (!xOutStream.is()) throw css::lang::NullPointerException(); + if (!xOutStream.is()) throw css::uno::RuntimeException(); css::uno::Reference xMsf ( m_xContext->getServiceManager()); css::uno::Reference xSaxWriter( @@ -2021,8 +2014,7 @@ void SAL_CALL SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { css::uno::Reference xIn; ::comphelper::MediaDescriptor md(Medium); @@ -2056,7 +2048,7 @@ SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL, css::uno::makeAny(e)); } if (!xStorage.is()) { - throw css::lang::NullPointerException(::rtl::OUString::createFromAscii( + throw css::uno::RuntimeException(::rtl::OUString::createFromAscii( "SfxDocumentMetaData::loadFromMedium: cannot get Storage"), *this); } @@ -2067,8 +2059,7 @@ void SAL_CALL SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { ::comphelper::MediaDescriptor md(Medium); if (!URL.equalsAscii("")) { @@ -2080,7 +2071,7 @@ SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL, if (!xStorage.is()) { - throw css::lang::NullPointerException(::rtl::OUString::createFromAscii( + throw css::uno::RuntimeException(::rtl::OUString::createFromAscii( "SfxDocumentMetaData::storeToMedium: cannot get Storage"), *this); } -- cgit From 0436f69e21da10550f3eb3af6a02800467a7bd42 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 1 Apr 2010 09:50:13 +0200 Subject: nativea: #161787# More safe code to retrieve open icon from shell library --- sfx2/source/appl/shutdowniconw32.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index d5d52a02fda5..7dd043ad85f8 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -747,10 +747,19 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) HICON hIcon( 0 ); if ( pMyItem->module.getLength() > 0 ) - hIcon = (HICON) LoadImageA( GetModuleHandleW( reinterpret_cast( pMyItem->module.getStr() )), + { + LPCWSTR pModuleName = reinterpret_cast( pMyItem->module.getStr() ); + HMODULE hModule = GetModuleHandleW( pModuleName ); + if ( hModule == NULL ) + { + LoadLibraryW( pModuleName ); + hModule = GetModuleHandleW( pModuleName ); + } + hIcon = (HICON) LoadImageA( hModule, MAKEINTRESOURCE( pMyItem->iconId ), IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR | LR_SHARED ); + } else hIcon = (HICON) LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( pMyItem->iconId ), IMAGE_ICON, cx, cy, -- cgit From 34d095ff24aa6966edf988d5d3b1654ab349dd3e Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 1 Apr 2010 14:52:37 +0200 Subject: nativea: #161787# Ensure that SHELL32 is mapped when accessing via GetModuleHandle --- sfx2/source/appl/shutdowniconw32.cxx | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index 7dd043ad85f8..26fd35272a51 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -273,7 +273,7 @@ static HMENU createSystrayMenu( ) addMenuItem( hMenu, IDM_TEMPLATE, ICON_TEMPLATE, pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true, aEmpty); addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); - addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString::createFromAscii( "shell32" )); + addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString::createFromAscii( "SHELL32" )); addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); #endif addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false, aEmpty ); @@ -742,28 +742,25 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) x = aRect.left; y = aRect.top; - int cx = GetSystemMetrics( SM_CXSMICON ); - int cy = GetSystemMetrics( SM_CYSMICON ); - HICON hIcon( 0 ); + int cx = GetSystemMetrics( SM_CXSMICON ); + int cy = GetSystemMetrics( SM_CYSMICON ); + HICON hIcon( 0 ); + HMODULE hModule( GetModuleHandle( NULL ) ); if ( pMyItem->module.getLength() > 0 ) { LPCWSTR pModuleName = reinterpret_cast( pMyItem->module.getStr() ); - HMODULE hModule = GetModuleHandleW( pModuleName ); + hModule = GetModuleHandleW( pModuleName ); if ( hModule == NULL ) { LoadLibraryW( pModuleName ); hModule = GetModuleHandleW( pModuleName ); } - hIcon = (HICON) LoadImageA( hModule, - MAKEINTRESOURCE( pMyItem->iconId ), - IMAGE_ICON, cx, cy, - LR_DEFAULTCOLOR | LR_SHARED ); } - else - hIcon = (HICON) LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( pMyItem->iconId ), - IMAGE_ICON, cx, cy, - LR_DEFAULTCOLOR | LR_SHARED ); + + hIcon = (HICON) LoadImageA( hModule, MAKEINTRESOURCE( pMyItem->iconId ), + IMAGE_ICON, cx, cy, + LR_DEFAULTCOLOR | LR_SHARED ); // DrawIconEx( lpdis->hDC, x, y+(height-cy)/2, hIcon, cx, cy, 0, NULL, DI_NORMAL ); -- cgit From c87db97f8cdd1c7fc9be95bb7028ccf68af66075 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:21:52 +0200 Subject: slidecopy: removed seemingly unused sfx2/win folder, containing some old icons used when we had an own Explorer --- sfx2/prj/build.lst | 1 - sfx2/win/res/expdesk.ico | Bin 4990 -> 0 bytes sfx2/win/res/expexp.ico | Bin 2758 -> 0 bytes sfx2/win/res/expfld.ico | Bin 2758 -> 0 bytes sfx2/win/res/expftp.ico | Bin 2758 -> 0 bytes sfx2/win/res/exptrash.ico | Bin 2758 -> 0 bytes sfx2/win/res/expwork.ico | Bin 2758 -> 0 bytes sfx2/win/res/frameset.ico | Bin 2758 -> 0 bytes sfx2/win/res/search.ico | Bin 2758 -> 0 bytes 9 files changed, 1 deletion(-) delete mode 100644 sfx2/win/res/expdesk.ico delete mode 100644 sfx2/win/res/expexp.ico delete mode 100644 sfx2/win/res/expfld.ico delete mode 100644 sfx2/win/res/expftp.ico delete mode 100644 sfx2/win/res/exptrash.ico delete mode 100644 sfx2/win/res/expwork.ico delete mode 100644 sfx2/win/res/frameset.ico delete mode 100644 sfx2/win/res/search.ico (limited to 'sfx2') diff --git a/sfx2/prj/build.lst b/sfx2/prj/build.lst index 89e618e8fc12..67bff5cbf349 100644 --- a/sfx2/prj/build.lst +++ b/sfx2/prj/build.lst @@ -2,7 +2,6 @@ sf sfx2 : l10n idl basic xmlscript framework shell setup_native sax S sf sfx2 usr1 - all sf_mkout NULL sf sfx2\inc nmake - all sf_inc NULL sf sfx2\prj get - all sf_prj NULL -sf sfx2\win\res get - all sf_wres NULL sf sfx2\mac\res get - all sf_mres NULL sf sfx2\source\inc get - all sf_sinc NULL sf sfx2\sdi nmake - all sf_sdi NULL diff --git a/sfx2/win/res/expdesk.ico b/sfx2/win/res/expdesk.ico deleted file mode 100644 index 06fb6e712e89..000000000000 Binary files a/sfx2/win/res/expdesk.ico and /dev/null differ diff --git a/sfx2/win/res/expexp.ico b/sfx2/win/res/expexp.ico deleted file mode 100644 index e0643765f605..000000000000 Binary files a/sfx2/win/res/expexp.ico and /dev/null differ diff --git a/sfx2/win/res/expfld.ico b/sfx2/win/res/expfld.ico deleted file mode 100644 index aeefecbdad51..000000000000 Binary files a/sfx2/win/res/expfld.ico and /dev/null differ diff --git a/sfx2/win/res/expftp.ico b/sfx2/win/res/expftp.ico deleted file mode 100644 index e1a442067d35..000000000000 Binary files a/sfx2/win/res/expftp.ico and /dev/null differ diff --git a/sfx2/win/res/exptrash.ico b/sfx2/win/res/exptrash.ico deleted file mode 100644 index 5c3e956863c3..000000000000 Binary files a/sfx2/win/res/exptrash.ico and /dev/null differ diff --git a/sfx2/win/res/expwork.ico b/sfx2/win/res/expwork.ico deleted file mode 100644 index 93fe39c7a492..000000000000 Binary files a/sfx2/win/res/expwork.ico and /dev/null differ diff --git a/sfx2/win/res/frameset.ico b/sfx2/win/res/frameset.ico deleted file mode 100644 index c9546f1e4d40..000000000000 Binary files a/sfx2/win/res/frameset.ico and /dev/null differ diff --git a/sfx2/win/res/search.ico b/sfx2/win/res/search.ico deleted file mode 100644 index 13e96131e3b8..000000000000 Binary files a/sfx2/win/res/search.ico and /dev/null differ -- cgit From f2fffda1c70fa75f1a4ca9d33710fae3584d20f7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:23 +0200 Subject: slidecopy: initial, empty ToolPanelDeck in a TaskPane (docking) window --- sfx2/inc/sfx2/sfxsids.hrc | 1 + sfx2/inc/sfx2/taskpane.hxx | 81 +++++++++++++ sfx2/sdi/frmslots.sdi | 5 + sfx2/sdi/sfx.sdi | 77 +++++++++---- sfx2/source/appl/appreg.cxx | 2 + sfx2/source/dialog/dialog.src | 4 + sfx2/source/dialog/makefile.mk | 3 +- sfx2/source/dialog/taskpane.cxx | 248 ++++++++++++++++++++++++++++++++++++++++ sfx2/source/inc/helpid.hrc | 1 + 9 files changed, 396 insertions(+), 26 deletions(-) create mode 100644 sfx2/inc/sfx2/taskpane.hxx create mode 100644 sfx2/source/dialog/taskpane.cxx (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index bcbb39c96638..0b92fc4dd80d 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -1173,6 +1173,7 @@ #define SID_HYPERLINK_GETLINK (SID_SVX_START + 361) #define SID_HYPERLINK_SETLINK (SID_SVX_START + 362) #define SID_NAVIGATOR (SID_SVX_START + 366) +#define SID_TASKPANE (SID_SVX_START + 367) #define SID_ZOOM_NEXT (SID_SVX_START + 402) #define SID_ZOOM_PREV (SID_SVX_START + 403) #define SID_INET_DLG (SID_SVX_START + 416) diff --git a/sfx2/inc/sfx2/taskpane.hxx b/sfx2/inc/sfx2/taskpane.hxx new file mode 100644 index 000000000000..c2801f8e5094 --- /dev/null +++ b/sfx2/inc/sfx2/taskpane.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SFX_TASKPANE_HXX +#define SFX_TASKPANE_HXX + +#include +#include + +#include + +//...................................................................................................................... +namespace sfx2 +{ +//...................................................................................................................... + + //================================================================================================================== + //= TaskPaneWrapper + //================================================================================================================== + class TaskPaneWrapper : public SfxChildWindow + { + public: + TaskPaneWrapper( + Window* i_pParent, + USHORT i_nId, + SfxBindings* i_pBindings, + SfxChildWinInfo* i_pInfo + ); + + SFX_DECL_CHILDWINDOW( TaskPaneWrapper ); + }; + + //================================================================================================================== + //= TaskPane + //================================================================================================================== + class TaskPane_Impl; + class TaskPane : public SfxDockingWindow + { + public: + TaskPane( + SfxBindings* i_pBindings, + TaskPaneWrapper& i_rWrapper, + Window* i_pParent, + WinBits i_nBits + ); + + virtual void GetFocus(); + virtual void Resize(); + + private: + ::boost::scoped_ptr< TaskPane_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace sfx2 +//...................................................................................................................... + +#endif // SFX_TASKPANE_HXX diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index 35f410db44af..aa5c2ba7387b 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -54,6 +54,11 @@ interface Window ExecMethod = ChildWindowExecute ; StateMethod = ChildWindowState ; ] + SID_TASKPANE // status(final|play) + [ + ExecMethod = ChildWindowExecute ; + StateMethod = ChildWindowState ; + ] SID_SHOW_BROWSER // ole(no) api(final/play/rec) [ ExecMethod = ChildWindowExecute ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 26f55ccdd178..87d148046ab5 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -4382,6 +4382,33 @@ SfxBoolItem Navigator SID_NAVIGATOR ToolBoxConfig = TRUE, GroupId = GID_NAVIGATOR; ] + +//-------------------------------------------------------------------------- +SfxBoolItem TaskPane SID_TASKPANE +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_VIEW; +] + //-------------------------------------------------------------------------- SfxVoidItem RestoreEditingView SID_RESTORE_EDITING_VIEW @@ -5897,31 +5924,31 @@ SfxVoidItem ExportDialog SID_EXPORT_DIALOG ] //-------------------------------------------------------------------------- -SfxVoidItem ImportDialog SID_IMPORT_DIALOG -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_DOCUMENT; -] - -//-------------------------------------------------------------------------- +SfxVoidItem ImportDialog SID_IMPORT_DIALOG +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_DOCUMENT; +] + +//-------------------------------------------------------------------------- SfxVoidItem SaveConfiguration SID_SAVECONFIG (SfxStringItem FileName SID_CFGFILE) [ diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index 9e688f885e3c..2cb4453700be 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -45,6 +45,7 @@ #include "inettbc.hxx" #include "stbitem.hxx" #include +#include #include #include #include "partwnd.hxx" @@ -69,6 +70,7 @@ void SfxApplication::Registrations_Impl() // ChildWindows SfxRecordingFloatWrapper_Impl::RegisterChildWindow(); SfxNavigatorWrapper::RegisterChildWindow( FALSE, NULL, SFX_CHILDWIN_NEVERHIDE ); + ::sfx2::TaskPaneWrapper::RegisterChildWindow( TRUE ); SfxPartChildWnd_Impl::RegisterChildWindow(); SfxTemplateDialogWrapper::RegisterChildWindow(TRUE); SfxDockingWrapper::RegisterChildWindow(); diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index c50b17436ca6..6cafb2dc04de 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -254,6 +254,10 @@ String SID_NAVIGATOR { Text [ en-US ] = "Navigator"; }; +String SID_TASKPANE +{ + Text [ en-US ] = "Tasks"; +}; ErrorBox MSG_ERROR_WRONG_CONFIRM { diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index 230bbe432aea..d420a2d37918 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -72,7 +72,8 @@ SLOFILES =\ $(SLO)$/tabdlg.obj \ $(SLO)$/tplcitem.obj \ $(SLO)$/tplpitem.obj \ - $(SLO)$/versdlg.obj + $(SLO)$/versdlg.obj \ + $(SLO)$/taskpane.obj SRS1NAME=$(TARGET) SRC1FILES =\ diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx new file mode 100644 index 000000000000..e82302627e97 --- /dev/null +++ b/sfx2/source/dialog/taskpane.cxx @@ -0,0 +1,248 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_sfx2.hxx" + +#include "sfx2/taskpane.hxx" +#include "sfx2/sfxsids.hrc" +#include "sfxresid.hxx" +#include "helpid.hrc" + +#include +#include + +#include + +//...................................................................................................................... +namespace sfx2 +{ +//...................................................................................................................... + +#define USE_DUMMY_PANEL +#if OSL_DEBUG_LEVEL > 0 + //================================================================================================================== + //= DummyPanel - declaration + //================================================================================================================== + class DummyPanel : public ::svt::ToolPanelBase + { + public: + DummyPanel( Window& i_rParent ); + virtual ~DummyPanel(); + + // IToolPanel + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; + virtual void Activate( Window& i_rParentWindow ); + virtual void Deactivate(); + virtual void SetSizePixel( const Size& i_rPanelWindowSize ); + virtual void GrabFocus(); + virtual void Dispose(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreatePanelAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ); + + class GreenWindow : public Window + { + public: + GreenWindow( Window& i_rParent ) + :Window( &i_rParent, 0 ) + { + SetLineColor(); + SetFillColor( COL_GREEN ); + } + virtual void Paint( const Rectangle& i_rRect ) + { + DrawRect( i_rRect ); + } + }; + + private: + ::boost::scoped_ptr< Window > m_pWindow; + }; + + //================================================================================================================== + //= DummyPanel - implementation + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + DummyPanel::DummyPanel( Window& i_rParent ) + :m_pWindow( new GreenWindow( i_rParent ) ) + { + m_pWindow->SetPosSizePixel( Point(), i_rParent.GetOutputSizePixel() ); + } + + //------------------------------------------------------------------------------------------------------------------ + DummyPanel::~DummyPanel() + { + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString DummyPanel::GetDisplayName() const + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Soylent Green" ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + Image DummyPanel::GetImage() const + { + return Image(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DummyPanel::Activate( Window& i_rParentWindow ) + { + OSL_ENSURE( &i_rParentWindow == m_pWindow->GetParent(), "DummyPanel::Activate: reparenting not supported (and not expected to be needed)!" ); + (void)i_rParentWindow; + + m_pWindow->Show(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DummyPanel::Deactivate() + { + m_pWindow->Hide(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DummyPanel::SetSizePixel( const Size& i_rPanelWindowSize ) + { + m_pWindow->SetPosSizePixel( Point(), i_rPanelWindowSize ); + } + + //------------------------------------------------------------------------------------------------------------------ + void DummyPanel::GrabFocus() + { + m_pWindow->GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DummyPanel::Dispose() + { + m_pWindow.reset(); + } + + //------------------------------------------------------------------------------------------------------------------ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::accessibility::XAccessible; + Reference< XAccessible > DummyPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) + { + (void)i_rParentAccessible; + return NULL; + } + +#endif + + //================================================================================================================== + //= TaskPane_Impl + //================================================================================================================== + class TaskPane_Impl : public ::boost::noncopyable + { + public: + TaskPane_Impl( TaskPane& i_rAntiImpl ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_aToolPanels( i_rAntiImpl, 0 ) + { + m_aToolPanels.Show(); +#if ( OSL_DEBUG_LEVEL > 0 ) && defined ( USE_DUMMY_PANEL ) + m_aToolPanels.InsertPanel( ::svt::PToolPanel( new DummyPanel( m_aToolPanels.GetPanelWindowAnchor() ) ), m_aToolPanels.GetPanelCount() ); +#endif + OnResize(); + } + + ~TaskPane_Impl() + { + } + + void OnResize(); + void OnGetFocus(); + + private: + TaskPane& m_rAntiImpl; + ::svt::ToolPanelDeck m_aToolPanels; + }; + + //------------------------------------------------------------------------------------------------------------------ + void TaskPane_Impl::OnResize() + { + m_aToolPanels.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPane_Impl::OnGetFocus() + { + m_aToolPanels.GrabFocus(); + } + + //================================================================================================================== + //= TaskPane + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + TaskPane::TaskPane( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ) + :SfxDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) + ,m_pImpl( new TaskPane_Impl( *this ) ) + { + SetText( String( SfxResId( SID_TASKPANE ) ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPane::GetFocus() + { + SfxDockingWindow::GetFocus(); + m_pImpl->OnGetFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPane::Resize() + { + SfxDockingWindow::Resize(); + m_pImpl->OnResize(); + } + + //================================================================================================================== + //= TaskPaneWrapper + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + SFX_IMPL_DOCKINGWINDOW( TaskPaneWrapper, SID_TASKPANE ); + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneWrapper::TaskPaneWrapper( Window* i_pParent, USHORT i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pInfo ) + :SfxChildWindow( i_pParent, i_nId ) + { + pWindow = new TaskPane( i_pBindings, *this, i_pParent, + WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE); + eChildAlignment = SFX_ALIGN_RIGHT; + + pWindow->SetHelpId( HID_TASKPANE_WINDOW ); + pWindow->SetOutputSizePixel( Size( 300, 450 ) ); + pWindow->Show(); + + dynamic_cast< SfxDockingWindow* >( pWindow )->Initialize( i_pInfo ); + SetHideNotDelete( TRUE ); + } + +//...................................................................................................................... +} // namespace sfx2 +//...................................................................................................................... diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index b8beacafee3a..00276dcfbebd 100644 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -333,6 +333,7 @@ #define HID_CONFIG_SAVE (HID_SFX_START + 310) #define HID_SEARCHDIALOG (HID_SFX_START + 311) +#define HID_TASKPANE_WINDOW (HID_SFX_START + 312) #define HID_XMLSEC_WARNING_BROKENSIGNATURE (HID_SFX_START + 314) #define HID_XMLSEC_QUERY_LOSINGSIGNATURE (HID_SFX_START + 315) -- cgit From c3e8e980d1abebf984ef8f1fea8d977ec448797f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:24 +0200 Subject: slidecopy: let the dummy/demo panel create a simple XAccessible, too --- sfx2/source/dialog/taskpane.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index e82302627e97..80273f5e517a 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -34,6 +34,11 @@ #include #include +#if OSL_DEBUG_LEVEL > 0 +#include +#include +#endif + #include //...................................................................................................................... @@ -42,6 +47,7 @@ namespace sfx2 //...................................................................................................................... #define USE_DUMMY_PANEL + #if OSL_DEBUG_LEVEL > 0 //================================================================================================================== //= DummyPanel - declaration @@ -149,8 +155,14 @@ namespace sfx2 using ::com::sun::star::accessibility::XAccessible; Reference< XAccessible > DummyPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) { - (void)i_rParentAccessible; - return NULL; + Reference< XAccessible > xPanelAccessible( m_pWindow->GetAccessible( FALSE ) ); + if ( !xPanelAccessible.is() ) + { + xPanelAccessible = m_pWindow->GetAccessible( TRUE ); + ::comphelper::OAccessibleImplementationAccess::setAccessibleParent( xPanelAccessible->getAccessibleContext(), + i_rParentAccessible ); + } + return xPanelAccessible; } #endif -- cgit From 1cf2a482871ba237ec9470b88da074b97a2dbf41 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:26 +0200 Subject: slidecopy: improved the generic TaskPane, now filled from the configuration, including a small sample extension still some way to go .... open items include: - add to all affected applications - respect the ImageURL property of the config data - clarify how this interacts with SD's Drawing Framework, and Impress' TaskPane - re-activate the previously-active tool panel when opening the pane again - obtain the XAccessible from the tool panel - title when docked - proper TAB handling when multiple panel/drawers exist --- sfx2/inc/sfx2/taskpane.hxx | 49 ++- sfx2/source/dialog/makefile.mk | 6 +- sfx2/source/dialog/taskpane.cxx | 481 +++++++++++++++++++++++-- sfx2/source/view/viewfrm.cxx | 34 ++ sfx2/workben/custompanel/Factories.xcu | 21 ++ sfx2/workben/custompanel/WriterWindowState.xcu | 15 + sfx2/workben/custompanel/ctp_factory.cxx | 164 +++++++++ sfx2/workben/custompanel/ctp_factory.hxx | 83 +++++ sfx2/workben/custompanel/ctp_panel.cxx | 233 ++++++++++++ sfx2/workben/custompanel/ctp_panel.hxx | 117 ++++++ sfx2/workben/custompanel/ctp_services.cxx | 92 +++++ sfx2/workben/custompanel/description.xml | 16 + sfx2/workben/custompanel/makefile.mk | 94 +++++ sfx2/workben/custompanel/manifest.xml | 10 + 14 files changed, 1363 insertions(+), 52 deletions(-) create mode 100644 sfx2/workben/custompanel/Factories.xcu create mode 100644 sfx2/workben/custompanel/WriterWindowState.xcu create mode 100644 sfx2/workben/custompanel/ctp_factory.cxx create mode 100644 sfx2/workben/custompanel/ctp_factory.hxx create mode 100644 sfx2/workben/custompanel/ctp_panel.cxx create mode 100644 sfx2/workben/custompanel/ctp_panel.hxx create mode 100644 sfx2/workben/custompanel/ctp_services.cxx create mode 100644 sfx2/workben/custompanel/description.xml create mode 100644 sfx2/workben/custompanel/makefile.mk create mode 100644 sfx2/workben/custompanel/manifest.xml (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/taskpane.hxx b/sfx2/inc/sfx2/taskpane.hxx index c2801f8e5094..896f2bf32a05 100644 --- a/sfx2/inc/sfx2/taskpane.hxx +++ b/sfx2/inc/sfx2/taskpane.hxx @@ -56,22 +56,53 @@ namespace sfx2 //================================================================================================================== //= TaskPane //================================================================================================================== - class TaskPane_Impl; - class TaskPane : public SfxDockingWindow + class ModuleTaskPane_Impl; + /** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective + module's configuration + */ + class ModuleTaskPane : public Window { public: - TaskPane( - SfxBindings* i_pBindings, - TaskPaneWrapper& i_rWrapper, - Window* i_pParent, - WinBits i_nBits - ); + /** creates a new instance + @param i_rParentWindow + the parent window + @param i_rModuleIdentifier + a string describing the module which the task pane should act for. The tool panels registered + for this module will be displayed in the task pane. + */ + ModuleTaskPane( Window& i_rParentWindow, const ::rtl::OUString& i_rModuleIdentifier ); + ~ModuleTaskPane(); + + /** determines whether a given module has any registered tool panels + */ + static bool ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ); + /** determines whether a given module has any registered tool panels + */ + static bool ModuleHasToolPanels( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame ); + + // Window overridables + virtual void Resize(); + virtual void GetFocus(); + + private: + ::boost::scoped_ptr< ModuleTaskPane_Impl > m_pImpl; + }; + + //================================================================================================================== + //= TaskPaneDockingWindow + //================================================================================================================== + class TaskPaneDockingWindow : public SfxDockingWindow + { + public: + TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, + Window* i_pParent, WinBits i_nBits ); virtual void GetFocus(); virtual void Resize(); + virtual long Notify( NotifyEvent& i_rNotifyEvent ); private: - ::boost::scoped_ptr< TaskPane_Impl > m_pImpl; + ModuleTaskPane m_aTaskPane; }; //...................................................................................................................... diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index d420a2d37918..410e971607b2 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -49,7 +49,8 @@ EXCEPTIONSFILES=\ $(SLO)$/recfloat.obj \ $(SLO)$/templdlg.obj \ $(SLO)$/dinfdlg.obj \ - $(SLO)$/dockwin.obj + $(SLO)$/dockwin.obj \ + $(SLO)$/taskpane.obj SLOFILES =\ $(EXCEPTIONSFILES) \ @@ -72,8 +73,7 @@ SLOFILES =\ $(SLO)$/tabdlg.obj \ $(SLO)$/tplcitem.obj \ $(SLO)$/tplpitem.obj \ - $(SLO)$/versdlg.obj \ - $(SLO)$/taskpane.obj + $(SLO)$/versdlg.obj SRS1NAME=$(TARGET) SRC1FILES =\ diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 80273f5e517a..383306da42e8 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -28,11 +28,28 @@ #include "sfx2/taskpane.hxx" #include "sfx2/sfxsids.hrc" +#include "sfx2/bindings.hxx" +#include "sfx2/dispatch.hxx" #include "sfxresid.hxx" #include "helpid.hrc" +/** === begin UNO includes === **/ +#include +#include +#include +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include +#include +#include #include #include +#include #if OSL_DEBUG_LEVEL > 0 #include @@ -46,7 +63,31 @@ namespace sfx2 { //...................................................................................................................... -#define USE_DUMMY_PANEL + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::frame::XModuleManager; + using ::com::sun::star::container::XNameAccess; + using ::com::sun::star::view::XToolPanel; + using ::com::sun::star::ui::XUIElementFactory; + using ::com::sun::star::ui::XUIElement; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::frame::XModuleManager; + using ::com::sun::star::frame::XFrame; + using ::com::sun::star::lang::XComponent; + /** === end UNO using === **/ + namespace PosSize = ::com::sun::star::awt::PosSize; + +//#define USE_DUMMY_PANEL #if OSL_DEBUG_LEVEL > 0 //================================================================================================================== @@ -168,69 +209,76 @@ namespace sfx2 #endif //================================================================================================================== - //= TaskPane_Impl + //= helpers //================================================================================================================== - class TaskPane_Impl : public ::boost::noncopyable + namespace { - public: - TaskPane_Impl( TaskPane& i_rAntiImpl ) - :m_rAntiImpl( i_rAntiImpl ) - ,m_aToolPanels( i_rAntiImpl, 0 ) + ::rtl::OUString lcl_identifyModule( const Reference< XFrame >& i_rDocumentFrame ) { - m_aToolPanels.Show(); -#if ( OSL_DEBUG_LEVEL > 0 ) && defined ( USE_DUMMY_PANEL ) - m_aToolPanels.InsertPanel( ::svt::PToolPanel( new DummyPanel( m_aToolPanels.GetPanelWindowAnchor() ) ), m_aToolPanels.GetPanelCount() ); -#endif - OnResize(); + ::rtl::OUString sModuleName; + try + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XModuleManager > xModuleManager( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + sModuleName = xModuleManager->identify( i_rDocumentFrame ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sModuleName; } - ~TaskPane_Impl() + ::rtl::OUString lcl_identifyModule( const SfxBindings* i_pBindings ) { + const SfxViewFrame* pViewFrame = i_pBindings->GetDispatcher()->GetFrame(); + const SfxFrame* pFrame = pViewFrame->GetFrame(); + const Reference< XFrame > xFrame( pFrame->GetFrameInterface() ); + return lcl_identifyModule( xFrame ); } - - void OnResize(); - void OnGetFocus(); - - private: - TaskPane& m_rAntiImpl; - ::svt::ToolPanelDeck m_aToolPanels; - }; - - //------------------------------------------------------------------------------------------------------------------ - void TaskPane_Impl::OnResize() - { - m_aToolPanels.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); - } - - //------------------------------------------------------------------------------------------------------------------ - void TaskPane_Impl::OnGetFocus() - { - m_aToolPanels.GrabFocus(); } //================================================================================================================== - //= TaskPane + //= TaskPaneDockingWindow //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - TaskPane::TaskPane( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ) + TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ) :SfxDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) - ,m_pImpl( new TaskPane_Impl( *this ) ) + ,m_aTaskPane( *this, lcl_identifyModule( i_pBindings ) ) { + m_aTaskPane.Show(); SetText( String( SfxResId( SID_TASKPANE ) ) ); } //------------------------------------------------------------------------------------------------------------------ - void TaskPane::GetFocus() + void TaskPaneDockingWindow::GetFocus() { SfxDockingWindow::GetFocus(); - m_pImpl->OnGetFocus(); + m_aTaskPane.GrabFocus(); } //------------------------------------------------------------------------------------------------------------------ - void TaskPane::Resize() + void TaskPaneDockingWindow::Resize() { SfxDockingWindow::Resize(); - m_pImpl->OnResize(); + m_aTaskPane.SetPosSizePixel( Point(), GetOutputSizePixel() ); + } + + //------------------------------------------------------------------------------------------------------------------ + long TaskPaneDockingWindow::Notify( NotifyEvent& i_rNotifyEvent ) + { + // in case this is a MouseButtonDown event, consume it - VCL's DockingWindow would otherwise + // start undocking, no matter which window this event was intended for + if ( i_rNotifyEvent.GetType() == EVENT_MOUSEBUTTONDOWN ) + { + const MouseEvent& rMouseEvent = *i_rNotifyEvent.GetMouseEvent(); + if ( rMouseEvent.IsLeft() && ( rMouseEvent.GetClicks() == 1 ) && !rMouseEvent.IsMod1() ) + { + if ( m_aTaskPane.IsWindowOrChild( i_rNotifyEvent.GetWindow() ) ) + return TRUE; + } + } + return SfxDockingWindow::Notify( i_rNotifyEvent ); } //================================================================================================================== @@ -243,7 +291,7 @@ namespace sfx2 TaskPaneWrapper::TaskPaneWrapper( Window* i_pParent, USHORT i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pInfo ) :SfxChildWindow( i_pParent, i_nId ) { - pWindow = new TaskPane( i_pBindings, *this, i_pParent, + pWindow = new TaskPaneDockingWindow( i_pBindings, *this, i_pParent, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE); eChildAlignment = SFX_ALIGN_RIGHT; @@ -255,6 +303,359 @@ namespace sfx2 SetHideNotDelete( TRUE ); } + //================================================================================================================== + //= CustomPanelUIElement + //================================================================================================================== + class CustomPanelUIElement + { + public: + CustomPanelUIElement() + :m_xUIElement() + ,m_xToolPanel() + ,m_xPanelWindow() + { + } + + CustomPanelUIElement( const Reference< XUIElement >& i_rUIElement ) + :m_xUIElement( i_rUIElement, UNO_SET_THROW ) + ,m_xToolPanel( i_rUIElement->getRealInterface(), UNO_QUERY_THROW ) + ,m_xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW ) + { + } + + bool is() const { return m_xPanelWindow.is(); } + + const Reference< XUIElement >& getUIElement() const { return m_xUIElement; } + const Reference< XToolPanel >& getToolPanel() const { return m_xToolPanel; } + const Reference< XWindow >& getPanelWindow() const { return m_xPanelWindow; } + + private: + Reference< XUIElement > m_xUIElement; + Reference< XToolPanel > m_xToolPanel; + Reference< XWindow > m_xPanelWindow; + }; + + //================================================================================================================== + //= CustomToolPanel + //================================================================================================================== + class CustomToolPanel : public ::svt::ToolPanelBase + { + public: + CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState ); + + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; + virtual void Activate( Window& i_rParentWindow ); + virtual void Deactivate(); + virtual void SetSizePixel( const Size& i_rPanelWindowSize ); + virtual void GrabFocus(); + virtual void Dispose(); + virtual Reference< XAccessible > + CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ); + + protected: + ~CustomToolPanel(); + + private: + bool impl_ensureToolPanelWindow( Window& i_rPanelParentWindow ); + + private: + const ::rtl::OUString m_sUIName; + const ::rtl::OUString m_sResourceURL; + CustomPanelUIElement m_aCustomPanel; + bool m_bAttemptedCreation; + }; + + //------------------------------------------------------------------------------------------------------------------ + CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState ) + :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) + ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) + ,m_aCustomPanel() + ,m_bAttemptedCreation( false ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + CustomToolPanel::~CustomToolPanel() + { + } + + //------------------------------------------------------------------------------------------------------------------ + bool CustomToolPanel::impl_ensureToolPanelWindow( Window& i_rPanelParentWindow ) + { + if ( m_bAttemptedCreation ) + return m_aCustomPanel.is(); + + m_bAttemptedCreation = true; + try + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XUIElementFactory > xFactory( aContext.createComponent( "com.sun.star.ui.UIElementFactoryManager" ), UNO_QUERY_THROW ); + + ::comphelper::NamedValueCollection aCreationArgs; + aCreationArgs.put( "ParentWindow", makeAny( i_rPanelParentWindow.GetComponentInterface() ) ); + + const Reference< XUIElement > xElement( + xFactory->createUIElement( m_sResourceURL, aCreationArgs.getPropertyValues() ), + UNO_SET_THROW ); + + m_aCustomPanel = CustomPanelUIElement( xElement ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return m_aCustomPanel.is(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString CustomToolPanel::GetDisplayName() const + { + return m_sUIName; + } + + //------------------------------------------------------------------------------------------------------------------ + Image CustomToolPanel::GetImage() const + { + // TODO: read from configuration + return Image(); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Activate( Window& i_rParentWindow ) + { + ENSURE_OR_RETURN_VOID( impl_ensureToolPanelWindow( i_rParentWindow ), "no panel to activate!" ); + + // TODO: we might need a mechanism to decide whether the panel should be destroyed/re-created, or (as it is + // done now) hidden/shown + m_aCustomPanel.getPanelWindow()->setVisible( sal_True ); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Deactivate() + { + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to deactivate!" ); + + m_aCustomPanel.getPanelWindow()->setVisible( sal_False ); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::SetSizePixel( const Size& i_rPanelWindowSize ) + { + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel/window to position!" ); + + try + { + m_aCustomPanel.getPanelWindow()->setPosSize( 0, 0, i_rPanelWindowSize.Width(), i_rPanelWindowSize.Height(), + PosSize::POSSIZE ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::GrabFocus() + { + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel/window to focus!" ); + + m_aCustomPanel.getPanelWindow()->setFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Dispose() + { + if ( !m_bAttemptedCreation ) + // nothing to dispose + return; + + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to destroy!" ); + try + { + Reference< XComponent > xUIElementComponent( m_aCustomPanel.getUIElement(), UNO_QUERY_THROW ); + xUIElementComponent->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) + { + // TODO + (void)i_rParentAccessible; + return NULL; + } + + //================================================================================================================== + //= ModuleTaskPane_Impl + //================================================================================================================== + class ModuleTaskPane_Impl : public ::boost::noncopyable + { + public: + ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const ::rtl::OUString& i_rModuleIdentifier ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_sModuleIdentifier( i_rModuleIdentifier ) + ,m_aPanels( i_rAntiImpl, 0 ) + { + m_aPanels.Show(); + #if ( OSL_DEBUG_LEVEL > 0 ) && defined ( USE_DUMMY_PANEL ) + m_aPanels.InsertPanel( ::svt::PToolPanel( new DummyPanel( m_aPanels.GetPanelWindowAnchor() ) ), m_aPanels.GetPanelCount() ); + #endif + OnResize(); + impl_initFromConfiguration(); + } + + ~ModuleTaskPane_Impl() + { + } + + void OnResize(); + void OnGetFocus(); + + static bool ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ); + + private: + void impl_initFromConfiguration(); + + static ::utl::OConfigurationTreeRoot + impl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier ); + static bool + impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ); + + private: + ModuleTaskPane& m_rAntiImpl; + ::rtl::OUString m_sModuleIdentifier; + ::svt::ToolPanelDeck m_aPanels; + }; + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::OnResize() + { + m_aPanels.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::OnGetFocus() + { + m_aPanels.GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::utl::OConfigurationTreeRoot ModuleTaskPane_Impl::impl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier ) + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + ::rtl::OUStringBuffer aPathComposer; + try + { + const Reference< XNameAccess > xModuleAccess( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) ); + + const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) ); + + aPathComposer.appendAscii( "org.openoffice.Office.UI." ); + aPathComposer.append( sWindowStateRef ); + aPathComposer.appendAscii( "/UIElements/States" ); + + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return ::utl::OConfigurationTreeRoot( aContext, aPathComposer.makeStringAndClear(), false ); + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane_Impl::impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ) + { + return i_rResourceURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/" ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::impl_initFromConfiguration() + { + const ::utl::OConfigurationTreeRoot aWindowStateConfig( impl_getModuleUIElementStatesConfig( m_sModuleIdentifier ) ); + if ( !aWindowStateConfig.isValid() ) + return; + + const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); + for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); + resource != aUIElements.getConstArray() + aUIElements.getLength(); + ++resource + ) + { + if ( !impl_isToolPanelResource( *resource ) ) + continue; + + ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); + ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode ) ); + m_aPanels.InsertPanel( pCustomPanel, m_aPanels.GetPanelCount() ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane_Impl::ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ) + { + const ::utl::OConfigurationTreeRoot aWindowStateConfig( impl_getModuleUIElementStatesConfig( i_rModuleIdentifier ) ); + if ( !aWindowStateConfig.isValid() ) + return false; + + const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); + for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); + resource != aUIElements.getConstArray() + aUIElements.getLength(); + ++resource + ) + { + if ( impl_isToolPanelResource( *resource ) ) + return true; + } + return false; + } + + //================================================================================================================== + //= ModuleTaskPane + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const ::rtl::OUString& i_rModuleIdentifier ) + :Window( &i_rParentWindow, 0 ) + ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rModuleIdentifier ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ModuleTaskPane::~ModuleTaskPane() + { + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane::ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ) + { + return ModuleTaskPane_Impl::ModuleHasToolPanels( i_rModuleIdentifier ); + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane::ModuleHasToolPanels( const Reference< XFrame >& i_rDocumentFrame ) + { + return ModuleTaskPane_Impl::ModuleHasToolPanels( lcl_identifyModule( i_rDocumentFrame ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane::Resize() + { + Window::Resize(); + m_pImpl->OnResize(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane::GetFocus() + { + Window::GetFocus(); + m_pImpl->OnGetFocus(); + } + //...................................................................................................................... } // namespace sfx2 //...................................................................................................................... diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index ba87f0fc33ca..dad748bbd371 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -46,6 +46,7 @@ #endif #include #include +#include #include #include #include @@ -92,6 +93,8 @@ #include #include +#include + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; @@ -104,6 +107,7 @@ namespace css = ::com::sun::star; // wg. ViewFrame::Current #include "appdata.hxx" +#include #include #include #include "openflag.hxx" @@ -195,6 +199,8 @@ struct SfxViewFrame_Impl sal_Bool bEnabled:1; sal_Bool bEventFlag:1; sal_Bool bWindowWasEnabled:1; + ::boost::optional< bool > + aHasToolPanels; SfxViewFrame_Impl() : pReloader(0 ) @@ -209,6 +215,19 @@ struct SfxViewFrame_Impl } }; +//------------------------------------------------------------------------- +namespace +{ + bool moduleHasToolPanels( SfxViewFrame_Impl& i_rViewFrameImpl ) + { + if ( !i_rViewFrameImpl.aHasToolPanels ) + { + i_rViewFrameImpl.aHasToolPanels.reset( ::sfx2::ModuleTaskPane::ModuleHasToolPanels( + i_rViewFrameImpl.pFrame->GetTopFrame()->GetFrameInterface() ) ); + } + return *i_rViewFrameImpl.aHasToolPanels; + } +} //------------------------------------------------------------------------- void SfxViewFrame::SetDowning_Impl() { @@ -3750,6 +3769,21 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) else if ( KnowsChildWindow(nSID) ) rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) ); } + else if ( nSID == SID_TASKPANE ) + { + if ( !KnowsChildWindow( nSID ) ) + { + rState.DisableItem( nSID ); + } + else if ( !moduleHasToolPanels( *pImp ) ) + { + rState.Put( SfxVisibilityItem( nSID, sal_False ) ); + } + else + { + rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) ); + } + } else if ( KnowsChildWindow(nSID) ) rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) ); else diff --git a/sfx2/workben/custompanel/Factories.xcu b/sfx2/workben/custompanel/Factories.xcu new file mode 100644 index 000000000000..88e6a4df14f8 --- /dev/null +++ b/sfx2/workben/custompanel/Factories.xcu @@ -0,0 +1,21 @@ + + + + + + + toolpanel + + + org.openoffice.example.custompanel + + + + + + org.openoffice.example.colorpanel.ToolPanelFactory + + + + + diff --git a/sfx2/workben/custompanel/WriterWindowState.xcu b/sfx2/workben/custompanel/WriterWindowState.xcu new file mode 100644 index 000000000000..1110d8a6fdaa --- /dev/null +++ b/sfx2/workben/custompanel/WriterWindowState.xcu @@ -0,0 +1,15 @@ + + + + + + + Soylent Green + + + true + + + + + diff --git a/sfx2/workben/custompanel/ctp_factory.cxx b/sfx2/workben/custompanel/ctp_factory.cxx new file mode 100644 index 000000000000..462709e7ad2c --- /dev/null +++ b/sfx2/workben/custompanel/ctp_factory.cxx @@ -0,0 +1,164 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sfx2.hxx" + +#include "ctp_factory.hxx" +#include "ctp_panel.hxx" + +/** === begin UNO includes === **/ +#include +#include +#include +/** === end UNO includes === **/ + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::lang::NotInitializedException; + using ::com::sun::star::lang::IllegalArgumentException; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::ui::XUIElement; + using ::com::sun::star::beans::PropertyValue; + using ::com::sun::star::container::NoSuchElementException; + using ::com::sun::star::beans::PropertyValue; + using ::com::sun::star::awt::XWindow; + /** === end UNO using === **/ + + //================================================================================================================== + //= ToolPanelFactory + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ToolPanelFactory::ToolPanelFactory( const Reference< XComponentContext >& i_rContext ) + :m_xContext( i_rContext ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanelFactory::~ToolPanelFactory() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XUIElement > SAL_CALL ToolPanelFactory::createUIElement( const ::rtl::OUString& i_rResourceURL, const Sequence< PropertyValue >& i_rArgs ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !i_rResourceURL.equalsAscii( "private:resource/toolpanel/org.openoffice.example.custompanel" ) ) + throw NoSuchElementException( i_rResourceURL, *this ); + + // retrieve the parent window + Reference< XWindow > xParentWindow; + const PropertyValue* pArg = i_rArgs.getConstArray(); + const PropertyValue* pArgEnd = i_rArgs.getConstArray() + i_rArgs.getLength(); + for ( ; pArg != pArgEnd; ++pArg ) + { + if ( pArg->Name.equalsAscii( "ParentWindow" ) ) + { + xParentWindow.set( pArg->Value, UNO_QUERY ); + break; + } + } + if ( !xParentWindow.is() ) + { + OSL_ENSURE( false, "ToolPanelFactory::createUIElement: no parent window in the args!" ); + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No parent window provided in the creation arguments. Cannot create tool panel." ) ), + *this, + 2 + ); + } + + /// create the panel + Reference< XUIElement > xUIElement( new PanelUIElement( m_xContext, xParentWindow, i_rResourceURL ) ); + return xUIElement; + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName( ) throw (RuntimeException) + { + return getImplementationName_static(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName_static( ) throw (RuntimeException) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.example.custompanel.ToolPanelFactory" ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException) + { + const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); + for ( const ::rtl::OUString* serviceName = aServiceNames.getConstArray(); + serviceName != aServiceNames.getConstArray() + aServiceNames.getLength(); + ++serviceName + ) + { + if ( i_rServiceName == *serviceName ) + return sal_True; + } + return sal_False; + } + + //------------------------------------------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames() throw (RuntimeException) + { + return getSupportedServiceNames_static(); + } + + //------------------------------------------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames_static() throw (RuntimeException) + { + Sequence< ::rtl::OUString > aServiceNames(1); + aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.example.colorpanel.ToolPanelFactory" ) ); + return aServiceNames; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XInterface > SAL_CALL ToolPanelFactory::Create( const Reference< XComponentContext >& i_rContext ) throw (RuntimeException) + { + return *( new ToolPanelFactory( i_rContext ) ); + } + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... diff --git a/sfx2/workben/custompanel/ctp_factory.hxx b/sfx2/workben/custompanel/ctp_factory.hxx new file mode 100644 index 000000000000..8a359f59caaf --- /dev/null +++ b/sfx2/workben/custompanel/ctp_factory.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SD_WORKBENCH_CTP_FACTORY_HXX +#define SD_WORKBENCH_CTP_FACTORY_HXX + +/** === begin UNO includes === **/ +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + class FactoryGuard; + + //================================================================================================================== + //= ToolPanelFactory + //================================================================================================================== + typedef ::cppu::WeakImplHelper2 < ::com::sun::star::ui::XUIElementFactory + , ::com::sun::star::lang::XServiceInfo + > ToolPanelFactory_Base; + class ToolPanelFactory :public ::cppu::BaseMutex + ,public ToolPanelFactory_Base + { + public: + ToolPanelFactory( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext + ); + ~ToolPanelFactory(); + + // XUIElementFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& i_rResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rArgs ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo - static versions + static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext ) throw (::com::sun::star::uno::RuntimeException); + + private: + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; + }; + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... + +#endif // SD_WORKBENCH_CTP_FACTORY_HXX diff --git a/sfx2/workben/custompanel/ctp_panel.cxx b/sfx2/workben/custompanel/ctp_panel.cxx new file mode 100644 index 000000000000..c159b65e497e --- /dev/null +++ b/sfx2/workben/custompanel/ctp_panel.cxx @@ -0,0 +1,233 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sfx2.hxx" + +#include "ctp_panel.hxx" + +/** === begin UNO includes === **/ +#include +#include +#include +#include +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::awt::XWindowPeer; + using ::com::sun::star::lang::XMultiComponentFactory; + using ::com::sun::star::awt::XToolkit; + using ::com::sun::star::awt::WindowDescriptor; + using ::com::sun::star::awt::WindowClass_SIMPLE; + using ::com::sun::star::awt::Rectangle; + using ::com::sun::star::awt::PaintEvent; + using ::com::sun::star::lang::EventObject; + using ::com::sun::star::awt::XDevice; + using ::com::sun::star::awt::XGraphics; + /** === end UNO using === **/ + namespace WindowAttribute = ::com::sun::star::awt::WindowAttribute; + namespace PosSize = ::com::sun::star::awt::PosSize; + + //================================================================================================================== + //= helpers + //================================================================================================================== + namespace + { + Reference< XWindow > lcl_createPlainWindow_nothrow( const Reference< XComponentContext >& i_rContext, + const Reference< XWindowPeer >& i_rParentWindow ) + { + try + { + ENSURE_OR_THROW( i_rContext.is(), "illegal component context" ); + Reference< XMultiComponentFactory > xFactory( i_rContext->getServiceManager(), UNO_SET_THROW ); + Reference< XToolkit > xToolkit( xFactory->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ), + i_rContext + ), UNO_QUERY_THROW ); + + WindowDescriptor aWindow; + aWindow.Type = WindowClass_SIMPLE; + aWindow.WindowServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "window" ) ); + aWindow.Parent = i_rParentWindow; + aWindow.WindowAttributes = WindowAttribute::BORDER; + + Reference< XWindowPeer > xWindow( xToolkit->createWindow( aWindow ), UNO_SET_THROW ); + return Reference< XWindow >( xWindow, UNO_QUERY_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } + } + //================================================================================================================== + //= class SingleColorPanel + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow ) + :SingleColorPanel_Base( m_aMutex ) + ,m_xWindow() + { + // retrieve the parent window for our to-be-created pane window + Reference< XWindowPeer > xParentPeer( i_rParentWindow, UNO_QUERY ); + + osl_incrementInterlockedCount( &m_refCount ); + if ( xParentPeer.is() ) + { + m_xWindow = lcl_createPlainWindow_nothrow( i_rContext, xParentPeer ); + m_xWindow->addPaintListener( this ); + if ( m_xWindow.is() ) + { + const Rectangle aPanelAnchorSize( i_rParentWindow->getPosSize() ); + m_xWindow->setPosSize( 0, 0, aPanelAnchorSize.Width, aPanelAnchorSize.Height, PosSize::POSSIZE ); + m_xWindow->setVisible( sal_True ); + } + } + osl_decrementInterlockedCount( &m_refCount ); + } + + //------------------------------------------------------------------------------------------------------------------ + SingleColorPanel::~SingleColorPanel() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XWindow > SAL_CALL SingleColorPanel::getWindow() throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() ) + throw DisposedException( ::rtl::OUString(), *this ); + return m_xWindow; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SingleColorPanel::windowPaint( const PaintEvent& i_rEvent ) throw (RuntimeException) + { + try + { + const Reference< XDevice > xDevice( i_rEvent.Source, UNO_QUERY_THROW ); + const Reference< XGraphics > xGraphics( xDevice->createGraphics(), UNO_SET_THROW ); + xGraphics->setFillColor( 0x80 << 8 ); + xGraphics->setLineColor( 0x80 << 16 ); + + const Reference< XWindow > xWindow( i_rEvent.Source, UNO_QUERY_THROW ); + const Rectangle aWindowRect( xWindow->getPosSize() ); + xGraphics->drawRect( 0, 0, aWindowRect.Width - 1, aWindowRect.Height - 1 ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SingleColorPanel::disposing( const EventObject& i_rSource ) throw (RuntimeException) + { + (void)i_rSource; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SingleColorPanel::disposing() + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() ) + // already disposed + return; + m_xWindow->removePaintListener( this ); + try + { + Reference< XComponent > xWindowComp( m_xWindow, UNO_QUERY_THROW ); + xWindowComp->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + m_xWindow.clear(); + } + + //================================================================================================================== + //= PanelUIElement + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + PanelUIElement::PanelUIElement( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow, + const ::rtl::OUString& i_rResourceURL ) + :PanelUIElement_Base( m_aMutex ) + ,m_sResourceURL( i_rResourceURL ) + ,m_xToolPanel( new SingleColorPanel( i_rContext, i_rParentWindow ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + PanelUIElement::~PanelUIElement() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XInterface > SAL_CALL PanelUIElement::getRealInterface( ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xToolPanel.is() ) + throw DisposedException(); + return m_xToolPanel; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL PanelUIElement::disposing() + { + Reference< XComponent > xPanelComponent( m_xToolPanel, UNO_QUERY_THROW ); + m_xToolPanel.clear(); + xPanelComponent->dispose(); + } + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... diff --git a/sfx2/workben/custompanel/ctp_panel.hxx b/sfx2/workben/custompanel/ctp_panel.hxx new file mode 100644 index 000000000000..c3882e3afe98 --- /dev/null +++ b/sfx2/workben/custompanel/ctp_panel.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SD_WORKBENCH_CTP_PANEL_HXX +#define SD_WORKBENCH_CTP_PANEL_HXX + +/** === begin UNO includes === **/ +#include +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include +#include + +#include + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= SingleColorPanel + //================================================================================================================== + typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::view::XToolPanel + , ::com::sun::star::awt::XPaintListener + > SingleColorPanel_Base; + class SingleColorPanel :public ::cppu::BaseMutex + ,public SingleColorPanel_Base + { + public: + SingleColorPanel( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow + ); + + // XToolPanel + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException); + + // XPaintListener + virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent equivalents + virtual void SAL_CALL disposing(); + + protected: + ~SingleColorPanel(); + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow; + }; + + //================================================================================================================== + //= PanelUIElement + //================================================================================================================== + typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement + > PanelUIElement_Base; + class PanelUIElement :public ::cppu::BaseMutex + ,public PanelUIElement_Base + { + public: + PanelUIElement( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow, + const ::rtl::OUString& i_rResourceURL + ); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface( ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + protected: + ~PanelUIElement(); + + private: + const ::rtl::OUString m_sResourceURL; + ::com::sun::star::uno::Reference< ::com::sun::star::view::XToolPanel > + m_xToolPanel; + }; + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... + +#endif // SD_WORKBENCH_CTP_PANEL_HXX diff --git a/sfx2/workben/custompanel/ctp_services.cxx b/sfx2/workben/custompanel/ctp_services.cxx new file mode 100644 index 000000000000..4164e8bc1629 --- /dev/null +++ b/sfx2/workben/custompanel/ctp_services.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sfx2.hxx" + +#include "ctp_factory.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + /** === end UNO using === **/ + + //================================================================================================================== + //= descriptors for the services implemented in this component + //================================================================================================================== + static struct ::cppu::ImplementationEntry s_aServiceEntries[] = + { + { + ToolPanelFactory::Create, + ToolPanelFactory::getImplementationName_static, + ToolPanelFactory::getSupportedServiceNames_static, + ::cppu::createSingleComponentFactory, NULL, 0 + }, + { 0, 0, 0, 0, 0, 0 } + }; + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... + +extern "C" +{ + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) + { + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) + { + return ::cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, ::sd::colortoolpanel::s_aServiceEntries ); + } + + //------------------------------------------------------------------------------------------------------------------ + void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) + { + return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , ::sd::colortoolpanel::s_aServiceEntries ); + } +} diff --git a/sfx2/workben/custompanel/description.xml b/sfx2/workben/custompanel/description.xml new file mode 100644 index 000000000000..7b85d64eaf69 --- /dev/null +++ b/sfx2/workben/custompanel/description.xml @@ -0,0 +1,16 @@ + + + + + + + + Custom Tool Panel Example + + + + + diff --git a/sfx2/workben/custompanel/makefile.mk b/sfx2/workben/custompanel/makefile.mk new file mode 100644 index 000000000000..b31625b1b9ab --- /dev/null +++ b/sfx2/workben/custompanel/makefile.mk @@ -0,0 +1,94 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=../.. +PRJNAME=sfx2 + +TARGET=custompanel +ENABLE_EXCEPTIONS=TRUE +LIBTARGET=NO +EXTENSIONNAME:=custom-tool-panel + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +#------------------------------------------------------------------- + +#---- extension version +EXTENSION_VERSION_BASE=0.1 +.IF ( "$(CWS_WORK_STAMP)" == "" ) || ( "$(UPDATER)" == "YES" ) + EXTENSION_VERSION=$(EXTENSION_VERSION_BASE) +.ELSE + EXTENSION_VERSION=$(EXTENSION_VERSION_BASE).cws.$(CWS_WORK_STAMP) +.ENDIF + +#---- extension title package name +EXTENSION_TITLE=Custom Tool Panel Example +EXTENSION_ZIPNAME=$(EXTENSIONNAME)-$(EXTENSION_VERSION_BASE)-$(RTL_OS:l)-$(RTL_ARCH:l) + +#-------------------------------------------------- + +SHL1DLLPRE= +SHL1TARGET=$(TARGET).uno +LIB1TARGET=$(SLB)/$(SHL1TARGET).lib +LIB1OBJFILES= \ + $(SLO)/ctp_factory.obj \ + $(SLO)/ctp_services.obj \ + $(SLO)/ctp_panel.obj + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(CPPUHELPERLIB) + +SHL1VERSIONMAP=$(SOLARSRC)/solenv/src/component.map +SHL1LIBS= $(LIB1TARGET) +SHL1DEF= $(MISC)/$(SHL1TARGET).def +SHL1RPATH= OXT +DEF1NAME= $(SHL1TARGET) + +# create Extension ----------------------------- + +COMPONENT_CONFIGDEST=. + +COMPONENT_XCU = \ + $(EXTENSIONDIR)/WriterWindowState.xcu \ + $(EXTENSIONDIR)/Factories.xcu + +COMPONENT_LIBRARIES = \ + $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST) + +# ........ dependencies for packaging the extension ........ +EXTENSION_PACKDEPS=makefile.mk + +# --- Targets ------------------------------------------------------ +.INCLUDE : extension_pre.mk +.INCLUDE : target.mk +.INCLUDE : extension_post.mk + diff --git a/sfx2/workben/custompanel/manifest.xml b/sfx2/workben/custompanel/manifest.xml new file mode 100644 index 000000000000..b57e3a8fbe0d --- /dev/null +++ b/sfx2/workben/custompanel/manifest.xml @@ -0,0 +1,10 @@ + + + + + + + -- cgit From 4c469d6bf5ea4136122ec1d9edf0eb214b4e108d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 09:26:14 +0200 Subject: slidecopy: didn't I have this file already? --- sfx2/workben/custompanel/delzip | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 sfx2/workben/custompanel/delzip (limited to 'sfx2') diff --git a/sfx2/workben/custompanel/delzip b/sfx2/workben/custompanel/delzip new file mode 100644 index 000000000000..e69de29bb2d1 -- cgit From 00d1c0a39e21071c94c230dbb27578347f8e6fc3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 09:27:41 +0200 Subject: slidecopy: A11Y support at XToolPanel --- sfx2/source/dialog/taskpane.cxx | 22 ++++++++++++++++++---- sfx2/workben/custompanel/ctp_panel.cxx | 14 ++++++++++++++ sfx2/workben/custompanel/ctp_panel.hxx | 1 + 3 files changed, 33 insertions(+), 4 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 383306da42e8..c7d91df1ce6b 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -213,6 +213,7 @@ namespace sfx2 //================================================================================================================== namespace { + //-------------------------------------------------------------------------------------------------------------- ::rtl::OUString lcl_identifyModule( const Reference< XFrame >& i_rDocumentFrame ) { ::rtl::OUString sModuleName; @@ -229,6 +230,7 @@ namespace sfx2 return sModuleName; } + //-------------------------------------------------------------------------------------------------------------- ::rtl::OUString lcl_identifyModule( const SfxBindings* i_pBindings ) { const SfxViewFrame* pViewFrame = i_pBindings->GetDispatcher()->GetFrame(); @@ -236,6 +238,8 @@ namespace sfx2 const Reference< XFrame > xFrame( pFrame->GetFrameInterface() ); return lcl_identifyModule( xFrame ); } + + //-------------------------------------------------------------------------------------------------------------- } //================================================================================================================== @@ -361,9 +365,10 @@ namespace sfx2 private: const ::rtl::OUString m_sUIName; + const Image m_aPanelImage; const ::rtl::OUString m_sResourceURL; CustomPanelUIElement m_aCustomPanel; - bool m_bAttemptedCreation; + bool m_bAttemptedCreation; }; //------------------------------------------------------------------------------------------------------------------ @@ -485,9 +490,18 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) { - // TODO - (void)i_rParentAccessible; - return NULL; + ENSURE_OR_RETURN( m_aCustomPanel.is(), "no panel to ask!", NULL ); + + Reference< XAccessible > xPanelAccessible; + try + { + xPanelAccessible.set( m_aCustomPanel.getToolPanel()->createAccessible( i_rParentAccessible ), UNO_SET_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return xPanelAccessible; } //================================================================================================================== diff --git a/sfx2/workben/custompanel/ctp_panel.cxx b/sfx2/workben/custompanel/ctp_panel.cxx index c159b65e497e..7cbd3b0dece4 100644 --- a/sfx2/workben/custompanel/ctp_panel.cxx +++ b/sfx2/workben/custompanel/ctp_panel.cxx @@ -71,6 +71,7 @@ namespace sd { namespace colortoolpanel using ::com::sun::star::lang::EventObject; using ::com::sun::star::awt::XDevice; using ::com::sun::star::awt::XGraphics; + using ::com::sun::star::accessibility::XAccessible; /** === end UNO using === **/ namespace WindowAttribute = ::com::sun::star::awt::WindowAttribute; namespace PosSize = ::com::sun::star::awt::PosSize; @@ -148,6 +149,19 @@ namespace sd { namespace colortoolpanel return m_xWindow; } + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL SingleColorPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() ) + throw DisposedException( ::rtl::OUString(), *this ); + + // TODO: the following is wrong, since it doesn't respect i_rParentAccessible. In a real extension, you should + // implement this correctly :) + (void)i_rParentAccessible; + return Reference< XAccessible >( getWindow(), UNO_QUERY ); + } + //------------------------------------------------------------------------------------------------------------------ void SAL_CALL SingleColorPanel::windowPaint( const PaintEvent& i_rEvent ) throw (RuntimeException) { diff --git a/sfx2/workben/custompanel/ctp_panel.hxx b/sfx2/workben/custompanel/ctp_panel.hxx index c3882e3afe98..75283d686250 100644 --- a/sfx2/workben/custompanel/ctp_panel.hxx +++ b/sfx2/workben/custompanel/ctp_panel.hxx @@ -63,6 +63,7 @@ namespace sd { namespace colortoolpanel // XToolPanel virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible ) throw (::com::sun::star::uno::RuntimeException); // XPaintListener virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException); -- cgit From ec769a41ff0ce34d345eea50d0a779c076f0b227 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 10:38:23 +0200 Subject: slidecopy: respect the ImageURL property for custom tool panels --- sfx2/source/dialog/taskpane.cxx | 30 +++++++++++++++++++++++-- sfx2/workben/custompanel/WriterWindowState.xcu | 3 +++ sfx2/workben/custompanel/makefile.mk | 14 ++++++++++-- sfx2/workben/custompanel/manifest.xml | 2 ++ sfx2/workben/custompanel/panel.png | Bin 0 -> 202 bytes 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 sfx2/workben/custompanel/panel.png (limited to 'sfx2') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index c7d91df1ce6b..4023842f2d15 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -41,6 +41,7 @@ #include #include #include +#include /** === end UNO includes === **/ #include @@ -84,6 +85,8 @@ namespace sfx2 using ::com::sun::star::frame::XModuleManager; using ::com::sun::star::frame::XFrame; using ::com::sun::star::lang::XComponent; + using ::com::sun::star::graphic::XGraphicProvider; + using ::com::sun::star::graphic::XGraphic; /** === end UNO using === **/ namespace PosSize = ::com::sun::star::awt::PosSize; @@ -240,6 +243,29 @@ namespace sfx2 } //-------------------------------------------------------------------------------------------------------------- + Image lcl_getPanelImage( const ::utl::OConfigurationNode& i_rPanelConfigNode ) + { + const ::rtl::OUString sImageURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "ImageURL" ) ) ); + if ( sImageURL.getLength() ) + { + try + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); + + ::comphelper::NamedValueCollection aMediaProperties; + aMediaProperties.put( "URL", sImageURL ); + + const Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_SET_THROW ); + return Image( xGraphic ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + return Image(); + } } //================================================================================================================== @@ -374,6 +400,7 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState ) :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) + ,m_aPanelImage( lcl_getPanelImage( i_rPanelWindowState ) ) ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) ,m_aCustomPanel() ,m_bAttemptedCreation( false ) @@ -422,8 +449,7 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ Image CustomToolPanel::GetImage() const { - // TODO: read from configuration - return Image(); + return m_aPanelImage; } //------------------------------------------------------------------------------------------------------------------ diff --git a/sfx2/workben/custompanel/WriterWindowState.xcu b/sfx2/workben/custompanel/WriterWindowState.xcu index 1110d8a6fdaa..79f71e8736f8 100644 --- a/sfx2/workben/custompanel/WriterWindowState.xcu +++ b/sfx2/workben/custompanel/WriterWindowState.xcu @@ -9,6 +9,9 @@ true + + vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png + diff --git a/sfx2/workben/custompanel/makefile.mk b/sfx2/workben/custompanel/makefile.mk index b31625b1b9ab..c90fcc6cf444 100644 --- a/sfx2/workben/custompanel/makefile.mk +++ b/sfx2/workben/custompanel/makefile.mk @@ -82,13 +82,23 @@ COMPONENT_XCU = \ $(EXTENSIONDIR)/Factories.xcu COMPONENT_LIBRARIES = \ - $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST) + $(EXTENSIONDIR)/$(SHL1TARGET)$(DLLPOST) + +COMPONENT_IMAGES= \ + $(EXTENSIONDIR)/panel.png # ........ dependencies for packaging the extension ........ -EXTENSION_PACKDEPS=makefile.mk +EXTENSION_PACKDEPS=makefile.mk $(COMPONENT_IMAGES) # --- Targets ------------------------------------------------------ .INCLUDE : extension_pre.mk .INCLUDE : target.mk .INCLUDE : extension_post.mk +$(EXTENSIONDIR)/%.png : ./%.png + @@-$(MKDIRHIER) $(@:d) + @$(COPY) $< $@ > $(NULLDEV) + +$(EXTENSIONDIR)/WriterWindowState.xcu: ./WriterWindowState.xcu + @@-$(MKDIRHIER) $(@:d) + $(COMMAND_ECHO)$(TYPE) ./WriterWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/WriterWindowState.xcu diff --git a/sfx2/workben/custompanel/manifest.xml b/sfx2/workben/custompanel/manifest.xml index b57e3a8fbe0d..1089f8b6fd59 100644 --- a/sfx2/workben/custompanel/manifest.xml +++ b/sfx2/workben/custompanel/manifest.xml @@ -7,4 +7,6 @@ manifest:full-path="WriterWindowState.xcu"/> + diff --git a/sfx2/workben/custompanel/panel.png b/sfx2/workben/custompanel/panel.png new file mode 100644 index 000000000000..2438714af8a6 Binary files /dev/null and b/sfx2/workben/custompanel/panel.png differ -- cgit From 6afa02e3d6e6324b8d3e2ddd91fbb81c583aab83 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 11:14:22 +0200 Subject: slidecopy: remember the tool panel's visibility states, and restore the next time --- sfx2/inc/sfx2/taskpane.hxx | 1 + sfx2/source/dialog/taskpane.cxx | 90 +++++++++++++++++--------- sfx2/workben/custompanel/WriterWindowState.xcu | 15 ++++- sfx2/workben/custompanel/ctp_factory.cxx | 10 ++- sfx2/workben/custompanel/ctp_panel.cxx | 11 ++-- sfx2/workben/custompanel/ctp_panel.hxx | 7 +- 6 files changed, 94 insertions(+), 40 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/taskpane.hxx b/sfx2/inc/sfx2/taskpane.hxx index 896f2bf32a05..dbed2c775fce 100644 --- a/sfx2/inc/sfx2/taskpane.hxx +++ b/sfx2/inc/sfx2/taskpane.hxx @@ -97,6 +97,7 @@ namespace sfx2 TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ); + // Window overridables virtual void GetFocus(); virtual void Resize(); virtual long Notify( NotifyEvent& i_rNotifyEvent ); diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 4023842f2d15..2ab3e7420632 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -216,6 +216,35 @@ namespace sfx2 //================================================================================================================== namespace { + //-------------------------------------------------------------------------------------------------------------- + ::utl::OConfigurationTreeRoot lcl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier, + const ::rtl::OUString& i_rResourceURL = ::rtl::OUString() ) + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + ::rtl::OUStringBuffer aPathComposer; + try + { + const Reference< XNameAccess > xModuleAccess( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) ); + + const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) ); + + aPathComposer.appendAscii( "org.openoffice.Office.UI." ); + aPathComposer.append( sWindowStateRef ); + aPathComposer.appendAscii( "/UIElements/States" ); + if ( i_rResourceURL.getLength() ) + { + aPathComposer.appendAscii( "/" ); + aPathComposer.append( i_rResourceURL ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return ::utl::OConfigurationTreeRoot( aContext, aPathComposer.makeStringAndClear(), false ); + } + //-------------------------------------------------------------------------------------------------------------- ::rtl::OUString lcl_identifyModule( const Reference< XFrame >& i_rDocumentFrame ) { @@ -388,11 +417,13 @@ namespace sfx2 private: bool impl_ensureToolPanelWindow( Window& i_rPanelParentWindow ); + void impl_updatePanelConfig( const bool i_bVisible ) const; private: const ::rtl::OUString m_sUIName; const Image m_aPanelImage; const ::rtl::OUString m_sResourceURL; + const ::rtl::OUString m_sPanelConfigPath; CustomPanelUIElement m_aCustomPanel; bool m_bAttemptedCreation; }; @@ -402,6 +433,7 @@ namespace sfx2 :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) ,m_aPanelImage( lcl_getPanelImage( i_rPanelWindowState ) ) ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) + ,m_sPanelConfigPath( i_rPanelWindowState.getNodePath() ) ,m_aCustomPanel() ,m_bAttemptedCreation( false ) { @@ -440,6 +472,16 @@ namespace sfx2 return m_aCustomPanel.is(); } + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::impl_updatePanelConfig( const bool i_bVisible ) const + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + ::utl::OConfigurationTreeRoot aConfig( aContext, m_sPanelConfigPath, true ); + + aConfig.setNodeValue( "Visible", makeAny( i_bVisible ) ); + aConfig.commit(); + } + //------------------------------------------------------------------------------------------------------------------ ::rtl::OUString CustomToolPanel::GetDisplayName() const { @@ -460,6 +502,9 @@ namespace sfx2 // TODO: we might need a mechanism to decide whether the panel should be destroyed/re-created, or (as it is // done now) hidden/shown m_aCustomPanel.getPanelWindow()->setVisible( sal_True ); + + // update the panel's configuration + impl_updatePanelConfig( true ); } //------------------------------------------------------------------------------------------------------------------ @@ -468,6 +513,9 @@ namespace sfx2 ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to deactivate!" ); m_aCustomPanel.getPanelWindow()->setVisible( sal_False ); + + // update the panel's configuration + impl_updatePanelConfig( false ); } //------------------------------------------------------------------------------------------------------------------ @@ -561,8 +609,6 @@ namespace sfx2 private: void impl_initFromConfiguration(); - static ::utl::OConfigurationTreeRoot - impl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier ); static bool impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ); @@ -584,30 +630,6 @@ namespace sfx2 m_aPanels.GrabFocus(); } - //------------------------------------------------------------------------------------------------------------------ - ::utl::OConfigurationTreeRoot ModuleTaskPane_Impl::impl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier ) - { - const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - ::rtl::OUStringBuffer aPathComposer; - try - { - const Reference< XNameAccess > xModuleAccess( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); - const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) ); - - const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) ); - - aPathComposer.appendAscii( "org.openoffice.Office.UI." ); - aPathComposer.append( sWindowStateRef ); - aPathComposer.appendAscii( "/UIElements/States" ); - - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return ::utl::OConfigurationTreeRoot( aContext, aPathComposer.makeStringAndClear(), false ); - } - //------------------------------------------------------------------------------------------------------------------ bool ModuleTaskPane_Impl::impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ) { @@ -617,10 +639,12 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ void ModuleTaskPane_Impl::impl_initFromConfiguration() { - const ::utl::OConfigurationTreeRoot aWindowStateConfig( impl_getModuleUIElementStatesConfig( m_sModuleIdentifier ) ); + const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( m_sModuleIdentifier ) ); if ( !aWindowStateConfig.isValid() ) return; + size_t nFirstVisiblePanel = size_t( -1 ); + const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); resource != aUIElements.getConstArray() + aUIElements.getLength(); @@ -632,14 +656,22 @@ namespace sfx2 ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode ) ); - m_aPanels.InsertPanel( pCustomPanel, m_aPanels.GetPanelCount() ); + size_t nPanelPos = m_aPanels.InsertPanel( pCustomPanel, m_aPanels.GetPanelCount() ); + + if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) ) + nFirstVisiblePanel = nPanelPos; + } + + if ( nFirstVisiblePanel != size_t( -1 ) ) + { + m_aPanels.ActivatePanel( nFirstVisiblePanel ); } } //------------------------------------------------------------------------------------------------------------------ bool ModuleTaskPane_Impl::ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ) { - const ::utl::OConfigurationTreeRoot aWindowStateConfig( impl_getModuleUIElementStatesConfig( i_rModuleIdentifier ) ); + const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( i_rModuleIdentifier ) ); if ( !aWindowStateConfig.isValid() ) return false; diff --git a/sfx2/workben/custompanel/WriterWindowState.xcu b/sfx2/workben/custompanel/WriterWindowState.xcu index 79f71e8736f8..527a3c89d8ac 100644 --- a/sfx2/workben/custompanel/WriterWindowState.xcu +++ b/sfx2/workben/custompanel/WriterWindowState.xcu @@ -2,12 +2,23 @@ - + Soylent Green - true + false + + + vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png + + + + + Soylent Red + + + false vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png diff --git a/sfx2/workben/custompanel/ctp_factory.cxx b/sfx2/workben/custompanel/ctp_factory.cxx index 462709e7ad2c..1b630a7c1440 100644 --- a/sfx2/workben/custompanel/ctp_factory.cxx +++ b/sfx2/workben/custompanel/ctp_factory.cxx @@ -82,7 +82,13 @@ namespace sd { namespace colortoolpanel { ::osl::MutexGuard aGuard( m_aMutex ); - if ( !i_rResourceURL.equalsAscii( "private:resource/toolpanel/org.openoffice.example.custompanel" ) ) + if ( !i_rResourceURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/org.openoffice.example.custompanel/" ) ) ) + throw NoSuchElementException( i_rResourceURL, *this ); + + const ::rtl::OUString sColor( i_rResourceURL.copy( i_rResourceURL.lastIndexOf( '/' ) + 1 ) ); + const bool bRed = sColor.equalsAscii( "red" ); + const bool bGreen = sColor.equalsAscii( "green" ); + if ( !bRed && !bGreen ) throw NoSuchElementException( i_rResourceURL, *this ); // retrieve the parent window @@ -108,7 +114,7 @@ namespace sd { namespace colortoolpanel } /// create the panel - Reference< XUIElement > xUIElement( new PanelUIElement( m_xContext, xParentWindow, i_rResourceURL ) ); + Reference< XUIElement > xUIElement( new PanelUIElement( m_xContext, xParentWindow, i_rResourceURL, bGreen ? 0x80 << 8 : 0x80 << 16 ) ); return xUIElement; } diff --git a/sfx2/workben/custompanel/ctp_panel.cxx b/sfx2/workben/custompanel/ctp_panel.cxx index 7cbd3b0dece4..7f39b671c2b6 100644 --- a/sfx2/workben/custompanel/ctp_panel.cxx +++ b/sfx2/workben/custompanel/ctp_panel.cxx @@ -113,9 +113,10 @@ namespace sd { namespace colortoolpanel //= class SingleColorPanel //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow ) + SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow, const ::sal_Int32 i_nPanelColor ) :SingleColorPanel_Base( m_aMutex ) ,m_xWindow() + ,m_nPanelColor( i_nPanelColor ) { // retrieve the parent window for our to-be-created pane window Reference< XWindowPeer > xParentPeer( i_rParentWindow, UNO_QUERY ); @@ -169,8 +170,8 @@ namespace sd { namespace colortoolpanel { const Reference< XDevice > xDevice( i_rEvent.Source, UNO_QUERY_THROW ); const Reference< XGraphics > xGraphics( xDevice->createGraphics(), UNO_SET_THROW ); - xGraphics->setFillColor( 0x80 << 8 ); - xGraphics->setLineColor( 0x80 << 16 ); + xGraphics->setFillColor( m_nPanelColor ); + xGraphics->setLineColor( 0x00FFFFFF ); const Reference< XWindow > xWindow( i_rEvent.Source, UNO_QUERY_THROW ); const Rectangle aWindowRect( xWindow->getPosSize() ); @@ -213,10 +214,10 @@ namespace sd { namespace colortoolpanel //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ PanelUIElement::PanelUIElement( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow, - const ::rtl::OUString& i_rResourceURL ) + const ::rtl::OUString& i_rResourceURL, const ::sal_Int32 i_nPanelColor ) :PanelUIElement_Base( m_aMutex ) ,m_sResourceURL( i_rResourceURL ) - ,m_xToolPanel( new SingleColorPanel( i_rContext, i_rParentWindow ) ) + ,m_xToolPanel( new SingleColorPanel( i_rContext, i_rParentWindow, i_nPanelColor ) ) { } diff --git a/sfx2/workben/custompanel/ctp_panel.hxx b/sfx2/workben/custompanel/ctp_panel.hxx index 75283d686250..5975af2badc1 100644 --- a/sfx2/workben/custompanel/ctp_panel.hxx +++ b/sfx2/workben/custompanel/ctp_panel.hxx @@ -58,7 +58,8 @@ namespace sd { namespace colortoolpanel public: SingleColorPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow, + const ::sal_Int32 i_nPanelColor ); // XToolPanel @@ -79,6 +80,7 @@ namespace sd { namespace colortoolpanel private: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow; + const sal_Int32 m_nPanelColor; }; //================================================================================================================== @@ -93,7 +95,8 @@ namespace sd { namespace colortoolpanel PanelUIElement( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow, - const ::rtl::OUString& i_rResourceURL + const ::rtl::OUString& i_rResourceURL, + const ::sal_Int32 i_nPanelColor ); // XUIElement -- cgit From d14f4691292d5fee516704b6a0aa12f71495a6c0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 11:32:16 +0200 Subject: slidecopy: default WinBits to WB_DIALOGCONTROL --- sfx2/source/dialog/taskpane.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 2ab3e7420632..e21edd20afa3 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -587,7 +587,7 @@ namespace sfx2 ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const ::rtl::OUString& i_rModuleIdentifier ) :m_rAntiImpl( i_rAntiImpl ) ,m_sModuleIdentifier( i_rModuleIdentifier ) - ,m_aPanels( i_rAntiImpl, 0 ) + ,m_aPanels( i_rAntiImpl ) { m_aPanels.Show(); #if ( OSL_DEBUG_LEVEL > 0 ) && defined ( USE_DUMMY_PANEL ) -- cgit From 1f6bd474e65cc23a981dae1e8b6fa5c89441afef Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 11:32:59 +0200 Subject: slidecopy: build the workbench folder, too --- sfx2/prj/build.lst | 1 + 1 file changed, 1 insertion(+) (limited to 'sfx2') diff --git a/sfx2/prj/build.lst b/sfx2/prj/build.lst index 67bff5cbf349..983e3108a11d 100644 --- a/sfx2/prj/build.lst +++ b/sfx2/prj/build.lst @@ -19,4 +19,5 @@ sf sfx2\source\statbar nmake - all sf_sbar sf_sdi sf_inc NULL sf sfx2\source\toolbox nmake - all sf_tbox sf_sdi sf_inc NULL sf sfx2\source\inet nmake - all sf_inet sf_sdi sf_inc NULL sf sfx2\source\explorer nmake - all sf_expl sf_sdi sf_inc NULL +sf sfx2\workben\custompanel nmake - all sf_wb_custompanel NULL sf sfx2\util nmake - all sf_util sf_appl sf_bast sf_cnfg sf_ctrl sf_dlg sf_doc sf_expl sf_inet sf_menu sf_layout sf_noti sf_sbar sf_tbox sf_view NULL -- cgit From ff4d73f155f97b544dd15a4e769253498e562537 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 11:58:20 +0200 Subject: slidecopy: add SID_TASKPANE support to Calc, Writer/Web, Writer/Global, Math, Writer/Form, Writer/Report, XMLForm --- sfx2/workben/custompanel/CalcWindowState.xcu | 18 ++++++++++++++++++ sfx2/workben/custompanel/Factories.xcu | 2 +- sfx2/workben/custompanel/WriterWindowState.xcu | 4 ++-- sfx2/workben/custompanel/ctp_factory.cxx | 9 +++------ sfx2/workben/custompanel/makefile.mk | 6 ++++++ sfx2/workben/custompanel/manifest.xml | 2 ++ 6 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 sfx2/workben/custompanel/CalcWindowState.xcu (limited to 'sfx2') diff --git a/sfx2/workben/custompanel/CalcWindowState.xcu b/sfx2/workben/custompanel/CalcWindowState.xcu new file mode 100644 index 000000000000..9dd981d9c973 --- /dev/null +++ b/sfx2/workben/custompanel/CalcWindowState.xcu @@ -0,0 +1,18 @@ + + + + + + + Soylent Blue + + + false + + + vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png + + + + + diff --git a/sfx2/workben/custompanel/Factories.xcu b/sfx2/workben/custompanel/Factories.xcu index 88e6a4df14f8..1d277a86a222 100644 --- a/sfx2/workben/custompanel/Factories.xcu +++ b/sfx2/workben/custompanel/Factories.xcu @@ -7,7 +7,7 @@ toolpanel - org.openoffice.example.custompanel + org.openoffice.example.colorpanel diff --git a/sfx2/workben/custompanel/WriterWindowState.xcu b/sfx2/workben/custompanel/WriterWindowState.xcu index 527a3c89d8ac..9376e34308b9 100644 --- a/sfx2/workben/custompanel/WriterWindowState.xcu +++ b/sfx2/workben/custompanel/WriterWindowState.xcu @@ -2,7 +2,7 @@ - + Soylent Green @@ -13,7 +13,7 @@ vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png - + Soylent Red diff --git a/sfx2/workben/custompanel/ctp_factory.cxx b/sfx2/workben/custompanel/ctp_factory.cxx index 1b630a7c1440..54880cc5fcc7 100644 --- a/sfx2/workben/custompanel/ctp_factory.cxx +++ b/sfx2/workben/custompanel/ctp_factory.cxx @@ -82,14 +82,11 @@ namespace sd { namespace colortoolpanel { ::osl::MutexGuard aGuard( m_aMutex ); - if ( !i_rResourceURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/org.openoffice.example.custompanel/" ) ) ) + if ( !i_rResourceURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/org.openoffice.example.colorpanel/" ) ) ) throw NoSuchElementException( i_rResourceURL, *this ); const ::rtl::OUString sColor( i_rResourceURL.copy( i_rResourceURL.lastIndexOf( '/' ) + 1 ) ); - const bool bRed = sColor.equalsAscii( "red" ); - const bool bGreen = sColor.equalsAscii( "green" ); - if ( !bRed && !bGreen ) - throw NoSuchElementException( i_rResourceURL, *this ); + const sal_Int32 nPanelColor = sColor.toInt32( 16 ); // retrieve the parent window Reference< XWindow > xParentWindow; @@ -114,7 +111,7 @@ namespace sd { namespace colortoolpanel } /// create the panel - Reference< XUIElement > xUIElement( new PanelUIElement( m_xContext, xParentWindow, i_rResourceURL, bGreen ? 0x80 << 8 : 0x80 << 16 ) ); + Reference< XUIElement > xUIElement( new PanelUIElement( m_xContext, xParentWindow, i_rResourceURL, nPanelColor ) ); return xUIElement; } diff --git a/sfx2/workben/custompanel/makefile.mk b/sfx2/workben/custompanel/makefile.mk index c90fcc6cf444..27a0123ace58 100644 --- a/sfx2/workben/custompanel/makefile.mk +++ b/sfx2/workben/custompanel/makefile.mk @@ -79,6 +79,7 @@ COMPONENT_CONFIGDEST=. COMPONENT_XCU = \ $(EXTENSIONDIR)/WriterWindowState.xcu \ + $(EXTENSIONDIR)/CalcWindowState.xcu \ $(EXTENSIONDIR)/Factories.xcu COMPONENT_LIBRARIES = \ @@ -102,3 +103,8 @@ $(EXTENSIONDIR)/%.png : ./%.png $(EXTENSIONDIR)/WriterWindowState.xcu: ./WriterWindowState.xcu @@-$(MKDIRHIER) $(@:d) $(COMMAND_ECHO)$(TYPE) ./WriterWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/WriterWindowState.xcu + +$(EXTENSIONDIR)/CalcWindowState.xcu: ./CalcWindowState.xcu + @@-$(MKDIRHIER) $(@:d) + $(COMMAND_ECHO)$(TYPE) ./CalcWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/CalcWindowState.xcu + diff --git a/sfx2/workben/custompanel/manifest.xml b/sfx2/workben/custompanel/manifest.xml index 1089f8b6fd59..dfb09a1a8f7d 100644 --- a/sfx2/workben/custompanel/manifest.xml +++ b/sfx2/workben/custompanel/manifest.xml @@ -5,6 +5,8 @@ manifest:full-path="custompanel.unoSHARED_EXTENSION"/> +