From 61addfefa431d7c5fd8a445c08bd5b1bf122161b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 14:32:25 +0100 Subject: [CWS autorecovery] removed the dead code for moving to the last record in a separate thread Part of the code relied in the SfxCancellable, which is going to be removed. Also, this feature wasn't used anymore for a long time now, if we want to have it, again, we should better re-implement it. --- svx/source/form/fmshell.cxx | 12 +- svx/source/form/fmshimp.cxx | 472 ------------------------------------------- svx/source/form/fmstring.src | 4 - svx/source/inc/fmresids.hrc | 2 +- svx/source/inc/fmshimp.hxx | 167 --------------- 5 files changed, 3 insertions(+), 654 deletions(-) (limited to 'svx') diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index ccdfb2b1af39..aba2702c4ddf 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -301,9 +301,6 @@ sal_uInt16 FmFormShell::PrepareClose(sal_Bool bUI, sal_Bool bForBrowsing) m_pFormView && m_pFormView->GetActualOutDev() && m_pFormView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW) { - if (GetImpl()->HasAnyPendingCursorAction()) - GetImpl()->CancelAnyPendingCursorAction(); - SdrPageView* pCurPageView = m_pFormView->GetSdrPageView(); // sal_uInt16 nPos = pCurPageView ? pCurPageView->GetWinList().Find((OutputDevice*)m_pFormView->GetActualOutDev()) : SDRPAGEVIEWWIN_NOTFOUND; @@ -1126,8 +1123,8 @@ void FmFormShell::GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich) || m_bDesignMode || !GetImpl()->getActiveForm().is() || GetImpl()->isInFilterMode() - || ( GetImpl()->HasPendingCursorAction(GetImpl()->getNavController()) - && (SID_FM_RECORD_TOTAL != nWhich) + || ( /*GetImpl()->HasPendingCursorAction(GetImpl()->getNavController()) + && */(SID_FM_RECORD_TOTAL != nWhich) ) ) rSet.DisableItem(nWhich); @@ -1415,11 +1412,6 @@ void FmFormShell::SetDesignMode( sal_Bool _bDesignMode ) if ( _bDesignMode == m_bDesignMode ) return; - // if we are moving our data source cursor currently .... - if ( GetImpl()->HasAnyPendingCursorAction() ) - // ... cancel this - GetImpl()->CancelAnyPendingCursorAction(); - FmFormModel* pModel = GetFormModel(); if (pModel) // fuer die Zeit des Uebergangs das Undo-Environment ausschalten, das sichert, dass man dort auch nicht-transiente diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index e4d656a06f28..06bd3cd128f4 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -408,11 +408,6 @@ sal_Bool FmXBoundFormFieldIterator::ShouldHandleElement(const Reference< XInterf return aVal.hasValue(); } -//============================================================================== - -DECL_CURSOR_ACTION_THREAD(FmMoveToLastThread) -IMPL_CURSOR_ACTION_THREAD(FmMoveToLastThread, SVX_RES(RID_STR_MOVING_CURSOR), last()); - //------------------------------------------------------------------------------ sal_Bool isControlList(const SdrMarkList& rMarkList) { @@ -834,8 +829,6 @@ void FmXFormShell::disposing() { ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety); - if (HasAnyPendingCursorAction()) - CancelAnyPendingCursorAction(); aGuard.clear(); DBG_ASSERT(!m_nInvalidationEvent, "FmXFormShell::~FmXFormShell : still have an invalidation event !"); @@ -1828,10 +1821,6 @@ void FmXFormShell::setActiveController( const Reference< XFormController>& xCont if (xController != m_xActiveController) { - // if there is a async cursor action running we have to restore the locking state of the controls of the old controller - if (HasPendingCursorAction(Reference< XResultSet>(m_xActiveForm, UNO_QUERY))) - restoreControlLocks(); - ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety); // switch all nav dispatchers belonging to the form of the current nav controller to 'non active' Reference< XResultSet> xNavigationForm; @@ -1911,10 +1900,6 @@ void FmXFormShell::setActiveController( const Reference< XFormController>& xCont if (m_xNavigationController.is()) xNavigationForm = Reference< XResultSet>(m_xNavigationController->getModel(), UNO_QUERY); - // if there is a async cursor action running we have to lock the controls of the new controller - if (HasPendingCursorAction(Reference< XResultSet>(m_xActiveForm, UNO_QUERY))) - setControlLocks(); - m_bInActivate = sal_False; m_pShell->UIFeatureChanged(); @@ -3150,312 +3135,6 @@ void FmXFormShell::clearFilter() } } -//------------------------------------------------------------------------------ -void FmXFormShell::setControlLocks() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::setControlLocks" ); - if ( impl_checkDisposed() ) - return; - - Reference< XTabController> xCtrler(getActiveController(), UNO_QUERY); - if (!xCtrler.is()) - return; - - Reference< XControlContainer> xControls(xCtrler->getContainer(), UNO_QUERY); - if (!xControls.is()) - return; - - DBG_ASSERT( m_aControlLocks.empty(), "FmXFormShell::setControlLocks: locking state array isn't empty (called me twice ?)!" ); - - Sequence< Reference< XControl> > aControls = xControls->getControls(); - const Reference< XControl>* pControls = aControls.getConstArray(); - - // iterate through all bound controls, remember the old locking state, set the lock - for (sal_Int32 i=0; i xCtrl(pControls[i], UNO_QUERY); - if (!xCtrl.is()) - { - // it may be a container of controls - Reference< XIndexAccess> xContainer(pControls[i], UNO_QUERY); - if (xContainer.is()) - { // no recursion. we only know top level control containers (e.g. grid controls) - for (sal_Int16 j=0; jgetCount(); ++j) - { - xContainer->getByIndex(j) >>= xCtrl; - if (!xCtrl.is()) - continue; - - m_aControlLocks.push_back( xCtrl->getLock() ); - xCtrl->setLock(sal_True); - } - } - continue; - } - - m_aControlLocks.push_back( xCtrl->getLock() ); - xCtrl->setLock(sal_True); - } -} - -//------------------------------------------------------------------------------ -void FmXFormShell::restoreControlLocks() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::restoreControlLocks" ); - if ( impl_checkDisposed() ) - return; - - Reference< XTabController> xCtrler(getActiveController(), UNO_QUERY); - if (!xCtrler.is()) - return; - - Reference< XControlContainer> xControls(xCtrler->getContainer(), UNO_QUERY); - if (!xControls.is()) - return; - - Sequence< Reference< XControl> > aControls(xControls->getControls()); - const Reference< XControl>* pControls = aControls.getConstArray(); - - // iterate through all bound controls, restore the old locking state - size_t nBoundControl = 0; - for (sal_Int32 i=0; i xCtrl(pControls[i], UNO_QUERY); - if (!xCtrl.is()) - { - // it may be a container of controls - Reference< XIndexAccess> xContainer(pControls[i], UNO_QUERY); - if (xContainer.is()) - { // no recursion. we only know top level control containers (e.g. grid controls) - for (sal_Int16 j=0; jgetCount(); ++j) - { - xContainer->getByIndex(j) >>= xCtrl; - if (!xCtrl.is()) - continue; - - DBG_ASSERT( nBoundControl < m_aControlLocks.size(), "FmXFormShell::restoreControlLocks: m_aControlLocks is invalid!" ); - xCtrl->setLock( m_aControlLocks[ nBoundControl ] ); - ++nBoundControl; - } - } - continue; - } - - DBG_ASSERT( nBoundControl < m_aControlLocks.size(), "FmXFormShell::restoreControlLocks: m_aControlLocks is invalid!" ); - // a violation of this condition would mean a) setControlLocks hasn't been called or b) the ControlContainer - // has changed since the last call to setControlLocks. - // a) clearly is a fault of the programmer and b) shouldn't be possible (as we are in alive mode) - xCtrl->setLock( m_aControlLocks[ nBoundControl ] ); - ++nBoundControl; - } - ::std::vector< sal_Bool > aEmpty; - m_aControlLocks.swap( aEmpty ); -} - -//------------------------------------------------------------------------------ -void FmXFormShell::DoAsyncCursorAction(const Reference< XFormController>& _xController, CURSOR_ACTION _eWhat) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::DoAsyncCursorAction" ); - if ( impl_checkDisposed() ) - return; - - DBG_ASSERT(_xController.is(), "FmXFormShell::DoAsyncCursorAction : invalid argument !"); - DoAsyncCursorAction(Reference< XResultSet>(_xController->getModel(), UNO_QUERY), _eWhat); -} - -//------------------------------------------------------------------------------ -void FmXFormShell::DoAsyncCursorAction(const Reference< XResultSet>& _xForm, CURSOR_ACTION _eWhat) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::DoAsyncCursorAction" ); - if ( impl_checkDisposed() ) - return; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - DBG_ASSERT(_xForm.is(), "FmXFormShell::DoAsyncCursorAction : invalid argument !"); - - // build the access path for the form - if (HasPendingCursorAction(_xForm)) - { - DBG_ERROR("FmXFormShell::DoAsyncCursorAction : invalid call !"); - return; - } - - CursorActionDescription& rDesc = m_aCursorActions[ _xForm ]; - // [] will create a new one if non-existent - DBG_ASSERT(rDesc.pThread == NULL, "FmXFormShell::DoAsyncCursorAction : the cursor action thread for this form is still alive !"); - - Reference< XResultSet > xCursor( getInternalForm( _xForm ), UNO_QUERY ); - switch (_eWhat) - { - case CA_MOVE_TO_LAST : - rDesc.pThread = new FmMoveToLastThread( xCursor ); - break; - case CA_MOVE_ABSOLUTE: - DBG_ERROR("FmXFormShell::DoAsyncCursorAction : CA_MOVE_ABSOLUTE not supported yet !"); - return; - } - rDesc.pThread->SetTerminationHdl(LINK(this, FmXFormShell, OnCursorActionDone)); - rDesc.pThread->EnableSelfDelete(sal_False); - - rDesc.bCanceling = sal_False; - - // set the control locks before starting the thread - DBG_ASSERT(getInternalForm(m_xActiveForm) == m_xActiveForm, "FmXFormShell::DoAsyncCursorAction : the active form should always be a internal one !"); - if (getInternalForm(_xForm) == m_xActiveForm) - setControlLocks(); - - // go ... - rDesc.pThread->create(); - - // set a priority slightly below normal - rDesc.pThread->setPriority(::vos::OThread::TPriority_BelowNormal); -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasPendingCursorAction(const Reference< XResultSet>& _xForm) const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasPendingCursorAction" ); - if ( impl_checkDisposed() ) - return sal_False; - - if (!_xForm.is()) - return sal_False; - - // TODO: if we ever re-implement the asynchronous cursor actions, then this will happen - // in the controller, and not in the form. In such a case, we here probably need to check - // whether the controller for the form has this "pending cursor action" - - return sal_False; -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasPendingCursorAction(const Reference< XFormController>& xController) const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasPendingCursorAction" ); - if ( impl_checkDisposed() ) - return sal_False; - - if (!xController.is()) - return sal_False; - - return HasPendingCursorAction(Reference< XResultSet>(xController->getModel(), UNO_QUERY)); -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasAnyPendingCursorAction() const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasAnyPendingCursorAction" ); - ::osl::MutexGuard aGuard( const_cast< FmXFormShell* >( this )->m_aAsyncSafety ); - - for ( CursorActions::const_iterator aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter ) - { - if (((*aIter).second.pThread != NULL) || ((*aIter).second.nFinishedEvent != 0)) - return sal_True; - } - return sal_False; -} - -//------------------------------------------------------------------------------ -void FmXFormShell::CancelAnyPendingCursorAction() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::CancelAnyPendingCursorAction" ); - if ( impl_checkDisposed() ) - return; - - ::osl::ResettableMutexGuard aGuard( m_aAsyncSafety ); - - CursorActions::iterator aIter; - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if (!(*aIter).second.nFinishedEvent && (*aIter).second.pThread) - { // the thread is really running - (*aIter).second.bCanceling = sal_True; - - aGuard.clear(); - (*aIter).second.pThread->StopItWait(); - // StopItWait returns after the termination handler (our OnCursorActionDone) has been called - aGuard.reset(); - } - } - - // all threads are finished (means canceled), now do the cleanup - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if ((*aIter).second.pThread) - { - LINK(this, FmXFormShell, OnCursorActionDoneMainThread).Call((*aIter).second.pThread); - DBG_ASSERT((*aIter).second.pThread == NULL, "FmXFormShell::CancelAnyPendingCursorAction : strange behaviour of OnCursorActionDoneMainThread !"); - } - } -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmXFormShell, OnCursorActionDone, FmCursorActionThread*, pThread) -{ - if ( impl_checkDisposed() ) - return 0L; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - - // search the pos of the thread within m_aCursorActions - CursorActions::iterator aIter; - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if ((*aIter).second.pThread == pThread) - break; - } - - DBG_ASSERT(aIter != m_aCursorActions.end(), "FmXFormShell::OnCursorActionDone : could not ::std::find the thread !"); - DBG_ASSERT((*aIter).second.nFinishedEvent == 0, "FmXFormShell::OnCursorActionDone : another 'ActionDone' for this thread is pending !"); - // as we allow only one async action at a time (per form) this shouldn't happen - - if (!(*aIter).second.bCanceling) - (*aIter).second.nFinishedEvent = Application::PostUserEvent(LINK(this, FmXFormShell, OnCursorActionDoneMainThread), pThread); - // if bCanceling is sal_True an other thread's execution is in CancelAnyPendingCursorAction - return 0L; -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmXFormShell, OnCursorActionDoneMainThread, FmCursorActionThread*, pThread) -{ - if ( impl_checkDisposed() ) - return 0L; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - - // search the pos of the thread within m_aCursorActions - CursorActions::iterator aIter = m_aCursorActions.find( pThread->getDataSource() ); - DBG_ASSERT(aIter != m_aCursorActions.end(), "FmXFormShell::OnCursorActionDoneMainThread : could not ::std::find the thread data !"); - DBG_ASSERT((*aIter).second.pThread == pThread, "FmXFormShell::OnCursorActionDoneMainThread : invalid thread data !"); - - // remember some thread parameters - Reference< XResultSet> xForm(pThread->getDataSource(), UNO_QUERY); - - // throw away the thread - delete (*aIter).second.pThread; - (*aIter).second.pThread = NULL; - (*aIter).second.nFinishedEvent = 0; - (*aIter).second.bCanceling = sal_False; - // as we allow exactly one thread per form we may remove this ones data from m_aCursorActions - m_aCursorActions.erase(aIter); - - DBG_ASSERT(getInternalForm(m_xActiveForm) == m_xActiveForm, "FmXFormShell::DoAsyncCursorAction : the active form should always be a internal one !"); - DBG_ASSERT(getInternalForm(xForm) == xForm, "FmXFormShell::DoAsyncCursorAction : the thread's form should always be a internal one !"); - // if one of the two asserts above fails the upcoming comparison is senseless - if (xForm == m_xActiveForm) - { - // the active controller belongs to the form where the action is finished - // -> re-enable the controls if they are not locked because of another running thread - if (!HasPendingCursorAction(xForm)) - restoreControlLocks(); - } - - m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(DatabaseSlotMap); - // it may not be neccessary but me thinks it's faster without the check if we really have to do this - - return 0L; -} - //------------------------------------------------------------------------------ void FmXFormShell::CreateExternalView() { @@ -4419,155 +4098,4 @@ void ControlConversionMenuController::StateChanged(sal_uInt16 nSID, SfxItemState } } -//================================================================== - -FmCursorActionThread::FmCursorActionThread(const Reference< XResultSet>& _xDataSource, const UniString& _rStopperCaption) - :m_xDataSource(_xDataSource) - ,m_sStopperCaption(_rStopperCaption) - ,m_bCanceled(sal_False) - ,m_bDeleteMyself(sal_False) - ,m_bDisposeCursor(sal_False) - ,m_bTerminated(sal_False) - ,m_bRunFailed(sal_False) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmCursorActionThread::FmCursorActionThread" ); - DBG_ASSERT(m_xDataSource.is() && Reference< XCancellable>(m_xDataSource, UNO_QUERY).is(), - "FmCursorActionThread::FmCursorActionThread : invalid cursor !"); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::run() -{ - // On instantiation of a SfxCancellable the application is notified and 'switches on' the red stop button. - // Unfortunally this is conditioned with the acquirement of the solar mutex, and the application tries - // only once and ignores the notification if it fails. - // To prevent that we get the solar mutex and _block_ 'til we got it. - // As we are in the 'top level execution' of this thread (with a rather small stack and no other mutexes locked) - // we shouldn't experience problems with deadlocks ... - ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex()); - ThreadStopper* pStopper = new ThreadStopper(this, m_sStopperCaption); - aSolarGuard.clear(); - - // we're not canceled yet - ::osl::ClearableMutexGuard aInitGuard(m_aAccessSafety); - m_bCanceled = sal_False; - m_bRunFailed = sal_False; - aInitGuard.clear(); - - // start it - try - { - RunImpl(); - } - catch(SQLException e) - { - ::osl::MutexGuard aErrorGuard(m_aAccessSafety); - m_bRunFailed = sal_True; - m_aRunException = e; - } - catch(Exception&) - { - DBG_ERROR("FmCursorActionThread::run : catched a non-database exception !"); - } - - - sal_Bool bReallyCanceled; - ::osl::ClearableMutexGuard aEvalGuard(m_aAccessSafety); - bReallyCanceled = m_bCanceled; - aEvalGuard.clear(); - - pStopper->OwnerTerminated(); - // this will cause the stopper to delete itself (in the main thread) so we don't have to care of the - // solar mutex -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::onTerminated() -{ - ::osl::ClearableMutexGuard aResetGuard(m_aAccessSafety); - if (m_aTerminationHandler.IsSet()) - m_aTerminationHandler.Call(this); - - if (IsCursorDisposeEnabled()) - { - Reference< ::com::sun::star::lang::XComponent> xDataSourceComponent(m_xDataSource, UNO_QUERY); - if (xDataSourceComponent.is()) - xDataSourceComponent->dispose(); - } - - aResetGuard.clear(); - // with this StopItWait has a chance to do it's Terminated() - - ::osl::MutexGuard aGuard(m_aFinalExitControl); - // Terminated() in StopItWait still returns sal_False - m_bTerminated = sal_True; - // Terminated() now returns sal_True, but StopItWait can't exit until this method exits (because of the guarded m_aFinalExitControl) - - if (IsSelfDeleteEnabled()) - delete this; -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::StopIt() -{ - ::osl::MutexGuard aGuard(m_aAccessSafety); - m_bCanceled = sal_True; - - Reference< XCancellable> xCancel(m_xDataSource, UNO_QUERY); - DBG_ASSERT(xCancel.is(), "FmCursorActionThread::StopIt : invalid cursor !"); - xCancel->cancel(); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::StopItWait() -{ - StopIt(); - - while (!Terminated()) - ; - - // OnTerminated has been called, but we can't simply exit : Suppose the caller want's to delete the thread object - // immediately after returning from StopItWait. With the following guard we ensure that we exit this method - // only after onTerminated has exited. - ::osl::ClearableMutexGuard aGuard(m_aFinalExitControl); - - // now onTerminated has exited, so we can leave, too -} - -//------------------------------------------------------------------------------ -FmCursorActionThread::ThreadStopper::ThreadStopper(FmCursorActionThread* pOwner, const UniString& rTitle) - :SfxCancellable(SFX_APP()->GetCancelManager(), rTitle) - ,m_pOwner(pOwner) -{ -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::ThreadStopper::Cancel() -{ - if (!m_pOwner) // the owner is already terminated and we're waiting for the OnDeleteInMainThread event - return; - - ::osl::MutexGuard aGuard(m_pOwner->m_aAccessSafety); - if (IsCancelled()) - // we already did pass this to our owner - return; - - SfxCancellable::Cancel(); - m_pOwner->StopIt(); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::ThreadStopper::OwnerTerminated() -{ - m_pOwner = NULL; - Application::PostUserEvent(LINK(this, FmCursorActionThread::ThreadStopper, OnDeleteInMainThread), this); -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmCursorActionThread::ThreadStopper, OnDeleteInMainThread, FmCursorActionThread::ThreadStopper*, pThis) -{ - delete pThis; - return 0L; -} - //============================================================================== diff --git a/svx/source/form/fmstring.src b/svx/source/form/fmstring.src index 8b42ccadc6a6..02beaf2397be 100644 --- a/svx/source/form/fmstring.src +++ b/svx/source/form/fmstring.src @@ -217,10 +217,6 @@ String RID_STR_PROPTITLE_FORMATTED { Text [ en-US ] = "Formatted Field"; }; -String RID_STR_MOVING_CURSOR -{ - Text [ en-US ] = "align data source"; -}; String RID_STR_PROPTITLE_LISTBOX { Text [ en-US ] = "List Box"; diff --git a/svx/source/inc/fmresids.hrc b/svx/source/inc/fmresids.hrc index 95a478fc5aee..37b936ef0ee2 100644 --- a/svx/source/inc/fmresids.hrc +++ b/svx/source/inc/fmresids.hrc @@ -196,7 +196,7 @@ #define RID_STR_FILTER_FILTER_OR (RID_FORMS_START + 80) #define RID_STR_PROPTITLE_FORMATTED (RID_FORMS_START + 81) #define RID_STR_SYNTAXERROR (RID_FORMS_START + 82) -#define RID_STR_MOVING_CURSOR (RID_FORMS_START + 83) + // FREE #define RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY (RID_FORMS_START + 84) #define RID_STR_SEARCH_ANYWHERE (RID_FORMS_START + 85) #define RID_STR_SEARCH_BEGINNING (RID_FORMS_START + 86) diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index 85644ea5daba..4932f3b8f850 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -71,7 +71,6 @@ #include "fmsrccfg.hxx" #include #include -#include #include #include #include @@ -122,21 +121,6 @@ protected: virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rContainer) const; }; -//======================================================================== -// I would prefer this to be a struct local to FmXFormShell but unfortunately local structs/classes -// are somewhat difficult with some of our compilers -class FmCursorActionThread; -struct SAL_DLLPRIVATE CursorActionDescription -{ - FmCursorActionThread* pThread; - ULONG nFinishedEvent; - // we want to do the cleanup of the thread in the main thread so we post an event to ourself - sal_Bool bCanceling; - // this thread is being canceled - - CursorActionDescription() : pThread(NULL), nFinishedEvent(0), bCanceling(sal_False) { } -}; - class FmFormPage; //======================================================================== struct SAL_DLLPRIVATE FmLoadAction @@ -205,18 +189,6 @@ class SAL_DLLPRIVATE FmXFormShell :public FmXFormShell_BASE // we explicitly switch off the propbrw before leaving the design mode // this flag tells us if we have to switch it on again when reentering - typedef ::std::map< - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >, - CursorActionDescription, - ::comphelper::OInterfaceCompare< ::com::sun::star::sdbc::XResultSet > - > CursorActions; - CursorActions m_aCursorActions; - // all actions on async cursors - - ::std::vector< sal_Bool > - m_aControlLocks; - // while doing a async cursor action we have to lock all controls of the active controller. - // m_aControlLocks remembers the previous lock states to be restored afterwards. ::osl::Mutex m_aAsyncSafety; // secure the access to our thread related members ::osl::Mutex m_aInvalidationSafety; @@ -563,20 +535,7 @@ private: // --------------------------------------------------- // asyncronous cursor actions/navigation slot handling - void setControlLocks(); // lock all controls of the active controller - void restoreControlLocks(); // restore the lock state of all controls of the active controller - public: - enum CURSOR_ACTION { CA_MOVE_TO_LAST, CA_MOVE_ABSOLUTE }; - void DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& _xController, CURSOR_ACTION _eWhat); - void DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm, CURSOR_ACTION _eWhat); - - sal_Bool HasAnyPendingCursorAction() const; - void CancelAnyPendingCursorAction(); - - sal_Bool HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& _xController) const; - sal_Bool HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const; - /** execute the given form slot

Warning. Only a small set of slots implemented currently.

@param _nSlot @@ -589,9 +548,6 @@ public: bool IsFormSlotEnabled( sal_Int32 _nSlot, ::com::sun::star::form::runtime::FeatureState* _pCompleteState = NULL ); protected: - DECL_LINK(OnCursorActionDone, FmCursorActionThread*); - DECL_LINK(OnCursorActionDoneMainThread, FmCursorActionThread*); - DECL_LINK( OnLoadForms, FmFormPage* ); }; @@ -646,127 +602,4 @@ public: SVX_DLLPRIVATE virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); }; -//================================================================== -// FmCursorActionThread -//================================================================== - -class SAL_DLLPRIVATE FmCursorActionThread : public ::vos::OThread -{ - Link m_aTerminationHandler; // the handler to be called upon termination - ::com::sun::star::sdbc::SQLException m_aRunException; // the database exception thrown by RunImpl - ::osl::Mutex m_aAccessSafety; // for securing the multi-thread access - ::osl::Mutex m_aFinalExitControl; // see StopItWait - -protected: - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xDataSource; // the cursor which we work with - -private: - - UniString m_sStopperCaption; // the caption for the ThreadStopper - sal_Bool m_bCanceled:1; // StopIt has been called ? - sal_Bool m_bDeleteMyself:1; // delete the thread upon termination (defaults to sal_False) ? - sal_Bool m_bDisposeCursor:1; // dispose the cursor upon termination (defaults to sal_False) ? - sal_Bool m_bTerminated:1; // onTerminated already called ? - sal_Bool m_bRunFailed:1; // a database execption occured in RunImpl ? - - // a ThreadStopper will be instantiated so that the open can be canceled via the UI - class ThreadStopper : protected SfxCancellable - { - FmCursorActionThread* m_pOwner; - - virtual ~ThreadStopper() { } - - public: - ThreadStopper(FmCursorActionThread* pOwner, const UniString& rTitle); - - virtual void Cancel(); - - virtual void OwnerTerminated(); - // Normally the Owner (a FmCursorActionThread) would delete the stopper when terminated. - // Unfortunally the application doesn't remove the 'red light' when a SfxCancellable is deleted - // if it (the app) can't acquire the solar mutex. The deletion is IGNORED then. So we have make - // sure that a) the stopper is deleted from inside the main thread (where the solar mutex is locked) - // and b) that in the time between the termination of the thread and the deletion of the stopper - // the latter doesn't access the former. - // The OwnerTerminated cares for both aspects. - // SO DON'T DELETE THE STOPPER EXPLICITLY ! - - protected: - // HACK HACK HACK HACK HACK : this should be private, but MSVC doesn't accept the LINK-macro then .... - DECL_LINK(OnDeleteInMainThread, ThreadStopper*); - }; - friend class FmCursorActionThread::ThreadStopper; - - -public: - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> getDataSource() const { return m_xDataSource; } - -private: - sal_Bool Terminated() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bTerminated; } - -public: - FmCursorActionThread(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource, const UniString& _rStopperCaption); - virtual ~FmCursorActionThread() {} - - // control of self-deletion - sal_Bool IsSelfDeleteEnabled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bDeleteMyself; } - void EnableSelfDelete(sal_Bool bEnable) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_bDeleteMyself = bEnable; } - - // control of cursor-dipose - sal_Bool IsCursorDisposeEnabled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bDisposeCursor; } - void EnableCursorDispose(sal_Bool bEnable) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_bDisposeCursor = bEnable; } - - // error-access - sal_Bool RunFailed() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bRunFailed; } - ::com::sun::star::sdbc::SQLException GetRunException() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_aRunException; } - - /// the excution (within the method "run") was canceled ? - sal_Bool WasCanceled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bCanceled; } - - /// the handler will be called synchronously (the parameter is a pointer to the thread) - void SetTerminationHdl(const Link& aTermHdl) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_aTerminationHandler = aTermHdl; } - - /// cancels the process. returns to the caller immediately. to be called from another thread (of course ;) - void StopIt(); - - /// cancels the process. does not return to the caller until the thread is terminated. - void StopItWait(); - -protected: - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - - /// called from within run. run itself handles (de)initialisation of the cancel handling. - virtual void RunImpl() = 0; -}; - -//------------------------------------------------------------------------------ - -#define DECL_CURSOR_ACTION_THREAD(classname) \ - \ -class SAL_DLLPRIVATE classname : public FmCursorActionThread \ -{ \ -public: \ - classname(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource); \ -protected: \ - virtual void RunImpl(); \ -}; \ - - -//------------------------------------------------------------------------------ - -#define IMPL_CURSOR_ACTION_THREAD(classname, caption, action) \ - \ -classname::classname(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource) \ - :FmCursorActionThread(_xDataSource, caption) \ -{ \ -} \ - \ -void classname::RunImpl() \ -{ \ - m_xDataSource->action; \ -} \ - - - #endif // _SVX_FMSHIMP_HXX -- cgit From 1e30a9a1368eab0b8a56efdcf677bb3c8e27c768 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 14:38:46 +0100 Subject: [CWS autorecovery] removed SfxCancellable/SfxCancelManager, and (part of) its transitive closure No real-life use cases for this exist anymore, since nowadays document loading happens synchronously all the time. --- svx/inc/linkmgr.hxx | 2 -- svx/inc/pch/precompiled_svx.hxx | 1 - svx/source/svxlink/fileobj.cxx | 8 -------- svx/source/svxlink/fileobj.hxx | 1 - svx/source/svxlink/linkmgr.cxx | 10 ---------- 5 files changed, 22 deletions(-) (limited to 'svx') diff --git a/svx/inc/linkmgr.hxx b/svx/inc/linkmgr.hxx index b65c91ce7ebd..24a3fff479bb 100644 --- a/svx/inc/linkmgr.hxx +++ b/svx/inc/linkmgr.hxx @@ -79,8 +79,6 @@ public: // (ist zur Zeit nur fuer die FileLinks interressant!) void CancelTransfers(); - static void SetTransferPriority( sfx2::SvBaseLink& rLink, USHORT nPrio ); - // um Status Informationen aus dem FileObject an den BaseLink zu // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat // dann die entsprechenden Informationen als String. diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index 8e9bc4d17930..4fe38e521830 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -757,7 +757,6 @@ #include "svtools/apearcfg.hxx" #include "svtools/brdcst.hxx" #include "svtools/cacheoptions.hxx" -#include "svtools/cancel.hxx" #include "svtools/cjkoptions.hxx" #include "svtools/cmdoptions.hxx" #include "svtools/cntwall.hxx" diff --git a/svx/source/svxlink/fileobj.cxx b/svx/source/svxlink/fileobj.cxx index d159c7f78abe..2ccc8754dffc 100644 --- a/svx/source/svxlink/fileobj.cxx +++ b/svx/source/svxlink/fileobj.cxx @@ -692,9 +692,6 @@ BOOL SvFileObject::IsDataComplete() const void SvFileObject::CancelTransfers() { - if( xMed.Is() ) - xMed->CancelTransfers(); - // und aus dem Cache austragen, wenn man mitten im Laden ist if( !bDataReady ) { @@ -706,11 +703,6 @@ void SvFileObject::CancelTransfers() } -void SvFileObject::SetTransferPriority( USHORT ) -{ -} - - void SvFileObject::SendStateChg_Impl( LinkState nState ) { if( !bStateChangeCalled && HasDataLinks() ) diff --git a/svx/source/svxlink/fileobj.hxx b/svx/source/svxlink/fileobj.hxx index 78dbe84dfdc3..44644b1cef0a 100644 --- a/svx/source/svxlink/fileobj.hxx +++ b/svx/source/svxlink/fileobj.hxx @@ -91,7 +91,6 @@ public: virtual BOOL IsDataComplete() const; void CancelTransfers(); - void SetTransferPriority( USHORT nPrio ); }; diff --git a/svx/source/svxlink/linkmgr.cxx b/svx/source/svxlink/linkmgr.cxx index 4f66ba983c06..229632587ba4 100644 --- a/svx/source/svxlink/linkmgr.cxx +++ b/svx/source/svxlink/linkmgr.cxx @@ -181,16 +181,6 @@ void SvxLinkManager::CancelTransfers() pFileObj->CancelTransfers(); } -void SvxLinkManager::SetTransferPriority( sfx2::SvBaseLink& /*rLink*/, USHORT /*nPrio*/ ) -{ -// SvFileObject* pFileObj = -// (SvFileObject*)SvFileObject::ClassFactory()-> -// CastAndAddRef( rLink.GetObj() ); -// OBJECT_CLIENT_FILE == (OBJECT_CLIENT_FILE & rLink.GetObjType()) ? -// (SvFileObject*)rLink.GetObj() : 0; -} - - // um Status Informationen aus dem FileObject an den BaseLink zu // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat // dann die entsprechenden Informationen als String. -- cgit From f1f8a59d49231984506a7b5a6e7f346616b47d56 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:05 +0100 Subject: [CWS autorecovery] removed some dead/unused stuff SID_BACKTOWEBTOP, some SFX_VIEW_* flags, some SFXFRAME_* flags, all BROWSE_* flags --- svx/inc/globlmn_tmpl.hrc | 6 ------ 1 file changed, 6 deletions(-) (limited to 'svx') diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index d40ca4de1876..07435b507caa 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -471,12 +471,6 @@ HelpID = SID_LOGOUT ; \ Text [ en-US ] = "Logout" ; \ -#define ITEM_FILE_BACKTOWEBTOP \ - Identifier = SID_BACKTOWEBTOP ; \ - Command = ".uno:BackToWebtop" ; \ - HelpID = SID_BACKTOWEBTOP ; \ - Text [ en-US ] = "Back to Webtop"; \ - #define ITEM_EDIT_UNDO \ Identifier = SID_UNDO ; \ Command = ".uno:UndoAction" ; \ -- cgit From 33bfbf7debee613fa83d8a450226aecb5f9c672f Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 8 Dec 2009 19:09:16 +0100 Subject: aw079: #i107346# flag for WrongSpell in SdrTextAttribute --- svx/inc/svx/sdr/attribute/sdrtextattribute.hxx | 5 ++++- svx/source/sdr/attribute/sdrtextattribute.cxx | 13 +++++++++---- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 10 +++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index 1759eb18d319..f672086ea5cd 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -81,6 +81,7 @@ namespace drawinglayer unsigned mbScroll : 1; unsigned mbInEditMode : 1; unsigned mbFixedCellHeight : 1; + unsigned mbWrongSpell : 1; public: SdrTextAttribute( @@ -99,7 +100,8 @@ namespace drawinglayer bool bBlink, bool bScroll, bool bInEditMode, - bool bFixedCellHeight); + bool bFixedCellHeight, + bool bWrongSpell); ~SdrTextAttribute(); // copy constructor and assigment operator @@ -119,6 +121,7 @@ namespace drawinglayer bool isScroll() const { return mbScroll; } bool isInEditMode() const { return mbInEditMode; } bool isFixedCellHeight() const { return mbFixedCellHeight; } + bool isWrongSpell() const { return mbWrongSpell; } const SdrFormTextAttribute* getSdrFormTextAttribute() const { return mpSdrFormTextAttribute; } sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index ae6204d15bef..3afc03d1600d 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -65,7 +65,8 @@ namespace drawinglayer bool bBlink, bool bScroll, bool bInEditMode, - bool bFixedCellHeight) + bool bFixedCellHeight, + bool bWrongSpell) : mpSdrText(&rSdrText), maOutlinerParaObject(rOutlinerParaObject), mpSdrFormTextAttribute(0), @@ -82,7 +83,8 @@ namespace drawinglayer mbBlink(bBlink), mbScroll(bScroll), mbInEditMode(bInEditMode), - mbFixedCellHeight(bFixedCellHeight) + mbFixedCellHeight(bFixedCellHeight), + mbWrongSpell(bWrongSpell) { if(XFT_NONE != eFormTextStyle) { @@ -123,7 +125,8 @@ namespace drawinglayer mbBlink(rCandidate.isBlink()), mbScroll(rCandidate.isScroll()), mbInEditMode(rCandidate.isInEditMode()), - mbFixedCellHeight(rCandidate.isFixedCellHeight()) + mbFixedCellHeight(rCandidate.isFixedCellHeight()), + mbWrongSpell(rCandidate.isWrongSpell()) { if(rCandidate.getSdrFormTextAttribute()) { @@ -164,6 +167,7 @@ namespace drawinglayer mbScroll = rCandidate.isScroll(); mbInEditMode = rCandidate.isInEditMode(); mbFixedCellHeight = rCandidate.isFixedCellHeight(); + mbWrongSpell = rCandidate.isWrongSpell(); return *this; } @@ -197,7 +201,8 @@ namespace drawinglayer && isBlink() == rCandidate.isBlink() && isScroll() == rCandidate.isScroll() && isInEditMode() == rCandidate.isInEditMode() - && isFixedCellHeight() == rCandidate.isFixedCellHeight()); + && isFixedCellHeight() == rCandidate.isFixedCellHeight() + && isWrongSpell() == rCandidate.isWrongSpell()); } void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 4e57166b4723..f778cccdee40 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -77,6 +77,9 @@ #include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -523,6 +526,10 @@ namespace drawinglayer const SdrFitToSizeType eFit(rTextObj.GetFitToSize()); const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); + // #i107346# + const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj); + const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING); + pRetval = new attribute::SdrTextAttribute( rText, aOutlinerParaObject, @@ -539,7 +546,8 @@ namespace drawinglayer SDRTEXTANI_BLINK == eAniKind, SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind, bInEditMode, - ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); + ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue(), + bWrongSpell); } return pRetval; -- cgit From b33fda9d468b5f845c5a3c91be67049107d5a41a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 14 Dec 2009 22:14:39 +0100 Subject: dba33e: #i107678# don't clone the source form when creating an forms environment, this nowadays (correctly) also copies all children --- svx/source/form/fmobj.cxx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'svx') diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 6bf300b094a1..f1cbdc043a03 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -519,7 +519,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > while (nCurrentSourceIndex <= nIndex) { sal_Bool bEqualDSS = sal_False; - while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bounded by nIndex) + while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bound by nIndex) { xSourceContainer->getByIndex(nCurrentSourceIndex) >>= xCurrentSourceForm; DBG_ASSERT(xCurrentSourceForm.is(), "FmFormObj::ensureModelEnv : invalid form ancestor (2) !"); @@ -581,12 +581,11 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > // correct this ... try { - Reference< XPersistObject > xSourcePersist(xCurrentSourceForm, UNO_QUERY); - DBG_ASSERT(xSourcePersist.is(), "FmFormObj::ensureModelEnv : invalid form (no persist object) !"); - - // create and insert (into the destination) a clone of the form - Reference< XCloneable > xCloneable( xSourcePersist, UNO_QUERY_THROW ); - xCurrentDestForm.set( xCloneable->createClone(), UNO_QUERY_THROW ); + // create and insert (into the destination) a copy of the form + xCurrentDestForm.set( + ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.form.component.DataForm" ) ), + UNO_QUERY_THROW ); + ::comphelper::copyProperties( xCurrentSourceForm, xCurrentDestForm ); DBG_ASSERT(nCurrentDestIndex == xDestContainer->getCount(), "FmFormObj::ensureModelEnv : something went wrong with the numbers !"); xDestContainer->insertByIndex(nCurrentDestIndex, makeAny(xCurrentDestForm)); @@ -604,7 +603,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > } } - // now xCurrentDestForm is a form aequivalent to xSourceForm (which means they have the same DSS and the same number + // now xCurrentDestForm is a form equivalent to xSourceForm (which means they have the same DSS and the same number // of left siblings with the same DSS, which counts for all their ancestors, too) // go down -- cgit From 1fe9ecbd1e32170c5f54e0cd2bdc85fbd0f212e7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 10:31:37 +0100 Subject: autorecovery: SetDontCreateCancellable is dead --- svx/source/svxlink/fileobj.cxx | 2 -- 1 file changed, 2 deletions(-) (limited to 'svx') diff --git a/svx/source/svxlink/fileobj.cxx b/svx/source/svxlink/fileobj.cxx index 2ccc8754dffc..6e0863fc8d40 100644 --- a/svx/source/svxlink/fileobj.cxx +++ b/svx/source/svxlink/fileobj.cxx @@ -299,8 +299,6 @@ BOOL SvFileObject::LoadFile_Impl() aStreamToLoadFrom.m_xInputStreamToLoadFrom, aStreamToLoadFrom.m_bIsReadOnly); // setStreamToLoadFrom(0,0); - // Keinen Eintrag im Roter Button Menu - xMed->SetDontCreateCancellable(); if( sReferer.Len() ) xMed->SetReferer( sReferer ); -- cgit From ef15b85ee3a40f37a5d2c298a0d5660577ae78df Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 23:07:57 +0100 Subject: autorecovery: SfxViewFrame's SfxFrame is a reference now, no pointer (it can never be NULL) --- svx/source/cui/cfg.cxx | 2 +- svx/source/cui/hlmailtp.cxx | 2 +- svx/source/dialog/hyprlink.cxx | 2 +- svx/source/dialog/rubydialog.cxx | 2 +- svx/source/editeng/svxacorr.cxx | 5 ++--- svx/source/form/datanavi.cxx | 2 +- svx/source/form/fmPropBrw.cxx | 38 +++++++++++++++++++------------------- svx/source/form/fmshimp.cxx | 5 ++--- svx/source/tbxctrls/tbxcolor.cxx | 2 +- 9 files changed, 29 insertions(+), 31 deletions(-) (limited to 'svx') diff --git a/svx/source/cui/cfg.cxx b/svx/source/cui/cfg.cxx index 5df1e03edb53..a6b4eb05ac39 100644 --- a/svx/source/cui/cfg.cxx +++ b/svx/source/cui/cfg.cxx @@ -1967,7 +1967,7 @@ void SvxConfigPage::Reset( const SfxItemSet& ) } if ( !_inout_rxFrame.is() && SfxViewFrame::Current() ) - _inout_rxFrame = SfxViewFrame::Current()->GetFrame()->GetFrameInterface(); + _inout_rxFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); if ( !_inout_rxFrame.is() ) { diff --git a/svx/source/cui/hlmailtp.cxx b/svx/source/cui/hlmailtp.cxx index 982e79c9d921..37dd3e7d980c 100644 --- a/svx/source/cui/hlmailtp.cxx +++ b/svx/source/cui/hlmailtp.cxx @@ -316,7 +316,7 @@ IMPL_LINK ( SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, void *, EMPTYARG ) } -/* uno::Reference< frame::XDispatchProvider > xProv( pViewFrame->GetFrame()->GetFrameInterface(), uno::UNO_QUERY ); +/* uno::Reference< frame::XDispatchProvider > xProv( pViewFrame->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if ( xProv.is() ) { !!! (pb) we need a new config item here diff --git a/svx/source/dialog/hyprlink.cxx b/svx/source/dialog/hyprlink.cxx index 0cb6cc4d52df..5b45296fa7f0 100644 --- a/svx/source/dialog/hyprlink.cxx +++ b/svx/source/dialog/hyprlink.cxx @@ -953,7 +953,7 @@ void SvxHyperlinkDlg::OpenDoc( const String& rURL, SfxViewFrame* pViewFrame ) if ( pViewFrame ) { - SfxFrameItem aView( SID_DOCFRAME, pViewFrame ? pViewFrame->GetFrame() : NULL ); + SfxFrameItem aView( SID_DOCFRAME, pViewFrame ? &pViewFrame->GetFrame() : NULL ); if ( pDisp ) pDisp->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aName, &aView, &aNewView, &aSilent, &aReadOnly, &aReferer, &aExternal, 0L ); diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index c957290d55c4..cd4f1300ed11 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -324,7 +324,7 @@ void SvxRubyDialog::Activate() aStylistPB.Enable(bEnable); //get selection from current view frame SfxViewFrame* pCurFrm = SfxViewFrame::Current(); - Reference< XController > xCtrl = pCurFrm->GetFrame()->GetController(); + Reference< XController > xCtrl = pCurFrm->GetFrame().GetController(); pImpl->SetController(xCtrl); if(pImpl->HasSelectionChanged()) { diff --git a/svx/source/editeng/svxacorr.cxx b/svx/source/editeng/svxacorr.cxx index 88e1543ab8c9..2330640200af 100644 --- a/svx/source/editeng/svxacorr.cxx +++ b/svx/source/editeng/svxacorr.cxx @@ -1327,8 +1327,7 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, } while( FALSE ); SfxViewFrame* pVFrame; - if( nRet && 0 != (pVFrame = SfxViewFrame::Current()) && - pVFrame->GetFrame() ) + if( nRet && 0 != (pVFrame = SfxViewFrame::Current()) ) { ULONG nHelpId = 0; if( nRet & ( Autocorrect|CptlSttSntnc|CptlSttWrd|ChgToEnEmDash ) ) @@ -1361,7 +1360,7 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, if( nHelpId ) { nHelpId += HID_AUTOCORR_HELP_START - 1; - SfxHelp::OpenHelpAgent( pVFrame->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pVFrame->GetFrame(), nHelpId ); } } diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index ffe012734ae5..c63cd643d8ac 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1611,7 +1611,7 @@ namespace svxform DBG_ASSERT( pBindings != NULL, "DataNavigatorWindow::LoadModels(): no SfxBindings; can't get frame" ); m_xFrame = Reference( - pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), + pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); DBG_ASSERT( m_xFrame.is(), "DataNavigatorWindow::LoadModels(): no frame" ); // add frameaction listener diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index ccce6b50ee20..d29d0a1096ff 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -31,20 +31,20 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -#include "fmhelp.hrc" -#include "fmprop.hrc" +#include "fmhelp.hrc" +#include "fmprop.hrc" #include "fmPropBrw.hxx" #include "fmresids.hrc" #include "fmservs.hxx" -#include "fmshimp.hxx" -#include "fmpgeimp.hxx" +#include "fmshimp.hxx" +#include "fmpgeimp.hxx" -#include "svx/dialmgr.hxx" -#include "svx/fmpage.hxx" -#include "svx/fmshell.hxx" -#include "svx/sdrpagewindow.hxx" -#include "svx/svdpagv.hxx" -#include "svx/svxids.hrc" +#include "svx/dialmgr.hxx" +#include "svx/fmpage.hxx" +#include "svx/fmshell.hxx" +#include "svx/sdrpagewindow.hxx" +#include "svx/svdpagv.hxx" +#include "svx/svxids.hrc" /** === begin UNO includes === **/ #include @@ -63,20 +63,20 @@ /** === end UNO includes === **/ #include -#include +#include #include #include #include -#include +#include #include -#include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include @@ -248,7 +248,7 @@ FmPropBrw::FmPropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBinding if ( _pBindings->GetDispatcher() ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFramesSupplier > - xSupp ( _pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); + xSupp ( _pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); // if ( xSupp.is() ) // xSupp->getFrames()->append( m_xMeAsFrame ); // Don't append frame to frame hierachy to prevent UI_DEACTIVATE messages diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 06bd3cd128f4..6c68c32c7706 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -518,9 +518,8 @@ FmXFormShell::FmXFormShell( FmFormShell& _rShell, SfxViewFrame* _pViewFrame ) m_aMarkTimer.SetTimeout(100); m_aMarkTimer.SetTimeoutHdl(LINK(this,FmXFormShell,OnTimeOut)); - SfxFrame* pFrame = _pViewFrame ? _pViewFrame->GetFrame() : NULL; - if ( pFrame ) - m_xAttachedFrame = pFrame->GetFrameInterface(); + if ( _pViewFrame ) + m_xAttachedFrame = _pViewFrame->GetFrame().GetFrameInterface(); // to prevent deletion of this we acquire our refcounter once ::comphelper::increment(FmXFormShell_BASE::m_refCount); diff --git a/svx/source/tbxctrls/tbxcolor.cxx b/svx/source/tbxctrls/tbxcolor.cxx index 495742e4ef0b..b27e9f4e7a60 100644 --- a/svx/source/tbxctrls/tbxcolor.cxx +++ b/svx/source/tbxctrls/tbxcolor.cxx @@ -65,7 +65,7 @@ namespace svx { try { - Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame()->GetFrameInterface(); + Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); Reference< XPropertySet > xFrameProps( xFrame, UNO_QUERY ); if ( xFrameProps.is() ) xFrameProps->getPropertyValue( PROPNAME_LAYOUTMANAGER ) >>= m_xLayouter; -- cgit From 3a25d7157f5d23ab307d3d94a2ddda219affae9f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 23:31:21 +0100 Subject: autorecovery: Sfx(View)Frame::GetTopFrame now also returning a SfxFrame& instead of an SfxFrame* --- svx/source/cui/hltpbase.cxx | 2 +- svx/source/dialog/hyprlink.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/source/cui/hltpbase.cxx b/svx/source/cui/hltpbase.cxx index b727602255f7..5bcd915516bd 100644 --- a/svx/source/cui/hltpbase.cxx +++ b/svx/source/cui/hltpbase.cxx @@ -72,7 +72,7 @@ SvxFramesComboBox::SvxFramesComboBox ( Window* pParent, const ResId& rResId, { TargetList* pList = new TargetList; SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0; - SfxFrame* pFrame = pViewFrame ? pViewFrame->GetTopFrame() : 0; + SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetTopFrame() : 0; if ( pFrame ) { pFrame->GetTargetList(*pList); diff --git a/svx/source/dialog/hyprlink.cxx b/svx/source/dialog/hyprlink.cxx index 5b45296fa7f0..94dfcb196d84 100644 --- a/svx/source/dialog/hyprlink.cxx +++ b/svx/source/dialog/hyprlink.cxx @@ -475,7 +475,7 @@ void SvxHyperlinkDlg::TargetMenu(const String& rSelEntry, BOOL bExecute) if (pVwFrm) // Alle moeglichen Target Frames zusammensammeln und anzeigen { TargetList aList; - pVwFrm->GetTopFrame()->GetTargetList(aList); + pVwFrm->GetTopFrame().GetTargetList(aList); USHORT nCount = (USHORT)aList.Count(); if( nCount ) -- cgit From 7255eca208d1cfdc2d294c168d0e849ae7150b22 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 18 Dec 2009 09:48:23 +0100 Subject: autorecovery: removed a few unused slot IDs --- svx/sdi/svx.sdi | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'svx') diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index e3826708c196..c4a82a436c39 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -13192,31 +13192,6 @@ SfxVoidItem SpellCheckerChanged SID_SPELLCHECKER_CHANGED GroupId = GID_SPECIAL; ] -//-------------------------------------------------------------------------- -SfxVoidItem PrepareMailExport SID_MAIL_PREPAREEXPORT -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EXPLORER; -] - //-------------------------------------------------------------------------- SfxUInt16Item Year2000 SID_ATTR_YEAR2000 () -- cgit From 064e40d3714c7deeba0d8cbcb7086de9ba1f5144 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 6 Jan 2010 16:34:35 +0100 Subject: aw079: #i107987# corrected selection and rotation for 3D light control --- svx/source/dialog/dlgctl3d.cxx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index 8123a353bc63..b5956b3949df 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -514,8 +514,17 @@ void Svx3DLightControl::TrySelection(Point aPosPixel) if(aResult.size()) { - // take the frontmost one - const E3dCompoundObject* pResult = aResult[0]; + // exclude expansion object which will be part of + // the hits. It's invisible, but for HitTest, it's included + const E3dCompoundObject* pResult = 0; + + for(sal_uInt32 b(0); !pResult && b < aResult.size(); b++) + { + if(aResult[b] && aResult[b] != mpExpansionObject) + { + pResult = aResult[b]; + } + } if(pResult == mp3DObj) { @@ -780,8 +789,8 @@ void Svx3DLightControl::GetPosition(double& rHor, double& rVer) } if(IsGeometrySelected()) { - rHor = mfRotateY; - rVer = mfRotateX; + rHor = mfRotateY / F_PI180; // 0..360.0 + rVer = mfRotateX / F_PI180; // -90.0..90.0 } } @@ -824,8 +833,8 @@ void Svx3DLightControl::SetPosition(double fHor, double fVer) { if(mfRotateX != fVer || mfRotateY != fHor) { - mfRotateX = fVer; - mfRotateY = fHor; + mfRotateX = fVer * F_PI180; + mfRotateY = fHor * F_PI180; if(mp3DObj) { -- cgit From 108c876c1c9a723b92f876662e02ee105a55bbfe Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 6 Jan 2010 18:33:15 +0100 Subject: aw079: #i107557# Re-added the edge rounding control handle to text frame visualisations --- svx/source/svdraw/svdorect.cxx | 79 +++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 31 deletions(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index 7d69955ec441..3e9b4b0cfa54 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -319,50 +319,67 @@ void SdrRectObj::NbcSetLogicRect(const Rectangle& rRect) sal_uInt32 SdrRectObj::GetHdlCount() const { - return 9L; + return IsTextFrame() ? 10 : 9; } SdrHdl* SdrRectObj::GetHdl(sal_uInt32 nHdlNum) const { - SdrHdl* pH=NULL; + SdrHdl* pH = NULL; Point aPnt; - SdrHdlKind eKind=HDL_MOVE; - if( IsTextFrame() && !nHdlNum ) + SdrHdlKind eKind = HDL_MOVE; + + if(!IsTextFrame()) { - pH=new ImpTextframeHdl(aRect); - pH->SetObj((SdrObject*)this); - pH->SetDrehWink(aGeo.nDrehWink); - return pH; + nHdlNum++; } - else + + switch(nHdlNum) { - switch (nHdlNum) { - case 0: { - long a=GetEckenradius(); - long b=Max(aRect.GetWidth(),aRect.GetHeight())/2; // Wird aufgerundet, da GetWidth() eins draufaddiert - if (a>b) a=b; - if (a<0) a=0; - aPnt=aRect.TopLeft(); - aPnt.X()+=a; - eKind=HDL_CIRC; - } break; // Eckenradius - case 1: aPnt=aRect.TopLeft(); eKind=HDL_UPLFT; break; // Oben links - case 2: aPnt=aRect.TopCenter(); eKind=HDL_UPPER; break; // Oben - case 3: aPnt=aRect.TopRight(); eKind=HDL_UPRGT; break; // Oben rechts - case 4: aPnt=aRect.LeftCenter(); eKind=HDL_LEFT ; break; // Links - case 5: aPnt=aRect.RightCenter(); eKind=HDL_RIGHT; break; // Rechts - case 6: aPnt=aRect.BottomLeft(); eKind=HDL_LWLFT; break; // Unten links - case 7: aPnt=aRect.BottomCenter(); eKind=HDL_LOWER; break; // Unten - case 8: aPnt=aRect.BottomRight(); eKind=HDL_LWRGT; break; // Unten rechts + case 0: + { + pH = new ImpTextframeHdl(aRect); + pH->SetObj((SdrObject*)this); + pH->SetDrehWink(aGeo.nDrehWink); + break; + } + case 1: + { + long a = GetEckenradius(); + long b = Max(aRect.GetWidth(),aRect.GetHeight())/2; // Wird aufgerundet, da GetWidth() eins draufaddiert + if (a>b) a=b; + if (a<0) a=0; + aPnt=aRect.TopLeft(); + aPnt.X()+=a; + eKind = HDL_CIRC; + break; } + case 2: aPnt=aRect.TopLeft(); eKind = HDL_UPLFT; break; // Oben links + case 3: aPnt=aRect.TopCenter(); eKind = HDL_UPPER; break; // Oben + case 4: aPnt=aRect.TopRight(); eKind = HDL_UPRGT; break; // Oben rechts + case 5: aPnt=aRect.LeftCenter(); eKind = HDL_LEFT ; break; // Links + case 6: aPnt=aRect.RightCenter(); eKind = HDL_RIGHT; break; // Rechts + case 7: aPnt=aRect.BottomLeft(); eKind = HDL_LWLFT; break; // Unten links + case 8: aPnt=aRect.BottomCenter(); eKind = HDL_LOWER; break; // Unten + case 9: aPnt=aRect.BottomRight(); eKind = HDL_LWRGT; break; // Unten rechts } - if (aGeo.nShearWink!=0) ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan); - if (aGeo.nDrehWink!=0) RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); - if (eKind!=HDL_MOVE) { - pH=new SdrHdl(aPnt,eKind); + + if(!pH) + { + if(aGeo.nShearWink) + { + ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan); + } + + if(aGeo.nDrehWink) + { + RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); + } + + pH = new SdrHdl(aPnt,eKind); pH->SetObj((SdrObject*)this); pH->SetDrehWink(aGeo.nDrehWink); } + return pH; } -- cgit From 75af76e9e1a58039e978aae3aba021f15f204968 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 11 Jan 2010 09:53:12 +0100 Subject: autorecovery: fix post-rebase build problems --- svx/source/form/datanavi.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 7b7223281292..4e5df772d2bb 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1611,7 +1611,7 @@ namespace svxform DBG_ASSERT( pBindings != NULL, "DataNavigatorWindow::LoadModels(): no SfxBindings; can't get frame" ); m_xFrame = Reference( - pBindings->GetDispatcher().GetFrame()->GetFrame()->GetFrameInterface(), + pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); DBG_ASSERT( m_xFrame.is(), "DataNavigatorWindow::LoadModels(): no frame" ); // add frameaction listener -- cgit From 216cc35f855f03c9976cd5663e5bb7a4f64de92a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 13 Jan 2010 15:46:51 +0100 Subject: autorecovery: save open/modified (Writer-based) reports and forms, when doing a session/emergency save Still, the documents are stored only, and not loaded. For storing, there's at least one known issue: The controller is unable to deliver the proper object name for a form which has been newly created, and then saved. In this case, an empty name (from the time where the form was created) will be returned, and used in the save process. --- svx/inc/svx/unomodel.hxx | 12 +++---- svx/source/xml/xmlexport.cxx | 84 +++++++++++++------------------------------- 2 files changed, 30 insertions(+), 66 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/unomodel.hxx b/svx/inc/svx/unomodel.hxx index 70e27f06ac43..577140e6df7f 100644 --- a/svx/inc/svx/unomodel.hxx +++ b/svx/inc/svx/unomodel.hxx @@ -102,12 +102,12 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SAL_CALL createAnyCompareByName( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); }; -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference xOut ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference xOut, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference xOut, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent, const char* pExportService ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference xInputStream ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference xInputStream, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference xInputStream, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent, const char* pImportService ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference& xOut ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference& xOut, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference& xOut, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent, const char* pExportService ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference& xInputStream ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference& xInputStream, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference& xInputStream, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent, const char* pImportService ); #endif diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx index aea2e3cb058f..5d2173871d78 100644 --- a/svx/source/xml/xmlexport.cxx +++ b/svx/source/xml/xmlexport.cxx @@ -31,6 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include +#include #include #include #include @@ -55,12 +56,12 @@ using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xOut, Reference< lang::XComponent > xComponent ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference& xOut, const Reference< lang::XComponent >& xComponent ) { return SvxDrawingLayerExport( pModel, xOut, xComponent, "com.sun.star.comp.DrawingLayer.XMLExporter" ); } -sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xOut, Reference< lang::XComponent > xComponent, const char* pExportService ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference& xOut, const Reference< lang::XComponent >& xComponent, const char* pExportService ) { sal_Bool bDocRet = xOut.is(); @@ -70,12 +71,13 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xObjectResolver; SvXMLEmbeddedObjectHelper *pObjectHelper = 0; + Reference< lang::XComponent > xSourceDoc( xComponent ); try { - if( !xComponent.is() ) + if( !xSourceDoc.is() ) { - xComponent = new SvxUnoDrawingModel( pModel ); - pModel->setUnoModel( Reference< XInterface >::query( xComponent ) ); + xSourceDoc = new SvxUnoDrawingModel( pModel ); + pModel->setUnoModel( Reference< XInterface >::query( xSourceDoc ) ); } uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); @@ -130,7 +132,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xExporter( xFilter, uno::UNO_QUERY ); if( xExporter.is() ) { - xExporter->setSourceDocument( xComponent ); + xExporter->setSourceDocument( xSourceDoc ); uno::Sequence< beans::PropertyValue > aDescriptor( 0 ); bDocRet = xFilter->filter( aDescriptor ); @@ -141,11 +143,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference 1 - ByteString aError( "uno Exception caught while exporting:\n" ); - aError += ByteString( String( e.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#endif + DBG_UNHANDLED_EXCEPTION(); bDocRet = sal_False; } @@ -160,7 +158,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xOut ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference& xOut ) { Reference< lang::XComponent > xComponent; return SvxDrawingLayerExport( pModel, xOut, xComponent ); @@ -168,12 +166,12 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xInputStream, Reference< lang::XComponent > xComponent ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference& xInputStream, const Reference< lang::XComponent >& xComponent ) { return SvxDrawingLayerImport( pModel, xInputStream, xComponent, "com.sun.star.comp.Draw.XMLOasisImporter" ); } -sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference xInputStream, Reference< lang::XComponent > xComponent, const char* pImportService ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference& xInputStream, const Reference< lang::XComponent >& xComponent, const char* pImportService ) { sal_uInt32 nRet = 0; @@ -183,13 +181,14 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference xObjectResolver; SvXMLEmbeddedObjectHelper *pObjectHelper = 0; - if( !xComponent.is() ) + Reference< lang::XComponent > xTargetDocument( xComponent ); + if( !xTargetDocument.is() ) { - xComponent = new SvxUnoDrawingModel( pModel ); - pModel->setUnoModel( Reference< XInterface >::query( xComponent ) ); + xTargetDocument = new SvxUnoDrawingModel( pModel ); + pModel->setUnoModel( Reference< XInterface >::query( xTargetDocument ) ); } - Reference< frame::XModel > xModel( xComponent, UNO_QUERY ); + Reference< frame::XModel > xTargetModel( xTargetDocument, UNO_QUERY ); try { @@ -202,7 +201,8 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::ReferencelockControllers(); + if ( xTargetModel.is() ) + xTargetModel->lockControllers(); // ------------------------------------- @@ -251,7 +251,7 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference xImporter( xFilter, UNO_QUERY ); - xImporter->setTargetDocument( xComponent ); + xImporter->setTargetDocument( xTargetDocument ); // finally, parser the stream xParser->parseStream( aParserInput ); @@ -260,45 +260,9 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference 1 - ByteString aError( "SAX parse exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } - catch( xml::sax::SAXException& r ) - { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "SAX exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } - catch( io::IOException& r ) - { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "IO exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } catch( uno::Exception& r ) { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "uno exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif + DBG_UNHANDLED_EXCEPTION(); } if( pGraphicHelper ) @@ -309,13 +273,13 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::ReferenceunlockControllers(); + if ( xTargetModel.is() ) + xTargetModel->unlockControllers(); return nRet == 0; } -sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference xInputStream ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference& xInputStream ) { Reference< lang::XComponent > xComponent; return SvxDrawingLayerImport( pModel, xInputStream, xComponent ); -- cgit From ffe5c97056ab181367e49691d487eb6f6f375200 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 27 Jan 2010 11:51:56 +0100 Subject: aw079: #i99147# attribute rework and others --- svx/inc/svx/scene3d.hxx | 2 + svx/inc/svx/sdr/attribute/sdrallattribute.hxx | 202 --------- svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx | 80 ++++ svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx | 66 ++- .../sdr/attribute/sdrformtextoutlineattribute.hxx | 30 +- .../attribute/sdrlinefillshadowtextattribute.hxx | 81 ++++ .../sdr/attribute/sdrlineshadowtextattribute.hxx | 79 ++++ .../svx/sdr/attribute/sdrshadowtextattribute.hxx | 76 ++++ svx/inc/svx/sdr/attribute/sdrtextattribute.hxx | 107 +++-- svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx | 23 +- .../svx/sdr/contact/viewobjectcontactofgroup.hxx | 3 - .../svx/sdr/primitive2d/sdrattributecreator.hxx | 63 ++- .../svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx | 4 +- .../sdr/primitive2d/sdrconnectorprimitive2d.hxx | 4 +- .../sdr/primitive2d/sdrcustomshapeprimitive2d.hxx | 6 +- .../svx/sdr/primitive2d/sdrdecompositiontools.hxx | 18 +- .../svx/sdr/primitive2d/sdrellipseprimitive2d.hxx | 2 +- svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx | 3 +- .../svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx | 3 +- svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx | 3 +- svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx | 4 +- svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx | 5 - .../sdr/primitive2d/sdrrectangleprimitive2d.hxx | 4 +- svx/inc/svx/sdr/properties/oleproperties.hxx | 69 +++ svx/inc/svx/svdogrp.hxx | 1 + svx/prj/d.lst | 3 + svx/source/engine3d/dragmt3d.cxx | 27 +- svx/source/engine3d/scene3d.cxx | 6 + svx/source/engine3d/view3d.cxx | 6 +- svx/source/sdr/attribute/makefile.mk | 5 +- svx/source/sdr/attribute/sdrallattribute.cxx | 412 ------------------ svx/source/sdr/attribute/sdrfilltextattribute.cxx | 92 ++++ svx/source/sdr/attribute/sdrformtextattribute.cxx | 335 ++++++++++----- .../sdr/attribute/sdrformtextoutlineattribute.cxx | 143 ++++++- .../attribute/sdrlinefillshadowtextattribute.cxx | 95 +++++ .../sdr/attribute/sdrlineshadowtextattribute.cxx | 93 ++++ .../sdr/attribute/sdrshadowtextattribute.cxx | 85 ++++ svx/source/sdr/attribute/sdrtextattribute.cxx | 473 +++++++++++++++------ svx/source/sdr/contact/viewcontact.cxx | 3 +- svx/source/sdr/contact/viewcontactofe3d.cxx | 30 +- svx/source/sdr/contact/viewcontactofe3dcube.cxx | 17 +- svx/source/sdr/contact/viewcontactofe3dextrude.cxx | 22 +- svx/source/sdr/contact/viewcontactofe3dlathe.cxx | 24 +- svx/source/sdr/contact/viewcontactofe3dpolygon.cxx | 22 +- svx/source/sdr/contact/viewcontactofe3dscene.cxx | 117 ++--- svx/source/sdr/contact/viewcontactofe3dsphere.cxx | 20 +- svx/source/sdr/contact/viewcontactofgraphic.cxx | 236 +++++----- svx/source/sdr/contact/viewcontactofgroup.cxx | 26 +- .../contact/viewcontactofmasterpagedescriptor.cxx | 41 +- .../sdr/contact/viewcontactofsdrcaptionobj.cxx | 194 ++++----- svx/source/sdr/contact/viewcontactofsdrcircobj.cxx | 91 ++-- svx/source/sdr/contact/viewcontactofsdredgeobj.cxx | 43 +- .../sdr/contact/viewcontactofsdrmeasureobj.cxx | 149 ++++--- .../sdr/contact/viewcontactofsdrmediaobj.cxx | 13 +- .../sdr/contact/viewcontactofsdrobjcustomshape.cxx | 179 ++++---- svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 93 ++-- svx/source/sdr/contact/viewcontactofsdrpage.cxx | 39 +- svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 163 ++++--- svx/source/sdr/contact/viewcontactofsdrrectobj.cxx | 105 ++--- svx/source/sdr/contact/viewcontactofunocontrol.cxx | 45 +- svx/source/sdr/contact/viewcontactofvirtobj.cxx | 41 +- svx/source/sdr/contact/viewobjectcontactofe3d.cxx | 1 - .../sdr/contact/viewobjectcontactofe3dscene.cxx | 11 - .../sdr/contact/viewobjectcontactofgroup.cxx | 14 - .../sdr/contact/viewobjectcontactofpageobj.cxx | 25 +- .../sdr/contact/viewobjectcontactofsdrole2obj.cxx | 8 +- svx/source/sdr/overlay/overlayobjectcell.cxx | 8 +- svx/source/sdr/overlay/overlayselection.cxx | 10 +- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 407 +++++++----------- .../sdr/primitive2d/sdrcaptionprimitive2d.cxx | 65 ++- .../sdr/primitive2d/sdrconnectorprimitive2d.cxx | 44 +- .../sdr/primitive2d/sdrcustomshapeprimitive2d.cxx | 27 +- .../sdr/primitive2d/sdrdecompositiontools.cxx | 58 +-- .../sdr/primitive2d/sdrellipseprimitive2d.cxx | 116 +++-- svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx | 66 ++- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 130 +++--- svx/source/sdr/primitive2d/sdrole2primitive2d.cxx | 64 ++- .../sdr/primitive2d/sdrolecontentprimitive2d.cxx | 2 +- svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx | 63 ++- svx/source/sdr/primitive2d/sdrprimitivetools.cxx | 17 - .../sdr/primitive2d/sdrrectangleprimitive2d.cxx | 55 +-- .../sdr/primitive3d/sdrattributecreator3d.cxx | 5 +- svx/source/sdr/properties/oleproperties.cxx | 80 ++++ svx/source/svdraw/svddrgmt.cxx | 44 +- svx/source/svdraw/svdedtv.cxx | 97 ++++- svx/source/svdraw/svdocapt.cxx | 2 +- svx/source/svdraw/svdogrp.cxx | 6 + svx/source/svdraw/svdopath.cxx | 12 +- svx/source/svdraw/svdotextpathdecomposition.cxx | 78 ++-- svx/source/table/tablehandles.cxx | 7 +- svx/source/table/viewcontactoftableobj.cxx | 124 ++++-- 91 files changed, 3420 insertions(+), 2652 deletions(-) delete mode 100644 svx/inc/svx/sdr/attribute/sdrallattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx create mode 100644 svx/inc/svx/sdr/properties/oleproperties.hxx delete mode 100644 svx/source/sdr/attribute/sdrallattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrfilltextattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrshadowtextattribute.cxx create mode 100644 svx/source/sdr/properties/oleproperties.cxx (limited to 'svx') diff --git a/svx/inc/svx/scene3d.hxx b/svx/inc/svx/scene3d.hxx index 718225aa990b..a4cd8c497cd6 100644 --- a/svx/inc/svx/scene3d.hxx +++ b/svx/inc/svx/scene3d.hxx @@ -111,6 +111,8 @@ public: E3dScene(E3dDefaultAttributes& rDefault); virtual ~E3dScene(); + virtual void SetBoundRectDirty(); + // access to cleanup of depth mapper void Cleanup3DDepthMapper() { ImpCleanup3DDepthMapper(); } diff --git a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx b/svx/inc/svx/sdr/attribute/sdrallattribute.hxx deleted file mode 100644 index a699c7f9a198..000000000000 --- a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx +++ /dev/null @@ -1,202 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrallattribute.hxx,v $ - * - * $Revision: 1.2 $ - * - * 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 _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX -#define _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// -// predefines - -namespace drawinglayer { namespace attribute { - class SdrLineAttribute; - class SdrFillAttribute; - class SdrLineStartEndAttribute; - class SdrShadowAttribute; - class FillGradientAttribute; - class SdrTextAttribute; -}} - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrShadowTextAttribute - { - // shadow and text attributes - SdrShadowAttribute* mpShadow; // shadow attributes (if used) - SdrTextAttribute* mpTextAttribute; // text and text attributes (if used) - - public: - SdrShadowTextAttribute( - SdrShadowAttribute* pShadow = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrShadowTextAttribute(); - - // copy constructor and assigment operator - SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate); - SdrShadowTextAttribute& operator=(const SdrShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (0 != mpTextAttribute); } - - // data access - const SdrShadowAttribute* getShadow() const { return mpShadow; } - const SdrTextAttribute* getText() const { return mpTextAttribute; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrFillTextAttribute - { - // shadow and text attributes - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) - SdrTextAttribute* mpTextAttribute; // text and text attributes (if used) - - public: - SdrFillTextAttribute( - SdrFillAttribute* pFill = 0, - FillGradientAttribute* pFillFloatTransGradient = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrFillTextAttribute(); - - // copy constructor and assigment operator - SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate); - SdrFillTextAttribute& operator=(const SdrFillTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrFillTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return ((mpTextAttribute) || (mpFill)); } - - // data access - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } - const SdrTextAttribute* getText() const { return mpTextAttribute; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineShadowTextAttribute : public SdrShadowTextAttribute - { - // line, shadow, lineStartEnd and text attributes - SdrLineAttribute* mpLine; // line attributes (if used) - SdrLineStartEndAttribute* mpLineStartEnd; // line start end (if used) - - public: - SdrLineShadowTextAttribute( - SdrLineAttribute* pLine = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrLineShadowTextAttribute(); - - // copy constructor and assigment operator - SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate); - SdrLineShadowTextAttribute& operator=(const SdrLineShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrLineShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpLine || (SdrShadowTextAttribute::isVisible())); } - - // data access - const SdrLineAttribute* getLine() const { return mpLine; } - const SdrLineStartEndAttribute* getLineStartEnd() const { return mpLineStartEnd; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineFillShadowTextAttribute : public SdrLineShadowTextAttribute - { - // add fill and transGradient attributes - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) - - public: - SdrLineFillShadowTextAttribute( - SdrLineAttribute* pLine = 0, - SdrFillAttribute* pFill = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - FillGradientAttribute* pFillFloatTransGradient = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrLineFillShadowTextAttribute(); - - // copy constructor and assigment operator - SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate); - SdrLineFillShadowTextAttribute& operator=(const SdrLineFillShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrLineFillShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpFill || (SdrLineShadowTextAttribute::isVisible())); } - - // data access - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif // _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX - -// eof diff --git a/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx new file mode 100644 index 000000000000..df8ee7c666a9 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * 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 _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrFillTextAttribute + { + // shadow and text attributes + SdrFillAttribute maFill; // fill attributes (if used) + FillGradientAttribute maFillFloatTransGradient; // fill float transparence gradient (if used) + SdrTextAttribute maTextAttribute; // text and text attributes (if used) + + public: + SdrFillTextAttribute( + const SdrFillAttribute& rFill, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute); + SdrFillTextAttribute(); + SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate); + SdrFillTextAttribute& operator=(const SdrFillTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrFillTextAttribute& rCandidate) const; + + // data access + const SdrFillAttribute& getFill() const { return maFill; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } + const SdrTextAttribute& getText() const { return maTextAttribute; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx index 77273bd9cb03..449c8cb8fcf6 100644 --- a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx @@ -38,8 +38,13 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class SfxItemSet; -namespace drawinglayer { namespace attribute { class SdrFormTextOutlineAttribute; }} + +namespace drawinglayer { namespace attribute { + class ImpSdrFormTextAttribute; + class SdrFormTextOutlineAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -50,53 +55,36 @@ namespace drawinglayer class SdrFormTextAttribute { private: - // FormText (FontWork) Attributes - sal_Int32 mnFormTextDistance; // distance from line in upright direction - sal_Int32 mnFormTextStart; // shift from polygon start - sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees - sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling - sal_uInt16 mnFormTextShdwTransp; // shadow transparence - XFormTextStyle meFormTextStyle; // on/off and char orientation - XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale - XFormTextShadow meFormTextShadow; // shadow mode - Color maFormTextShdwColor; // shadow color - - // outline attributes; used when getFormTextOutline() is true and (for - // shadow) when getFormTextShadow() != XFTSHADOW_NONE - SdrFormTextOutlineAttribute* mpOutline; - SdrFormTextOutlineAttribute* mpShadowOutline; - - // bitfield - unsigned mbFormTextMirror : 1; // change orientation - unsigned mbFormTextOutline : 1; // show contour of objects + ImpSdrFormTextAttribute* mpSdrFormTextAttribute; public: + /// constructors/assignmentoperator/destructor SdrFormTextAttribute(const SfxItemSet& rSet); - ~SdrFormTextAttribute(); - - // copy constructor and assigment operator + SdrFormTextAttribute(); SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate); SdrFormTextAttribute& operator=(const SdrFormTextAttribute& rCandidate); + ~SdrFormTextAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrFormTextAttribute& rCandidate) const; - // data access - sal_Int32 getFormTextDistance() const { return mnFormTextDistance; } - sal_Int32 getFormTextStart() const { return mnFormTextStart; } - sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; } - sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; } - sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; } - XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } - XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; } - XFormTextShadow getFormTextShadow() const { return meFormTextShadow; } - Color getFormTextShdwColor() const { return maFormTextShdwColor; } - - const SdrFormTextOutlineAttribute* getOutline() const { return mpOutline; } - const SdrFormTextOutlineAttribute* getShadowOutline() const { return mpShadowOutline; } - - bool getFormTextMirror() const { return mbFormTextMirror; } - bool getFormTextOutline() const { return mbFormTextOutline; } + // data read access + sal_Int32 getFormTextDistance() const; + sal_Int32 getFormTextStart() const; + sal_Int32 getFormTextShdwXVal() const; + sal_Int32 getFormTextShdwYVal() const; + sal_uInt16 getFormTextShdwTransp() const; + XFormTextStyle getFormTextStyle() const; + XFormTextAdjust getFormTextAdjust() const; + XFormTextShadow getFormTextShadow() const; + Color getFormTextShdwColor() const; + const SdrFormTextOutlineAttribute& getOutline() const; + const SdrFormTextOutlineAttribute& getShadowOutline() const; + bool getFormTextMirror() const; + bool getFormTextOutline() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx index 8e11c97ed5c3..d13fe39232ff 100644 --- a/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx @@ -33,8 +33,15 @@ #define _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX #include -#include -#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace attribute { + class ImpSdrFormTextOutlineAttribute; + class LineAttribute; + class StrokeAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -45,24 +52,29 @@ namespace drawinglayer class SdrFormTextOutlineAttribute { private: - // one set of attributes for FormText (FontWork) outline visualisation - LineAttribute maLineAttribute; - StrokeAttribute maStrokeAttribute; - sal_uInt8 mnTransparence; + ImpSdrFormTextOutlineAttribute* mpSdrFormTextOutlineAttribute; public: + /// constructors/assignmentoperator/destructor SdrFormTextOutlineAttribute( const LineAttribute& rLineAttribute, const StrokeAttribute& rStrokeAttribute, sal_uInt8 nTransparence); + SdrFormTextOutlineAttribute(); + SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate); + SdrFormTextOutlineAttribute& operator=(const SdrFormTextOutlineAttribute& rCandidate); + ~SdrFormTextOutlineAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrFormTextOutlineAttribute& rCandidate) const; // data read access - const LineAttribute& getLineAttribute() const { return maLineAttribute; } - const StrokeAttribute getStrokeAttribute() const { return maStrokeAttribute; } - sal_uInt8 getTransparence() const { return mnTransparence; } + const LineAttribute& getLineAttribute() const; + const StrokeAttribute& getStrokeAttribute() const; + sal_uInt8 getTransparence() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx new file mode 100644 index 000000000000..c2fa9200dfe8 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * 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 _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineFillShadowTextAttribute : public SdrLineShadowTextAttribute + { + // add fill and transGradient attributes + SdrFillAttribute maFill; // fill attributes (if used) + FillGradientAttribute maFillFloatTransGradient; // fill float transparence gradient (if used) + + public: + SdrLineFillShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute); + SdrLineFillShadowTextAttribute(); + SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate); + SdrLineFillShadowTextAttribute& operator=(const SdrLineFillShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineFillShadowTextAttribute& rCandidate) const; + + // data access + const SdrFillAttribute& getFill() const { return maFill; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx new file mode 100644 index 000000000000..e5d19cef5f4e --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * 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: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * 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 _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineShadowTextAttribute : public SdrShadowTextAttribute + { + // line, shadow, lineStartEnd and text attributes + SdrLineAttribute maLine; // line attributes (if used) + SdrLineStartEndAttribute maLineStartEnd; // line start end (if used) + + public: + SdrLineShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute); + SdrLineShadowTextAttribute(); + SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate); + SdrLineShadowTextAttribute& operator=(const SdrLineShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineShadowTextAttribute& rCandidate) const; + + // data access + const SdrLineAttribute& getLine() const { return maLine; } + const SdrLineStartEndAttribute& getLineStartEnd() const { return maLineStartEnd; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx new file mode 100644 index 000000000000..f71a74d6a580 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * 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 _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrShadowTextAttribute + { + // shadow and text attributes + SdrShadowAttribute maShadow; // shadow attributes (if used) + SdrTextAttribute maTextAttribute; // text and text attributes (if used) + + public: + SdrShadowTextAttribute( + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute); + SdrShadowTextAttribute(); + SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate); + SdrShadowTextAttribute& operator=(const SdrShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrShadowTextAttribute& rCandidate) const; + + // data access + const SdrShadowAttribute& getShadow() const { return maShadow; } + const SdrTextAttribute& getText() const { return maTextAttribute; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index f672086ea5cd..36a9c2591c43 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -39,9 +39,20 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class SdrText; -namespace drawinglayer { namespace animation { class AnimationEntryList; }} -namespace drawinglayer { namespace attribute { class SdrFormTextAttribute; }} + +namespace drawinglayer { namespace animation { + class AnimationEntryList; +}} + +namespace drawinglayer { namespace attribute { + class SdrFormTextAttribute; +}} + +namespace drawinglayer { namespace attribute { + class ImpSdrTextAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -52,41 +63,13 @@ namespace drawinglayer class SdrTextAttribute { private: - // all-text attributes. The SdrText itself and a copy - // of te OPO - const SdrText* mpSdrText; - OutlinerParaObject maOutlinerParaObject; - - // Set when it's a FormText; contains all FormText attributes - SdrFormTextAttribute* mpSdrFormTextAttribute; - - // text distances - sal_Int32 maTextLeftDistance; - sal_Int32 maTextUpperDistance; - sal_Int32 maTextRightDistance; - sal_Int32 maTextLowerDistance; - - // #i101556# use versioning from text attributes to detect changes - sal_uInt32 maPropertiesVersion; - - // text alignments - SdrTextHorzAdjust maSdrTextHorzAdjust; - SdrTextVertAdjust maSdrTextVertAdjust; - - // bitfield - unsigned mbContour : 1; - unsigned mbFitToSize : 1; - unsigned mbHideContour : 1; - unsigned mbBlink : 1; - unsigned mbScroll : 1; - unsigned mbInEditMode : 1; - unsigned mbFixedCellHeight : 1; - unsigned mbWrongSpell : 1; + ImpSdrTextAttribute* mpSdrTextAttribute; public: + /// constructors/assignmentoperator/destructor SdrTextAttribute( const SdrText& rSdrText, - const OutlinerParaObject& rOutlinerParaObjectPtr, + const OutlinerParaObject& rOutlinerParaObject, XFormTextStyle eFormTextStyle, sal_Int32 aTextLeftDistance, sal_Int32 aTextUpperDistance, @@ -102,38 +85,44 @@ namespace drawinglayer bool bInEditMode, bool bFixedCellHeight, bool bWrongSpell); - ~SdrTextAttribute(); - - // copy constructor and assigment operator + SdrTextAttribute(); SdrTextAttribute(const SdrTextAttribute& rCandidate); SdrTextAttribute& operator=(const SdrTextAttribute& rCandidate); + ~SdrTextAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrTextAttribute& rCandidate) const; - // data access - const SdrText& getSdrText() const { return *mpSdrText; } - const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } - bool isContour() const { return mbContour; } - bool isFitToSize() const { return mbFitToSize; } - bool isHideContour() const { return mbHideContour; } - bool isBlink() const { return mbBlink; } - bool isScroll() const { return mbScroll; } - bool isInEditMode() const { return mbInEditMode; } - bool isFixedCellHeight() const { return mbFixedCellHeight; } - bool isWrongSpell() const { return mbWrongSpell; } - const SdrFormTextAttribute* getSdrFormTextAttribute() const { return mpSdrFormTextAttribute; } - sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } - sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } - sal_Int32 getTextRightDistance() const { return maTextRightDistance; } - sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; } - sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; } - SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } - SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } - - // animation timing generation - void getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const; - void getScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const; + // data read access + const SdrText& getSdrText() const; + const OutlinerParaObject& getOutlinerParaObject() const; + bool isContour() const; + bool isFitToSize() const; + bool isHideContour() const; + bool isBlink() const; + bool isScroll() const; + bool isInEditMode() const; + bool isFixedCellHeight() const; + bool isWrongSpell() const; + const SdrFormTextAttribute& getSdrFormTextAttribute() const; + sal_Int32 getTextLeftDistance() const; + sal_Int32 getTextUpperDistance() const; + sal_Int32 getTextRightDistance() const; + sal_Int32 getTextLowerDistance() const; + sal_uInt32 getPropertiesVersion() const; + SdrTextHorzAdjust getSdrTextHorzAdjust() const; + SdrTextVertAdjust getSdrTextVertAdjust() const; + + // helpers: animation timing generators + void getBlinkTextTiming( + drawinglayer::animation::AnimationEntryList& rAnimList) const; + void getScrollTextTiming( + drawinglayer::animation::AnimationEntryList& rAnimList, + double fFrameLength, + double fTextLength) const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx index 415526b07d77..49ba86d2bb69 100644 --- a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx +++ b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx @@ -33,22 +33,16 @@ #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predeclarations class E3dScene; -namespace drawinglayer { - namespace geometry { - class ViewInformation3D; - } - namespace attribute { - class SdrSceneAttribute; - class SdrLightingAttribute; - } -} - namespace basegfx { class B3DRange; } @@ -70,7 +64,6 @@ namespace sdr public: // basic constructor, used from SdrObject. ViewContactOfE3dScene(E3dScene& rScene); - virtual ~ViewContactOfE3dScene(); // access to SdrObject E3dScene& GetE3dScene() const @@ -101,14 +94,14 @@ namespace sdr protected: // the 3d transformation stack - drawinglayer::geometry::ViewInformation3D* mpViewInformation3D; + drawinglayer::geometry::ViewInformation3D maViewInformation3D; // the object transformation - basegfx::B2DHomMatrix* mpObjectTransformation; + basegfx::B2DHomMatrix maObjectTransformation; // attributes - drawinglayer::attribute::SdrSceneAttribute* mpSdrSceneAttribute; - drawinglayer::attribute::SdrLightingAttribute* mpSdrLightingAttribute; + drawinglayer::attribute::SdrSceneAttribute maSdrSceneAttribute; + drawinglayer::attribute::SdrLightingAttribute maSdrLightingAttribute; // create methods for ViewInformation3D and ObjectTransformation void createViewInformation3D(const ::basegfx::B3DRange& rContentRange); diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx index 902ce95a9fc4..252906d55aa4 100644 --- a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx +++ b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx @@ -50,9 +50,6 @@ namespace sdr ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact); virtual ~ViewObjectContactOfGroup(); - // test this VOC for visibility concerning model-view stuff like e.g. Layer - virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const; - // This method recursively paints the draw hierarchy. virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const; }; diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx index e4a8fa01902f..638aae7ee7ef 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx @@ -50,7 +50,7 @@ namespace drawinglayer { namespace attribute { class SdrShadowTextAttribute; class SdrLineShadowTextAttribute; class SdrLineFillShadowTextAttribute; - class SdrLineFillShadowAttribute; + class SdrLineFillShadowAttribute3D; class SdrSceneAttribute; class SdrLightingAttribute; class SdrFillTextAttribute; @@ -67,13 +67,21 @@ namespace drawinglayer namespace primitive2d { // SdrAttribute creators - attribute::SdrLineAttribute* createNewSdrLineAttribute(const SfxItemSet& rSet); - attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth); - attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet); - attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet); + attribute::SdrLineAttribute createNewSdrLineAttribute( + const SfxItemSet& rSet); + + attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute( + const SfxItemSet& rSet, + double fWidth); + + attribute::SdrShadowAttribute createNewSdrShadowAttribute( + const SfxItemSet& rSet); + + attribute::SdrFillAttribute createNewSdrFillAttribute( + const SfxItemSet& rSet); // #i101508# Support handing over given text-to-border distances - attribute::SdrTextAttribute* createNewSdrTextAttribute( + attribute::SdrTextAttribute createNewSdrTextAttribute( const SfxItemSet& rSet, const SdrText& rText, const sal_Int32* pLeft = 0, @@ -81,20 +89,37 @@ namespace drawinglayer const sal_Int32* pRight = 0, const sal_Int32* pLower = 0); - attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet); - attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet); - attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute( + attribute::FillGradientAttribute createNewTransparenceGradientAttribute( + const SfxItemSet& rSet); + + attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute( + const SfxItemSet& rSet); + + attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute( const SfxItemSet& rSet, - const SdrText& rText, + const SdrText* pText, bool bSuppressText); // #i98072# added option to suppress text on demand - attribute::SdrLineShadowTextAttribute* createNewSdrLineShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText); - attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText); - attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill); - attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet); - attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet); + + attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText); + + attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText); + + attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute( + const SfxItemSet& rSet, + bool bSuppressFill); + + attribute::SdrSceneAttribute createNewSdrSceneAttribute( + const SfxItemSet& rSet); + + attribute::SdrLightingAttribute createNewSdrLightingAttribute( + const SfxItemSet& rSet); // #i101508# Support handing over given text-to-border distances - attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute( + attribute::SdrFillTextAttribute createNewSdrFillTextAttribute( const SfxItemSet& rSet, const SdrText* pSdrText, const sal_Int32* pLeft = 0, @@ -103,7 +128,11 @@ namespace drawinglayer const sal_Int32* pLower = 0); // helpers - void calculateRelativeCornerRadius(sal_Int32 nRadius, const ::basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY); + void calculateRelativeCornerRadius( + sal_Int32 nRadius, + const ::basegfx::B2DRange& rObjectRange, + double& rfCornerRadiusX, + double& rfCornerRadiusY); } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx index 177c42bfff17..e70cc4992e17 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx index 5523480f1f51..e5b8b4834e0f 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx @@ -33,8 +33,8 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDRCONNECTORPRIMITIVE2D_HXX #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index 72035eb99569..99d3fb180a25 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -33,8 +33,8 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDCUSTOMSHAPEPRIMITIVE2D_HXX #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -61,8 +61,8 @@ namespace drawinglayer // making exceptions with shadow generation unsigned mb3DShape : 1; - // #SJ# Allow text clipping against TextBox in special cases (used for SC) - unsigned mbForceTextClipToTextRange : 1; + // #SJ# Allow text clipping against TextBox in special cases (used for SC) + unsigned mbForceTextClipToTextRange : 1; protected: // local decomposition. diff --git a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx index 0f46c2809597..51171ec99f67 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx @@ -58,22 +58,22 @@ namespace drawinglayer namespace primitive2d { Primitive2DReference createPolyPolygonFillPrimitive( - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient = 0L); + const attribute::FillGradientAttribute& rFillGradient); Primitive2DReference createPolygonLinePrimitive( - const ::basegfx::B2DPolygon& rUnitPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolygon& rUnitPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrLineAttribute& rLine, - const attribute::SdrLineStartEndAttribute* pStroke = 0L); + const attribute::SdrLineStartEndAttribute& rStroke); Primitive2DReference createTextPrimitive( - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrTextAttribute& rText, - const attribute::SdrLineAttribute* pStroke, + const attribute::SdrLineAttribute& rStroke, bool bCellText, bool bWordWrap, bool bClipOnBounds); diff --git a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx index 1d11c27ede71..b4dae8aed62a 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx @@ -34,7 +34,7 @@ #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx index 787c230d7b3d..c93d188177b2 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx @@ -34,9 +34,8 @@ #include #include -#include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx index 3e998f23fd2b..c5d5c31bd302 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -33,8 +33,7 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX #include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx index 2deaf474e12e..658bbe3429f7 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx @@ -34,8 +34,7 @@ #include #include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx index d6de666d901f..b95563c69741 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx index 2d419e9cd45d..766c4439e5be 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx @@ -40,7 +40,6 @@ namespace basegfx { class BColor; - class B2DHomMatrix; } ////////////////////////////////////////////////////////////////////////////// @@ -55,10 +54,6 @@ namespace drawinglayer // create a 7x7 gluepoint symbol in given colors as BitmapEx BitmapEx createDefaultGluepoint_7x7(const basegfx::BColor& rBColorA, const basegfx::BColor& rBColorB); - - // #i99123# - Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix); - } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx index 816956b188fe..18ca37872351 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/properties/oleproperties.hxx b/svx/inc/svx/sdr/properties/oleproperties.hxx new file mode 100644 index 000000000000..009c375dff99 --- /dev/null +++ b/svx/inc/svx/sdr/properties/oleproperties.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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: graphicproperties.hxx,v $ + * $Revision: 1.6 $ + * + * 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 _SDR_PROPERTIES_OLEPROPERTIES_HXX +#define _SDR_PROPERTIES_OLEPROPERTIES_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace properties + { + class OleProperties : public RectangleProperties + { + protected: + public: + // basic constructor + OleProperties(SdrObject& rObj); + + // constructor for copying, but using new object + OleProperties(const OleProperties& rProps, SdrObject& rObj); + + // destructor + virtual ~OleProperties(); + + // Clone() operator, normally just calls the local copy constructor + virtual BaseProperties& Clone(SdrObject& rObj) const; + + // force default attributes for a specific object type, called from + // DefaultProperties::GetObjectItemSet() if a new ItemSet is created + virtual void ForceDefaultAttributes(); + }; + } // end of namespace properties +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_PROPERTIES_OLEPROPERTIES_HXX + +// eof diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx index 5f243d451f90..db799da81e1d 100644 --- a/svx/inc/svx/svdogrp.hxx +++ b/svx/inc/svx/svdogrp.hxx @@ -69,6 +69,7 @@ public: SdrObjGroup(); virtual ~SdrObjGroup(); + virtual void SetBoundRectDirty(); virtual UINT16 GetObjIdentifier() const; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual SdrLayerID GetLayer() const; diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 8b4675feb3e9..7d2f508d9d21 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -637,6 +637,9 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay ..\inc\svx\sdr\overlay\overlayselection.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayselection.hxx ..\inc\svx\sdr\overlay\overlaytools.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaytools.hxx +mkdir: %_DEST%\inc%_EXT%\svx\sdr\primitive2d +..\inc\svx\sdr\primitive2d\sdrprimitivetools.hxx %_DEST%\inc%_EXT%\svx\sdr\primitive2d\sdrprimitivetools.hxx + mkdir: %_DEST%\inc%_EXT%\svx\sdr\animation ..\inc\svx\sdr\animation\ainfographic.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfographic.hxx ..\inc\svx\sdr\animation\ainfoscrolltext.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfoscrolltext.hxx diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index 3408108788c4..4c09e6720fe2 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -70,8 +70,33 @@ E3dDragMethod::E3dDragMethod ( // eine Unit anlegen const long nCnt(rMark.GetMarkCount()); static bool bDoInvalidate(false); + long nObjs(0); - for(long nObjs = 0;nObjs < nCnt;nObjs++) + if(mbMoveFull) + { + // for non-visible 3D objects fallback to wireframe interaction + bool bInvisibleObjects(false); + + for(nObjs = 0;!bInvisibleObjects && nObjs < nCnt;nObjs++) + { + E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj()); + + if(pE3dObj) + { + if(!pE3dObj->HasFillStyle() && !pE3dObj->HasLineStyle()) + { + bInvisibleObjects = true; + } + } + } + + if(bInvisibleObjects) + { + mbMoveFull = false; + } + } + + for(nObjs = 0;nObjs < nCnt;nObjs++) { E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj()); diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 0e2b87be4ca7..171eda577a9c 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -337,6 +337,12 @@ UINT16 E3dScene::GetObjIdentifier() const return E3D_SCENE_ID; } +void E3dScene::SetBoundRectDirty() +{ + // avoid resetting aOutRect which in case of this object is model data, + // not re-creatable view data +} + /************************************************************************* |* |* SetSnapRect diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 3f89d202b6ba..e789da69d6e3 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -74,7 +74,7 @@ #include #include #include -#include +#include #include #include #include @@ -208,8 +208,8 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr // if we have full overlay from selected objects, embed with 50% transparence, the // transformation is added to the OverlayPrimitive2DSequenceObject - drawinglayer::primitive2d::Primitive2DReference aUnifiedAlphaPrimitive2D(new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aContent, 0.5)); - aContent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlphaPrimitive2D, 1); + drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aContent, 0.5)); + aContent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1); sdr::overlay::OverlayPrimitive2DSequenceObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aContent); diff --git a/svx/source/sdr/attribute/makefile.mk b/svx/source/sdr/attribute/makefile.mk index 44e161a3b503..33ef24169ab4 100644 --- a/svx/source/sdr/attribute/makefile.mk +++ b/svx/source/sdr/attribute/makefile.mk @@ -43,7 +43,10 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES=\ - $(SLO)$/sdrallattribute.obj \ + $(SLO)$/sdrfilltextattribute.obj \ + $(SLO)$/sdrlinefillshadowtextattribute.obj \ + $(SLO)$/sdrlineshadowtextattribute.obj \ + $(SLO)$/sdrshadowtextattribute.obj \ $(SLO)$/sdrtextattribute.obj \ $(SLO)$/sdrformtextattribute.obj \ $(SLO)$/sdrformtextoutlineattribute.obj diff --git a/svx/source/sdr/attribute/sdrallattribute.cxx b/svx/source/sdr/attribute/sdrallattribute.cxx deleted file mode 100644 index 9eee8dbccce8..000000000000 --- a/svx/source/sdr/attribute/sdrallattribute.cxx +++ /dev/null @@ -1,412 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrallattribute.cxx,v $ - * - * $Revision: 1.2 $ - * - * 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_svx.hxx" - -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrShadowTextAttribute::SdrShadowTextAttribute( - SdrShadowAttribute* pShadow, - SdrTextAttribute* pTextAttribute) - : mpShadow(pShadow), - mpTextAttribute(pTextAttribute) - { - } - - SdrShadowTextAttribute::SdrShadowTextAttribute( - const SdrShadowTextAttribute& rCandidate) - : mpShadow(0), - mpTextAttribute(0) - { - *this = rCandidate; - } - - SdrShadowTextAttribute::~SdrShadowTextAttribute() - { - delete mpShadow; - delete mpTextAttribute; - } - - SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate) - { - // handle mpShadow - { - // delete local mpShadow if necessary - if(mpShadow) - { - delete mpShadow; - mpShadow = 0; - } - - // copy mpShadow if necessary - if(rCandidate.mpShadow) - { - mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow); - } - } - - // handle mpTextAttribute - { - // delete local mpTextAttribute if necessary - if(mpTextAttribute) - { - delete mpTextAttribute; - mpTextAttribute = 0; - } - - // copy mpTextAttribute if necessary - if(rCandidate.mpTextAttribute) - { - mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute); - } - } - - return *this; - } - - bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const - { - // handle mpShadow - if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow)) - return false; - - // handle mpTextAttribute - if(!pointerOrContentEqual(mpTextAttribute, rCandidate.mpTextAttribute)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrFillTextAttribute::SdrFillTextAttribute( - SdrFillAttribute* pFill, - FillGradientAttribute* pFillFloatTransGradient, - SdrTextAttribute* pTextAttribute) - : mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient), - mpTextAttribute(pTextAttribute) - { - } - - SdrFillTextAttribute::SdrFillTextAttribute( - const SdrFillTextAttribute& rCandidate) - : mpFill(0), - mpFillFloatTransGradient(0), - mpTextAttribute(0) - { - *this = rCandidate; - } - - SdrFillTextAttribute::~SdrFillTextAttribute() - { - delete mpFill; - delete mpFillFloatTransGradient; - delete mpTextAttribute; - } - - SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate) - { - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - // handle mpTextAttribute - { - // delete local mpTextAttribute if necessary - if(mpTextAttribute) - { - delete mpTextAttribute; - mpTextAttribute = 0; - } - - // copy mpTextAttribute if necessary - if(rCandidate.mpTextAttribute) - { - mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute); - } - } - - return *this; - } - - bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const - { - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - // handle mpTextAttribute - if(!pointerOrContentEqual(mpTextAttribute, rCandidate.mpTextAttribute)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( - SdrLineAttribute* pLine, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - SdrTextAttribute* pTextAttribute) - : SdrShadowTextAttribute(pShadow, pTextAttribute), - mpLine(pLine), - mpLineStartEnd(pLineStartEnd) - { - } - - SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( - const SdrLineShadowTextAttribute& rCandidate) - : SdrShadowTextAttribute(0, 0), - mpLine(0), - mpLineStartEnd(0) - { - *this = rCandidate; - } - - SdrLineShadowTextAttribute::~SdrLineShadowTextAttribute() - { - delete mpLine; - delete mpLineStartEnd; - } - - SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate) - { - // call parent - SdrShadowTextAttribute::operator=(rCandidate); - - // handle mpLine - { - // delete local mpLine if necessary - if(mpLine) - { - delete mpLine; - mpLine = 0; - } - - // copy mpLine if necessary - if(rCandidate.mpLine) - { - mpLine = new SdrLineAttribute(*rCandidate.mpLine); - } - } - - // handle mpLineStartEnd - { - // delete local mpLineStartEnd if necessary - if(mpLineStartEnd) - { - delete mpLineStartEnd; - mpLineStartEnd = 0; - } - - // copy mpLineStartEnd if necessary - if(rCandidate.mpLineStartEnd) - { - mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd); - } - } - - return *this; - } - - bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const - { - // call parent - if(!(SdrShadowTextAttribute::operator==(rCandidate))) - return false; - - // handle mpLine - if(!pointerOrContentEqual(mpLine, rCandidate.mpLine)) - return false; - - // handle mpLineStartEnd - if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( - SdrLineAttribute* pLine, - attribute::SdrFillAttribute* pFill, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - FillGradientAttribute* pFillFloatTransGradient, - SdrTextAttribute* pTextAttribute) - : SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pTextAttribute), - mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient) - { - } - - SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( - const SdrLineFillShadowTextAttribute& rCandidate) - : SdrLineShadowTextAttribute(0, 0, 0, 0), - mpFill(0), - mpFillFloatTransGradient(0) - { - *this = rCandidate; - } - - SdrLineFillShadowTextAttribute::~SdrLineFillShadowTextAttribute() - { - delete mpFill; - delete mpFillFloatTransGradient; - } - - SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate) - { - // call parent - SdrLineShadowTextAttribute::operator=(rCandidate); - - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - return *this; - } - - bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const - { - // call parent - if(!(SdrLineShadowTextAttribute::operator==(rCandidate))) - return false; - - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/svx/source/sdr/attribute/sdrfilltextattribute.cxx b/svx/source/sdr/attribute/sdrfilltextattribute.cxx new file mode 100644 index 000000000000..e281c77068c5 --- /dev/null +++ b/svx/source/sdr/attribute/sdrfilltextattribute.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * 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_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrFillTextAttribute::SdrFillTextAttribute( + const SdrFillAttribute& rFill, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute) + : maFill(rFill), + maFillFloatTransGradient(rFillFloatTransGradient), + maTextAttribute(rTextAttribute) + { + } + + SdrFillTextAttribute::SdrFillTextAttribute() + : maFill(), + maFillFloatTransGradient(), + maTextAttribute() + { + } + + SdrFillTextAttribute::SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate) + : maFill(rCandidate.getFill()), + maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()), + maTextAttribute(rCandidate.getText()) + { + } + + SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate) + { + maFill = rCandidate.getFill(); + maFillFloatTransGradient = rCandidate.getFillFloatTransGradient(); + maTextAttribute = rCandidate.getText(); + + return *this; + } + + bool SdrFillTextAttribute::isDefault() const + { + return(getFill().isDefault() + && getFillFloatTransGradient().isDefault() + && getText().isDefault()); + } + + bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const + { + return(getFill() == rCandidate.getFill() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient() + && getText() == rCandidate.getText()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx index a33ee3f7dfe4..5b6140cc3ea7 100644 --- a/svx/source/sdr/attribute/sdrformtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -32,8 +32,8 @@ #include "precompiled_svx.hxx" #include +#include #include - #include #include #include @@ -44,11 +44,8 @@ #include #include #include - #include #include -#include -#include #include #include #include @@ -56,12 +53,10 @@ #include #include #include +#include +#include #include -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - ////////////////////////////////////////////////////////////////////////////// // helper to get line, stroke and transparence attributes from SfxItemSet @@ -158,144 +153,272 @@ namespace drawinglayer { namespace attribute { - SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet) - : mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()), - mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()), - mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()), - mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()), - mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()), - meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()), - meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()), - meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()), - maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()), - mpOutline(0), - mpShadowOutline(0), - mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()), - mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue()) + class ImpSdrFormTextAttribute { - if(getFormTextOutline()) + public: + // refcounter + sal_uInt32 mnRefCount; + + // FormText (FontWork) Attributes + sal_Int32 mnFormTextDistance; // distance from line in upright direction + sal_Int32 mnFormTextStart; // shift from polygon start + sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees + sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling + sal_uInt16 mnFormTextShdwTransp; // shadow transparence + XFormTextStyle meFormTextStyle; // on/off and char orientation + XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale + XFormTextShadow meFormTextShadow; // shadow mode + Color maFormTextShdwColor; // shadow color + + // outline attributes; used when getFormTextOutline() is true and (for + // shadow) when getFormTextShadow() != XFTSHADOW_NONE + SdrFormTextOutlineAttribute maOutline; + SdrFormTextOutlineAttribute maShadowOutline; + + // bitfield + unsigned mbFormTextMirror : 1; // change orientation + unsigned mbFormTextOutline : 1; // show contour of objects + + ImpSdrFormTextAttribute(const SfxItemSet& rSet) + : mnRefCount(0), + mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()), + mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()), + mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()), + mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()), + mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()), + meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()), + meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()), + meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()), + maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()), + maOutline(), + maShadowOutline(), + mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()), + mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue()) { - const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); - - // also need to prepare attributes for outlines + if(getFormTextOutline()) { - const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); - - mpOutline = new SdrFormTextOutlineAttribute( - aLineAttribute, aStrokeAttribute, nTransparence); + const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); + + // also need to prepare attributes for outlines + { + const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); + + maOutline = SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } + + if(XFTSHADOW_NONE != getFormTextShadow()) + { + // also need to prepare attributes for shadow outlines + const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); + + maShadowOutline = SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } } + } - if(XFTSHADOW_NONE != getFormTextShadow()) - { - // also need to prepare attributes for shadow outlines - const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); - - mpShadowOutline = new SdrFormTextOutlineAttribute( - aLineAttribute, aStrokeAttribute, nTransparence); - } + ImpSdrFormTextAttribute() + : mnRefCount(0), + mnFormTextDistance(0), + mnFormTextStart(0), + mnFormTextShdwXVal(0), + mnFormTextShdwYVal(0), + mnFormTextShdwTransp(0), + meFormTextStyle(XFT_NONE), + meFormTextAdjust(XFT_CENTER), + meFormTextShadow(XFTSHADOW_NONE), + maFormTextShdwColor(), + maOutline(), + maShadowOutline(), + mbFormTextMirror(false), + mbFormTextOutline(false) + { } - } - SdrFormTextAttribute::~SdrFormTextAttribute() - { - if(mpOutline) + // data read access + sal_Int32 getFormTextDistance() const { return mnFormTextDistance; } + sal_Int32 getFormTextStart() const { return mnFormTextStart; } + sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; } + sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; } + sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; } + XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } + XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; } + XFormTextShadow getFormTextShadow() const { return meFormTextShadow; } + Color getFormTextShdwColor() const { return maFormTextShdwColor; } + const SdrFormTextOutlineAttribute& getOutline() const { return maOutline; } + const SdrFormTextOutlineAttribute& getShadowOutline() const { return maShadowOutline; } + bool getFormTextMirror() const { return mbFormTextMirror; } + bool getFormTextOutline() const { return mbFormTextOutline; } + + // compare operator + bool operator==(const ImpSdrFormTextAttribute& rCandidate) const { - delete mpOutline; - mpOutline = 0; + return (getFormTextDistance() == rCandidate.getFormTextDistance() + && getFormTextStart() == rCandidate.getFormTextStart() + && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal() + && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal() + && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp() + && getFormTextStyle() == rCandidate.getFormTextStyle() + && getFormTextAdjust() == rCandidate.getFormTextAdjust() + && getFormTextShadow() == rCandidate.getFormTextShadow() + && getFormTextShdwColor() == rCandidate.getFormTextShdwColor() + && getOutline() == rCandidate.getOutline() + && getShadowOutline() == rCandidate.getShadowOutline() + && getFormTextMirror() == rCandidate.getFormTextMirror() + && getFormTextOutline() == rCandidate.getFormTextOutline()); } - if(mpShadowOutline) + static ImpSdrFormTextAttribute* get_global_default() { - delete mpShadowOutline; - mpShadowOutline = 0; + static ImpSdrFormTextAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFormTextAttribute(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; } + }; + + SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet) + : mpSdrFormTextAttribute(new ImpSdrFormTextAttribute(rSet)) + { + } + + SdrFormTextAttribute::SdrFormTextAttribute() + : mpSdrFormTextAttribute(ImpSdrFormTextAttribute::get_global_default()) + { + mpSdrFormTextAttribute->mnRefCount++; } SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate) - : mnFormTextDistance(rCandidate.getFormTextDistance()), - mnFormTextStart(rCandidate.getFormTextStart()), - mnFormTextShdwXVal(rCandidate.getFormTextShdwXVal()), - mnFormTextShdwYVal(rCandidate.getFormTextShdwYVal()), - mnFormTextShdwTransp(rCandidate.getFormTextShdwTransp()), - meFormTextStyle(rCandidate.getFormTextStyle()), - meFormTextAdjust(rCandidate.getFormTextAdjust()), - meFormTextShadow(rCandidate.getFormTextShadow()), - maFormTextShdwColor(rCandidate.getFormTextShdwColor()), - mpOutline(0), - mpShadowOutline(0), - mbFormTextMirror(rCandidate.getFormTextMirror()), - mbFormTextOutline(rCandidate.getFormTextOutline()) + : mpSdrFormTextAttribute(rCandidate.mpSdrFormTextAttribute) { - if(rCandidate.getOutline()) + mpSdrFormTextAttribute->mnRefCount++; + } + + SdrFormTextAttribute::~SdrFormTextAttribute() + { + if(mpSdrFormTextAttribute->mnRefCount) { - mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline()); + mpSdrFormTextAttribute->mnRefCount--; } - - if(rCandidate.getShadowOutline()) + else { - mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline()); + delete mpSdrFormTextAttribute; } } + bool SdrFormTextAttribute::isDefault() const + { + return mpSdrFormTextAttribute == ImpSdrFormTextAttribute::get_global_default(); + } + SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate) { - mnFormTextDistance = rCandidate.getFormTextDistance(); - mnFormTextStart = rCandidate.getFormTextStart(); - mnFormTextShdwXVal = rCandidate.getFormTextShdwXVal(); - mnFormTextShdwYVal = rCandidate.getFormTextShdwYVal(); - mnFormTextShdwTransp = rCandidate.getFormTextShdwTransp(); - meFormTextStyle = rCandidate.getFormTextStyle(); - meFormTextAdjust = rCandidate.getFormTextAdjust(); - meFormTextShadow = rCandidate.getFormTextShadow(); - maFormTextShdwColor = rCandidate.getFormTextShdwColor(); - - if(mpOutline) + if(rCandidate.mpSdrFormTextAttribute != mpSdrFormTextAttribute) { - delete mpOutline; + if(mpSdrFormTextAttribute->mnRefCount) + { + mpSdrFormTextAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextAttribute; + } + + mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute; + mpSdrFormTextAttribute->mnRefCount++; } - mpOutline = 0; + return *this; + } - if(rCandidate.getOutline()) + bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const + { + if(rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute) { - mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline()); + return true; } - if(mpShadowOutline) + if(rCandidate.isDefault() != isDefault()) { - delete mpShadowOutline; + return false; } - mpShadowOutline = 0; + return (*rCandidate.mpSdrFormTextAttribute == *mpSdrFormTextAttribute); + } - if(rCandidate.getShadowOutline()) - { - mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline()); - } + sal_Int32 SdrFormTextAttribute::getFormTextDistance() const + { + return mpSdrFormTextAttribute->getFormTextDistance(); + } - mbFormTextMirror = rCandidate.getFormTextMirror(); - mbFormTextOutline = rCandidate.getFormTextOutline(); + sal_Int32 SdrFormTextAttribute::getFormTextStart() const + { + return mpSdrFormTextAttribute->getFormTextStart(); + } - return *this; + sal_Int32 SdrFormTextAttribute::getFormTextShdwXVal() const + { + return mpSdrFormTextAttribute->getFormTextShdwXVal(); } - bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const + sal_Int32 SdrFormTextAttribute::getFormTextShdwYVal() const + { + return mpSdrFormTextAttribute->getFormTextShdwYVal(); + } + + sal_uInt16 SdrFormTextAttribute::getFormTextShdwTransp() const + { + return mpSdrFormTextAttribute->getFormTextShdwTransp(); + } + + XFormTextStyle SdrFormTextAttribute::getFormTextStyle() const + { + return mpSdrFormTextAttribute->getFormTextStyle(); + } + + XFormTextAdjust SdrFormTextAttribute::getFormTextAdjust() const + { + return mpSdrFormTextAttribute->getFormTextAdjust(); + } + + XFormTextShadow SdrFormTextAttribute::getFormTextShadow() const + { + return mpSdrFormTextAttribute->getFormTextShadow(); + } + + Color SdrFormTextAttribute::getFormTextShdwColor() const + { + return mpSdrFormTextAttribute->getFormTextShdwColor(); + } + + const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getOutline() const + { + return mpSdrFormTextAttribute->getOutline(); + } + + const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getShadowOutline() const + { + return mpSdrFormTextAttribute->getShadowOutline(); + } + + bool SdrFormTextAttribute::getFormTextMirror() const + { + return mpSdrFormTextAttribute->getFormTextMirror(); + } + + bool SdrFormTextAttribute::getFormTextOutline() const { - return (getFormTextDistance() == rCandidate.getFormTextDistance() - && getFormTextStart() == rCandidate.getFormTextStart() - && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal() - && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal() - && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp() - && getFormTextStyle() == rCandidate.getFormTextStyle() - && getFormTextAdjust() == rCandidate.getFormTextAdjust() - && getFormTextShadow() == rCandidate.getFormTextShadow() - && getFormTextShdwColor() == rCandidate.getFormTextShdwColor() - && pointerOrContentEqual(getOutline(), rCandidate.getOutline()) - && pointerOrContentEqual(getShadowOutline(), rCandidate.getShadowOutline()) - && getFormTextMirror() == rCandidate.getFormTextMirror() - && getFormTextOutline() == rCandidate.getFormTextOutline()); + return mpSdrFormTextAttribute->getFormTextOutline(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx index db2fe20ae21b..fa225f1a0094 100644 --- a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx @@ -32,10 +32,8 @@ #include "precompiled_svx.hxx" #include - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -43,21 +41,146 @@ namespace drawinglayer { namespace attribute { + class ImpSdrFormTextOutlineAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // one set of attributes for FormText (FontWork) outline visualisation + LineAttribute maLineAttribute; + StrokeAttribute maStrokeAttribute; + sal_uInt8 mnTransparence; + + ImpSdrFormTextOutlineAttribute( + const LineAttribute& rLineAttribute, + const StrokeAttribute& rStrokeAttribute, + sal_uInt8 nTransparence) + : mnRefCount(0), + maLineAttribute(rLineAttribute), + maStrokeAttribute(rStrokeAttribute), + mnTransparence(nTransparence) + { + } + + // data read access + const LineAttribute& getLineAttribute() const { return maLineAttribute; } + const StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } + sal_uInt8 getTransparence() const { return mnTransparence; } + + // compare operator + bool operator==(const ImpSdrFormTextOutlineAttribute& rCandidate) const + { + return (getLineAttribute() == rCandidate.getLineAttribute() + && getStrokeAttribute() == rCandidate.getStrokeAttribute() + && getTransparence() == rCandidate.getTransparence()); + } + + static ImpSdrFormTextOutlineAttribute* get_global_default() + { + static ImpSdrFormTextOutlineAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFormTextOutlineAttribute( + LineAttribute(), + StrokeAttribute(), + 0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute( const LineAttribute& rLineAttribute, const StrokeAttribute& rStrokeAttribute, sal_uInt8 nTransparence) - : maLineAttribute(rLineAttribute), - maStrokeAttribute(rStrokeAttribute), - mnTransparence(nTransparence) + : mpSdrFormTextOutlineAttribute(new ImpSdrFormTextOutlineAttribute( + rLineAttribute, rStrokeAttribute, nTransparence)) + { + } + + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute() + : mpSdrFormTextOutlineAttribute(ImpSdrFormTextOutlineAttribute::get_global_default()) + { + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate) + : mpSdrFormTextOutlineAttribute(rCandidate.mpSdrFormTextOutlineAttribute) + { + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + SdrFormTextOutlineAttribute::~SdrFormTextOutlineAttribute() + { + if(mpSdrFormTextOutlineAttribute->mnRefCount) + { + mpSdrFormTextOutlineAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextOutlineAttribute; + } + } + + bool SdrFormTextOutlineAttribute::isDefault() const + { + return mpSdrFormTextOutlineAttribute == ImpSdrFormTextOutlineAttribute::get_global_default(); + } + + SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute& rCandidate) { + if(rCandidate.mpSdrFormTextOutlineAttribute != mpSdrFormTextOutlineAttribute) + { + if(mpSdrFormTextOutlineAttribute->mnRefCount) + { + mpSdrFormTextOutlineAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextOutlineAttribute; + } + + mpSdrFormTextOutlineAttribute = rCandidate.mpSdrFormTextOutlineAttribute; + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + return *this; } bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const { - return (getLineAttribute() == rCandidate.getLineAttribute() - && getStrokeAttribute() == rCandidate.getStrokeAttribute() - && getTransparence() == rCandidate.getTransparence()); + if(rCandidate.mpSdrFormTextOutlineAttribute == mpSdrFormTextOutlineAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrFormTextOutlineAttribute == *mpSdrFormTextOutlineAttribute); + } + + const LineAttribute& SdrFormTextOutlineAttribute::getLineAttribute() const + { + return mpSdrFormTextOutlineAttribute->getLineAttribute(); + } + + const StrokeAttribute& SdrFormTextOutlineAttribute::getStrokeAttribute() const + { + return mpSdrFormTextOutlineAttribute->getStrokeAttribute(); + } + + sal_uInt8 SdrFormTextOutlineAttribute::getTransparence() const + { + return mpSdrFormTextOutlineAttribute->getTransparence(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx new file mode 100644 index 000000000000..6d8356833829 --- /dev/null +++ b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * 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_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute) + : SdrLineShadowTextAttribute(rLine, rLineStartEnd, rShadow, rTextAttribute), + maFill(rFill), + maFillFloatTransGradient(rFillFloatTransGradient) + { + } + + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute() + : SdrLineShadowTextAttribute(), + maFill(), + maFillFloatTransGradient() + { + } + + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate) + : SdrLineShadowTextAttribute(rCandidate), + maFill(rCandidate.getFill()), + maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()) + { + } + + SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate) + { + SdrLineShadowTextAttribute::operator=(rCandidate); + maFill = rCandidate.getFill(); + maFillFloatTransGradient = rCandidate.getFillFloatTransGradient(); + + return *this; + } + + bool SdrLineFillShadowTextAttribute::isDefault() const + { + return (SdrLineShadowTextAttribute::isDefault() + && getFill().isDefault() + && getFillFloatTransGradient().isDefault()); + } + + bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const + { + return(SdrLineShadowTextAttribute::operator==(rCandidate) + && getFill() == rCandidate.getFill() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx new file mode 100644 index 000000000000..6b863a11aa03 --- /dev/null +++ b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * 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_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute) + : SdrShadowTextAttribute(rShadow, rTextAttribute), + maLine(rLine), + maLineStartEnd(rLineStartEnd) + { + } + + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute() + : SdrShadowTextAttribute(), + maLine(), + maLineStartEnd() + { + } + + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate) + : SdrShadowTextAttribute(rCandidate), + maLine(rCandidate.getLine()), + maLineStartEnd(rCandidate.getLineStartEnd()) + { + } + + SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate) + { + SdrShadowTextAttribute::operator=(rCandidate); + maLine = rCandidate.getLine(); + maLineStartEnd = rCandidate.getLineStartEnd(); + + return *this; + } + + bool SdrLineShadowTextAttribute::isDefault() const + { + return(SdrShadowTextAttribute::isDefault() + && getLine().isDefault() + && getLineStartEnd().isDefault()); + } + + bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const + { + return(SdrShadowTextAttribute::operator==(rCandidate) + && getLine() == rCandidate.getLine() + && getLineStartEnd() == rCandidate.getLineStartEnd()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx new file mode 100644 index 000000000000..34485b57399c --- /dev/null +++ b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * 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_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrShadowTextAttribute::SdrShadowTextAttribute( + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute) + : maShadow(rShadow), + maTextAttribute(rTextAttribute) + { + } + + SdrShadowTextAttribute::SdrShadowTextAttribute() + : maShadow(), + maTextAttribute() + { + } + + SdrShadowTextAttribute::SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate) + : maShadow(rCandidate.getShadow()), + maTextAttribute(rCandidate.getText()) + { + } + + SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate) + { + maShadow = rCandidate.getShadow(); + maTextAttribute = rCandidate.getText(); + + return *this; + } + + bool SdrShadowTextAttribute::isDefault() const + { + return (getShadow().isDefault() + && getText().isDefault()); + } + + bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const + { + return (getShadow() == rCandidate.getShadow() + && getText() == rCandidate.getText()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 3afc03d1600d..0acc7cfc6c86 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -34,21 +34,233 @@ #include #include #include -#include -#include -#include #include -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace attribute { + class ImpSdrTextAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // all-text attributes. The SdrText itself and a copy + // of te OPO + const SdrText* mpSdrText; + const OutlinerParaObject* mpOutlinerParaObject; + + // Set when it's a FormText; contains all FormText attributes + SdrFormTextAttribute maSdrFormTextAttribute; + + // text distances + sal_Int32 maTextLeftDistance; + sal_Int32 maTextUpperDistance; + sal_Int32 maTextRightDistance; + sal_Int32 maTextLowerDistance; + + // #i101556# use versioning from text attributes to detect changes + sal_uInt32 maPropertiesVersion; + + // text alignments + SdrTextHorzAdjust maSdrTextHorzAdjust; + SdrTextVertAdjust maSdrTextVertAdjust; + + // bitfield + unsigned mbContour : 1; + unsigned mbFitToSize : 1; + unsigned mbHideContour : 1; + unsigned mbBlink : 1; + unsigned mbScroll : 1; + unsigned mbInEditMode : 1; + unsigned mbFixedCellHeight : 1; + unsigned mbWrongSpell : 1; + + public: + ImpSdrTextAttribute( + const SdrText* pSdrText, + const OutlinerParaObject& rOutlinerParaObject, + XFormTextStyle eFormTextStyle, + sal_Int32 aTextLeftDistance, + sal_Int32 aTextUpperDistance, + sal_Int32 aTextRightDistance, + sal_Int32 aTextLowerDistance, + SdrTextHorzAdjust aSdrTextHorzAdjust, + SdrTextVertAdjust aSdrTextVertAdjust, + bool bContour, + bool bFitToSize, + bool bHideContour, + bool bBlink, + bool bScroll, + bool bInEditMode, + bool bFixedCellHeight, + bool bWrongSpell) + : mnRefCount(0), + mpSdrText(pSdrText), + mpOutlinerParaObject(new OutlinerParaObject(rOutlinerParaObject)), + maSdrFormTextAttribute(), + maTextLeftDistance(aTextLeftDistance), + maTextUpperDistance(aTextUpperDistance), + maTextRightDistance(aTextRightDistance), + maTextLowerDistance(aTextLowerDistance), + maPropertiesVersion(0), + maSdrTextHorzAdjust(aSdrTextHorzAdjust), + maSdrTextVertAdjust(aSdrTextVertAdjust), + mbContour(bContour), + mbFitToSize(bFitToSize), + mbHideContour(bHideContour), + mbBlink(bBlink), + mbScroll(bScroll), + mbInEditMode(bInEditMode), + mbFixedCellHeight(bFixedCellHeight), + mbWrongSpell(bWrongSpell) + { + if(pSdrText) + { + if(XFT_NONE != eFormTextStyle) + { + // text on path. Create FormText attribute + const SfxItemSet& rSet = pSdrText->GetItemSet(); + maSdrFormTextAttribute = SdrFormTextAttribute(rSet); + } + + // #i101556# init with version number to detect changes of single text + // attribute and/or style sheets in primitive data without having to + // copy that data locally (which would be better from principle) + maPropertiesVersion = pSdrText->GetObject().GetProperties().getVersion(); + } + } + + ImpSdrTextAttribute() + : mnRefCount(0), + mpSdrText(0), + mpOutlinerParaObject(0), + maSdrFormTextAttribute(), + maTextLeftDistance(0), + maTextUpperDistance(0), + maTextRightDistance(0), + maTextLowerDistance(0), + maPropertiesVersion(0), + maSdrTextHorzAdjust(SDRTEXTHORZADJUST_LEFT), + maSdrTextVertAdjust(SDRTEXTVERTADJUST_TOP), + mbContour(false), + mbFitToSize(false), + mbHideContour(false), + mbBlink(false), + mbScroll(false), + mbInEditMode(false), + mbFixedCellHeight(false), + mbWrongSpell(false) + { + } + + ~ImpSdrTextAttribute() + { + if(mpOutlinerParaObject) + { + delete mpOutlinerParaObject; + } + } + + // data read access + const SdrText& getSdrText() const + { + OSL_ENSURE(mpSdrText, "Access to text of default version of ImpSdrTextAttribute (!)"); + return *mpSdrText; + } + const OutlinerParaObject& getOutlinerParaObject() const + { + OSL_ENSURE(mpOutlinerParaObject, "Access to OutlinerParaObject of default version of ImpSdrTextAttribute (!)"); + return *mpOutlinerParaObject; + } + bool isContour() const { return mbContour; } + bool isFitToSize() const { return mbFitToSize; } + bool isHideContour() const { return mbHideContour; } + bool isBlink() const { return mbBlink; } + bool isScroll() const { return mbScroll; } + bool isInEditMode() const { return mbInEditMode; } + bool isFixedCellHeight() const { return mbFixedCellHeight; } + bool isWrongSpell() const { return mbWrongSpell; } + const SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; } + sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } + sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } + sal_Int32 getTextRightDistance() const { return maTextRightDistance; } + sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; } + sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; } + SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } + SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } + + // compare operator + bool operator==(const ImpSdrTextAttribute& rCandidate) const + { + if(mpOutlinerParaObject != rCandidate.mpOutlinerParaObject) + { + if(mpOutlinerParaObject && rCandidate.mpOutlinerParaObject) + { + // compares OPO and it's contents, but traditionally not the RedLining + // which is not seen as model, but as temporary information + if(!(getOutlinerParaObject() == rCandidate.getOutlinerParaObject())) + { + return false; + } + + // #i102062# for primitive visualisation, the WrongList (SpellChecking) + // is important, too, so use isWrongListEqual since there is no WrongList + // comparison in the regular OutlinerParaObject compare (since it's + // not-persistent data) + if(!(getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject()))) + { + return false; + } + } + else + { + // only one is zero; not equal + return false; + } + } + + return ( + getSdrFormTextAttribute() == rCandidate.getSdrFormTextAttribute() + && getTextLeftDistance() == rCandidate.getTextLeftDistance() + && getTextUpperDistance() == rCandidate.getTextUpperDistance() + && getTextRightDistance() == rCandidate.getTextRightDistance() + && getTextLowerDistance() == rCandidate.getTextLowerDistance() + && getPropertiesVersion() == rCandidate.getPropertiesVersion() + + && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust() + && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust() + + && isContour() == rCandidate.isContour() + && isFitToSize() == rCandidate.isFitToSize() + && isHideContour() == rCandidate.isHideContour() + && isBlink() == rCandidate.isBlink() + && isScroll() == rCandidate.isScroll() + && isInEditMode() == rCandidate.isInEditMode() + && isFixedCellHeight() == rCandidate.isFixedCellHeight() + && isWrongSpell() == rCandidate.isWrongSpell()); + } + + static ImpSdrTextAttribute* get_global_default() + { + static ImpSdrTextAttribute* pDefault = 0; + + if(!pDefault) + { + // use default constructor + pDefault = new ImpSdrTextAttribute(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrTextAttribute::SdrTextAttribute( const SdrText& rSdrText, const OutlinerParaObject& rOutlinerParaObject, @@ -67,149 +279,172 @@ namespace drawinglayer bool bInEditMode, bool bFixedCellHeight, bool bWrongSpell) - : mpSdrText(&rSdrText), - maOutlinerParaObject(rOutlinerParaObject), - mpSdrFormTextAttribute(0), - maTextLeftDistance(aTextLeftDistance), - maTextUpperDistance(aTextUpperDistance), - maTextRightDistance(aTextRightDistance), - maTextLowerDistance(aTextLowerDistance), - maPropertiesVersion(0), - maSdrTextHorzAdjust(aSdrTextHorzAdjust), - maSdrTextVertAdjust(aSdrTextVertAdjust), - mbContour(bContour), - mbFitToSize(bFitToSize), - mbHideContour(bHideContour), - mbBlink(bBlink), - mbScroll(bScroll), - mbInEditMode(bInEditMode), - mbFixedCellHeight(bFixedCellHeight), - mbWrongSpell(bWrongSpell) - { - if(XFT_NONE != eFormTextStyle) - { - // text on path. Create FormText attribute - const SfxItemSet& rSet = getSdrText().GetItemSet(); - mpSdrFormTextAttribute = new SdrFormTextAttribute(rSet); - } + : mpSdrTextAttribute(new ImpSdrTextAttribute( + &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance, aTextUpperDistance, + aTextRightDistance, aTextLowerDistance, aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour, + bFitToSize, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell)) + { + } - // #i101556# init with version number to detect changes of single text - // attribute and/or style sheets in primitive data without having to - // copy that data locally (which would be better from principle) - maPropertiesVersion = rSdrText.GetObject().GetProperties().getVersion(); + SdrTextAttribute::SdrTextAttribute() + : mpSdrTextAttribute(ImpSdrTextAttribute::get_global_default()) + { + mpSdrTextAttribute->mnRefCount++; + } + + SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate) + : mpSdrTextAttribute(rCandidate.mpSdrTextAttribute) + { + mpSdrTextAttribute->mnRefCount++; } SdrTextAttribute::~SdrTextAttribute() { - if(mpSdrFormTextAttribute) + if(mpSdrTextAttribute->mnRefCount) { - delete mpSdrFormTextAttribute; - mpSdrFormTextAttribute = 0; + mpSdrTextAttribute->mnRefCount--; } - } - - SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate) - : mpSdrText(&rCandidate.getSdrText()), - maOutlinerParaObject(rCandidate.getOutlinerParaObject()), - mpSdrFormTextAttribute(0), - maTextLeftDistance(rCandidate.getTextLeftDistance()), - maTextUpperDistance(rCandidate.getTextUpperDistance()), - maTextRightDistance(rCandidate.getTextRightDistance()), - maTextLowerDistance(rCandidate.getTextLowerDistance()), - maPropertiesVersion(rCandidate.getPropertiesVersion()), - maSdrTextHorzAdjust(rCandidate.getSdrTextHorzAdjust()), - maSdrTextVertAdjust(rCandidate.getSdrTextVertAdjust()), - mbContour(rCandidate.isContour()), - mbFitToSize(rCandidate.isFitToSize()), - mbHideContour(rCandidate.isHideContour()), - mbBlink(rCandidate.isBlink()), - mbScroll(rCandidate.isScroll()), - mbInEditMode(rCandidate.isInEditMode()), - mbFixedCellHeight(rCandidate.isFixedCellHeight()), - mbWrongSpell(rCandidate.isWrongSpell()) - { - if(rCandidate.getSdrFormTextAttribute()) + else { - mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute()); + delete mpSdrTextAttribute; } } - SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate) + bool SdrTextAttribute::isDefault() const { - mpSdrText = &rCandidate.getSdrText(); - maOutlinerParaObject = rCandidate.getOutlinerParaObject(); + return mpSdrTextAttribute == ImpSdrTextAttribute::get_global_default(); + } - if(mpSdrFormTextAttribute) + SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate) + { + if(rCandidate.mpSdrTextAttribute != mpSdrTextAttribute) { - delete mpSdrFormTextAttribute; + if(mpSdrTextAttribute->mnRefCount) + { + mpSdrTextAttribute->mnRefCount--; + } + else + { + delete mpSdrTextAttribute; + } + + mpSdrTextAttribute = rCandidate.mpSdrTextAttribute; + mpSdrTextAttribute->mnRefCount++; } - mpSdrFormTextAttribute = 0; + return *this; + } + + bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const + { + if(rCandidate.mpSdrTextAttribute == mpSdrTextAttribute) + { + return true; + } - if(rCandidate.getSdrFormTextAttribute()) + if(rCandidate.isDefault() != isDefault()) { - mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute()); + return false; } - maTextLeftDistance = rCandidate.getTextLeftDistance(); - maTextUpperDistance = rCandidate.getTextUpperDistance(); - maTextRightDistance = rCandidate.getTextRightDistance(); - maTextLowerDistance = rCandidate.getTextLowerDistance(); - maPropertiesVersion = rCandidate.getPropertiesVersion(); + return (*rCandidate.mpSdrTextAttribute == *mpSdrTextAttribute); + } - maSdrTextHorzAdjust = rCandidate.getSdrTextHorzAdjust(); - maSdrTextVertAdjust = rCandidate.getSdrTextVertAdjust(); + const SdrText& SdrTextAttribute::getSdrText() const + { + return mpSdrTextAttribute->getSdrText(); + } - mbContour = rCandidate.isContour(); - mbFitToSize = rCandidate.isFitToSize(); - mbHideContour = rCandidate.isHideContour(); - mbBlink = rCandidate.isBlink(); - mbScroll = rCandidate.isScroll(); - mbInEditMode = rCandidate.isInEditMode(); - mbFixedCellHeight = rCandidate.isFixedCellHeight(); - mbWrongSpell = rCandidate.isWrongSpell(); + const OutlinerParaObject& SdrTextAttribute::getOutlinerParaObject() const + { + return mpSdrTextAttribute->getOutlinerParaObject(); + } - return *this; + bool SdrTextAttribute::isContour() const + { + return mpSdrTextAttribute->isContour(); } - bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const + bool SdrTextAttribute::isFitToSize() const + { + return mpSdrTextAttribute->isFitToSize(); + } + + bool SdrTextAttribute::isHideContour() const + { + return mpSdrTextAttribute->isHideContour(); + } + + bool SdrTextAttribute::isBlink() const + { + return mpSdrTextAttribute->isBlink(); + } + + bool SdrTextAttribute::isScroll() const + { + return mpSdrTextAttribute->isScroll(); + } + + bool SdrTextAttribute::isInEditMode() const + { + return mpSdrTextAttribute->isInEditMode(); + } + + bool SdrTextAttribute::isFixedCellHeight() const + { + return mpSdrTextAttribute->isFixedCellHeight(); + } + + bool SdrTextAttribute::isWrongSpell() const + { + return mpSdrTextAttribute->isWrongSpell(); + } + + const SdrFormTextAttribute& SdrTextAttribute::getSdrFormTextAttribute() const + { + return mpSdrTextAttribute->getSdrFormTextAttribute(); + } + + sal_Int32 SdrTextAttribute::getTextLeftDistance() const + { + return mpSdrTextAttribute->getTextLeftDistance(); + } + + sal_Int32 SdrTextAttribute::getTextUpperDistance() const + { + return mpSdrTextAttribute->getTextUpperDistance(); + } + + sal_Int32 SdrTextAttribute::getTextRightDistance() const + { + return mpSdrTextAttribute->getTextRightDistance(); + } + + sal_Int32 SdrTextAttribute::getTextLowerDistance() const + { + return mpSdrTextAttribute->getTextLowerDistance(); + } + + sal_uInt32 SdrTextAttribute::getPropertiesVersion() const + { + return mpSdrTextAttribute->getPropertiesVersion(); + } + + SdrTextHorzAdjust SdrTextAttribute::getSdrTextHorzAdjust() const + { + return mpSdrTextAttribute->getSdrTextHorzAdjust(); + } + + SdrTextVertAdjust SdrTextAttribute::getSdrTextVertAdjust() const { - return ( - // compares OPO and it's contents, but traditionally not the RedLining - // which is not seen as model, but as temporary information - getOutlinerParaObject() == rCandidate.getOutlinerParaObject() - - // #i102062# for primitive visualisation, the WrongList (SpellChecking) - // is important, too, so use isWrongListEqual since there is no WrongList - // comparison in the regular OutlinerParaObject compare (since it's - // not-persistent data) - && getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject()) - - && pointerOrContentEqual(getSdrFormTextAttribute(), rCandidate.getSdrFormTextAttribute()) - && getTextLeftDistance() == rCandidate.getTextLeftDistance() - && getTextUpperDistance() == rCandidate.getTextUpperDistance() - && getTextRightDistance() == rCandidate.getTextRightDistance() - && getTextLowerDistance() == rCandidate.getTextLowerDistance() - && getPropertiesVersion() == rCandidate.getPropertiesVersion() - - && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust() - && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust() - - && isContour() == rCandidate.isContour() - && isFitToSize() == rCandidate.isFitToSize() - && isHideContour() == rCandidate.isHideContour() - && isBlink() == rCandidate.isBlink() - && isScroll() == rCandidate.isScroll() - && isInEditMode() == rCandidate.isInEditMode() - && isFixedCellHeight() == rCandidate.isFixedCellHeight() - && isWrongSpell() == rCandidate.isWrongSpell()); + return mpSdrTextAttribute->getSdrTextVertAdjust(); } void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const { if(isBlink()) { - mpSdrText->GetObject().impGetBlinkTextTiming(rAnimList); + getSdrText().GetObject().impGetBlinkTextTiming(rAnimList); } } @@ -217,7 +452,7 @@ namespace drawinglayer { if(isScroll()) { - mpSdrText->GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength); + getSdrText().GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength); } } } // end of namespace attribute diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index fa9bc88d8f73..4f78318a5b49 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -280,7 +280,8 @@ namespace sdr DBG_ERROR("ViewContact::createViewIndependentPrimitive2DSequence(): Never call the fallback base implementation, this is always an error (!)"); const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(1000.0, 1000.0, 5000.0, 3000.0))); const basegfx::BColor aYellow(1.0, 1.0, 0.0); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewcontactofe3d.cxx b/svx/source/sdr/contact/viewcontactofe3d.cxx index 77a5bf4dff3c..5a2b25010009 100644 --- a/svx/source/sdr/contact/viewcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewcontactofe3d.cxx @@ -37,10 +37,12 @@ #include #include #include -#include -#include #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -128,13 +130,14 @@ namespace sdr // create embedded 2d primitive and add. LightNormal and ShadowSlant are needed for evtl. // 3D shadow extraction for correct B2DRange calculation (shadow is part of the object) - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::Embedded3DPrimitive2D( - rxContent3D, - pVCOfE3DScene->getObjectTransformation(), - aViewInformation3D, - aLightNormal, - fShadowSlant, - rAllContentRange)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::Embedded3DPrimitive2D( + rxContent3D, + pVCOfE3DScene->getObjectTransformation(), + aViewInformation3D, + aLightNormal, + fShadowSlant, + rAllContentRange)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } @@ -179,9 +182,12 @@ namespace sdr if(!rObjectTransform.isIdentity()) { - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::TransformPrimitive3D( - rObjectTransform, xRetval)); - return drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::TransformPrimitive3D( + rObjectTransform, + xRetval)); + + xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofe3dcube.cxx b/svx/source/sdr/contact/viewcontactofe3dcube.cxx index 8626296cb42a..bccccd1d074d 100644 --- a/svx/source/sdr/contact/viewcontactofe3dcube.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dCubeObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get cube geometry and use as traslation and scaling for unit cube basegfx::B3DRange aCubeRange; @@ -100,12 +92,13 @@ namespace sdr const basegfx::B2DVector aTextureSize(aCubeSize.getX(), aCubeSize.getY()); // create primitive and add - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrCubePrimitive3D(aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrCubePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx index 815a9416c7de..501727aa9782 100644 --- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dExtrudeObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get extrude geometry const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon()); @@ -93,15 +85,15 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrExtrudePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids, - bCharacterMode, bCloseFront, bCloseBack)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrExtrudePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids, + bCharacterMode, bCloseFront, bCloseBack)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx index 877ffaca2117..8bea766cbdfe 100644 --- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dLatheObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get extrude geometry const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dLatheObj().GetPolyPoly2D()); @@ -107,16 +99,16 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrLathePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - aPolyPolygon, nHorizontalSegments, nVerticalSegments, - fDiagonal, fBackScale, fRotation, - bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrLathePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + aPolyPolygon, nHorizontalSegments, nVerticalSegments, + fDiagonal, fBackScale, fRotation, + bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx index 9ae265d29362..b69d1d6a8ced 100644 --- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx @@ -60,23 +60,15 @@ namespace sdr drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dPolygonObj().GetMergedItemSet(); const bool bSuppressFill(GetE3dPolygonObj().GetLineOnly()); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill)); // get extrude geometry basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D()); const basegfx::B3DPolyPolygon aPolyNormals3D(GetE3dPolygonObj().GetPolyNormals3D()); const basegfx::B2DPolyPolygon aPolyTexture2D(GetE3dPolygonObj().GetPolyTexture2D()); - const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count()); - const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count()); + const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count()); + const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count()); if(bNormals || bTexture) { @@ -181,13 +173,13 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( - aPolyPolygon3D, aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( + aPolyPolygon3D, aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx index 9c5885d2bf95..ca6168c4aafb 100644 --- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx @@ -41,11 +41,11 @@ #include #include #include -#include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -167,21 +167,13 @@ namespace sdr ViewContactOfE3dScene::ViewContactOfE3dScene(E3dScene& rScene) : ViewContactOfSdrObj(rScene), - mpViewInformation3D(0), - mpObjectTransformation(0), - mpSdrSceneAttribute(0), - mpSdrLightingAttribute(0) + maViewInformation3D(), + maObjectTransformation(), + maSdrSceneAttribute(), + maSdrLightingAttribute() { } - ViewContactOfE3dScene::~ViewContactOfE3dScene() - { - delete mpViewInformation3D; - delete mpObjectTransformation; - delete mpSdrSceneAttribute; - delete mpSdrLightingAttribute; - } - void ViewContactOfE3dScene::createViewInformation3D(const basegfx::B3DRange& rContentRange) { basegfx::B3DHomMatrix aTransformation; @@ -265,34 +257,36 @@ namespace sdr } const uno::Sequence< beans::PropertyValue > aEmptyProperties; - mpViewInformation3D = new drawinglayer::geometry::ViewInformation3D(aTransformation, aOrientation, aProjection, aDeviceToView, 0.0, aEmptyProperties); + maViewInformation3D = drawinglayer::geometry::ViewInformation3D( + aTransformation, aOrientation, aProjection, + aDeviceToView, 0.0, aEmptyProperties); } void ViewContactOfE3dScene::createObjectTransformation() { // create 2d Object Transformation from relative point in 2d scene to world - mpObjectTransformation = new basegfx::B2DHomMatrix; const Rectangle& rRectangle = GetE3dScene().GetSnapRect(); - mpObjectTransformation->set(0, 0, rRectangle.getWidth()); - mpObjectTransformation->set(1, 1, rRectangle.getHeight()); - mpObjectTransformation->set(0, 2, rRectangle.Left()); - mpObjectTransformation->set(1, 2, rRectangle.Top()); + maObjectTransformation.set(0, 0, rRectangle.getWidth()); + maObjectTransformation.set(1, 1, rRectangle.getHeight()); + maObjectTransformation.set(0, 2, rRectangle.Left()); + maObjectTransformation.set(1, 2, rRectangle.Top()); } void ViewContactOfE3dScene::createSdrSceneAttribute() { const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet(); - mpSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet); + maSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet); } void ViewContactOfE3dScene::createSdrLightingAttribute() { const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet(); - mpSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet); + maSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet); } - drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence(const SetOfByte* pLayerVisibility) const + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence( + const SetOfByte* pLayerVisibility) const { drawinglayer::primitive2d::Primitive2DSequence xRetval; const sal_uInt32 nChildrenCount(GetObjectCount()); @@ -332,19 +326,27 @@ namespace sdr // on identity and the time on 0.0. const uno::Sequence< beans::PropertyValue > aEmptyProperties; const drawinglayer::geometry::ViewInformation3D aNeutralViewInformation3D(aEmptyProperties); - const basegfx::B3DRange aContentRange(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D)); + const basegfx::B3DRange aContentRange( + drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D)); // create 2d primitive 3dscene with generated sub-list from collector - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ScenePrimitive2D( - bTestVisibility ? aVisibleSequence : aAllSequence, - getSdrSceneAttribute(), - getSdrLightingAttribute(), - getObjectTransformation(), - getViewInformation3D(aContentRange))); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::ScenePrimitive2D( + bTestVisibility ? aVisibleSequence : aAllSequence, + getSdrSceneAttribute(), + getSdrLightingAttribute(), + getObjectTransformation(), + getViewInformation3D(aContentRange))); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } + // always append an invisible outline for the cases where no visible content exists + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, getObjectTransformation())); + return xRetval; } @@ -358,27 +360,7 @@ namespace sdr xRetval = createScenePrimitive2DSequence(0); } - if(xRetval.hasElements()) - { - return xRetval; - } - else - { - // create a gray placeholder hairline polygon in object size as empty 3D scene marker. Use object size - // model information directly, NOT getBoundRect()/getSnapRect() since these will - // be using the geometry data we get just asked for. AFAIK for empty 3D Scenes, the model data - // is SdrObject::aOutRect which i can access directly using GetLastBoundRect() here - const Rectangle aEmptySceneGeometry(GetE3dScene().GetLastBoundRect()); - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange( - aEmptySceneGeometry.Left(), aEmptySceneGeometry.Top(), - aEmptySceneGeometry.Right(), aEmptySceneGeometry.Bottom()))); - const double fGrayTone(0xc0 / 255.0); - const basegfx::BColor aGrayTone(fGrayTone, fGrayTone, fGrayTone); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone)); - - // The replacement object may also get a text like 'empty 3D Scene' here later - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + return xRetval; } void ViewContactOfE3dScene::ActionChanged() @@ -387,22 +369,15 @@ namespace sdr ViewContactOfSdrObj::ActionChanged(); // mark locally cached values as invalid - delete mpViewInformation3D; - mpViewInformation3D = 0; - - delete mpObjectTransformation; - mpObjectTransformation = 0; - - delete mpSdrSceneAttribute; - mpSdrSceneAttribute = 0; - - delete mpSdrLightingAttribute; - mpSdrLightingAttribute = 0; + maViewInformation3D = drawinglayer::geometry::ViewInformation3D(); + maObjectTransformation.identity(); + maSdrSceneAttribute = drawinglayer::attribute::SdrSceneAttribute(); + maSdrLightingAttribute = drawinglayer::attribute::SdrLightingAttribute(); } const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D() const { - if(!mpViewInformation3D) + if(maViewInformation3D.isDefault()) { // this version will create the content range on demand locally and thus is less // performant than the other one. Since the information is buffered the planned @@ -421,47 +396,47 @@ namespace sdr const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(aContentRange); } - return *mpViewInformation3D; + return maViewInformation3D; } const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D(const basegfx::B3DRange& rContentRange) const { - if(!mpViewInformation3D) + if(maViewInformation3D.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(rContentRange); } - return *mpViewInformation3D; + return maViewInformation3D; } const basegfx::B2DHomMatrix& ViewContactOfE3dScene::getObjectTransformation() const { - if(!mpObjectTransformation) + if(maObjectTransformation.isIdentity()) { const_cast < ViewContactOfE3dScene* >(this)->createObjectTransformation(); } - return *mpObjectTransformation; + return maObjectTransformation; } const drawinglayer::attribute::SdrSceneAttribute& ViewContactOfE3dScene::getSdrSceneAttribute() const { - if(!mpSdrSceneAttribute) + if(maSdrSceneAttribute.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createSdrSceneAttribute(); } - return *mpSdrSceneAttribute; + return maSdrSceneAttribute; } const drawinglayer::attribute::SdrLightingAttribute& ViewContactOfE3dScene::getSdrLightingAttribute() const { - if(!mpSdrLightingAttribute) + if(maSdrLightingAttribute.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createSdrLightingAttribute(); } - return *mpSdrLightingAttribute; + return maSdrLightingAttribute; } drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dScene::getAllPrimitive3DSequence() const diff --git a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx index e175416d7552..cb234138d8f7 100644 --- a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx @@ -57,16 +57,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dSphereObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get sphere center and size for geometry basegfx::B3DRange aSphereRange; @@ -92,14 +84,14 @@ namespace sdr F_PI2 * aSphereSize.getY()); // half outline, (PI * d)/2 -> PI/2 * d // create primitive and add - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrSpherePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - nHorizontalSegments, nVerticalSegments)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrSpherePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + nHorizontalSegments, nVerticalSegments)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index fcac5f68056e..b7663fc30dcf 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -42,7 +41,6 @@ #endif #include -#include #include #include #include @@ -62,6 +60,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -151,10 +150,9 @@ namespace sdr * aSmallerMatrix; const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); - const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0); const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D( aSmallerMatrix, - aEmptyAttributes, + drawinglayer::attribute::SdrLineFillShadowTextAttribute(), rGraphicObject, rLocalGrafInfo)); @@ -180,14 +178,12 @@ namespace sdr aEmptyGraphicAttr)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1); - if(!rAttribute.getLine()) + if(rAttribute.getLine().isDefault()) { // create a surrounding frame when no linestyle given const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor()); const basegfx::BColor aBColor(aColor.getBColor()); - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(rObjectMatrix); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, @@ -317,127 +313,123 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; - SdrText* pSdrText = GetGrafObject().getText(0); - - if(pSdrText) + const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); + drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetGrafObject().getText(0))); + + // create and fill GraphicAttr + GraphicAttr aLocalGrafInfo; + const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue()); + const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP)); + aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue()); + aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue()); + aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue()); + aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue()); + aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue()); + aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01); + aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55)); + aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue()); + aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); + aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); + + if(aAttribute.isDefault() && 255L != aLocalGrafInfo.GetTransparency()) { - const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - bool bVisible(pAttribute && pAttribute->isVisible()); - - // create and fill GraphicAttr - GraphicAttr aLocalGrafInfo; - const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue()); - const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP)); - aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue()); - aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue()); - aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue()); - aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue()); - aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue()); - aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01); - aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55)); - aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue()); - aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); - aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); - - if(!bVisible && 255L != aLocalGrafInfo.GetTransparency()) + // no fill, no line, no text (invisible), but the graphic content is visible. + // Create evtl. shadow for content which was not created by createNewSdrLineFillShadowTextAttribute yet + const drawinglayer::attribute::SdrShadowAttribute aShadow( + drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet)); + + if(!aShadow.isDefault()) { - // content is visible, so force some fill stuff - delete pAttribute; - bVisible = true; + // create new attribute set if indeed shadow is used + aAttribute = drawinglayer::attribute::SdrLineFillShadowTextAttribute( + aAttribute.getLine(), + aAttribute.getFill(), + aAttribute.getLineStartEnd(), + aShadow, + aAttribute.getFillFloatTransGradient(), + aAttribute.getText()); + } + } - // check shadow - drawinglayer::attribute::SdrShadowAttribute* pShadow = drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet); + // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() + // which will use the primitive data we just create in the near future + const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // look for mirroring + const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); + const sal_Int32 nDrehWink(rGeoStat.nDrehWink); + const bool bRota180(18000 == nDrehWink); + const bool bMirrored(GetGrafObject().IsMirrored()); + const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1)); + bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase)); + bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase)); + + // set mirror flags at LocalGrafInfo. Take into account that the geometry in + // aObjectRange is already changed and rotated when bRota180 is used. To rebuild + // that old behaviour (as long as part of the model data), correct the H/V flags + // accordingly. The created bitmapPrimitive WILL use the rotation, too. + if(bRota180) + { + // if bRota180 which is used for vertical mirroring, the graphic will already be rotated + // by 180 degrees. To correct, switch off VMirror and invert HMirroring. + bHMirr = !bHMirr; + bVMirr = false; + } - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + if(bHMirr || bVMirr) + { + aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0)); + } - // create new attribute set - pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0L, 0L, 0L, pShadow, 0L, 0L); - } + // fill object matrix + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); - if(pAttribute) - { - if(pAttribute->isVisible() || bVisible) - { - // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() - // which will use the primitive data we just create in the near future - const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // look for mirroring - const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); - const sal_Int32 nDrehWink(rGeoStat.nDrehWink); - const bool bRota180(18000 == nDrehWink); - const bool bMirrored(GetGrafObject().IsMirrored()); - const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1)); - bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase)); - bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase)); - - // set mirror flags at LocalGrafInfo. Take into account that the geometry in - // aObjectRange is already changed and rotated when bRota180 is used. To rebuild - // that old behaviour (as long as part of the model data), correct the H/V flags - // accordingly. The created bitmapPrimitive WILL use the rotation, too. - if(bRota180) - { - // if bRota180 which is used for vertical mirroring, the graphic will already be rotated - // by 180 degrees. To correct, switch off VMirror and invert HMirroring. - bHMirr = !bHMirr; - bVMirr = false; - } - - if(bHMirr || bVMirr) - { - aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0)); - } - - // fill object matrix - const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); - const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0); - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - fShearX, fRotate, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // get the current, unchenged graphic obect from SdrGrafObj - const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); - - if(visualisationUsesPresObj()) - { - // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one - // with the content which is the placeholder graphic - xRetval = createVIP2DSForPresObj(aObjectMatrix, *pAttribute, aLocalGrafInfo); - } - else if(visualisationUsesDraft()) - { - // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism - // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious - // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent - // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster - // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages - xRetval = createVIP2DSForDraft(aObjectMatrix, *pAttribute); - } - else - { - // create primitive. Info: Calling the copy-constructor of GraphicObject in this - // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( - aObjectMatrix, - *pAttribute, - rGraphicObject, - aLocalGrafInfo)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - delete pAttribute; - } + // get the current, unchenged graphic obect from SdrGrafObj + const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); + + if(visualisationUsesPresObj()) + { + // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one + // with the content which is the placeholder graphic + xRetval = createVIP2DSForPresObj(aObjectMatrix, aAttribute, aLocalGrafInfo); + } + else if(visualisationUsesDraft()) + { + // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism + // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious + // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent + // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster + // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages + xRetval = createVIP2DSForDraft(aObjectMatrix, aAttribute); } + else + { + // create primitive. Info: Calling the copy-constructor of GraphicObject in this + // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic + const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( + aObjectMatrix, + aAttribute, + rGraphicObject, + aLocalGrafInfo)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + + // always append an invisible outline for the cases where no visible content exists + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectMatrix)); return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofgroup.cxx b/svx/source/sdr/contact/viewcontactofgroup.cxx index 3dd2b4bd4388..00e9ad8cb684 100644 --- a/svx/source/sdr/contact/viewcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewcontactofgroup.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -81,25 +82,22 @@ namespace sdr drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq); } } - - if(xRetval.hasElements()) - { - return xRetval; - } else { - // create a gray placeholder hairline polygon in object size. Use the model data directly. For empty groups, - // this is SdrObject::aOutRect, as can be seen in SdrObjGroup::GetSnapRect(). Access that using GetLastBoundRect() - // to not execute anything. + // append an invisible outline for the cases where no visible content exists const Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect()); - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange( - aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()))); - const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone)); + const basegfx::B2DRange aCurrentRange( + aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), + aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()); - // The replacement object may also get a text like 'empty group' here later - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aCurrentRange)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + + return xRetval; } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index 748d5c083a65..84f6c7c9bfe2 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -41,12 +41,14 @@ #include #include #include -#include #include #include #include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -68,26 +70,27 @@ namespace sdr { // build primitive from pBackgroundCandidate's attributes const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - if(pFill) + if(!aFill.isDefault()) { - if(pFill->isVisible()) - { - // direct model data is the page size, get and use it - const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); - const basegfx::B2DRange aInnerRange( - rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), - rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pFill; + // direct model data is the page size, get and use it + const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); + const basegfx::B2DRange aInnerRange( + rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), + rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), + rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index 337681e4d391..57e7ec69485b 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -70,107 +69,108 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence xRetval; const SdrCaptionObj& rCaptionObj(GetCaptionObj()); const SfxItemSet& rItemSet = rCaptionObj.GetMergedItemSet(); - SdrText* pSdrText = rCaptionObj.getText(0); - - if(pSdrText) + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + rCaptionObj.getText(0))); + + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); + + // fill object matrix + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // calculate corner radius + double fCornerRadiusX; + double fCornerRadiusY; + drawinglayer::primitive2d::calculateRelativeCornerRadius( + rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); + + // create primitive. Always create one (even if invisible) to let the decomposition + // of SdrCaptionPrimitive2D create needed invisible elements for HitTest and BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCaptionPrimitive2D( + aObjectMatrix, + aAttribute, + rCaptionObj.getTailPolygon(), + fCornerRadiusX, + fCornerRadiusY)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + + if(!aAttribute.isDefault() && rCaptionObj.GetSpecialTextBoxShadow()) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) + // for SC, the caption object may have a specialized shadow. The usual object shadow is off + // and a specialized shadow gets created here (see old paint) + const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR)); + const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue()); + const Color aShadCol(rShadColItem.GetColorValue()); + const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue(); + + // Create own ItemSet and modify as needed + // Always hide lines for special calc shadow + SfxItemSet aSet(rItemSet); + aSet.Put(XLineStyleItem(XLINE_NONE)); + + if(XFILL_HATCH == eStyle) + { + // #41666# Hatch color is set hard to shadow color + XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue(); + aHatch.SetColor(aShadCol); + aSet.Put(XFillHatchItem(String(),aHatch)); + } + else { - if(pAttribute->isVisible()) + if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle) { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); - - // fill object matrix - basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // calculate corner radius - double fCornerRadiusX; - double fCornerRadiusY; - drawinglayer::primitive2d::calculateRelativeCornerRadius(rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrCaptionPrimitive2D( - aObjectMatrix, *pAttribute, rCaptionObj.getTailPolygon(), fCornerRadiusX, fCornerRadiusY)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - - if(rCaptionObj.GetSpecialTextBoxShadow()) - { - // for SC, the caption object may have a specialized shadow. The usual object shadow is off - // and a specialized shadow gets created here (see old paint) - const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR)); - const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue()); - const Color aShadCol(rShadColItem.GetColorValue()); - const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue(); - - // Create own ItemSet and modify as needed - // Always hide lines for special calc shadow - SfxItemSet aSet(rItemSet); - aSet.Put(XLineStyleItem(XLINE_NONE)); - - if(XFILL_HATCH == eStyle) - { - // #41666# Hatch color is set hard to shadow color - XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue(); - aHatch.SetColor(aShadCol); - aSet.Put(XFillHatchItem(String(),aHatch)); - } - else - { - if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle) - { - // force fill to solid (for Gradient and Bitmap) - aSet.Put(XFillStyleItem(XFILL_SOLID)); - } - - aSet.Put(XFillColorItem(String(),aShadCol)); - aSet.Put(XFillTransparenceItem(nTransp)); - } - - // crete FillAttribute from modified ItemSet - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(aSet); - drawinglayer::primitive2d::Primitive2DReference xSpecialShadow; - - if(pFill) - { - if(pFill->isVisible()) - { - // add shadow offset to object matrix - const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue()); - const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); - aObjectMatrix.translate(nXDist, nYDist); - - // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition) - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY)); - - // create the specialized shadow primitive - xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), aObjectMatrix, *pFill); - } - - delete pFill; - } - - if(xSpecialShadow.is()) - { - // if we really got a special shadow, create a two-element retval with the shadow - // behind the standard object's geometry - xRetval.realloc(2); - - xRetval[0] = xSpecialShadow; - xRetval[1] = xReference; - } - } + // force fill to solid (for Gradient and Bitmap) + aSet.Put(XFillStyleItem(XFILL_SOLID)); } - delete pAttribute; + aSet.Put(XFillColorItem(String(),aShadCol)); + aSet.Put(XFillTransparenceItem(nTransp)); + } + + // crete FillAttribute from modified ItemSet + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(aSet)); + drawinglayer::primitive2d::Primitive2DReference xSpecialShadow; + + if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) + { + // add shadow offset to object matrix + const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue()); + const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); + aObjectMatrix.translate(nXDist, nYDist); + + // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition) + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY)); + + // create the specialized shadow primitive + xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + aObjectMatrix, + aFill, + drawinglayer::attribute::FillGradientAttribute()); + } + + if(xSpecialShadow.is()) + { + // if we really got a special shadow, create a two-element retval with the shadow + // behind the standard object's geometry + xRetval.realloc(2); + + xRetval[0] = xSpecialShadow; + xRetval[1] = xReference; } } diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx index 047685dc14f2..2ff6a48686e9 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -58,56 +57,62 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrCircObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetCircObj().GetMergedItemSet(); - SdrText* pSdrText = GetCircObj().getText(0); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetCircObj().getText(0))); - if(pSdrText) - { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetCircObj().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetCircObj().GetGeoRect(); + const basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); - // fill object matrix - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); + // fill object matrix + const basegfx::B2DHomMatrix aObjectMatrix( + basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); - // create primitive data - const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); + // create primitive data + const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); - if(OBJ_CIRC == nIdentifier) - { - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipsePrimitive2D(aObjectMatrix, *pAttribute)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - else - { - const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue()); - const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue()); - const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000); - const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000); - const bool bCloseSegment(OBJ_CARC != nIdentifier); - const bool bCloseUsingCenter(OBJ_SECT == nIdentifier); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D(aObjectMatrix, *pAttribute, fStart, fEnd, bCloseSegment, bCloseUsingCenter)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } + // always create primitives to allow the decomposition of SdrEllipsePrimitive2D + // or SdrEllipseSegmentPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + if(OBJ_CIRC == nIdentifier) + { + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrEllipsePrimitive2D( + aObjectMatrix, + aAttribute)); - delete pAttribute; - } + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + else + { + const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue()); + const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue()); + const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000); + const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000); + const bool bCloseSegment(OBJ_CARC != nIdentifier); + const bool bCloseUsingCenter(OBJ_SECT == nIdentifier); + + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D( + aObjectMatrix, + aAttribute, + fStart, + fEnd, + bCloseSegment, + bCloseUsingCenter)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx index 10b63f8044bf..df0151d65615 100644 --- a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include ////////////////////////////////////////////////////////////////////////////// @@ -55,35 +54,27 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrEdgeObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; - ::basegfx::B2DPolygon aEdgeTrack(GetEdgeObj().getEdgeTrack()); + const basegfx::B2DPolygon& rEdgeTrack = GetEdgeObj().getEdgeTrack(); - // base visualisation on EdgeTrack - if(aEdgeTrack.count()) - { - // ckeck attributes - const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); - SdrText* pSdrText = GetEdgeObj().getText(0); + // what to do when no EdgeTrack is provided (HitTest and selectability) ? + OSL_ENSURE(0 != rEdgeTrack.count(), "Connectors with no geometry are not allowed (!)"); - if(pSdrText) - { - drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText); + // ckeck attributes + const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); + const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute( + rItemSet, + GetEdgeObj().getText(0))); - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrConnectorPrimitive2D(*pAttribute, aEdgeTrack)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + // create primitive. Always create primitives to allow the decomposition of + // SdrConnectorPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrConnectorPrimitive2D( + aAttribute, + rEdgeTrack)); - delete pAttribute; - } - } - } - - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx index 18a82377d582..a129882686c8 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -61,91 +60,85 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMeasureObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetMeasureObj().GetMergedItemSet(); - SdrText* pSdrText = GetMeasureObj().getText(0); + const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute( + rItemSet, + GetMeasureObj().getText(0))); - if(pSdrText) - { - drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText); + // take properties which are the model data. + const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); + const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); + const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); + const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); + const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); + const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); + const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); + const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); + const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); + const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); + drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); + drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - if(pAttribute) + switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue()) + { + case SDRMEASURE_TEXTLEFTOUTSIDE : { - if(pAttribute->isVisible()) - { - // take properties which are the model data. - const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); - const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); - const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); - const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); - const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); - const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); - const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); - const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); - const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); - const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); - drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - - switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue()) - { - case SDRMEASURE_TEXTLEFTOUTSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; - break; - } - case SDRMEASURE_TEXTINSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; - break; - } - case SDRMEASURE_TEXTRIGHTOUTSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; - break; - } - default : // SDRMEASURE_TEXTHAUTO - { - break; - } - } - - switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) - { - case SDRMEASURE_ABOVE : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; - break; - } - case SDRMEASURETEXT_BREAKEDLINE : - case SDRMEASURETEXT_VERTICALCENTERED : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; - break; - } - case SDRMEASURE_BELOW : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; - break; - } - default : // SDRMEASURE_TEXTVAUTO - { - break; - } - } - - // create primitive with the model data - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrMeasurePrimitive2D(*pAttribute, - aStart, aEnd, aMTPHor, aMTPVer, fDistance, fUpperDistance, fLowerDistance, fLeftDelta, fRightDelta, - bBelow, bTextRotation, bTextAutoAngle)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; + break; + } + case SDRMEASURE_TEXTINSIDE : + { + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; + break; + } + case SDRMEASURE_TEXTRIGHTOUTSIDE : + { + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; + break; + } + default : // SDRMEASURE_TEXTHAUTO + { + break; + } + } - delete pAttribute; + switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) + { + case SDRMEASURE_ABOVE : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; + break; + } + case SDRMEASURETEXT_BREAKEDLINE : + case SDRMEASURETEXT_VERTICALCENTERED : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; + break; + } + case SDRMEASURE_BELOW : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; + break; + } + default : // SDRMEASURE_TEXTVAUTO + { + break; } } - return xRetval; + // create primitive with the model data. Always create primitives to allow the + // decomposition of SdrMeasurePrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrMeasurePrimitive2D( + aAttribute, aStart, aEnd, + aMTPHor, aMTPVer, fDistance, + fUpperDistance, fLowerDistance, + fLeftDelta, fRightDelta, bBelow, + bTextRotation, bTextAutoAngle)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx index 96a2f65e32ee..03eb97281240 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx @@ -157,7 +157,9 @@ namespace sdr // create range using the model data directly. This is in SdrTextObj::aRect which i will access using // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM. const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect()); - const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + const basegfx::B2DRange aRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); // create object transform basegfx::B2DHomMatrix aTransform; @@ -166,12 +168,15 @@ namespace sdr aTransform.set(0, 2, aRange.getMinX()); aTransform.set(1, 2, aRange.getMinY()); - // create media primitive + // create media primitive. Always create primitives to allow the + // decomposition of MediaPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect const basegfx::BColor aBackgroundColor(67.0 / 255.0, 67.0 / 255.0, 67.0 / 255.0); const rtl::OUString& rURL(GetSdrMediaObj().getURL()); const sal_uInt32 nPixelBorder(4L); - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::MediaPrimitive2D( - aTransform, rURL, aBackgroundColor, nPixelBorder)); + const drawinglayer::primitive2d::Primitive2DReference xRetval( + new drawinglayer::primitive2d::MediaPrimitive2D( + aTransform, rURL, aBackgroundColor, nPixelBorder)); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 352b9198e97b..36475a38eb64 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -34,13 +34,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -121,126 +121,121 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetCustomShapeObj().GetMergedItemSet(); - SdrText* pSdrText = GetCustomShapeObj().getText(0); - if(pSdrText) - { - // #i98072# Get shandow and text; eventually suppress the text if it's - // a TextPath FontworkGallery object - drawinglayer::attribute::SdrShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrShadowTextAttribute( + // #i98072# Get shandow and text; eventually suppress the text if it's + // a TextPath FontworkGallery object + const drawinglayer::attribute::SdrShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrShadowTextAttribute( rItemSet, - *pSdrText, - GetCustomShapeObj().IsTextPath()); - drawinglayer::primitive2d::Primitive2DSequence xGroup; - bool bHasText(pAttribute && pAttribute->getText()); + GetCustomShapeObj().getText(0), + GetCustomShapeObj().IsTextPath())); + drawinglayer::primitive2d::Primitive2DSequence xGroup; + bool bHasText(!aAttribute.getText().isDefault()); + + // create Primitive2DSequence from sub-geometry + const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); + bool b3DShape(false); - // create Primitive2DSequence from sub-geometry - const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); - bool b3DShape(false); + if(pSdrObjRepresentation) + { + SdrObjListIter aIterator(*pSdrObjRepresentation); - if(pSdrObjRepresentation) + while(aIterator.IsMore()) { - SdrObjListIter aIterator(*pSdrObjRepresentation); + SdrObject& rCandidate = *aIterator.Next(); - while(aIterator.IsMore()) + if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) { - SdrObject& rCandidate = *aIterator.Next(); - - if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) - { - b3DShape = true; - } - - const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); + b3DShape = true; } + + const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); } + } + + if(bHasText || xGroup.hasElements()) + { + // prepare text box geometry + basegfx::B2DHomMatrix aTextBoxMatrix; + bool bWordWrap(false); - if(bHasText || xGroup.hasElements()) + if(bHasText) { - // prepare text box geometry - basegfx::B2DHomMatrix aTextBoxMatrix; - bool bWordWrap(false); + // take unrotated snap rect as default, then get the + // unrotated text box. Rotation needs to be done centered + const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); - if(bHasText) - { - // take unrotated snap rect as default, then get the - // unrotated text box. Rotation needs to be done centered - const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); - const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); + // #i101684# get the text range unrotated and absolute to the object range + const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect()); - // #i101684# get the text range unrotated and absolute to the object range - const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect()); + // give text object a size + aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); - // give text object a size - aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); + // check if we have a rotation/shear at all to take care of + const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); + const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); - // check if we have a rotation/shear at all to take care of - const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); - const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); + if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) + { + if(aObjectRange != aTextRange) + { + // move relative to unrotated object range + aTextBoxMatrix.translate( + aTextRange.getMinX() - aObjectRange.getMinimum().getX(), + aTextRange.getMinY() - aObjectRange.getMinimum().getY()); + } - if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) + if(rGeoStat.nShearWink) { - if(aObjectRange != aTextRange) - { - // move relative to unrotated object range - aTextBoxMatrix.translate( - aTextRange.getMinX() - aObjectRange.getMinimum().getX(), - aTextRange.getMinY() - aObjectRange.getMinimum().getY()); - } - - if(rGeoStat.nShearWink) - { - aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - if(!basegfx::fTools::equalZero(fExtraTextRotation)) - { - aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); - } - - // give text it's target position - aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); } - else + + if(rGeoStat.nDrehWink) { - aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY()); + aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); } - // check if SdrTextWordWrapItem is set - bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue(); - } + if(!basegfx::fTools::equalZero(fExtraTextRotation)) + { + aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); + } - // make sure a (even empty) SdrShadowTextAttribute exists for - // primitive creation - if(!pAttribute) + // give text it's target position + aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + } + else { - pAttribute = new drawinglayer::attribute::SdrShadowTextAttribute(0L, 0L); + aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY()); } - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( - *pAttribute, - xGroup, - aTextBoxMatrix, - bWordWrap, - b3DShape, - false)); // #SJ# New parameter to force to clipped BlockText for SC - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + // check if SdrTextWordWrapItem is set + bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue(); } - if(pAttribute) - { - delete pAttribute; - } + // create primitive + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( + aAttribute, + xGroup, + aTextBoxMatrix, + bWordWrap, + b3DShape, + false)); // #SJ# New parameter to force to clipped BlockText for SC + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + // always append an invisible outline for the cases where no visible content exists + const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + const basegfx::B2DRange aObjectRange( + aObjectBound.Left(), aObjectBound.Top(), + aObjectBound.Right(), aObjectBound.Bottom()); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectRange)); + return xRetval; } } // end of namespace contact diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 7672577138d0..bcd7646f326a 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -76,59 +75,51 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters( bool bHighContrast) const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; - SdrText* pSdrText = GetOle2Obj().getText(0); - - if(pSdrText) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); - const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // create object matrix - const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); - const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); - const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // Prepare attribute settings, will be used soon anyways - const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(!pAttribute) - { - // force existence, even when not visible - pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0, 0, 0, 0, 0, 0); - } - - // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing - // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect - // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). - // It will also take care of HighContrast and ScaleContent - const drawinglayer::primitive2d::Primitive2DReference xOleContent( - new drawinglayer::primitive2d::SdrOleContentPrimitive2D( - GetOle2Obj(), - aObjectMatrix, - - // #i104867# add GraphicVersion number to be able to check for - // content change in the primitive later - GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), - - bHighContrast)); - - // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways. - const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrOle2Primitive2D( + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); + const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + + // create object matrix + const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // Prepare attribute settings, will be used soon anyways + const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetOle2Obj().getText(0))); + + // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing + // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect + // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). + // It will also take care of HighContrast and ScaleContent + const drawinglayer::primitive2d::Primitive2DReference xOleContent( + new drawinglayer::primitive2d::SdrOleContentPrimitive2D( + GetOle2Obj(), + aObjectMatrix, + + // #i104867# add GraphicVersion number to be able to check for + // content change in the primitive later + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), + + bHighContrast)); + + // create primitive. Use Ole2 primitive here. Prepare attribute settings, will + // be used soon anyways. Always create primitives to allow the decomposition of + // SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrOle2Primitive2D( xOLEContent, aObjectMatrix, - *pAttribute)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - delete pAttribute; - } + aAttribute)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 26a3934c179e..12b7e1b0acf4 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -45,9 +45,9 @@ #include #include #include -#include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -101,7 +101,8 @@ namespace sdr const svtools::ColorConfig aColorConfig; const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor); const basegfx::BColor aRGBColor(aInitColor.getBColor()); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } @@ -216,25 +217,25 @@ namespace sdr { // build primitive from pObject's attributes const SfxItemSet& rFillProperties = pObject->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - if(pFill) + if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) { - if(pFill->isVisible()) - { - // direct model data is the page size, get and use it - const basegfx::B2DRange aInnerRange( - rPage.GetLftBorder(), rPage.GetUppBorder(), - rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pFill; + // direct model data is the page size, get and use it + const basegfx::B2DRange aInnerRange( + rPage.GetLftBorder(), rPage.GetUppBorder(), + rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } } diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index 3c8449bae7f6..97716a7fdddd 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -57,93 +56,91 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet(); - SdrText* pSdrText = GetPathObj().getText(0); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetPathObj().getText(0))); + basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); + sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); + sal_uInt32 nPointCount(0); + + for(sal_uInt32 a(0); a < nPolyCount; a++) + { + nPointCount += aUnitPolyPolygon.getB2DPolygon(a).count(); + } + + if(!nPointCount) + { + OSL_ENSURE(false, "PolyPolygon object without geometry detected, this should not be created (!)"); + basegfx::B2DPolygon aFallbackLine; + aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0)); + aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0)); + aUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine); + + nPolyCount = 1; + } + + // prepare object transformation and unit polygon (direct model data) + basegfx::B2DHomMatrix aObjectMatrix; + const bool bIsLine( + !aUnitPolyPolygon.areControlPointsUsed() + && 1 == nPolyCount + && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); - if(pSdrText) + if(bIsLine) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( - rItemSet, - *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); - const sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); - - if(nPolyCount) - { - // prepare object transformation and unit polygon (direct model data) - basegfx::B2DHomMatrix aObjectMatrix; - const bool bIsLine( - !aUnitPolyPolygon.areControlPointsUsed() - && 1 == nPolyCount - && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); - - if(bIsLine) - { - // special handling for single line mode (2 points) - const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); - const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); - const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); - const basegfx::B2DVector aLine(aEnd - aStart); - - // #i102548# create new unit polygon for line (horizontal) - basegfx::B2DPolygon aNewPolygon; - aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); - aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); - aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); - - // #i102548# fill objectMatrix with rotation and offset (no shear for lines) - aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aLine.getLength(), 1.0, - 0.0, - atan2(aLine.getY(), aLine.getX()), - aStart.getX(), aStart.getY()); - } - else - { - // #i102548# create unscaled, unsheared, unrotated and untranslated polygon - // (unit polygon) by creating the object matrix and back-transforming the polygon - const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); - const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); - const double fWidth(aObjectRange.getWidth()); - const double fHeight(aObjectRange.getHeight()); - const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth); - const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); - - aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - fScaleX, fScaleY, - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY()); - - // ceate unit polygon from object's absolute path - basegfx::B2DHomMatrix aInverse(aObjectMatrix); - aInverse.invert(); - aUnitPolyPolygon.transform(aInverse); - } - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrPathPrimitive2D( - aObjectMatrix, - *pAttribute, - aUnitPolyPolygon)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - delete pAttribute; - } + // special handling for single line mode (2 points) + const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); + const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); + const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); + const basegfx::B2DVector aLine(aEnd - aStart); + + // #i102548# create new unit polygon for line (horizontal) + basegfx::B2DPolygon aNewPolygon; + aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); + aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); + aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); + + // #i102548# fill objectMatrix with rotation and offset (no shear for lines) + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aLine.getLength(), 1.0, + 0.0, + atan2(aLine.getY(), aLine.getX()), + aStart.getX(), aStart.getY()); } + else + { + // #i102548# create unscaled, unsheared, unrotated and untranslated polygon + // (unit polygon) by creating the object matrix and back-transforming the polygon + const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); + const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); + const double fWidth(aObjectRange.getWidth()); + const double fHeight(aObjectRange.getHeight()); + const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth); + const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); + + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + fScaleX, fScaleY, + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY()); + + // ceate unit polygon from object's absolute path + basegfx::B2DHomMatrix aInverse(aObjectMatrix); + aInverse.invert(); + aUnitPolyPolygon.transform(aInverse); + } + + // create primitive. Always create primitives to allow the decomposition of + // SdrPathPrimitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrPathPrimitive2D( + aObjectMatrix, + aAttribute, + aUnitPolyPolygon)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 94b26b5d020e..6a7f6842a76d 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -59,70 +58,48 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet(); - SdrText* pSdrText = GetRectObj().getText(0); - - if(pSdrText) - { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetRectObj().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); - - // fill object matrix - basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // calculate corner radius - sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue()); - double fCornerRadiusX; - double fCornerRadiusY; - drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); - - // #i105856# use knowledge about pickthrough from the model - const bool bPickThroughTransparentTextFrames( - GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrRectanglePrimitive2D( - aObjectMatrix, - *pAttribute, - fCornerRadiusX, - fCornerRadiusY, - // #i105856# use fill for HitTest when TextFrame and not PickThrough - GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pAttribute; - } - - if(!xRetval.hasElements()) - { - // #i99123# - // Object is invisible. Create a fallback primitive for HitTest - basegfx::B2DHomMatrix aObjectMatrix; - basegfx::B2DPolyPolygon aObjectPolyPolygon; - GetRectObj().TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon); - const drawinglayer::primitive2d::Primitive2DReference xReference( - drawinglayer::primitive2d::createFallbackHitTestPrimitive(aObjectMatrix)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - return xRetval; + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetRectObj().getText(0))); + + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetRectObj().GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); + + // fill object matrix + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // calculate corner radius + sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue()); + double fCornerRadiusX; + double fCornerRadiusY; + drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); + + // #i105856# use knowledge about pickthrough from the model + const bool bPickThroughTransparentTextFrames( + GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); + + // create primitive. Always create primitives to allow the decomposition of + // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrRectanglePrimitive2D( + aObjectMatrix, + aAttribute, + fCornerRadiusX, + fCornerRadiusY, + // #i105856# use fill for HitTest when TextFrame and not PickThrough + GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx index 7bea25feeeed..f830369fc2ec 100644 --- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx @@ -50,6 +50,7 @@ #include #include #include +#include //........................................................................ namespace sdr { namespace contact { @@ -138,35 +139,43 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfUnoControl::createViewIndependentPrimitive2DSequence() const { + // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use + // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) + // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything + const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); + const basegfx::B2DRange aRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // create object transform + basegfx::B2DHomMatrix aTransform; + + aTransform.set(0, 0, aRange.getWidth()); + aTransform.set(1, 1, aRange.getHeight()); + aTransform.set(0, 2, aRange.getMinX()); + aTransform.set(1, 2, aRange.getMinY()); + Reference< XControlModel > xControlModel = GetSdrUnoObj().GetUnoControlModel(); if(xControlModel.is()) { - // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use - // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) - // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything - const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); - const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // create object transform - basegfx::B2DHomMatrix aTransform; - aTransform.set(0, 0, aRange.getWidth()); - aTransform.set(1, 1, aRange.getHeight()); - aTransform.set(0, 2, aRange.getMinX()); - aTransform.set(1, 2, aRange.getMinY()); - // create control primitive WITHOUT possibly existing XControl; this would be done in // the VOC in createPrimitive2DSequence() - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D( - aTransform, xControlModel)); + const drawinglayer::primitive2d::Primitive2DReference xRetval( + new drawinglayer::primitive2d::ControlPrimitive2D( + aTransform, + xControlModel)); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } else { - // #i93161# This UnoControl does not yet have a xControlModel (can happen - // during diverse creations). Without a model, create no visualisation. - return drawinglayer::primitive2d::Primitive2DSequence(); + // always append an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xRetval( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aTransform)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofvirtobj.cxx b/svx/source/sdr/contact/viewcontactofvirtobj.cxx index 0f046bdda97f..5578bf399f84 100644 --- a/svx/source/sdr/contact/viewcontactofvirtobj.cxx +++ b/svx/source/sdr/contact/viewcontactofvirtobj.cxx @@ -36,6 +36,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -77,29 +78,39 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfVirtObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; + // create displacement transformation if we have content + basegfx::B2DHomMatrix aObjectMatrix; + Point aAnchor(GetVirtObj().GetAnchorPos()); + + if(aAnchor.X() || aAnchor.Y()) + { + aObjectMatrix.set(0, 2, aAnchor.X()); + aObjectMatrix.set(1, 2, aAnchor.Y()); + } // use method from referenced object to get the Primitive2DSequence - const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual(GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence()); + const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual( + GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence()); if(xSequenceVirtual.hasElements()) { - // create displacement transformation if we have content - ::basegfx::B2DHomMatrix aObjectMatrix; - Point aAnchor(GetVirtObj().GetAnchorPos()); - - if(aAnchor.X() || aAnchor.Y()) - { - aObjectMatrix.set(0, 2, aAnchor.X()); - aObjectMatrix.set(1, 2, aAnchor.Y()); - } - // create transform primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::TransformPrimitive2D(aObjectMatrix, xSequenceVirtual)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::TransformPrimitive2D( + aObjectMatrix, + xSequenceVirtual)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + else + { + // always append an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectMatrix)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx index 435eb31c47f0..d031ef552486 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx @@ -39,7 +39,6 @@ #include #include #include -#include ////////////////////////////////////////////////////////////////////////////// // predeclarations diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx index b093ddbe8b75..68ac3365796e 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx @@ -125,17 +125,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } - else - { - // do neither print nor PDF export the fallback visualisation - if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) - { - // empty group, fallback to parent method which will create the default - // grayed frame for empty 3d scenes by using model data and - // createViewIndependentPrimitive2DSequence::ViewContactOfE3dScene - xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo); - } - } if(bIsActiveVC) { diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx index 0f67ba46acb9..b7406bd1cc58 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx @@ -59,20 +59,6 @@ namespace sdr { } - bool ViewObjectContactOfGroup::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const - { - const bool bHasChildren(0 != GetViewContact().GetObjectCount()); - - if(!bHasChildren && (GetObjectContact().isOutputToPrinter() || GetObjectContact().isOutputToRecordingMetaFile())) - { - // empty group uses fallback gray empty frame display. Do neither print nor PDF export it - return false; - } - - // call parent - return ViewObjectContactOfSdrObj::isPrimitiveVisible(rDisplayInfo); - } - drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const { const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index bd208b5cf54f..645632c956f8 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -44,7 +44,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -296,28 +296,19 @@ namespace sdr else if(bCreateGrayFrame) { // #i105146# no content, but frame display. To make hitting the page preview objects - // on the handout page more simple, add a HitTest fill primitive - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); - aOutline.transform(aPageObjectTransform); - - const drawinglayer::primitive2d::Primitive2DReference xHitFill( - new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon(aOutline), - basegfx::BColor(0.0, 0.0, 0.0))); - - const drawinglayer::primitive2d::Primitive2DReference xHit( - new drawinglayer::primitive2d::HitTestPrimitive2D( - drawinglayer::primitive2d::Primitive2DSequence(&xHitFill, 1))); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xHit, 1); + // on the handout page more simple, add hidden fill geometry + const drawinglayer::primitive2d::Primitive2DReference xFrameHit( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, + aPageObjectTransform)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xFrameHit, 1); } // add a gray outline frame, except not when printing if(bCreateGrayFrame) { const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor); - basegfx::B2DPolygon aOwnOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOwnOutline(basegfx::tools::createUnitPolygon()); aOwnOutline.transform(aPageObjectTransform); const drawinglayer::primitive2d::Primitive2DReference xGrayFrame( diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index 635ae9c7fcc8..954102c0a8cb 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -39,11 +39,11 @@ #include #include #include -#include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -207,7 +207,7 @@ namespace sdr if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) { // shade the representation if the object is activated outplace - basegfx::B2DPolygon aObjectOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aObjectOutline(basegfx::tools::createUnitPolygon()); aObjectOutline.transform(aObjectTransform); // Use a FillHatchPrimitive2D with necessary attributes diff --git a/svx/source/sdr/overlay/overlayobjectcell.cxx b/svx/source/sdr/overlay/overlayobjectcell.cxx index 5df0fc85f8f9..35fe4351981b 100644 --- a/svx/source/sdr/overlay/overlayobjectcell.cxx +++ b/svx/source/sdr/overlay/overlayobjectcell.cxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include using namespace ::basegfx; @@ -87,12 +87,12 @@ namespace sdr if(mePaintType == CELL_OVERLAY_TRANSPARENT) { // embed in 50% transparent paint - const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aRetval, 0.5)); - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1); } else // CELL_OVERLAY_INVERT { diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx index b788de195903..6b449699a51d 100644 --- a/svx/source/sdr/overlay/overlayselection.cxx +++ b/svx/source/sdr/overlay/overlayselection.cxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include @@ -144,8 +144,8 @@ namespace sdr { // embed all rectangles in transparent paint const double fTransparence(mnLastTransparence / 100.0); - const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aRetval, fTransparence)); @@ -159,13 +159,13 @@ namespace sdr // add both to result aRetval.realloc(2); - aRetval[0] = aUnifiedAlpha; + aRetval[0] = aUnifiedTransparence; aRetval[1] = aSelectionOutline; } else { // just add transparent part - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1); } } } diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index d657e6b9a8d7..a1ef5d8f0957 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -58,14 +58,11 @@ #include #include #include -#include #include #include -#include #include #include #include -#include #include #include #include @@ -73,13 +70,22 @@ #include #include #include -#include #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -221,9 +227,8 @@ namespace drawinglayer { namespace primitive2d { - attribute::SdrLineAttribute* createNewSdrLineAttribute(const SfxItemSet& rSet) + attribute::SdrLineAttribute createNewSdrLineAttribute(const SfxItemSet& rSet) { - attribute::SdrLineAttribute* pRetval(0L); const XLineStyle eStyle(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue()); if(XLINE_NONE != eStyle) @@ -253,7 +258,7 @@ namespace drawinglayer } } - pRetval = new attribute::SdrLineAttribute( + return attribute::SdrLineAttribute( XLineJointtoB2DLineJoin(eJoint), (double)nWidth, (double)nTransparence * 0.01, @@ -263,12 +268,13 @@ namespace drawinglayer } } - return pRetval; + return attribute::SdrLineAttribute(); } - attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth) + attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute( + const SfxItemSet& rSet, + double fWidth) { - attribute::SdrLineStartEndAttribute* pRetval(0L); const sal_Int32 nTempStartWidth(((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue()); const sal_Int32 nTempEndWidth(((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue()); basegfx::B2DPolyPolygon aStartPolyPolygon; @@ -328,15 +334,16 @@ namespace drawinglayer if(bStartActive || bEndActive) { - pRetval = new attribute::SdrLineStartEndAttribute(aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered); + return attribute::SdrLineStartEndAttribute( + aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth, + bStartActive, bEndActive, bStartCentered, bEndCentered); } - return pRetval; + return attribute::SdrLineStartEndAttribute(); } - attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet) + attribute::SdrShadowAttribute createNewSdrShadowAttribute(const SfxItemSet& rSet) { - attribute::SdrShadowAttribute* pRetval(0L); const bool bShadow(((SdrShadowItem&)rSet.Get(SDRATTR_SHADOW)).GetValue()); if(bShadow) @@ -374,16 +381,15 @@ namespace drawinglayer (double)((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); const Color aColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue()); - pRetval = new attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor()); + return attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor()); } } - return pRetval; + return attribute::SdrShadowAttribute(); } - attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet) + attribute::SdrFillAttribute createNewSdrFillAttribute(const SfxItemSet& rSet) { - attribute::SdrFillAttribute* pRetval(0L); const XFillStyle eStyle(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue()); if(XFILL_NONE != eStyle) @@ -398,9 +404,9 @@ namespace drawinglayer if(100 != nTransparence) { const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue()); - attribute::FillGradientAttribute* pGradient(0L); - attribute::FillHatchAttribute* pHatch(0L); - attribute::SdrFillBitmapAttribute* pBitmap(0L); + attribute::FillGradientAttribute aGradient; + attribute::FillHatchAttribute aHatch; + attribute::SdrFillBitmapAttribute aBitmap; switch(eStyle) { @@ -412,10 +418,10 @@ namespace drawinglayer } case XFILL_GRADIENT : { - XGradient aGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue()); + XGradient aXGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue()); - const Color aStartColor(aGradient.GetStartColor()); - const sal_uInt16 nStartIntens(aGradient.GetStartIntens()); + const Color aStartColor(aXGradient.GetStartColor()); + const sal_uInt16 nStartIntens(aXGradient.GetStartIntens()); basegfx::BColor aStart(aStartColor.getBColor()); if(nStartIntens != 100) @@ -424,8 +430,8 @@ namespace drawinglayer aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01); } - const Color aEndColor(aGradient.GetEndColor()); - const sal_uInt16 nEndIntens(aGradient.GetEndIntens()); + const Color aEndColor(aXGradient.GetEndColor()); + const sal_uInt16 nEndIntens(aXGradient.GetEndIntens()); basegfx::BColor aEnd(aEndColor.getBColor()); if(nEndIntens != 100) @@ -434,12 +440,12 @@ namespace drawinglayer aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01); } - pGradient = new attribute::FillGradientAttribute( - XGradientStyleToGradientStyle(aGradient.GetGradientStyle()), - (double)aGradient.GetBorder() * 0.01, - (double)aGradient.GetXOffset() * 0.01, - (double)aGradient.GetYOffset() * 0.01, - (double)aGradient.GetAngle() * F_PI1800, + aGradient = attribute::FillGradientAttribute( + XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()), + (double)aXGradient.GetBorder() * 0.01, + (double)aXGradient.GetXOffset() * 0.01, + (double)aXGradient.GetYOffset() * 0.01, + (double)aXGradient.GetAngle() * F_PI1800, aStart, aEnd, ((const XGradientStepCountItem&)rSet.Get(XATTR_GRADIENTSTEPCOUNT)).GetValue()); @@ -451,7 +457,7 @@ namespace drawinglayer const XHatch& rHatch(((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetHatchValue()); const Color aColorB(rHatch.GetColor()); - pHatch = new attribute::FillHatchAttribute( + aHatch = attribute::FillHatchAttribute( XHatchStyleToHatchStyle(rHatch.GetHatchStyle()), (double)rHatch.GetDistance(), (double)rHatch.GetAngle() * F_PI1800, @@ -462,23 +468,25 @@ namespace drawinglayer } case XFILL_BITMAP : { - pBitmap = createNewSdrFillBitmapAttribute(rSet); + aBitmap = createNewSdrFillBitmapAttribute(rSet); break; } } - pRetval = new attribute::SdrFillAttribute( + return attribute::SdrFillAttribute( (double)nTransparence * 0.01, aColor.getBColor(), - pGradient, pHatch, pBitmap); + aGradient, + aHatch, + aBitmap); } } - return pRetval; + return attribute::SdrFillAttribute(); } // #i101508# Support handing over given text-to-border distances - attribute::SdrTextAttribute* createNewSdrTextAttribute( + attribute::SdrTextAttribute createNewSdrTextAttribute( const SfxItemSet& rSet, const SdrText& rText, const sal_Int32* pLeft, @@ -486,7 +494,6 @@ namespace drawinglayer const sal_Int32* pRight, const sal_Int32* pLower) { - attribute::SdrTextAttribute* pRetval(0); const SdrTextObj& rTextObj = rText.GetObject(); if(rText.GetOutlinerParaObject() && rText.GetModel()) @@ -530,7 +537,7 @@ namespace drawinglayer const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj); const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING); - pRetval = new attribute::SdrTextAttribute( + return attribute::SdrTextAttribute( rText, aOutlinerParaObject, ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), @@ -550,15 +557,15 @@ namespace drawinglayer bWrongSpell); } - return pRetval; + return attribute::SdrTextAttribute(); } - attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet) + attribute::FillGradientAttribute createNewTransparenceGradientAttribute(const SfxItemSet& rSet) { - attribute::FillGradientAttribute* pRetval = 0L; const SfxPoolItem* pGradientItem; - if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem) && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()) + if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem) + && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()) { // test if float transparence is completely transparent const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue(); @@ -571,7 +578,7 @@ namespace drawinglayer const double fStartLum(nStartLuminance / 255.0); const double fEndLum(nEndLuminance / 255.0); - pRetval = new attribute::FillGradientAttribute( + return attribute::FillGradientAttribute( XGradientStyleToGradientStyle(rGradient.GetGradientStyle()), (double)rGradient.GetBorder() * 0.01, (double)rGradient.GetXOffset() * 0.01, @@ -583,12 +590,11 @@ namespace drawinglayer } } - return pRetval; + return attribute::FillGradientAttribute(); } - attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet) + attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute(const SfxItemSet& rSet) { - attribute::SdrFillBitmapAttribute* pRetval(0L); Bitmap aBitmap((((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetBitmapValue()).GetBitmap()); // make sure it's not empty, use default instead @@ -635,7 +641,7 @@ namespace drawinglayer (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(), (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue()); - pRetval = new attribute::SdrFillBitmapAttribute( + return attribute::SdrFillBitmapAttribute( aBitmap, aSize, aOffset, @@ -644,252 +650,174 @@ namespace drawinglayer ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(), ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(), ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue()); - - return pRetval; } - attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText, bool bSuppressText) + attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText, + bool bSuppressText) { - attribute::SdrShadowTextAttribute* pRetval(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrTextAttribute aText; // #i98072# added option to suppress text // look for text first - if(!bSuppressText) + if(!bSuppressText && pText) { - pText = createNewSdrTextAttribute(rSet, rText); + aText = createNewSdrTextAttribute(rSet, *pText); } // try shadow - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet)); - if(pText || pShadow) - { - pRetval = new attribute::SdrShadowTextAttribute(pShadow, pText); - } - - return pRetval; + return attribute::SdrShadowTextAttribute(aShadow, aText); } - attribute::SdrLineShadowTextAttribute* createNewSdrLineShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText) + attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText) { - attribute::SdrLineShadowTextAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrLineAttribute aLine; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - pText = createNewSdrTextAttribute(rSet, rText); - - // when object has text and text is fontwork and hide contour is set for fontwork, force - // line and fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) + if(pText) { - bFontworkHideContour = true; + aText = createNewSdrTextAttribute(rSet, *pText); + + // when object has text and text is fontwork and hide contour is set for fontwork, force + // line and fill style to empty + if(!aText.isDefault() + && !aText.getSdrFormTextAttribute().isDefault() + && aText.isHideContour()) + { + bFontworkHideContour = true; + } } // try line style if(!bFontworkHideContour) { - pLine = createNewSdrLineAttribute(rSet); + aLine = createNewSdrLineAttribute(rSet); - if(pLine && !pLine->isVisible()) - { - delete pLine; - pLine = 0L; - } - - if(pLine) + if(!aLine.isDefault()) { // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } } - // try shadow - if(pLine || pText) + if(!aLine.isDefault() || !aText.isDefault()) { - pShadow = createNewSdrShadowAttribute(rSet); + // try shadow + const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet)); - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + return attribute::SdrLineShadowTextAttribute(aLine, aLineStartEnd, aShadow, aText); } - if(pLine || pText) - { - pRetval = new attribute::SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pText); - } - - return pRetval; + return attribute::SdrLineShadowTextAttribute(); } - attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText) + attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText) { - attribute::SdrLineFillShadowTextAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrLineAttribute aLine; + attribute::SdrFillAttribute aFill; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrShadowAttribute aShadow; + attribute::FillGradientAttribute aFillFloatTransGradient; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - pText = createNewSdrTextAttribute(rSet, rText); - - // when object has text and text is fontwork and hide contour is set for fontwork, force - // line and fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) + if(pText) { - bFontworkHideContour = true; - } - - // try line style - if(!bFontworkHideContour) - { - pLine = createNewSdrLineAttribute(rSet); + aText = createNewSdrTextAttribute(rSet, *pText); - if(pLine && !pLine->isVisible()) + // when object has text and text is fontwork and hide contour is set for fontwork, force + // line and fill style to empty + if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()) { - delete pLine; - pLine = 0L; - } - - if(pLine) - { - // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + bFontworkHideContour = true; } } - // try fill style if(!bFontworkHideContour) { - pFill = createNewSdrFillAttribute(rSet); + // try line style + aLine = createNewSdrLineAttribute(rSet); - if(pFill && !pFill->isVisible()) + if(!aLine.isDefault()) { - delete pFill; - pFill = 0L; + // try LineStartEnd + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } - if(pFill) + // try fill style + aFill = createNewSdrFillAttribute(rSet); + + if(!aFill.isDefault()) { // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - // try shadow - if(pLine || pFill || pText) + if(!aLine.isDefault() || !aFill.isDefault() || !aText.isDefault()) { - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } - } + // try shadow + aShadow = createNewSdrShadowAttribute(rSet); - if(pLine || pFill || pText) - { - pRetval = new attribute::SdrLineFillShadowTextAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient, pText); + return attribute::SdrLineFillShadowTextAttribute( + aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient, aText); } - return pRetval; + return attribute::SdrLineFillShadowTextAttribute(); } - attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill) + attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill) { - attribute::SdrLineFillShadowAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); + attribute::SdrFillAttribute aFill; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrShadowAttribute aShadow; + attribute::FillGradientAttribute aFillFloatTransGradient; // try line style - pLine = createNewSdrLineAttribute(rSet); + const attribute::SdrLineAttribute aLine(createNewSdrLineAttribute(rSet)); - if(pLine && !pLine->isVisible()) - { - delete pLine; - pLine = 0L; - } - - if(pLine) + if(!aLine.isDefault()) { // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } // try fill style - pFill = bSuppressFill ? 0 : createNewSdrFillAttribute(rSet); - - if(pFill && !pFill->isVisible()) + if(!bSuppressFill) { - delete pFill; - pFill = 0L; - } - - if(pFill) - { - // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); - } + aFill = createNewSdrFillAttribute(rSet); - // try shadow - if(pLine || pFill) - { - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) + if(!aFill.isDefault()) { - delete pShadow; - pShadow = 0L; + // try fillfloattransparence + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - if(pLine || pFill) + if(!aLine.isDefault() || !aFill.isDefault()) { - pRetval = new attribute::SdrLineFillShadowAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient); + // try shadow + aShadow = createNewSdrShadowAttribute(rSet); + + return attribute::SdrLineFillShadowAttribute3D( + aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient); } - return pRetval; + return attribute::SdrLineFillShadowAttribute3D(); } - attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet) + attribute::SdrSceneAttribute createNewSdrSceneAttribute(const SfxItemSet& rSet) { // get perspective ::com::sun::star::drawing::ProjectionMode aProjectionMode(::com::sun::star::drawing::ProjectionMode_PARALLEL); @@ -926,10 +854,10 @@ namespace drawinglayer // get two sided lighting const bool bTwoSidedLighting(((const Svx3DTwoSidedLightingItem&)rSet.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue()); - return new attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting); + return attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting); } - attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet) + attribute::SdrLightingAttribute createNewSdrLightingAttribute(const SfxItemSet& rSet) { // extract lights from given SfxItemSet (from scene) ::std::vector< attribute::Sdr3DLightAttribute > aLightVector; @@ -994,7 +922,7 @@ namespace drawinglayer const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue()); const basegfx::BColor aAmbientLight(aAmbientValue.getBColor()); - return new attribute::SdrLightingAttribute(aAmbientLight, aLightVector); + return attribute::SdrLightingAttribute(aAmbientLight, aLightVector); } void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY) @@ -1051,57 +979,50 @@ namespace drawinglayer } // #i101508# Support handing over given text-to-border distances - attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute( + attribute::SdrFillTextAttribute createNewSdrFillTextAttribute( const SfxItemSet& rSet, - const SdrText* pSdrText, + const SdrText* pText, const sal_Int32* pLeft, const sal_Int32* pUpper, const sal_Int32* pRight, const sal_Int32* pLower) { - attribute::SdrFillTextAttribute* pRetval(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrFillAttribute aFill; + attribute::FillGradientAttribute aFillFloatTransGradient; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - if(pSdrText) + if(pText) { - pText = createNewSdrTextAttribute(rSet, *pSdrText, pLeft, pUpper, pRight, pLower); - } + aText = createNewSdrTextAttribute(rSet, *pText, pLeft, pUpper, pRight, pLower); - // when object has text and text is fontwork and hide contour is set for fontwork, force - // fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) - { - bFontworkHideContour = true; + // when object has text and text is fontwork and hide contour is set for fontwork, force + // fill style to empty + if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()) + { + bFontworkHideContour = true; + } } - // try fill style if(!bFontworkHideContour) { - pFill = createNewSdrFillAttribute(rSet); - - if(pFill && !pFill->isVisible()) - { - delete pFill; - pFill = 0L; - } + // try fill style + aFill = createNewSdrFillAttribute(rSet); - if(pFill) + if(!aFill.isDefault()) { // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - if(pFill || pText) + if(!aFill.isDefault() || !aText.isDefault()) { - pRetval = new attribute::SdrFillTextAttribute(pFill, pFillFloatTransGradient, pText); + return attribute::SdrFillTextAttribute(aFill, aFillFloatTransGradient, aText); } - return pRetval; + return attribute::SdrFillTextAttribute(); } } // end of namespace primitive2d diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx index e4967f767299..58017f9d01fc 100644 --- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,6 @@ namespace drawinglayer Primitive2DSequence SdrCaptionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; - Primitive2DSequence aHitTestContent; // create unit outline polygon const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( @@ -59,68 +58,66 @@ namespace drawinglayer getCornerRadiusY())); // add fill - if(getSdrLFSTAttribute().getFill()) + if(getSdrLFSTAttribute().getFill().isDefault()) { + // create invisible fill for HitTest appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive( + createHiddenGeometryPrimitives2D( + true, basegfx::B2DPolyPolygon(aUnitOutline), - getTransform(), - *getSdrLFSTAttribute().getFill(), - getSdrLFSTAttribute().getFillFloatTransGradient())); + getTransform())); } else { - // if no fill, create one for HitTest and BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)), + getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { + // create invisible line for HitTest/BoundRect appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolygonLinePrimitive( - aUnitOutline, - getTransform(), - *getSdrLFSTAttribute().getLine())); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolygonLinePrimitive( - getTail(), - getTransform(), - *getSdrLFSTAttribute().getLine(), - getSdrLFSTAttribute().getLineStartEnd())); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(getTail()), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect. It - // is sufficient to use the tail; the body is already ensured with fill creation - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive( - getTail(), + aUnitOutline, getTransform(), - attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)))); - } + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); - // add HitTest and BoundRect helper geometry (if exists) - if(aHitTestContent.hasElements()) - { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - Primitive2DReference(new HitTestPrimitive2D(aHitTestContent))); + createPolygonLinePrimitive( + getTail(), + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - *getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, @@ -128,9 +125,9 @@ namespace drawinglayer } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx index 0c39f7a6480f..a729f8fcfc7a 100644 --- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx @@ -35,7 +35,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -51,34 +52,45 @@ namespace drawinglayer { Primitive2DSequence aRetval; - // prepare unit transform - ::basegfx::B2DHomMatrix aEmptyMatrix; - // add line - if(getSdrLSTAttribute().getLine()) + if(getSdrLSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(getUnitPolygon()))); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + getUnitPolygon(), + basegfx::B2DHomMatrix(), + getSdrLSTAttribute().getLine(), + getSdrLSTAttribute().getLineStartEnd())); } // add text - if(getSdrLSTAttribute().getText()) + if(!getSdrLSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(getUnitPolygon()), + basegfx::B2DHomMatrix(), + getSdrLSTAttribute().getText(), + getSdrLSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLSTAttribute().getShadow()) + if(!getSdrLSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index 5b686bb5abae..3cf7b6415725 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -36,6 +36,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -52,21 +53,23 @@ namespace drawinglayer Primitive2DSequence aRetval(getSubPrimitives()); // add text - if(getSdrSTAttribute().getText()) + if(!getSdrSTAttribute().getText().isDefault()) { - const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( - basegfx::B2DPolyPolygon(aUnitOutline), - getTextBox(), - *getSdrSTAttribute().getText(), - 0, - false, - getWordWrap(), - isForceTextClipToTextRange())); + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTextBox(), + getSdrSTAttribute().getText(), + attribute::SdrLineAttribute(), + false, + getWordWrap(), + isForceTextClipToTextRange())); } // add shadow - if(aRetval.hasElements() && getSdrSTAttribute().getShadow()) + if(aRetval.hasElements() && !getSdrSTAttribute().getShadow().isDefault()) { // #i105323# add generic shadow only for 2D shapes. For // 3D shapes shadow will be set at the individual created @@ -80,7 +83,7 @@ namespace drawinglayer // shadow will be correct (using ColorModifierStack), but expensive. if(!get3DShape()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow()); } } diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 8474b72be2e4..db55e4588fea 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -31,12 +31,10 @@ #include "precompiled_svx.hxx" #include -#include #include -#include #include -#include -#include +#include +#include #include #include #include @@ -55,6 +53,10 @@ #include #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -70,25 +72,25 @@ namespace drawinglayer const basegfx::B2DPolyPolygon& rUnitPolyPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient) + const attribute::FillGradientAttribute& rFillGradient) { // prepare fully scaled polygon basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); BasePrimitive2D* pNewFillPrimitive = 0; - if(rFill.isGradient()) + if(!rFill.getGradient().isDefault()) { - pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, *rFill.getGradient()); + pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, rFill.getGradient()); } - else if(rFill.isHatch()) + else if(!rFill.getHatch().isDefault()) { - pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), *rFill.getHatch()); + pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), rFill.getHatch()); } - else if(rFill.isBitmap()) + else if(!rFill.getBitmap().isDefault()) { const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); - pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap()->getFillBitmapAttribute(aRange)); + pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap().getFillBitmapAttribute(aRange)); } else { @@ -100,9 +102,9 @@ namespace drawinglayer // create simpleTransparencePrimitive, add created fill primitive const Primitive2DReference xRefA(pNewFillPrimitive); const Primitive2DSequence aContent(&xRefA, 1L); - return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rFill.getTransparence())); + return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rFill.getTransparence())); } - else if(pFillGradient) + else if(!rFillGradient.isDefault()) { // create sequence with created fill primitive const Primitive2DReference xRefA(pNewFillPrimitive); @@ -111,11 +113,11 @@ namespace drawinglayer // create FillGradientPrimitive2D for transparence and add to new sequence // fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); - const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, *pFillGradient)); + const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, rFillGradient)); const Primitive2DSequence aAlpha(&xRefB, 1L); - // create AlphaPrimitive2D using alpha and content - return Primitive2DReference(new AlphaPrimitive2D(aContent, aAlpha)); + // create TransparencePrimitive2D using alpha and content + return Primitive2DReference(new TransparencePrimitive2D(aContent, aAlpha)); } else { @@ -128,7 +130,7 @@ namespace drawinglayer const basegfx::B2DPolygon& rUnitPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrLineAttribute& rLine, - const attribute::SdrLineStartEndAttribute* pStroke) + const attribute::SdrLineStartEndAttribute& rStroke) { // prepare fully scaled polygon basegfx::B2DPolygon aScaledPolygon(rUnitPolygon); @@ -139,10 +141,10 @@ namespace drawinglayer const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen()); BasePrimitive2D* pNewLinePrimitive = 0L; - if(!rUnitPolygon.isClosed() && pStroke) + if(!rUnitPolygon.isClosed() && !rStroke.isDefault()) { - attribute::LineStartEndAttribute aStart(pStroke->getStartWidth(), pStroke->getStartPolyPolygon(), pStroke->isStartCentered()); - attribute::LineStartEndAttribute aEnd(pStroke->getEndWidth(), pStroke->getEndPolyPolygon(), pStroke->isEndCentered()); + attribute::LineStartEndAttribute aStart(rStroke.getStartWidth(), rStroke.getStartPolyPolygon(), rStroke.isStartCentered()); + attribute::LineStartEndAttribute aEnd(rStroke.getEndWidth(), rStroke.getEndPolyPolygon(), rStroke.isEndCentered()); // create data pNewLinePrimitive = new PolygonStrokeArrowPrimitive2D(aScaledPolygon, aLineAttribute, aStrokeAttribute, aStart, aEnd); @@ -158,7 +160,7 @@ namespace drawinglayer // create simpleTransparencePrimitive, add created fill primitive const Primitive2DReference xRefA(pNewLinePrimitive); const Primitive2DSequence aContent(&xRefA, 1L); - return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rLine.getTransparence())); + return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rLine.getTransparence())); } else { @@ -171,7 +173,7 @@ namespace drawinglayer const basegfx::B2DPolyPolygon& rUnitPolyPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrTextAttribute& rText, - const attribute::SdrLineAttribute* pStroke, + const attribute::SdrLineAttribute& rStroke, bool bCellText, bool bWordWrap, bool bClipOnBounds) @@ -182,7 +184,7 @@ namespace drawinglayer if(rText.isContour()) { // contour text - if(pStroke && 0.0 != pStroke->getWidth()) + if(!rStroke.isDefault() && 0.0 != rStroke.getWidth()) { // take line width into account and shrink contour polygon accordingly // decompose to get scale @@ -197,7 +199,7 @@ namespace drawinglayer fabs(aScale.getX()), fabs(aScale.getY()))); // grow the polygon. To shrink, use negative value (half width) - aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(pStroke->getWidth() * 0.5)); + aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(rStroke.getWidth() * 0.5)); // scale back to unit polygon aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix( @@ -221,7 +223,7 @@ namespace drawinglayer rObjectTransform); } } - else if(rText.getSdrFormTextAttribute()) + else if(!rText.getSdrFormTextAttribute().isDefault()) { // text on path, use scaled polygon basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); @@ -230,7 +232,7 @@ namespace drawinglayer &rText.getSdrText(), rText.getOutlinerParaObject(), aScaledPolyPolygon, - *rText.getSdrFormTextAttribute()); + rText.getSdrFormTextAttribute()); } else { @@ -327,7 +329,7 @@ namespace drawinglayer if(rText.isScroll()) { // suppress scroll when FontWork - if(!rText.getSdrFormTextAttribute()) + if(rText.getSdrFormTextAttribute().isDefault()) { // get scroll direction const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection()); @@ -468,7 +470,7 @@ namespace drawinglayer const Primitive2DSequence aTempContent(&aRetval[0], 1); aRetval[0] = Primitive2DReference( - new UnifiedAlphaPrimitive2D( + new UnifiedTransparencePrimitive2D( aTempContent, rShadow.getTransparence())); } diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index 1327d2a422fa..302eabecbdf9 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -36,10 +36,9 @@ #include #include #include -#include #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -59,52 +58,73 @@ namespace drawinglayer // Do use createPolygonFromUnitCircle, but let create from first quadrant to mimic old geometry creation. // This is needed to have the same look when stroke is used since the polygon start point defines the // stroke start, too. - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitCircle(1)); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitCircle(1)); // scale and move UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - const basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); + const basegfx::B2DHomMatrix aUnitCorrectionMatrix( + basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); // apply to the geometry aUnitOutline.transform(aUnitCorrectionMatrix); // add fill - if(getSdrLFSTAttribute().getFill()) + if(!getSdrLFSTAttribute().getFill().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrEllipsePrimitive2D::SdrEllipsePrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) : BufferedDecompositionPrimitive2D(), maTransform(rTransform), @@ -142,7 +162,7 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle)); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle)); if(mbCloseSegment) { @@ -150,57 +170,77 @@ namespace drawinglayer { // for compatibility, insert the center point at polygon start to get the same // line stroking pattern as the old painting mechanisms. - aUnitOutline.insert(0L, ::basegfx::B2DPoint(0.0, 0.0)); + aUnitOutline.insert(0L, basegfx::B2DPoint(0.0, 0.0)); } aUnitOutline.setClosed(true); } // move and scale UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createTranslateB2DHomMatrix(1.0, 1.0)); - aUnitCorrectionMatrix.scale(0.5, 0.5); + const basegfx::B2DHomMatrix aUnitCorrectionMatrix( + basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); // apply to the geometry aUnitOutline.transform(aUnitCorrectionMatrix); // add fill - if(getSdrLFSTAttribute().getFill() && aUnitOutline.isClosed()) + if(!getSdrLFSTAttribute().getFill().isDefault() && aUnitOutline.isClosed()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrEllipseSegmentPrimitive2D::SdrEllipseSegmentPrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, double fStartAngle, double fEndAngle, diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index befff1b0c539..d83fa53f812e 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -36,7 +36,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -49,21 +50,25 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); // add fill, but only when graphic ist transparent - if(getSdrLFSTAttribute().getFill() && isTransparent()) + if(!getSdrLFSTAttribute().getFill().isDefault() && isTransparent()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(!getSdrLFSTAttribute().getLine().isDefault()) { // if line width is given, polygon needs to be grown by half of it to make the // outline to be outside of the bitmap - if(0.0 != getSdrLFSTAttribute().getLine()->getWidth()) + if(0.0 != getSdrLFSTAttribute().getLine().getWidth()) { // decompose to get scale basegfx::B2DVector aScale, aTranslate; @@ -71,46 +76,61 @@ namespace drawinglayer getTransform().decompose(aScale, aTranslate, fRotate, fShearX); // create expanded range (add relative half line width to unit rectangle) - double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5); + double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5); double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0); double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0); const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY); basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aExpandedUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } } - else - { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); - } // add graphic content if(255L != getGraphicAttr().GetTransparency()) { - Primitive2DReference xGraphicContentPrimitive(new GraphicPrimitive2D(getTransform(), getGraphicObject(), getGraphicAttr())); + const Primitive2DReference xGraphicContentPrimitive( + new GraphicPrimitive2D( + getTransform(), + getGraphicObject(), + getGraphicAttr())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xGraphicContentPrimitive); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index e22e9eb61c5b..ebac828bb9d5 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -39,8 +39,8 @@ #include #include #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -60,36 +60,44 @@ namespace drawinglayer bool bLeftActive, bool bRightActive) const { - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); + const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); basegfx::B2DPolygon aPolygon; aPolygon.append(rStart); aPolygon.append(rEnd); - if(!pLineStartEnd || (!bLeftActive && !bRightActive)) + if(rLineStartEnd.isDefault() || (!bLeftActive && !bRightActive)) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, 0); + return createPolygonLinePrimitive( + aPolygon, + rObjectMatrix, + rLineAttribute, + attribute::SdrLineStartEndAttribute()); } if(bLeftActive && bRightActive) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, pLineStartEnd); + return createPolygonLinePrimitive( + aPolygon, + rObjectMatrix, + rLineAttribute, + rLineStartEnd); } const basegfx::B2DPolyPolygon aEmpty; const attribute::SdrLineStartEndAttribute aLineStartEnd( - bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty, - bLeftActive ? pLineStartEnd->getStartWidth() : 0.0, bRightActive ? pLineStartEnd->getEndWidth() : 0.0, - bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false, - bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false); + bLeftActive ? rLineStartEnd.getStartPolyPolygon() : aEmpty, bRightActive ? rLineStartEnd.getEndPolyPolygon() : aEmpty, + bLeftActive ? rLineStartEnd.getStartWidth() : 0.0, bRightActive ? rLineStartEnd.getEndWidth() : 0.0, + bLeftActive ? rLineStartEnd.isStartActive() : false, bRightActive ? rLineStartEnd.isEndActive() : false, + bLeftActive ? rLineStartEnd.isStartCentered() : false, bRightActive? rLineStartEnd.isEndCentered() : false); - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, &aLineStartEnd); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, aLineStartEnd); } Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - SdrBlockTextPrimitive2D* pBlockText = 0L; + SdrBlockTextPrimitive2D* pBlockText = 0; basegfx::B2DRange aTextRange; double fTextX((getStart().getX() + getEnd().getX()) * 0.5); double fTextY((getStart().getX() + getEnd().getX()) * 0.5); @@ -97,11 +105,13 @@ namespace drawinglayer const double fDistance(aLine.getLength()); const double fAngle(atan2(aLine.getY(), aLine.getX())); bool bAutoUpsideDown(false); - const attribute::SdrTextAttribute* pTextAttribute = getSdrLSTAttribute().getText(); + const attribute::SdrTextAttribute rTextAttribute = getSdrLSTAttribute().getText(); const basegfx::B2DHomMatrix aObjectMatrix( basegfx::tools::createShearXRotateTranslateB2DHomMatrix(0.0, fAngle, getStart())); - if(pTextAttribute) + // preapare text, but do not add yet; it needs to be aligned to + // the line geometry + if(!rTextAttribute.isDefault()) { basegfx::B2DHomMatrix aTextMatrix; double fTestAngle(fAngle); @@ -127,58 +137,52 @@ namespace drawinglayer // create primitive and get text range pBlockText = new SdrBlockTextPrimitive2D( - &pTextAttribute->getSdrText(), - pTextAttribute->getOutlinerParaObject(), + &rTextAttribute.getSdrText(), + rTextAttribute.getOutlinerParaObject(), aTextMatrix, SDRTEXTHORZADJUST_CENTER, SDRTEXTVERTADJUST_CENTER, - pTextAttribute->isScroll(), + rTextAttribute.isScroll(), false, false, false, false); + aTextRange = pBlockText->getB2DRange(aViewInformation); } // prepare line attribute and result - const attribute::SdrLineAttribute* pLineAttribute(getSdrLSTAttribute().getLine()); - - if(!pLineAttribute) - { - // if initially no line is defined, create one for HitTest and BoundRect - pLineAttribute = new attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)); - } - { + const attribute::SdrLineAttribute rLineAttribute(getSdrLSTAttribute().getLine()); bool bArrowsOutside(false); bool bMainLineSplitted(false); - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); + const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); double fStartArrowW(0.0); double fStartArrowH(0.0); double fEndArrowW(0.0); double fEndArrowH(0.0); - if(pLineStartEnd) + if(!rLineStartEnd.isDefault()) { - if(pLineStartEnd->isStartActive()) + if(rLineStartEnd.isStartActive()) { - const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getStartPolyPolygon())); - fStartArrowW = pLineStartEnd->getStartWidth(); + const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getStartPolyPolygon())); + fStartArrowW = rLineStartEnd.getStartWidth(); fStartArrowH = aArrowRange.getHeight() * fStartArrowW / aArrowRange.getWidth(); - if(pLineStartEnd->isStartCentered()) + if(rLineStartEnd.isStartCentered()) { fStartArrowH *= 0.5; } } - if(pLineStartEnd->isEndActive()) + if(rLineStartEnd.isEndActive()) { - const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getEndPolyPolygon())); - fEndArrowW = pLineStartEnd->getEndWidth(); + const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getEndPolyPolygon())); + fEndArrowW = rLineStartEnd.getEndWidth(); fEndArrowH = aArrowRange.getHeight() * fEndArrowW / aArrowRange.getWidth(); - if(pLineStartEnd->isEndCentered()) + if(rLineStartEnd.isEndCentered()) { fEndArrowH *= 0.5; } @@ -187,7 +191,7 @@ namespace drawinglayer const double fSpaceNeededByArrows(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.5)); const double fArrowsOutsideLen((fStartArrowH + fEndArrowH + fStartArrowW + fEndArrowW) * 0.5); - const double fHalfLineWidth(pLineAttribute->getWidth() * 0.5); + const double fHalfLineWidth(rLineAttribute.getWidth() * 0.5); if(fSpaceNeededByArrows > fDistance) { @@ -279,12 +283,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY()); const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); if(!bMainLineSplitted || MEASURETEXTPOSITION_CENTERED != eHorizontal) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(* pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); } } else @@ -295,12 +299,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY()); const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); } } @@ -313,13 +317,13 @@ namespace drawinglayer const basegfx::B2DPoint aLeftUp(0.0, fTopEdge); const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); // right help line const basegfx::B2DPoint aRightUp(fDistance, fTopEdge); const basegfx::B2DPoint aRightDown(fDistance, fBottomRight); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); // text horizontal position if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal) @@ -333,9 +337,9 @@ namespace drawinglayer fTextX -= (fArrowsOutsideLen - fStartArrowH); } - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX -= pTextAttribute->getTextRightDistance(); + fTextX -= rTextAttribute.getTextRightDistance(); } } else if(MEASURETEXTPOSITION_POSITIVE == eHorizontal) @@ -349,9 +353,9 @@ namespace drawinglayer fTextX += (fArrowsOutsideLen - fEndArrowH); } - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX += pTextAttribute->getTextLeftDistance(); + fTextX += rTextAttribute.getTextLeftDistance(); } } else // MEASURETEXTPOSITION_CENTERED @@ -359,9 +363,9 @@ namespace drawinglayer // centered fTextX = aMainLeft.getX() + ((fDistance - aTextRange.getWidth()) * 0.5); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX += (pTextAttribute->getTextLeftDistance() - pTextAttribute->getTextRightDistance()) / 2L; + fTextX += (rTextAttribute.getTextLeftDistance() - rTextAttribute.getTextRightDistance()) / 2L; } } @@ -372,9 +376,9 @@ namespace drawinglayer const double fSmall(fArrowsOutsideLen * 0.10); fTextY = aMainLeft.getY() - (aTextRange.getHeight() + fSmall + fHalfLineWidth); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY -= pTextAttribute->getTextLowerDistance(); + fTextY -= rTextAttribute.getTextLowerDistance(); } } else if(MEASURETEXTPOSITION_POSITIVE == eVertical) @@ -383,9 +387,9 @@ namespace drawinglayer const double fSmall(fArrowsOutsideLen * 0.10); fTextY = aMainLeft.getY() + (fSmall + fHalfLineWidth); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY += pTextAttribute->getTextUpperDistance(); + fTextY += rTextAttribute.getTextUpperDistance(); } } else // MEASURETEXTPOSITION_CENTERED @@ -393,21 +397,19 @@ namespace drawinglayer // centered fTextY = aMainLeft.getY() - (aTextRange.getHeight() * 0.5); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY += (pTextAttribute->getTextUpperDistance() - pTextAttribute->getTextLowerDistance()) / 2L; + fTextY += (rTextAttribute.getTextUpperDistance() - rTextAttribute.getTextLowerDistance()) / 2L; } } } - if(!getSdrLSTAttribute().getLine()) + if(getSdrLSTAttribute().getLine().isDefault()) { - // embed line geometry to invisible line group - const Primitive2DReference xHiddenLines(new HitTestPrimitive2D(aRetval)); - aRetval = Primitive2DSequence(&xHiddenLines, 1); + // embed line geometry to invisible (100% transparent) line group for HitTest + const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(aRetval)); - // delete temporary LineAttribute again - delete pLineAttribute; + aRetval = Primitive2DSequence(&xHiddenLines, 1); } if(pBlockText) @@ -437,9 +439,11 @@ namespace drawinglayer } // add shadow - if(getSdrLSTAttribute().getShadow()) + if(!getSdrLSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index bf2df22fb2e6..cb9cb8bf3546 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -34,7 +34,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -84,23 +85,29 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); // add fill - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getFill()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getFill().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line // #i97981# condition was inverse to purpose. When being compatible to paint version, // border needs to be suppressed - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getLine()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getLine().isDefault()) { // if line width is given, polygon needs to be grown by half of it to make the // outline to be outside of the bitmap - if(0.0 != getSdrLFSTAttribute().getLine()->getWidth()) + if(0.0 != getSdrLFSTAttribute().getLine().getWidth()) { // decompose to get scale basegfx::B2DVector aScale, aTranslate; @@ -108,27 +115,37 @@ namespace drawinglayer getTransform().decompose(aScale, aTranslate, fRotate, fShearX); // create expanded range (add relative half line width to unit rectangle) - double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5); + double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5); double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0); double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0); const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY); basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aExpandedUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } } else { // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } // add graphic content @@ -136,15 +153,26 @@ namespace drawinglayer // add text, no need to supress to stay compatible since text was // always supported by the old paints, too - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getShadow()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index d46ab7b4b14d..ea7ed0c808d1 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -138,7 +138,7 @@ namespace drawinglayer if(aColor.bIsVisible) { - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); const Color aVclColor(aColor.nColor); aOutline.transform(getObjectTransform()); const drawinglayer::primitive2d::Primitive2DReference xOutline( diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index 39f3efc617f5..6b9da51e3b68 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -52,50 +52,67 @@ namespace drawinglayer Primitive2DSequence aRetval; // add fill - if(getSdrLFSTAttribute().getFill() && getUnitPolyPolygon().isClosed()) + if(!getSdrLFSTAttribute().getFill().isDefault() + && getUnitPolyPolygon().isClosed()) { // take care for orientations - basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon(basegfx::tools::correctOrientations(getUnitPolyPolygon())); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(aOrientedUnitPolyPolygon, getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + const basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon( + basegfx::tools::correctOrientations(getUnitPolyPolygon())); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + aOrientedUnitPolyPolygon, + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - Primitive2DSequence aTemp(getUnitPolyPolygon().count()); - - for(sal_uInt32 a(0L); a < getUnitPolyPolygon().count(); a++) - { - aTemp[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd()); - } - - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp); + // if initially no line is defined, create one for HitTest and BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + getUnitPolyPolygon(), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - Primitive2DSequence xHiddenLineSequence(getUnitPolyPolygon().count()); + Primitive2DSequence aTemp(getUnitPolyPolygon().count()); for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++) { - xHiddenLineSequence[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), aBlackHairline); + aTemp[a] = createPolygonLinePrimitive( + getUnitPolyPolygon().getB2DPolygon(a), + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd()); } - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + getUnitPolyPolygon(), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index 25b39ebb07d5..dd3c602266f7 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -33,10 +33,6 @@ #include #include #include -#include -#include -#include -#include #include ////////////////////////////////////////////////////////////////////////////// @@ -177,19 +173,6 @@ namespace drawinglayer return aRetVal.get() ? *aRetVal.get() : BitmapEx(); } - // #i99123# - Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix) - { - // create PolygonHairlinePrimitive2D - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); - aUnitOutline.transform(rMatrix); - const basegfx::BColor aBlack(0.0, 0.0, 0.0); - const Primitive2DReference xReference(new PolygonHairlinePrimitive2D(aUnitOutline, aBlack)); - - // create HitTestPrimitive2D with it - const Primitive2DSequence xSequence(&xReference, 1); - return Primitive2DReference(new HitTestPrimitive2D(xSequence)); - } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 93ed597cb0a3..94da69bc7323 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -35,7 +35,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -50,7 +51,6 @@ namespace drawinglayer Primitive2DSequence SdrRectanglePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; - Primitive2DSequence aHitTestContent; // create unit outline polygon const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( @@ -59,64 +59,67 @@ namespace drawinglayer getCornerRadiusY())); // add fill - if(getSdrLFSTAttribute().getFill()) + if(!getSdrLFSTAttribute().getFill().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - *getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } else if(getForceFillForHitTest()) { // if no fill and it's a text frame, create a fill for HitTest and // BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, - createPolyPolygonFillPrimitive( + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, basegfx::B2DPolyPolygon(aUnitOutline), - getTransform(), - attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)), - getSdrLFSTAttribute().getFillFloatTransGradient())); + getTransform())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(!getSdrLFSTAttribute().getLine().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive( aUnitOutline, getTransform(), - *getSdrLFSTAttribute().getLine())); + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else if(!getForceFillForHitTest()) { // if initially no line is defined and it's not a text frame, create // a line for HitTest and BoundRect - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, - createPolygonLinePrimitive( - aUnitOutline, - getTransform(), - attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)))); - } - - // add HitTest and BoundRect helper geometry (if exists) - if(aHitTestContent.hasElements()) - { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - Primitive2DReference(new HitTestPrimitive2D(aHitTestContent))); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx index 6f997a2658ef..038226c2e06d 100644 --- a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx +++ b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx @@ -34,8 +34,11 @@ #include #include #include -#include +#include +#include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx new file mode 100644 index 000000000000..b2a103bd8cfc --- /dev/null +++ b/svx/source/sdr/properties/oleproperties.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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: graphicproperties.cxx,v $ + * $Revision: 1.12.76.1 $ + * + * 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_svx.hxx" + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace properties + { + OleProperties::OleProperties(SdrObject& rObj) + : RectangleProperties(rObj) + { + } + + OleProperties::OleProperties(const OleProperties& rProps, SdrObject& rObj) + : RectangleProperties(rProps, rObj) + { + } + + OleProperties::~OleProperties() + { + } + + BaseProperties& OleProperties::Clone(SdrObject& rObj) const + { + return *(new OleProperties(*this, rObj)); + } + + void OleProperties::ForceDefaultAttributes() + { + // call parent + RectangleProperties::ForceDefaultAttributes(); + + // force ItemSet + GetObjectItemSet(); + + // #i108221# + mpItemSet->Put( XFillStyleItem(XFILL_NONE) ); + mpItemSet->Put( XLineStyleItem(XLINE_NONE) ); + } + } // end of namespace properties +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 826e87520ce3..dd3006ba9a6d 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -69,7 +69,7 @@ #include #include #include -#include +#include #include #include "svditer.hxx" #include @@ -78,13 +78,14 @@ #include #include #include -#include #include #include #include #include #include #include +#include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -726,8 +727,8 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay if(aResultTransparent.hasElements()) { - drawinglayer::primitive2d::Primitive2DReference aUnifiedAlphaPrimitive2D(new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aResultTransparent, 0.5)); - aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlphaPrimitive2D, 1); + drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aResultTransparent, 0.5)); + aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1); sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResultTransparent); rOverlayManager.add(*pNewOverlayObject); @@ -825,35 +826,22 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla if(getSolidDraggingActive()) { const SfxItemSet& rItemSet = pEdge->GetMergedItemSet(); - drawinglayer::attribute::SdrLineAttribute* pLine = drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet); - drawinglayer::attribute::SdrLineStartEndAttribute* pLineStartEnd = 0; + const drawinglayer::attribute::SdrLineAttribute aLine( + drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet)); - if(pLine && !pLine->isVisible()) + if(!aLine.isDefault()) { - delete pLine; - pLine = 0; - } - - if(pLine) - { - pLineStartEnd = drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(rItemSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0; - } + const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd( + drawinglayer::primitive2d::createNewSdrLineStartEndAttribute( + rItemSet, + aLine.getWidth())); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( aRetval, drawinglayer::primitive2d::createPolygonLinePrimitive( - aEdgePolygon, basegfx::B2DHomMatrix(), *pLine, pLineStartEnd)); - - if(pLineStartEnd) - { - delete pLineStartEnd; - } - - delete pLine; + aEdgePolygon, + basegfx::B2DHomMatrix(), + aLine, + aLineStartEnd)); } } else diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index b95c13864776..5e0dfbced62c 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -808,16 +808,101 @@ void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark) void SdrEditView::DeleteMarkedObj() { - if (GetMarkedObjectCount()) { - BrkAction(); - //HMHHideMarkHdl(); - BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); + // moved breaking action and undo start outside loop + BrkAction(); + BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); + + // remove as long as something is selected. This allows to schedule objects for + // removal for a next run as needed + while(GetMarkedObjectCount()) + { + // vector to remember the parents which may be empty after object removal + std::vector< SdrObject* > aParents; + + { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const sal_uInt32 nCount(rMarkList.GetMarkCount()); + sal_uInt32 a(0); + + for(a = 0; a < nCount; a++) + { + // in the first run, add all found parents, but only once + SdrMark* pMark = rMarkList.GetMark(a); + SdrObject* pObject = pMark->GetMarkedSdrObj(); + SdrObject* pParent = pObject->GetObjList()->GetOwnerObj(); + + if(pParent) + { + if(aParents.size()) + { + std::vector< SdrObject* >::iterator aFindResult = + std::find(aParents.begin(), aParents.end(), pParent); + + if(aFindResult == aParents.end()) + { + aParents.push_back(pParent); + } + } + else + { + aParents.push_back(pParent); + } + } + } + + if(aParents.size()) + { + // in a 2nd run, remove all objects which may already be scheduled for + // removal. I am not sure if this can happen, but theoretically + // a to-be-removed object may already be the group/3DScene itself + for(a = 0; a < nCount; a++) + { + SdrMark* pMark = rMarkList.GetMark(a); + SdrObject* pObject = pMark->GetMarkedSdrObj(); + + std::vector< SdrObject* >::iterator aFindResult = + std::find(aParents.begin(), aParents.end(), pObject); + + if(aFindResult != aParents.end()) + { + aParents.erase(aFindResult); + } + } + } + } + + // original stuff: remove selected objects. Handle clear will + // do something only once DeleteMarkedList(GetMarkedObjectList()); GetMarkedObjectListWriteAccess().Clear(); aHdl.Clear(); - EndUndo(); - MarkListHasChanged(); + + while(aParents.size() && !GetMarkedObjectCount()) + { + // iterate over remembered parents + SdrObject* pParent = aParents.back(); + aParents.pop_back(); + + if(pParent->GetSubList() && 0 == pParent->GetSubList()->GetObjCount()) + { + // we detected an empty parent, a candidate to leave group/3DScene + // if entered + if(GetSdrPageView()->GetAktGroup() + && GetSdrPageView()->GetAktGroup() == pParent) + { + GetSdrPageView()->LeaveOneGroup(); + } + + // schedule empty parent for removal + GetMarkedObjectListWriteAccess().InsertEntry( + SdrMark(pParent, GetSdrPageView())); + } + } } + + // end undo and change messaging moved at the end + EndUndo(); + MarkListHasChanged(); } void SdrEditView::CopyMarkedObj() diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index be3529ea4818..7c3575e786dd 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -846,7 +846,7 @@ void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, cons } // geometry access -::basegfx::B2DPolygon SdrCaptionObj::getTailPolygon() const +basegfx::B2DPolygon SdrCaptionObj::getTailPolygon() const { return aTailPoly.getB2DPolygon(); } diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index ea29c860e8ab..20587f715c81 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -166,6 +166,12 @@ void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const } +void SdrObjGroup::SetBoundRectDirty() +{ + // avoid resetting aOutRect which in case of this object is model data, + // not re-creatable view data +} + UINT16 SdrObjGroup::GetObjIdentifier() const { return UINT16(OBJ_GRUP); diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index dfad9824a8fd..02ec537c19b9 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -79,6 +79,7 @@ inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } #include #include #include +#include using namespace sdr; @@ -2744,13 +2745,10 @@ SdrObject* SdrPathObj::RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index) SdrObject* SdrPathObj::DoConvertToPolyObj(BOOL bBezier) const { // #i89784# check for FontWork with activated HideContour - bool bHideContour(false); - - { - drawinglayer::attribute::SdrTextAttribute* pText = drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0)); - bHideContour = pText && pText->getSdrFormTextAttribute() && pText->isHideContour(); - delete pText; - } + const drawinglayer::attribute::SdrTextAttribute aText( + drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0))); + const bool bHideContour( + !aText.isDefault() && !aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()); SdrObject* pRet = bHideContour ? 0 : diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 6522feb7a2b8..e7fc3d771a5b 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -66,7 +66,7 @@ #include #include #include -#include +#include #include #include #include @@ -230,7 +230,7 @@ namespace { class impPolygonParagraphHandler { - const drawinglayer::attribute::SdrFormTextAttribute& mrSdrFormTextAttribute; // FormText parameters + const drawinglayer::attribute::SdrFormTextAttribute maSdrFormTextAttribute; // FormText parameters std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrDecomposition; // destination primitive list std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow Reference < com::sun::star::i18n::XBreakIterator > mxBreak; // break iterator @@ -273,7 +273,7 @@ namespace const drawinglayer::attribute::SdrFormTextAttribute& rSdrFormTextAttribute, std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rDecomposition, std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rShadowDecomposition) - : mrSdrFormTextAttribute(rSdrFormTextAttribute), + : maSdrFormTextAttribute(rSdrFormTextAttribute), mrDecomposition(rDecomposition), mrShadowDecomposition(rShadowDecomposition) { @@ -297,18 +297,18 @@ namespace double fPolyStart(0.0); double fScaleFactor(1.0); - if(mrSdrFormTextAttribute.getFormTextMirror()) + if(maSdrFormTextAttribute.getFormTextMirror()) { aPolygonCandidate.flip(); } - if(mrSdrFormTextAttribute.getFormTextStart() - && (XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust() - || XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust())) + if(maSdrFormTextAttribute.getFormTextStart() + && (XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust() + || XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust())) { - if(XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust()) { - fPolyStart += mrSdrFormTextAttribute.getFormTextStart(); + fPolyStart += maSdrFormTextAttribute.getFormTextStart(); if(fPolyStart > fPolyEnd) { @@ -317,7 +317,7 @@ namespace } else { - fPolyEnd -= mrSdrFormTextAttribute.getFormTextStart(); + fPolyEnd -= maSdrFormTextAttribute.getFormTextStart(); if(fPolyEnd < fPolyStart) { @@ -326,7 +326,7 @@ namespace } } - if(XFT_LEFT != mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_LEFT != maSdrFormTextAttribute.getFormTextAdjust()) { // calculate total text length of this paragraph, some layout needs to be done const double fParagraphTextLength(getParagraphTextLength(rTextPortions)); @@ -335,7 +335,7 @@ namespace // but still take care of XFT_AUTOSIZE in that case const bool bTextTooLong(fParagraphTextLength > (fPolyEnd - fPolyStart)); - if(XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust()) { if(!bTextTooLong) { @@ -343,7 +343,7 @@ namespace fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength); } } - else if(XFT_CENTER == mrSdrFormTextAttribute.getFormTextAdjust()) + else if(XFT_CENTER == maSdrFormTextAttribute.getFormTextAdjust()) { if(!bTextTooLong) { @@ -351,7 +351,7 @@ namespace fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength) / 2.0; } } - else if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + else if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // if scale, prepare scale factor between curve length and text length if(0.0 != fParagraphTextLength) @@ -386,7 +386,7 @@ namespace // prepare portion length. Takes RTL sections into account. double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen)); - if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // when scaling, expand portion length fPortionLength *= fScaleFactor; @@ -401,27 +401,27 @@ namespace aNewTransformA.scale(aFontScaling.getX(), aFontScaling.getY()); // prepare scaling of text primitive - if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // when scaling, expand text primitive scaling aNewTransformA.scale(fScaleFactor, fScaleFactor); } // eventually create shadow primitives from aDecomposition and add to rDecomposition - const bool bShadow(XFTSHADOW_NONE != mrSdrFormTextAttribute.getFormTextShadow()); + const bool bShadow(XFTSHADOW_NONE != maSdrFormTextAttribute.getFormTextShadow()); if(bShadow) { - if(XFTSHADOW_NORMAL == mrSdrFormTextAttribute.getFormTextShadow()) + if(XFTSHADOW_NORMAL == maSdrFormTextAttribute.getFormTextShadow()) { aNewShadowTransform.translate( - mrSdrFormTextAttribute.getFormTextShdwXVal(), - -mrSdrFormTextAttribute.getFormTextShdwYVal()); + maSdrFormTextAttribute.getFormTextShdwXVal(), + -maSdrFormTextAttribute.getFormTextShdwYVal()); } else // XFTSHADOW_SLANT { - double fScaleValue(mrSdrFormTextAttribute.getFormTextShdwYVal() / 100.0); - double fShearValue(-mrSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800); + double fScaleValue(maSdrFormTextAttribute.getFormTextShdwYVal() / 100.0); + double fShearValue(-maSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800); aNewShadowTransform.scale(1.0, fScaleValue); aNewShadowTransform.shearX(sin(fShearValue)); @@ -429,7 +429,7 @@ namespace } } - switch(mrSdrFormTextAttribute.getFormTextStyle()) + switch(maSdrFormTextAttribute.getFormTextStyle()) { case XFT_ROTATE : { @@ -487,7 +487,7 @@ namespace } // distance from path? - if(mrSdrFormTextAttribute.getFormTextDistance()) + if(maSdrFormTextAttribute.getFormTextDistance()) { if(aEndPos.equal(aStartPos)) { @@ -497,7 +497,7 @@ namespace // use back vector (aStartPos - aEndPos) here to get mirrored perpendicular as in old stuff const basegfx::B2DVector aPerpendicular( basegfx::getNormalizedPerpendicular(aStartPos - aEndPos) * - mrSdrFormTextAttribute.getFormTextDistance()); + maSdrFormTextAttribute.getFormTextDistance()); aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY()); } @@ -506,7 +506,7 @@ namespace { if(pCandidate->getText().Len() && nNextGlyphLen) { - const Color aShadowColor(mrSdrFormTextAttribute.getFormTextShdwColor()); + const Color aShadowColor(maSdrFormTextAttribute.getFormTextShdwColor()); const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor()); const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); const ::std::vector< double > aNewDXArray( @@ -627,7 +627,7 @@ namespace { if(rOutlineAttribute.getTransparence()) { - // create UnifiedAlphaPrimitive2D + // create UnifiedTransparencePrimitive2D drawinglayer::primitive2d::Primitive2DSequence aStrokePrimitiveSequence(nStrokeCount); for(sal_uInt32 b(0L); b < nStrokeCount; b++) @@ -635,8 +635,8 @@ namespace aStrokePrimitiveSequence[b] = drawinglayer::primitive2d::Primitive2DReference(aStrokePrimitives[b]); } - drawinglayer::primitive2d::UnifiedAlphaPrimitive2D* pNew2 = - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + drawinglayer::primitive2d::UnifiedTransparencePrimitive2D* pNew2 = + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aStrokePrimitiveSequence, (double)rOutlineAttribute.getTransparence() / 100.0); aNewPrimitives.push_back(pNew2); @@ -716,7 +716,9 @@ void SdrTextObj::impDecomposePathTextPrimitive( std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aRegularDecomposition; std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aShadowDecomposition; impPolygonParagraphHandler aPolygonParagraphHandler( - rFormTextAttribute, aRegularDecomposition, aShadowDecomposition); + rFormTextAttribute, + aRegularDecomposition, + aShadowDecomposition); sal_uInt32 a; for(a = 0L; a < nLoopCount; a++) @@ -755,10 +757,14 @@ void SdrTextObj::impDecomposePathTextPrimitive( } // evtl. add shadow outlines - if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getShadowOutline()) + if(rFormTextAttribute.getFormTextOutline() + && !rFormTextAttribute.getShadowOutline().isDefault()) { const drawinglayer::primitive2d::Primitive2DSequence aOutlines( - impAddPathTextOutlines(aShadowDecomposition, *rFormTextAttribute.getShadowOutline())); + impAddPathTextOutlines( + aShadowDecomposition, + rFormTextAttribute.getShadowOutline())); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalA, aOutlines); } } @@ -774,10 +780,14 @@ void SdrTextObj::impDecomposePathTextPrimitive( } // evtl. add outlines - if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getOutline()) + if(rFormTextAttribute.getFormTextOutline() + && !rFormTextAttribute.getOutline().isDefault()) { const drawinglayer::primitive2d::Primitive2DSequence aOutlines( - impAddPathTextOutlines(aRegularDecomposition, *rFormTextAttribute.getOutline())); + impAddPathTextOutlines( + aRegularDecomposition, + rFormTextAttribute.getOutline())); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalB, aOutlines); } } diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 72e10e29c336..2c2e1bb9df83 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -50,7 +50,7 @@ #include #include #include -#include +#include namespace sdr { namespace table { @@ -245,10 +245,11 @@ drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayOb } else { - // embed in HitTest primitive to support HitTest of this overlay object + // embed in 100% transparent UnifiedTransparencePrimitive2D to support HitTest + // of this overlay object const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1); const drawinglayer::primitive2d::Primitive2DReference aNewReference( - new drawinglayer::primitive2d::HitTestPrimitive2D(aSequence)); + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aSequence, 1.0)); aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1); } } diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index e4e515ed1613..b4a941413e70 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -37,19 +37,20 @@ #include #include #include -#include #include #include #include -#include #include -#include #include #include -#include #include #include #include +#include +#include +#include +#include +#include #include "cell.hxx" #include "tablelayouter.hxx" @@ -99,31 +100,44 @@ namespace drawinglayer { Primitive2DSequence aRetval; - if(getSdrFTAttribute().getFill() || getSdrFTAttribute().getText()) + if(!getSdrFTAttribute().getFill().isDefault() + || !getSdrFTAttribute().getText().isDefault()) { // prepare unit polygon - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createPolygonFromRect(aUnitRange)); + const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); // add fill - if(getSdrFTAttribute().getFill()) + if(!getSdrFTAttribute().getFill().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( - aUnitPolyPolygon, - getTransform(), - *getSdrFTAttribute().getFill(), - getSdrFTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getFill(), + getSdrFTAttribute().getFillFloatTransGradient())); + } + else + { + // if no fill create one for HitTest and BoundRect fallback + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, + aUnitPolyPolygon, + getTransform())); } // add text - if(getSdrFTAttribute().getText()) + if(!getSdrFTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( - aUnitPolyPolygon, - getTransform(), - *getSdrFTAttribute().getText(), - 0, - true, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getText(), + attribute::SdrLineAttribute(), + true, + false, + false)); } } @@ -539,14 +553,13 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfTableObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const sdr::table::SdrTableObj& rTableObj = GetTableObj(); const uno::Reference< com::sun::star::table::XTable > xTable = rTableObj.getTable(); - const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet(); if(xTable.is()) { // create primitive representation for table + drawinglayer::primitive2d::Primitive2DSequence xRetval; const sal_Int32 nRowCount(xTable->getRowCount()); const sal_Int32 nColCount(xTable->getColumnCount()); const sal_Int32 nAllCount(nRowCount * nColCount); @@ -599,7 +612,7 @@ namespace sdr const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet(); const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol); const SdrText* pSdrText = rTableObj.getText(nTextIndex); - drawinglayer::attribute::SdrFillTextAttribute* pAttribute = 0; + drawinglayer::attribute::SdrFillTextAttribute aAttribute; if(pSdrText) { @@ -609,7 +622,7 @@ namespace sdr const sal_Int32 nUpper(xCurrentCell->GetTextUpperDistance()); const sal_Int32 nLower(xCurrentCell->GetTextLowerDistance()); - pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( rCellItemSet, pSdrText, &nLeft, @@ -619,21 +632,17 @@ namespace sdr } else { - pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( rCellItemSet, pSdrText); } - if(pAttribute) + // always create cell primitives for BoundRect and HitTest { - if(pAttribute->isVisible()) - { - const drawinglayer::primitive2d::Primitive2DReference xCellReference(new drawinglayer::primitive2d::SdrCellPrimitive2D( - aCellMatrix, *pAttribute)); - xCellSequence[nCellInsert++] = xCellReference; - } - - delete pAttribute; + const drawinglayer::primitive2d::Primitive2DReference xCellReference( + new drawinglayer::primitive2d::SdrCellPrimitive2D( + aCellMatrix, aAttribute)); + xCellSequence[nCellInsert++] = xCellReference; } // handle cell borders @@ -678,21 +687,46 @@ namespace sdr xRetval = xCellSequence; drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xBorderSequence); } - } - if(xRetval.hasElements()) - { - // check and create evtl. shadow for created content - drawinglayer::attribute::SdrShadowAttribute* pNewShadowAttribute = drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet); - - if(pNewShadowAttribute) + if(xRetval.hasElements()) { - xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, *pNewShadowAttribute); - delete pNewShadowAttribute; + // check and create evtl. shadow for created content + const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet(); + const drawinglayer::attribute::SdrShadowAttribute aNewShadowAttribute( + drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet)); + + if(!aNewShadowAttribute.isDefault()) + { + xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, aNewShadowAttribute); + } } - } - return xRetval; + return xRetval; + } + else + { + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = rTableObj.GetGeoRect(); + const basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // create object matrix + const GeoStat& rGeoStat(rTableObj.GetGeoStat()); + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // credate an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, + aObjectMatrix)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } ViewContactOfTableObj::ViewContactOfTableObj(::sdr::table::SdrTableObj& rTableObj) -- cgit From e8b81cd40140a1a5f79f9eb24470ad4891564ef8 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 28 Jan 2010 17:21:44 +0100 Subject: aw079: #i99147# corrected diverse aspects of invisible object visualisation and interaction --- svx/inc/svx/cube3d.hxx | 5 +- svx/inc/svx/extrud3d.hxx | 7 +-- svx/inc/svx/lathe3d.hxx | 7 +-- svx/inc/svx/obj3d.hxx | 10 ++-- svx/inc/svx/polygn3d.hxx | 6 +- svx/inc/svx/scene3d.hxx | 9 +-- svx/inc/svx/sdrmasterpagedescriptor.hxx | 5 +- svx/inc/svx/sphere3d.hxx | 7 +-- svx/inc/svx/svdoashp.hxx | 11 ++-- svx/inc/svx/svdoattr.hxx | 5 +- svx/inc/svx/svdobj.hxx | 2 + svx/inc/svx/svdocapt.hxx | 7 +-- svx/inc/svx/svdocirc.hxx | 9 +-- svx/inc/svx/svdoedge.hxx | 7 +-- svx/inc/svx/svdograf.hxx | 10 +--- svx/inc/svx/svdogrp.hxx | 7 +-- svx/inc/svx/svdomeas.hxx | 7 +-- svx/inc/svx/svdomedia.hxx | 3 +- svx/inc/svx/svdoole2.hxx | 5 +- svx/inc/svx/svdopage.hxx | 11 ++-- svx/inc/svx/svdopath.hxx | 5 +- svx/inc/svx/svdorect.hxx | 11 +--- svx/inc/svx/svdotable.hxx | 8 +-- svx/inc/svx/svdotext.hxx | 8 +-- svx/inc/svx/svdovirt.hxx | 4 +- svx/inc/svx/svdpage.hxx | 1 + svx/source/customshapes/EnhancedCustomShape2d.cxx | 13 ----- svx/source/sdr/properties/makefile.mk | 1 + svx/source/svdraw/sdrmasterpagedescriptor.cxx | 3 +- svx/source/svdraw/svddrgmt.cxx | 15 ++++- svx/source/svdraw/svdhdl.cxx | 4 +- svx/source/svdraw/svdobj.cxx | 6 +- svx/source/svdraw/svdogrp.cxx | 2 +- svx/source/svdraw/svdoole2.cxx | 9 +++ svx/source/svdraw/svdpage.cxx | 3 +- svx/source/table/svdotable.cxx | 2 +- svx/source/table/tablehandles.cxx | 8 +-- svx/source/table/viewcontactoftableobj.cxx | 69 +++++++++++------------ 38 files changed, 137 insertions(+), 175 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/cube3d.hxx b/svx/inc/svx/cube3d.hxx index 3985ab6ca594..0661200a9850 100644 --- a/svx/inc/svx/cube3d.hxx +++ b/svx/inc/svx/cube3d.hxx @@ -55,10 +55,6 @@ enum { CUBE_BOTTOM = 0x0001, CUBE_BACK = 0x0002, CUBE_LEFT = 0x0004, class SVX_DLLPUBLIC E3dCubeObj : public E3dCompoundObject { private: - // Zur Geometrieerzeugung eines Cubes notwendige - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // Parameter basegfx::B3DPoint aCubePos; basegfx::B3DVector aCubeSize; @@ -69,6 +65,7 @@ private: protected: void SetDefaultAttributes(E3dDefaultAttributes& rDefault); + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: TYPEINFO(); diff --git a/svx/inc/svx/extrud3d.hxx b/svx/inc/svx/extrud3d.hxx index ee0c38af9fdd..b979a44fce60 100644 --- a/svx/inc/svx/extrud3d.hxx +++ b/svx/inc/svx/extrud3d.hxx @@ -43,11 +43,6 @@ class SVX_DLLPUBLIC E3dExtrudeObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::E3dExtrudeProperties access to SetGeometryValid() friend class sdr::properties::E3dExtrudeProperties; @@ -55,6 +50,8 @@ private: basegfx::B2DPolyPolygon maExtrudePolygon; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/lathe3d.hxx b/svx/inc/svx/lathe3d.hxx index a0474fef522d..2d8e92df6496 100644 --- a/svx/inc/svx/lathe3d.hxx +++ b/svx/inc/svx/lathe3d.hxx @@ -47,16 +47,13 @@ class SVX_DLLPUBLIC E3dLatheObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // Partcodes fuer Wireframe-Generierung: Standard oder Deckelflaeche enum { LATHE_PART_STD = 1, LATHE_PART_COVER = 2 }; basegfx::B2DPolyPolygon maPolyPoly2D; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/obj3d.hxx b/svx/inc/svx/obj3d.hxx index 30a22938f888..8297d727919f 100644 --- a/svx/inc/svx/obj3d.hxx +++ b/svx/inc/svx/obj3d.hxx @@ -109,8 +109,7 @@ public: class SVX_DLLPUBLIC E3dObject : public SdrAttrObj { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dProperties access to StructureChanged() friend class sdr::properties::E3dProperties; @@ -119,6 +118,8 @@ class SVX_DLLPUBLIC E3dObject : public SdrAttrObj friend class E3dDragMethod; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + E3dObjList maSubList; // Subliste (Childobjekte) basegfx::B3DRange maLocalBoundVol; // umschliessendes Volumen des Objekts (aus geometrieerzeugung) @@ -223,8 +224,7 @@ public: class SVX_DLLPUBLIC E3dCompoundObject : public E3dObject { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dCompoundProperties access to SetGeometryValid() friend class sdr::properties::E3dCompoundProperties; friend class sdr::properties::E3dExtrudeProperties; @@ -232,6 +232,8 @@ class SVX_DLLPUBLIC E3dCompoundObject : public E3dObject friend class sdr::properties::E3dSphereProperties; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + // Material des Objektes Color aMaterialAmbientColor; diff --git a/svx/inc/svx/polygn3d.hxx b/svx/inc/svx/polygn3d.hxx index 5bc9f9b8fb15..c24fb765cffb 100644 --- a/svx/inc/svx/polygn3d.hxx +++ b/svx/inc/svx/polygn3d.hxx @@ -37,9 +37,6 @@ class SVX_DLLPUBLIC E3dPolygonObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // Parameter basegfx::B3DPolyPolygon aPolyPoly3D; basegfx::B3DPolyPolygon aPolyNormals3D; @@ -49,6 +46,9 @@ private: SVX_DLLPRIVATE void CreateDefaultNormals(); SVX_DLLPRIVATE void CreateDefaultTexture(); +protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + public: void SetPolyPolygon3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); void SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); diff --git a/svx/inc/svx/scene3d.hxx b/svx/inc/svx/scene3d.hxx index a4cd8c497cd6..d7bd5e2d809e 100644 --- a/svx/inc/svx/scene3d.hxx +++ b/svx/inc/svx/scene3d.hxx @@ -71,17 +71,14 @@ class Imp3DDepthRemapper; class SVX_DLLPUBLIC E3dScene : public E3dObject { - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dSceneProperties access to StructureChanged() friend class sdr::properties::E3dSceneProperties; - // #110094# DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: // Transformationen B3dCamera aCameraSet; Camera3D aCamera; diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index b0593ab48774..52752945255c 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -52,17 +52,20 @@ namespace sdr { class MasterPageDescriptor : public sdr::PageUser { + private: SdrPage& maOwnerPage; SdrPage& maUsedPage; SetOfByte maVisibleLayers; // ViewContact part sdr::contact::ViewContact* mpViewContact; - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); // assignment operator defined, but not implemented void operator=(const MasterPageDescriptor& rCandidate); + protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + public: MasterPageDescriptor(SdrPage& aOwnerPage, SdrPage& aUsedPage); virtual ~MasterPageDescriptor(); diff --git a/svx/inc/svx/sphere3d.hxx b/svx/inc/svx/sphere3d.hxx index 9c11b6537354..1f8e21a032ca 100644 --- a/svx/inc/svx/sphere3d.hxx +++ b/svx/inc/svx/sphere3d.hxx @@ -44,15 +44,12 @@ class SVX_DLLPUBLIC E3dSphereObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - basegfx::B3DPoint aCenter; basegfx::B3DVector aSize; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx index f65afc0b4efe..db7189254b76 100644 --- a/svx/inc/svx/svdoashp.hxx +++ b/svx/inc/svx/svdoashp.hxx @@ -88,15 +88,16 @@ struct SdrCustomShapeInteraction class SVX_DLLPUBLIC SdrObjCustomShape : public SdrTextObj { +private: // fObjectRotation is containing the object rotation in degrees. double fObjectRotation; -private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +public: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + // to allow sdr::properties::CustomShapeProperties access friend class sdr::properties::CustomShapeProperties; @@ -179,7 +180,7 @@ public: virtual UINT16 GetObjIdentifier() const; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; - virtual void SetModel(SdrModel* pNewModel); + virtual void SetModel(SdrModel* pNewModel); virtual void RecalcSnapRect(); diff --git a/svx/inc/svx/svdoattr.hxx b/svx/inc/svx/svdoattr.hxx index 3bcce26ea45e..2edc125d88f6 100644 --- a/svx/inc/svx/svdoattr.hxx +++ b/svx/inc/svx/svdoattr.hxx @@ -55,11 +55,12 @@ class SfxItemPool; class SVX_DLLPUBLIC SdrAttrObj : public SdrObject { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: friend class SdrOutliner; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + Rectangle maSnapRect; protected: diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index cc21e645e4d2..fce776ef0abf 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -426,6 +426,7 @@ public: // BaseProperties section private: sdr::properties::BaseProperties* mpProperties; +protected: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); public: virtual sdr::properties::BaseProperties& GetProperties() const; @@ -434,6 +435,7 @@ public: // #110094# DrawContact section private: sdr::contact::ViewContact* mpViewContact; +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: sdr::contact::ViewContact& GetViewContact() const; diff --git a/svx/inc/svx/svdocapt.hxx b/svx/inc/svx/svdocapt.hxx index 37bfd5ed2f9b..fd6e7dc67789 100644 --- a/svx/inc/svx/svdocapt.hxx +++ b/svx/inc/svx/svdocapt.hxx @@ -63,19 +63,16 @@ public: class SVX_DLLPUBLIC SdrCaptionObj : public SdrRectObj { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); private: - // to allow sdr::properties::CaptionProperties access to ImpRecalcTail() friend class sdr::properties::CaptionProperties; - friend class SdrTextObj; // fuer ImpRecalcTail() bei AutoGrow protected: - // DrawContact section -private: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +private: Polygon aTailPoly; // das ganze Polygon des Schwanzes sal_Bool mbSpecialTextBoxShadow; // for calc special shadow, default FALSE sal_Bool mbFixedTail; // for calc note box fixed tail, default FALSE diff --git a/svx/inc/svx/svdocirc.hxx b/svx/inc/svx/svdocirc.hxx index 3f6a589d2cd7..866b63379a3e 100644 --- a/svx/inc/svx/svdocirc.hxx +++ b/svx/inc/svx/svdocirc.hxx @@ -61,20 +61,17 @@ public: class SVX_DLLPUBLIC SdrCircObj : public SdrRectObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo() friend class sdr::properties::CircleProperties; // only for SdrCircleAttributes SdrObjKind GetCircleKind() const { return meCircleKind; } - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: - SdrObjKind meCircleKind; + SdrObjKind meCircleKind; long nStartWink; long nEndWink; diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx index 227afd9ab027..a4dfcc322f4e 100644 --- a/svx/inc/svx/svdoedge.hxx +++ b/svx/inc/svx/svdoedge.hxx @@ -160,19 +160,16 @@ public: class SVX_DLLPUBLIC SdrEdgeObj : public SdrTextObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::ConnectorProperties access to ImpSetAttrToEdgeInfo() friend class sdr::properties::ConnectorProperties; friend class SdrCreateView; friend class ImpEdgeHdl; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: SdrObjConnection aCon1; // Verbindungszustand des Linienanfangs SdrObjConnection aCon2; // Verbindungszustand des Linienendes diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index 4f00da997361..a8d6a006835e 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -88,22 +88,16 @@ class SdrGraphicLink; class SVX_DLLPUBLIC SdrGrafObj : public SdrRectObj { private: - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // to allow sdr::properties::GraphicProperties access to SetXPolyDirty() friend class sdr::properties::GraphicProperties; // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink() friend class sdr::contact::ViewObjectContactOfGraphic; - friend class SdrGraphicLink; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren void ImpSetGrafInfoToAttr(); // Werte in den Pool kopieren diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx index db799da81e1d..8d1cf9b4e0b0 100644 --- a/svx/inc/svx/svdogrp.hxx +++ b/svx/inc/svx/svdogrp.hxx @@ -49,14 +49,11 @@ class SfxItemSet; class SVX_DLLPUBLIC SdrObjGroup : public SdrObject { - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // #110094# DrawContact section private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: SdrObjList* pSub; // Subliste (Kinder) long nDrehWink; long nShearWink; diff --git a/svx/inc/svx/svdomeas.hxx b/svx/inc/svx/svdomeas.hxx index 406c5badbcb0..eb4c77e80269 100644 --- a/svx/inc/svx/svdomeas.hxx +++ b/svx/inc/svx/svdomeas.hxx @@ -68,18 +68,15 @@ public: class SVX_DLLPUBLIC SdrMeasureObj : public SdrTextObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::MeasureProperties access to SetTextDirty() friend class sdr::properties::MeasureProperties; friend class SdrMeasureField; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: Point aPt1; Point aPt2; FASTBOOL bTextDirty; diff --git a/svx/inc/svx/svdomedia.hxx b/svx/inc/svx/svdomedia.hxx index 4b612dcf7e9e..8c2d683397ed 100644 --- a/svx/inc/svx/svdomedia.hxx +++ b/svx/inc/svx/svdomedia.hxx @@ -83,11 +83,10 @@ public: protected: virtual void mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState ); + virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact(); private: - virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - ::avmedia::MediaItem maMediaProperties; ::std::auto_ptr< Graphic > mapGraphic; }; diff --git a/svx/inc/svx/svdoole2.hxx b/svx/inc/svx/svdoole2.hxx index 2b5a19f7b60b..b26fbe55d2d6 100644 --- a/svx/inc/svx/svdoole2.hxx +++ b/svx/inc/svx/svdoole2.hxx @@ -62,11 +62,10 @@ private: SVX_DLLPRIVATE void GetObjRef_Impl(); SVX_DLLPRIVATE void SetGraphic_Impl(const Graphic* pGrf); - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: svt::EmbeddedObjectRef xObjRef; Graphic* pGraphic; String aProgName; diff --git a/svx/inc/svx/svdopage.hxx b/svx/inc/svx/svdopage.hxx index b138b7c12be9..f046a20dbed0 100644 --- a/svx/inc/svx/svdopage.hxx +++ b/svx/inc/svx/svdopage.hxx @@ -44,17 +44,14 @@ public: virtual void PageInDestruction(const SdrPage& rPage); private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // #111111# // To make things more safe, remember the page, not a number SdrPage* mpShownPage; +protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + public: TYPEINFO(); SdrPageObj(SdrPage* pNewPage = 0L); diff --git a/svx/inc/svx/svdopath.hxx b/svx/inc/svx/svdopath.hxx index 382f968f19b2..d8157446d0ce 100644 --- a/svx/inc/svx/svdopath.hxx +++ b/svx/inc/svx/svdopath.hxx @@ -65,13 +65,12 @@ public: class SVX_DLLPUBLIC SdrPathObj : public SdrTextObj { +private: friend class ImpPathForDragAndCreate; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: basegfx::B2DPolyPolygon maPathPolygon; SdrObjKind meKind; diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx index d8b0d2767553..eadd5c7490a0 100644 --- a/svx/inc/svx/svdorect.hxx +++ b/svx/inc/svx/svdorect.hxx @@ -54,19 +54,14 @@ namespace sdr { namespace properties { class SVX_DLLPUBLIC SdrRectObj : public SdrTextObj { private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::RectangleProperties access to SetXPolyDirty() friend class sdr::properties::RectangleProperties; - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - friend class SdrTextObj; // wg SetXPolyDirty bei GrowAdjust protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + XPolygon* mpXPoly; protected: diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx index a524ce757898..779087cbe254 100644 --- a/svx/inc/svx/svdotable.hxx +++ b/svx/inc/svx/svdotable.hxx @@ -315,14 +315,10 @@ public: private: void init( sal_Int32 nColumns, sal_Int32 nRows ); - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: virtual SdrObjGeoData* NewGeoData() const; virtual void SaveGeoData(SdrObjGeoData& rGeo) const; virtual void RestGeoData(const SdrObjGeoData& rGeo); diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx index 6ffa4ab5bd22..928b1b4580b2 100644 --- a/svx/inc/svx/svdotext.hxx +++ b/svx/inc/svx/svdotext.hxx @@ -145,13 +145,11 @@ private: // CustomShapeproperties need to access the "bTextFrame" member: friend class sdr::properties::CustomShapeProperties; - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +private: // This method is only allowed for sdr::properties::TextProperties SVX_DLLPRIVATE SdrOutliner* GetTextEditOutliner() const { diff --git a/svx/inc/svx/svdovirt.hxx b/svx/inc/svx/svdovirt.hxx index 190576fc68c6..7451fb582dff 100644 --- a/svx/inc/svx/svdovirt.hxx +++ b/svx/inc/svx/svdovirt.hxx @@ -49,11 +49,9 @@ class SVX_DLLPUBLIC SdrVirtObj : public SdrObject public: virtual sdr::properties::BaseProperties& GetProperties() const; -private: - // AW, OD 2004-05-03 #i27224# +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: SdrObject& rRefObj; // Referenziertes Zeichenobjekt Rectangle aSnapRect; diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 3523308b6e8f..02181afb1674 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -403,6 +403,7 @@ public: // #110094# DrawContact section private: sdr::contact::ViewContact* mpViewContact; +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: sdr::contact::ViewContact& GetViewContact() const; diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 940b882f2e7c..d8d66838c3eb 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1709,19 +1709,6 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm if(aNewB2DPolyPolygon.count()) { - if( !bLineGeometryNeededOnly ) - { - // hack aNewB2DPolyPolygon to fill logic rect - this is - // needed to produce gradient fills that look like mso - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(0,0)); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(), - aLogicRect.GetHeight())); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - } // #i37011# bool bForceCreateTwoObjects(false); diff --git a/svx/source/sdr/properties/makefile.mk b/svx/source/sdr/properties/makefile.mk index 04e96dd6c24d..8e0fe5955a03 100644 --- a/svx/source/sdr/properties/makefile.mk +++ b/svx/source/sdr/properties/makefile.mk @@ -51,6 +51,7 @@ SLOFILES=\ $(SLO)$/textproperties.obj \ $(SLO)$/customshapeproperties.obj \ $(SLO)$/rectangleproperties.obj \ + $(SLO)$/oleproperties.obj \ $(SLO)$/captionproperties.obj \ $(SLO)$/circleproperties.obj \ $(SLO)$/connectorproperties.obj \ diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 652327f3ff85..9cee1e344c6a 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -76,7 +76,8 @@ namespace sdr { if(!mpViewContact) { - ((MasterPageDescriptor*)this)->mpViewContact = ((MasterPageDescriptor*)this)->CreateObjectSpecificViewContact(); + const_cast< MasterPageDescriptor* >(this)->mpViewContact = + const_cast< MasterPageDescriptor* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index dd3006ba9a6d..0b34c5cc4e81 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -678,7 +678,7 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay createSdrDragEntries(); } - // if there are entries, derive OverlayObjects fromthe entries, including + // if there are entries, derive OverlayObjects from the entries, including // modification from current interactive state if(maSdrDragEntries.size()) { @@ -823,7 +823,18 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla // this polygon is a temporary calculated connector path, so it is not possible to fetch // the needed primitives directly from the pEdge object which does not get changed. If full // drag is on, use the SdrObjects ItemSet to create a adequate representation - if(getSolidDraggingActive()) + bool bUseSolidDragging(getSolidDraggingActive()); + + if(bUseSolidDragging) + { + // switch off solid dragging if connector is not visible + if(!pEdge->HasLineStyle()) + { + bUseSolidDragging = false; + } + } + + if(bUseSolidDragging) { const SfxItemSet& rItemSet = pEdge->GetMergedItemSet(); const drawinglayer::attribute::SdrLineAttribute aLine( diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index d3202e389f83..7bd47ae80616 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -284,13 +284,13 @@ SdrHdlBitmapSet& getSimpleSet() SdrHdlBitmapSet& getModernSet() { - static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS)); return *aModernSet.get(); } SdrHdlBitmapSet& getHighContrastSet() { - static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_ACCESSIBILITY_MARKERS)); return *aHighContrastSet.get(); } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index fb26d7b5fc9c..3ed33e0f20ad 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -329,7 +329,8 @@ sdr::properties::BaseProperties& SdrObject::GetProperties() const { if(!mpProperties) { - ((SdrObject*)this)->mpProperties = ((SdrObject*)this)->CreateObjectSpecificProperties(); + const_cast< SdrObject* >(this)->mpProperties = + const_cast< SdrObject* >(this)->CreateObjectSpecificProperties(); } return *mpProperties; @@ -364,7 +365,8 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const { if(!mpViewContact) { - ((SdrObject*)this)->mpViewContact = ((SdrObject*)this)->CreateObjectSpecificViewContact(); + const_cast< SdrObject* >(this)->mpViewContact = + const_cast< SdrObject* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 20587f715c81..89d9221a8552 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -83,7 +83,7 @@ sdr::properties::BaseProperties* SdrObjGroup::CreateObjectSpecificProperties() { - return new sdr::properties::GroupProperties((SdrObject&)(*this)); + return new sdr::properties::GroupProperties(*this); } ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 67505e12ba73..69599790ab1b 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -89,6 +89,7 @@ #include #include #include +#include // #i100710# #include @@ -735,6 +736,14 @@ static bool ImplIsMathObj( const uno::Reference < embed::XEmbeddedObject >& rObj } } +////////////////////////////////////////////////////////////////////////////// +// BaseProperties section + +sdr::properties::BaseProperties* SdrOle2Obj::CreateObjectSpecificProperties() +{ + return new sdr::properties::OleProperties(*this); +} + ////////////////////////////////////////////////////////////////////////////// // DrawContact section diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index a8cbfbb24c3d..864cc3d77e8d 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1168,7 +1168,8 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const { if(!mpViewContact) { - ((SdrPage*)this)->mpViewContact = ((SdrPage*)this)->CreateObjectSpecificViewContact(); + const_cast< SdrPage* >(this)->mpViewContact = + const_cast< SdrPage* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 97e06fd4bb61..2fa47ed0b119 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -2575,7 +2575,7 @@ basegfx::B2DPolyPolygon SdrTableObj::getSpecialDragPoly(const SdrDragStat& rDrag basegfx::B2DPolyPolygon aRetval; const SdrHdl* pHdl = rDrag.GetHdl(); - if(HDL_USER == pHdl->GetKind()) + if(pHdl && HDL_USER == pHdl->GetKind()) { const TableEdgeHdl* pEdgeHdl = dynamic_cast< const TableEdgeHdl* >( pHdl ); diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 2c2e1bb9df83..b034fafe7994 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -50,7 +50,7 @@ #include #include #include -#include +#include namespace sdr { namespace table { @@ -245,11 +245,11 @@ drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayOb } else { - // embed in 100% transparent UnifiedTransparencePrimitive2D to support HitTest - // of this overlay object + // embed in HiddenGeometryPrimitive2D to support HitTest of this invisible + // overlay object const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1); const drawinglayer::primitive2d::Primitive2DReference aNewReference( - new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aSequence, 1.0)); + new drawinglayer::primitive2d::HiddenGeometryPrimitive2D(aSequence)); aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1); } } diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index b4a941413e70..0afa4aa50096 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -98,47 +98,42 @@ namespace drawinglayer Primitive2DSequence SdrCellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { + // prepare unit polygon Primitive2DSequence aRetval; + const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); - if(!getSdrFTAttribute().getFill().isDefault() - || !getSdrFTAttribute().getText().isDefault()) + // add fill + if(!getSdrFTAttribute().getFill().isDefault()) { - // prepare unit polygon - const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); - - // add fill - if(!getSdrFTAttribute().getFill().isDefault()) - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive( - aUnitPolyPolygon, - getTransform(), - getSdrFTAttribute().getFill(), - getSdrFTAttribute().getFillFloatTransGradient())); - } - else - { - // if no fill create one for HitTest and BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createHiddenGeometryPrimitives2D( - true, - aUnitPolyPolygon, - getTransform())); - } + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getFill(), + getSdrFTAttribute().getFillFloatTransGradient())); + } + else + { + // if no fill create one for HitTest and BoundRect fallback + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, + aUnitPolyPolygon, + getTransform())); + } - // add text - if(!getSdrFTAttribute().getText().isDefault()) - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createTextPrimitive( - aUnitPolyPolygon, - getTransform(), - getSdrFTAttribute().getText(), - attribute::SdrLineAttribute(), - true, - false, - false)); - } + // add text + if(!getSdrFTAttribute().getText().isDefault()) + { + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getText(), + attribute::SdrLineAttribute(), + true, + false, + false)); } return aRetval; -- cgit From af66a011a47f673a9a0ee2c6a0b27e23b11b6ebf Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 21:32:33 +0100 Subject: autorecovery: more sophisticated configuration data for interaction handlers The generic css.task.InteractionHandler implementation in module uui is now able to instantiate "sub handlers", i.e. components to delegate a request to, based on the type of the request, and some configuration data. The "old" (and now deprecated) configuration scheme at org.openoffice.ucb.InteractionHandler did not contain type information, so any handlers registered there were always called when no default implementation for a given request was available. The "new" configuration scheme at org.openoffice.Interaction contains UNO type information. That is, a given handler implementation can declare itself responsible for an arbitrary set of UNO types, and for each of those types, whether it is also responsible for sub types. The generic interaction handler implementation uses this configuration data, when it encounteres an interaction request it cannot fullfill itself, to instantiate a component to delegate the request to. As with the "old" data, such a component is required to support the css.task.XInteractionHandler2 interface. Also, if it supports css.lang.XInitialization, then it will be initialized with a name-value pair, the name being "Parent", the value being the XWindow interface of the parent window for any message boxes. As an examplary implementation for this feature, the css.sdb.InteractionHandler has been deprecated. Now the css.sdb.DatabaseInteractionHandler is reponsible for database-related interactions, and the new configuration scheme is pre-filled with data assigning this responsibility. Consequently, a lot of places previously creating an css.sdb.InteractionHandler have been modified to create the default css.task.InteractionHandler. --- svx/source/form/fmctrler.cxx | 2 +- svx/source/inc/fmservs.hxx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/source/form/fmctrler.cxx b/svx/source/form/fmctrler.cxx index af2a103c5d03..ad4844427685 100644 --- a/svx/source/form/fmctrler.cxx +++ b/svx/source/form/fmctrler.cxx @@ -3942,7 +3942,7 @@ bool FmXFormController::ensureInteractionHandler() if ( !m_xORB.is() ) return false; - m_xInteractionHandler.set( m_xORB->createInstance( SRV_SDB_INTERACTION_HANDLER ), UNO_QUERY ); + m_xInteractionHandler.set( m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), UNO_QUERY ); OSL_ENSURE( m_xInteractionHandler.is(), "FmXFormController::ensureInteractionHandler: could not create an interaction handler!" ); return m_xInteractionHandler.is(); } diff --git a/svx/source/inc/fmservs.hxx b/svx/source/inc/fmservs.hxx index 201a5a351224..bb63f39b64cc 100644 --- a/svx/source/inc/fmservs.hxx +++ b/svx/source/inc/fmservs.hxx @@ -59,7 +59,6 @@ #define FM_CONTROL_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.control.GridControl" ) ) #define FM_FORM_CONTROLLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormController" ) ) #define SRV_SDB_CONNECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.Connection" ) ) -#define SRV_SDB_INTERACTION_HANDLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.InteractionHandler" ) ) #define FM_SUN_COMPONENT_FORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.Form" ) ) #define FM_SUN_COMPONENT_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TextField" ) ) #define FM_SUN_COMPONENT_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ListBox" ) ) -- cgit From db91786a9326d275aeec1fa86c8e9c78a294ca53 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 2 Feb 2010 12:15:37 +0100 Subject: aw079 #i108636# use better operator== for comparing two UNO API sequences of primitives --- svx/source/sdr/primitive2d/sdrole2primitive2d.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index cb9cb8bf3546..7e63c8cb0016 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -64,7 +64,13 @@ namespace drawinglayer { const SdrOle2Primitive2D& rCompare = (SdrOle2Primitive2D&)rPrimitive; - if(getOLEContent() == rCompare.getOLEContent() + // #i108636# The standard operator== on two UNO sequences did not work as i + // would have expected; it just checks the .is() states and the data type + // of the sequence. What i need here is detection of equality of the whole + // sequence content, thus i need to use the arePrimitive2DSequencesEqual helper + // here instead of the operator== which lead to always returning false and thus + // always re-decompositions of the subcontent. + if(arePrimitive2DSequencesEqual(getOLEContent(), rCompare.getOLEContent()) && getTransform() == rCompare.getTransform() && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()) { -- cgit From c51e93fc737bdb7f806ee9ce534706b318042a48 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Mon, 8 Feb 2010 16:03:09 +0100 Subject: mtaccfixes: #i87415 Mnemonics need to be unambiguous --- svx/source/dialog/srchdlg.src | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/srchdlg.src b/svx/source/dialog/srchdlg.src index 2c69a25b92d8..510d7b59ccf7 100644 --- a/svx/source/dialog/srchdlg.src +++ b/svx/source/dialog/srchdlg.src @@ -240,7 +240,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 12 , 163 ) ; Size = MAP_APPFONT ( 126 , 10 ) ; - Text [ en-US ] = "Current selection ~only" ; + Text [ en-US ] = "C~urrent selection only" ; TabStop = TRUE ; Hide = TRUE ; }; @@ -349,7 +349,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 12 , 285 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "~Search in" ; + Text [ en-US ] = "Search i~n" ; Hide = TRUE ; }; ListBox LB_CALC_SEARCHIN @@ -371,7 +371,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 12 , 300 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "~Search direction" ; + Text [ en-US ] = "Search ~direction" ; Hide = TRUE ; }; RadioButton RB_CALC_ROWS @@ -385,7 +385,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 75 , 313 ) ; Size = MAP_APPFONT ( 63 , 10 ) ; - Text [ en-US ] = "Col~umns" ; + Text [ en-US ] = "Colu~mns" ; Hide = TRUE ; }; CheckBox CB_ALL_SHEETS -- cgit From 5f1e3bff24310560c4a3c314bb0cd909d1f423c2 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 9 Feb 2010 11:33:08 +0100 Subject: aw079 #i99386# finer granular changes for MPBGO removal --- svx/inc/svx/sdrmasterpagedescriptor.hxx | 7 + svx/inc/svx/svdobj.hxx | 4 + svx/inc/svx/svdpage.hxx | 118 ++++++++----- .../contact/viewcontactofmasterpagedescriptor.cxx | 32 ++++ svx/source/sdr/contact/viewcontactofsdrpage.cxx | 30 ++++ .../viewobjectcontactofmasterpagedescriptor.cxx | 13 ++ svx/source/sdr/properties/attributeproperties.cxx | 2 + svx/source/svdraw/sdrmasterpagedescriptor.cxx | 21 +++ svx/source/svdraw/svdobj.cxx | 4 + svx/source/svdraw/svdpage.cxx | 194 ++++++++++++++++++++- svx/source/svdraw/svdpntv.cxx | 2 +- svx/source/unodraw/UnoGraphicExporter.cxx | 54 +++++- 12 files changed, 434 insertions(+), 47 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index 52752945255c..a8780c614285 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -34,9 +34,12 @@ #include #include +#define NEWPBG + ////////////////////////////////////////////////////////////////////////////// // predeclarations class SdrObject; +class SfxItemSet; namespace sdr { @@ -92,8 +95,12 @@ namespace sdr sal_Bool operator==(const MasterPageDescriptor& rCandidate) const; sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const; +#ifdef NEWPBG + const SfxItemSet& getCorrectFillAttributes() const; +#else // #i42075# Get the correct BackgroundObject SdrObject* GetBackgroundObject() const; +#endif }; } // end of namespace sdr diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index fce776ef0abf..edab358a2e4a 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -31,6 +31,8 @@ #ifndef _SVDOBJ_HXX #define _SVDOBJ_HXX +#define NEWPBG + #include #include #include @@ -1102,10 +1104,12 @@ public: sal_Bool IsTransparent( BOOL bCheckForAlphaChannel = FALSE ) const; +#ifndef NEWPBG // #111111# // Needed again and again i will now add a test for finding out if // this object is the BackgroundObject of the page. sal_Bool IsMasterPageBackgroundObject() const; +#endif // #116168# // Give info if object is in destruction diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 02181afb1674..60193f132db9 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -31,59 +31,29 @@ #ifndef _SVDPAGE_HXX #define _SVDPAGE_HXX -#include +#define NEWPBG -#ifndef _PRINT_HXX //autogen +#include #include -#endif -#ifndef _GDIMTF_HXX //autogen #include -#endif #include #include #include #include - -////////////////////////////////////////////////////////////////////////////// -// sdr::Comment interface #include - -// #111111# #include #include - -// StandardCheckVisisbilityRedirector #include #include #include "svx/svxdllapi.h" - #include #include #include -// #110094# -namespace sdr -{ - namespace contact - { - class ViewContact; - } // end of namespace contact -} // end of namespace sdr - -// ------------------------------ -// - intern benutzte Paint-Modi - -// ------------------------------ - -//#if 0 // _SOLAR__PRIVATE - -#define IMP_PAGEPAINT_NORMAL 0 -#define IMP_PAGEPAINT_PREPARE_CACHE 1 -#define IMP_PAGEPAINT_PAINT_CACHE 2 -#define IMP_PAGEPAINT_PREPARE_BG_CACHE 3 -#define IMP_PAGEPAINT_PAINT_BG_CACHE 4 - -//#endif // __PRIVATE +////////////////////////////////////////////////////////////////////////////// +// predefines +namespace sdr { namespace contact { class ViewContact; }} class SdrPage; class SdrModel; class SfxItemPool; @@ -113,7 +83,11 @@ public: SdrInsertReasonKind GetReason() const { return eReason; } }; -class SVX_DLLPUBLIC SdrObjList { +////////////////////////////////////////////////////////////////////////////// +// class SdrObjList + +class SVX_DLLPUBLIC SdrObjList +{ private: typedef ::std::vector SdrObjectContainerType; SdrObjectContainerType maList; @@ -350,8 +324,12 @@ Objektes abgefragt sowie direkt gesetzt werden. // Used for all methods which return a page number #define SDRPAGE_NOTFOUND 0xFFFF +////////////////////////////////////////////////////////////////////////////// +// class SdrPageGridFrame + // Fuer das Fangraster/Punkgitter im Writer -class SdrPageGridFrame { +class SdrPageGridFrame +{ Rectangle aPaper; Rectangle aUserArea; public: @@ -383,8 +361,50 @@ public: }; //////////////////////////////////////////////////////////////////////////////////////////////////// +// class SdrPageProperties + +#ifdef NEWPBG + +class SVX_DLLPUBLIC SdrPageProperties : public SfxListener +{ +private: + // data + SdrPage* mpSdrPage; + SfxStyleSheet* mpStyleSheet; + SfxItemSet* mpProperties; + + // internal helpers + void ImpRemoveStyleSheet(); + void ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet); + + // not implemented + SdrPageProperties& operator=(const SdrPageProperties& rCandidate); + +public: + // construct/destruct + SdrPageProperties(SdrPage& rSdrPage); + SdrPageProperties(const SdrPageProperties& rCandidate); + virtual ~SdrPageProperties(); + + // Notify(...) from baseclass SfxListener + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); + + // data read/write + const SfxItemSet& GetItemSet() const; + void PutItemSet(const SfxItemSet& rSet); + void PutItem(const SfxPoolItem& rItem); + void ClearItem(const sal_uInt16 nWhich = 0); + + // StyleSheet access + void SetStyleSheet(SfxStyleSheet* pStyleSheet); + SfxStyleSheet* GetStyleSheet() const; +}; + +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////// +// class SdrPage -class SVX_DLLPUBLIC SdrPage: public SdrObjList, public tools::WeakBase< SdrPage > +class SVX_DLLPUBLIC SdrPage : public SdrObjList, public tools::WeakBase< SdrPage > { /////////////////////////////////////////////////////////////////////////////// // start PageUser section @@ -430,9 +450,19 @@ friend class ChXChartDocument; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxUnoPage; protected: - SdrLayerAdmin* pLayerAdmin; - SdrObject* pBackgroundObj; + SdrLayerAdmin* pLayerAdmin; +#ifndef NEWPBG + SdrObject* pBackgroundObj; +#else +private: + SdrPageProperties* mpSdrPageProperties; + +public: + SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; } + const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; } +#endif +protected: // new MasterPageDescriptorVector ::sdr::MasterPageDescriptor* mpMasterPageDescriptor; @@ -537,8 +567,10 @@ public: bool IsSwappingLocked() const { return mbSwappingLocked; } void SetSwappingLocked(bool bLock) { mbSwappingLocked = bLock; } +#ifndef NEWPBG SdrObject* GetBackgroundObj() const { return pBackgroundObj; } void SetBackgroundObj( SdrObject* pObj ); +#endif ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoPage(); @@ -567,8 +599,8 @@ public: /** Check if page is the HandoutMasterPage (in SVX, no PK_HANDOUT available) */ bool isHandoutMasterPage() const; -////////////////////////////////////////////////////////////////////////////// -// sdr::Comment interface + ////////////////////////////////////////////////////////////////////////////// + // sdr::Comment interface private: sdr::CommentVector maComments; @@ -577,8 +609,6 @@ public: const sdr::Comment& GetCommentByIndex(sal_uInt32 nIndex); void AddComment(const sdr::Comment& rNew); void ReplaceCommentByIndex(sal_uInt32 nIndex, const sdr::Comment& rNew); - -////////////////////////////////////////////////////////////////////////////// }; typedef tools::WeakReference< SdrPage > SdrPageWeakRef; diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index 84f6c7c9bfe2..4dad454af869 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -64,6 +64,33 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; + +#ifdef NEWPBG + // build primitive from page fill attributes + const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes)); + + if(!aFill.isDefault()) + { + // direct model data is the page size, get and use it + const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); + const basegfx::B2DRange aInnerRange( + rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), + rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), + rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } +#else const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject(); if(pBackgroundCandidate) @@ -93,6 +120,7 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } +#endif return xRetval; } @@ -113,20 +141,24 @@ namespace sdr { sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount()); +#ifndef NEWPBG if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) { nRetval--; } +#endif return nRetval; } ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const { +#ifndef NEWPBG if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) { nIndex++; } +#endif return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact(); } diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 12b7e1b0acf4..3018a9dc17e2 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -206,6 +206,31 @@ namespace sdr } else { +#ifdef NEWPBG + // build primitive from pObject's attributes + const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet(); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillAttributes)); + + if(!aFill.isDefault()) + { + // direct model data is the page size, get and use it + const basegfx::B2DRange aInnerRange( + rPage.GetLftBorder(), rPage.GetUppBorder(), + rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + +#else OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)"); if(rPage.GetObjCount()) @@ -239,6 +264,7 @@ namespace sdr } } } +#endif } } @@ -461,20 +487,24 @@ namespace sdr { sal_uInt32 nSubObjectCount(getPage().GetObjCount()); +#ifndef NEWPBG if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) { nSubObjectCount--; } +#endif return nSubObjectCount; } ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const { +#ifndef NEWPBG if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) { nIndex++; } +#endif SdrObject* pObj = getPage().GetObj(nIndex); DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)"); diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx index fa785125118c..f0c3eb2c8bed 100644 --- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx @@ -98,6 +98,18 @@ namespace sdr rDisplayInfo.SetProcessLayers(aPreprocessedLayers); rDisplayInfo.SetSubContentActive(true); +#ifdef NEWPBG + // check layer visibility (traditionally was member of layer 1) + if(aPreprocessedLayers.IsSet(1)) + { + // hide PageBackground for special DrawModes; historical reasons + if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast()) + { + // if visible, create the default background primitive sequence + xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); + } + } +#else // check if there is a MasterPageBackgroundObject and if it's visible in the LayerSet const SdrObject* pBackgroundCandidate = rDescriptor.GetBackgroundObject(); @@ -110,6 +122,7 @@ namespace sdr xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); } } +#endif // hide MasterPage content? Test self here for hierarchy if(isPrimitiveVisible(rDisplayInfo)) diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index 4fcdb12ffe5c..df8944342619 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -587,6 +587,7 @@ namespace sdr bHintUsed = sal_True; } +#ifndef NEWPBG // #111111# // When it's the BackgroundObject, set the MasterPage to changed to // get a refresh for the evtl. changed BackgroundStyle @@ -602,6 +603,7 @@ namespace sdr { GetSdrObject().GetPage()->ActionChanged(); } +#endif if(!bHintUsed) { diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 9cee1e344c6a..dcc519148e27 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -37,6 +37,11 @@ // #i42075# #include +#ifdef NEWPBG +#include +#include +#endif + ////////////////////////////////////////////////////////////////////////////// namespace sdr @@ -98,6 +103,7 @@ namespace sdr maVisibleLayers = rNew; GetViewContact().ActionChanged(); +#ifndef NEWPBG // #i42075# For AFs convenience, do a change notify at the MasterPageBackgroundObject, too SdrObject* pObject = GetBackgroundObject(); @@ -105,6 +111,7 @@ namespace sdr { pObject->BroadcastObjectChange(); } +#endif } } @@ -123,6 +130,19 @@ namespace sdr || maVisibleLayers != rCandidate.maVisibleLayers); } +#ifdef NEWPBG + const SfxItemSet& MasterPageDescriptor::getCorrectFillAttributes() const + { + const SfxItemSet& rOwnerPageAtributes = GetOwnerPage().getSdrPageProperties().GetItemSet(); + + if(XFILL_NONE != ((const XFillStyleItem&)rOwnerPageAtributes.Get(XATTR_FILLSTYLE)).GetValue()) + { + return rOwnerPageAtributes; + } + + return GetUsedPage().getSdrPageProperties().GetItemSet(); + } +#else // #i42075# Get the correct BackgroundObject SdrObject* MasterPageDescriptor::GetBackgroundObject() const { @@ -158,6 +178,7 @@ namespace sdr return pRetval; } +#endif } // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 3ed33e0f20ad..58f3d4ce2873 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -375,6 +375,7 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const // DrawContact support: Methods for handling Object changes void SdrObject::ActionChanged() const { +#ifndef NEWPBG // Forward change call to MasterPageDescriptor if BackgroundObject was changed const SdrPage* pObjectsPage = GetPage(); @@ -419,6 +420,7 @@ void SdrObject::ActionChanged() const } } } +#endif // Do necessary ViewContact actions GetViewContact().ActionChanged(); @@ -3117,6 +3119,7 @@ void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const ba SetSnapRect(aBaseRect); } +#ifndef NEWPBG // #111111# // Needed again and again i will now add a test for finding out if // this object is the BackgroundObject of the page. @@ -3136,6 +3139,7 @@ sal_Bool SdrObject::IsMasterPageBackgroundObject() const return sal_False; } +#endif // #116168# // Give info if object is in destruction diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 864cc3d77e8d..b53606d53aeb 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -69,6 +69,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -1175,6 +1176,140 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const return *mpViewContact; } +//////////////////////////////////////////////////////////////////////////////////////////////////// +#ifdef NEWPBG + +void SdrPageProperties::ImpRemoveStyleSheet() +{ + if(mpStyleSheet) + { + EndListening(*mpStyleSheet); + mpProperties->SetParent(0); + mpStyleSheet = 0; + } +} + +void SdrPageProperties::ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet) +{ + if(mpStyleSheet != &rNewStyleSheet) + { + ImpRemoveStyleSheet(); + mpStyleSheet = &rNewStyleSheet; + StartListening(rNewStyleSheet); + mpProperties->SetParent(&rNewStyleSheet.GetItemSet()); + } +} + +void ImpPageChange(SdrPage& rSdrPage) +{ + rSdrPage.ActionChanged(); + + if(rSdrPage.GetModel()) + { + rSdrPage.GetModel()->SetChanged(true); + SdrHint aHint(HINT_PAGEORDERCHG); + aHint.SetPage(&rSdrPage); + rSdrPage.GetModel()->Broadcast(aHint); + } +} + +SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) +: mpSdrPage(&rSdrPage), + mpStyleSheet(0), + mpProperties(new SfxItemSet(mpSdrPage->GetModel()->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST)) +{ + if(!rSdrPage.IsMasterPage()) + { + mpProperties->Put(XFillStyleItem(XFILL_NONE)); + } +} + +SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) +: mpSdrPage(rCandidate.mpSdrPage), + mpStyleSheet(0), + mpProperties(new SfxItemSet(*rCandidate.mpProperties)) +{ + if(rCandidate.GetStyleSheet()) + { + ImpAddStyleSheet(*rCandidate.GetStyleSheet()); + } +} + +SdrPageProperties::~SdrPageProperties() +{ + ImpRemoveStyleSheet(); + delete mpProperties; +} + +void SdrPageProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) +{ + const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint* >(&rHint); + + if(pSimpleHint) + { + switch(pSimpleHint->GetId()) + { + case SFX_HINT_DATACHANGED : + { + // notify change, broadcast + ImpPageChange(*mpSdrPage); + break; + } + case SFX_HINT_DYING : + { + // Style needs to be forgotten + ImpRemoveStyleSheet(); + break; + } + } + } +} + +const SfxItemSet& SdrPageProperties::GetItemSet() const +{ + return *mpProperties; +} + +void SdrPageProperties::PutItemSet(const SfxItemSet& rSet) +{ + OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)"); + mpProperties->Put(rSet); + ImpPageChange(*mpSdrPage); +} + +void SdrPageProperties::PutItem(const SfxPoolItem& rItem) +{ + OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)"); + mpProperties->Put(rItem); + ImpPageChange(*mpSdrPage); +} + +void SdrPageProperties::ClearItem(const sal_uInt16 nWhich) +{ + mpProperties->ClearItem(nWhich); + ImpPageChange(*mpSdrPage); +} + +void SdrPageProperties::SetStyleSheet(SfxStyleSheet* pStyleSheet) +{ + if(pStyleSheet) + { + ImpAddStyleSheet(*pStyleSheet); + } + else + { + ImpRemoveStyleSheet(); + } + + ImpPageChange(*mpSdrPage); +} + +SfxStyleSheet* SdrPageProperties::GetStyleSheet() const +{ + return mpStyleSheet; +} + +#endif //////////////////////////////////////////////////////////////////////////////////////////////////// TYPEINIT1(SdrPage,SdrObjList); @@ -1189,7 +1324,11 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) nBordRgt(0L), nBordLwr(0L), pLayerAdmin(new SdrLayerAdmin(&rNewModel.GetLayerAdmin())), +#ifndef NEWPBG pBackgroundObj(0L), +#else + mpSdrPageProperties(0), +#endif mpMasterPageDescriptor(0L), nPageNum(0L), mbMaster(bMasterPage), @@ -1201,6 +1340,10 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) DBG_CTOR(SdrPage,NULL); aPrefVisiLayers.SetAll(); eListKind = (bMasterPage) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; + +#ifdef NEWPBG + mpSdrPageProperties = new SdrPageProperties(*this); +#endif } SdrPage::SdrPage(const SdrPage& rSrcPage) @@ -1214,7 +1357,11 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) nBordRgt(rSrcPage.nBordRgt), nBordLwr(rSrcPage.nBordLwr), pLayerAdmin(new SdrLayerAdmin(rSrcPage.pModel->GetLayerAdmin())), +#ifndef NEWPBG pBackgroundObj(0L), +#else + mpSdrPageProperties(0), +#endif mpMasterPageDescriptor(0L), nPageNum(rSrcPage.nPageNum), mbMaster(rSrcPage.mbMaster), @@ -1248,6 +1395,10 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) mxUnoPage = NULL; xComponent->dispose(); } + +#ifdef NEWPBG + mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); +#endif } SdrPage::~SdrPage() @@ -1281,7 +1432,9 @@ SdrPage::~SdrPage() // when they get called from PageInDestruction(). maPageUsers.clear(); +#ifndef NEWPBG SdrObject::Free( pBackgroundObj ); +#endif delete pLayerAdmin; TRG_ClearMasterPage(); @@ -1293,6 +1446,13 @@ SdrPage::~SdrPage() mpViewContact = 0L; } +#ifdef NEWPBG + { + delete mpSdrPageProperties; + mpSdrPageProperties = 0; + } +#endif + DBG_DTOR(SdrPage,NULL); } @@ -1304,7 +1464,9 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mpViewContact = 0L; } +#ifndef NEWPBG SdrObject::Free( pBackgroundObj ); +#endif // Joe also sets some parameters for the class this one // is derived from. SdrObjList does the same bad handling of @@ -1339,6 +1501,7 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; +#ifndef NEWPBG if(rSrcPage.pBackgroundObj) { pBackgroundObj = rSrcPage.pBackgroundObj->Clone(); @@ -1348,6 +1511,12 @@ void SdrPage::operator=(const SdrPage& rSrcPage) // #i62000# for single-page MPBGO, force no line pBackgroundObj->SetMergedItem(XLineStyleItem(XLINE_NONE)); } +#else + { + delete mpSdrPageProperties; + mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); + } +#endif // Now copy the contained obejcts (by cloning them) SdrObjList::operator=(rSrcPage); @@ -1526,8 +1695,16 @@ void SdrPage::SetModel(SdrModel* pNewModel) } pLayerAdmin->SetModel(pNewModel); +#ifndef NEWPBG if( pBackgroundObj ) pBackgroundObj->SetModel( pNewModel ); +#else + { + SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); + delete mpSdrPageProperties; + mpSdrPageProperties = pNew; + } +#endif } // update listeners at possible api wrapper object @@ -1661,6 +1838,7 @@ XubString SdrPage::GetLayoutName() const return String(); } +#ifndef NEWPBG void SdrPage::SetBackgroundObj( SdrObject* pObj ) { if ( pObj ) @@ -1676,6 +1854,7 @@ void SdrPage::SetBackgroundObj( SdrObject* pObj ) SdrObject::Free( pBackgroundObj ); pBackgroundObj = pObj; } +#endif void SdrPage::SetInserted( bool bIns ) { @@ -1750,10 +1929,22 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay ) aColor = pView->GetApplicationDocumentColor(); } +#ifdef NEWPBG + const SfxItemSet* pBackgroundFill = &getSdrPageProperties().GetItemSet(); + + if(!IsMasterPage() && TRG_HasMasterPage()) + { + if(XFILL_NONE == ((const XFillStyleItem&)pBackgroundFill->Get(XATTR_FILLSTYLE)).GetValue()) + { + pBackgroundFill = &TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + } + } + + GetDraftFillColor(*pBackgroundFill, aColor); +#else // first, see if we have a background object SdrObject* pBackgroundObj2 = NULL; - if( IsMasterPage() ) { if( GetObjCount() ) @@ -1782,6 +1973,7 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay ) const SfxItemSet& rSet = pBackgroundObj2->GetMergedItemSet(); GetDraftFillColor( rSet, aColor ); } +#endif return aColor; } diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 8c46e1d06bb6..2d04301433e9 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -335,7 +335,7 @@ void __EXPORT SdrPaintView::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint if (eKind==HINT_PAGEORDERCHG) { const SdrPage* pPg=pSdrHint->GetPage(); - if(!pPg->IsInserted()) + if(pPg && !pPg->IsInserted()) { if(mpPageView && mpPageView->GetPage() == pPg) { diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index ebd8f83e00f0..1e191f3125c1 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -618,6 +618,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, VirtualDevice aVDev; const MapMode aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY ); +#ifndef NEWPBG // create a view SdrView* pView; @@ -633,17 +634,25 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, pView->SetBordVisible( FALSE ); pView->SetPageVisible( FALSE ); pView->ShowSdrPage( pPage ); +#endif SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL); maOldCalcFieldValueHdl = rOutl.GetCalcFieldValueHdl(); rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) ); +#ifdef NEWPBG + rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor() ); +#else rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pView->GetSdrPageView()) ); +#endif // #i102251# const sal_uInt32 nOldCntrl(rOutl.GetControlWord()); sal_uInt32 nCntrl = nOldCntrl & ~EE_CNTRL_ONLINESPELLING; rOutl.SetControlWord(nCntrl); +#ifdef NEWPBG + SdrObject* pTempBackgroundShape = 0; +#endif std::vector< SdrObject* > aShapes; bool bRet = true; @@ -652,6 +661,12 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, { if( rSettings.mbExportOnlyBackground ) { +#ifdef NEWPBG + pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize())); + pTempBackgroundShape->SetMergedItemSet(pPage->getSdrPageProperties().GetItemSet()); + pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE)); + aShapes.push_back(pTempBackgroundShape); +#else SdrObject* pShape = 0; if( pPage->IsMasterPage() ) { @@ -665,6 +680,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, if( pShape ) aShapes.push_back( pShape ); +#endif } else { @@ -741,8 +757,26 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aVDev.SetDrawMode( aVDev.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ); aVDev.EnableOutput( FALSE ); aMtf.Record( &aVDev ); - Size aNewSize; + +#ifdef NEWPBG + // create a view + SdrView* pView; + + if( PTR_CAST( FmFormModel, mpDoc ) ) + { + pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ); + } + else + { + pView = new SdrView( mpDoc, &aVDev ); + } + + pView->SetBordVisible( FALSE ); + pView->SetPageVisible( FALSE ); + pView->ShowSdrPage( pPage ); +#endif + if ( pView && pPage ) { pView->SetBordVisible( FALSE ); @@ -783,6 +817,13 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aGraphic = Graphic(aMtf); } +#ifdef NEWPBG + if ( pView ) + { + pView->HideSdrPage(); + delete pView; + } +#endif if( rSettings.mbTranslucent ) { Size aOutSize; @@ -907,6 +948,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, // calculate bound rect for all shapes Rectangle aBound; +#ifndef NEWPBG if(rSettings.mbExportOnlyBackground) { // shape is MPBGO and if it's not yet set, it's size will @@ -916,6 +958,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aBound = Rectangle(Point(0,0), pPage->GetSize()); } else +#endif { std::vector< SdrObject* >::iterator aIter = aShapes.begin(); const std::vector< SdrObject* >::iterator aEnd = aShapes.end(); @@ -989,11 +1032,20 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, } } +#ifndef NEWPBG if ( pView ) { pView->HideSdrPage(); delete pView; } +#endif + +#ifdef NEWPBG + if(pTempBackgroundShape) + { + SdrObject::Free(pTempBackgroundShape); + } +#endif rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl ); -- cgit From 3497a025cea0fc5fc0a7ca3ad835b17c6ae38573 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 10 Feb 2010 12:16:22 +0100 Subject: aw079: changes after resync (linux) --- svx/source/svdraw/svdpage.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index b53606d53aeb..7516148d7a47 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1214,7 +1214,8 @@ void ImpPageChange(SdrPage& rSdrPage) } SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) -: mpSdrPage(&rSdrPage), +: SfxListener(), + mpSdrPage(&rSdrPage), mpStyleSheet(0), mpProperties(new SfxItemSet(mpSdrPage->GetModel()->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST)) { @@ -1225,7 +1226,8 @@ SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) } SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) -: mpSdrPage(rCandidate.mpSdrPage), +: SfxListener(), + mpSdrPage(rCandidate.mpSdrPage), mpStyleSheet(0), mpProperties(new SfxItemSet(*rCandidate.mpProperties)) { @@ -1241,7 +1243,7 @@ SdrPageProperties::~SdrPageProperties() delete mpProperties; } -void SdrPageProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) +void SdrPageProperties::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint* >(&rHint); -- cgit From c4eadd3cb2aa9e6e12123683728b9dd2c587eb25 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 11 Feb 2010 17:35:16 +0100 Subject: aw079 #i99386# cleanup of define and last change from CL --- svx/inc/svx/sdrmasterpagedescriptor.hxx | 7 -- svx/inc/svx/svdobj.hxx | 9 -- svx/inc/svx/svdpage.hxx | 14 --- .../contact/viewcontactofmasterpagedescriptor.cxx | 50 +---------- svx/source/sdr/contact/viewcontactofsdrpage.cxx | 55 +----------- .../viewobjectcontactofmasterpagedescriptor.cxx | 15 ---- svx/source/sdr/properties/attributeproperties.cxx | 18 ---- svx/source/svdraw/sdrmasterpagedescriptor.cxx | 51 ----------- svx/source/svdraw/svdobj.cxx | 69 -------------- svx/source/svdraw/svdpage.cxx | 100 +-------------------- svx/source/unodraw/UnoGraphicExporter.cxx | 66 +------------- 11 files changed, 6 insertions(+), 448 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index a8780c614285..cee577767a06 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -34,8 +34,6 @@ #include #include -#define NEWPBG - ////////////////////////////////////////////////////////////////////////////// // predeclarations class SdrObject; @@ -95,12 +93,7 @@ namespace sdr sal_Bool operator==(const MasterPageDescriptor& rCandidate) const; sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const; -#ifdef NEWPBG const SfxItemSet& getCorrectFillAttributes() const; -#else - // #i42075# Get the correct BackgroundObject - SdrObject* GetBackgroundObject() const; -#endif }; } // end of namespace sdr diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index edab358a2e4a..f953d6b4ed78 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -31,8 +31,6 @@ #ifndef _SVDOBJ_HXX #define _SVDOBJ_HXX -#define NEWPBG - #include #include #include @@ -1104,13 +1102,6 @@ public: sal_Bool IsTransparent( BOOL bCheckForAlphaChannel = FALSE ) const; -#ifndef NEWPBG - // #111111# - // Needed again and again i will now add a test for finding out if - // this object is the BackgroundObject of the page. - sal_Bool IsMasterPageBackgroundObject() const; -#endif - // #116168# // Give info if object is in destruction sal_Bool IsInDestruction() const; diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 60193f132db9..bb0ed9e8cee3 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -31,8 +31,6 @@ #ifndef _SVDPAGE_HXX #define _SVDPAGE_HXX -#define NEWPBG - #include #include #include @@ -363,8 +361,6 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////// // class SdrPageProperties -#ifdef NEWPBG - class SVX_DLLPUBLIC SdrPageProperties : public SfxListener { private: @@ -400,7 +396,6 @@ public: SfxStyleSheet* GetStyleSheet() const; }; -#endif //////////////////////////////////////////////////////////////////////////////////////////////////// // class SdrPage @@ -451,16 +446,12 @@ friend class ChXChartDocument; protected: SdrLayerAdmin* pLayerAdmin; -#ifndef NEWPBG - SdrObject* pBackgroundObj; -#else private: SdrPageProperties* mpSdrPageProperties; public: SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; } const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; } -#endif protected: // new MasterPageDescriptorVector @@ -567,11 +558,6 @@ public: bool IsSwappingLocked() const { return mbSwappingLocked; } void SetSwappingLocked(bool bLock) { mbSwappingLocked = bLock; } -#ifndef NEWPBG - SdrObject* GetBackgroundObj() const { return pBackgroundObj; } - void SetBackgroundObj( SdrObject* pObj ); -#endif - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoPage(); virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const; diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index 4dad454af869..d99c6f7baa5f 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -65,7 +65,6 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence xRetval; -#ifdef NEWPBG // build primitive from page fill attributes const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); const drawinglayer::attribute::SdrFillAttribute aFill( @@ -90,37 +89,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } -#else - const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject(); - - if(pBackgroundCandidate) - { - // build primitive from pBackgroundCandidate's attributes - const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - - if(!aFill.isDefault()) - { - // direct model data is the page size, get and use it - const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); - const basegfx::B2DRange aInnerRange( - rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), - rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), - rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference( - drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), - aEmptyTransform, - aFill, - drawinglayer::attribute::FillGradientAttribute())); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } -#endif return xRetval; } @@ -139,27 +107,11 @@ namespace sdr sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const { - sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount()); - -#ifndef NEWPBG - if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) - { - nRetval--; - } -#endif - - return nRetval; + return GetMasterPageDescriptor().GetUsedPage().GetObjCount(); } ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const { -#ifndef NEWPBG - if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) - { - nIndex++; - } -#endif - return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact(); } diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 3018a9dc17e2..d469b15a761a 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -206,7 +206,6 @@ namespace sdr } else { -#ifdef NEWPBG // build primitive from pObject's attributes const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet(); const drawinglayer::attribute::SdrFillAttribute aFill( @@ -229,42 +228,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } - -#else - OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)"); - - if(rPage.GetObjCount()) - { - SdrObject* pObject = rPage.GetObj(0); - OSL_ENSURE(pObject && pObject->IsMasterPageBackgroundObject(), "MasterPage with wrong MPBGO detected (!)"); - - if(pObject && pObject->IsMasterPageBackgroundObject()) - { - // build primitive from pObject's attributes - const SfxItemSet& rFillProperties = pObject->GetMergedItemSet(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - - if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) - { - // direct model data is the page size, get and use it - const basegfx::B2DRange aInnerRange( - rPage.GetLftBorder(), rPage.GetUppBorder(), - rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference( - drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), - aEmptyTransform, - aFill, - drawinglayer::attribute::FillGradientAttribute())); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - } -#endif } } @@ -485,27 +448,11 @@ namespace sdr sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const { - sal_uInt32 nSubObjectCount(getPage().GetObjCount()); - -#ifndef NEWPBG - if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) - { - nSubObjectCount--; - } -#endif - - return nSubObjectCount; + return getPage().GetObjCount(); } ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const { -#ifndef NEWPBG - if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) - { - nIndex++; - } -#endif - SdrObject* pObj = getPage().GetObj(nIndex); DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)"); return pObj->GetViewContact(); diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx index f0c3eb2c8bed..f5ca659f501c 100644 --- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx @@ -98,7 +98,6 @@ namespace sdr rDisplayInfo.SetProcessLayers(aPreprocessedLayers); rDisplayInfo.SetSubContentActive(true); -#ifdef NEWPBG // check layer visibility (traditionally was member of layer 1) if(aPreprocessedLayers.IsSet(1)) { @@ -109,20 +108,6 @@ namespace sdr xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); } } -#else - // check if there is a MasterPageBackgroundObject and if it's visible in the LayerSet - const SdrObject* pBackgroundCandidate = rDescriptor.GetBackgroundObject(); - - if(pBackgroundCandidate && aPreprocessedLayers.IsSet(pBackgroundCandidate->GetLayer())) - { - // hide PageBackground for special DrawModes; historical reasons - if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast()) - { - // if yes, create the default background primitive sequence - xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); - } - } -#endif // hide MasterPage content? Test self here for hierarchy if(isPrimitiveVisible(rDisplayInfo)) diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index df8944342619..b6dbf9aab670 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -587,24 +587,6 @@ namespace sdr bHintUsed = sal_True; } -#ifndef NEWPBG - // #111111# - // When it's the BackgroundObject, set the MasterPage to changed to - // get a refresh for the evtl. changed BackgroundStyle - - // #114265# - // To only invalidate the page when the StyleSheet change happens, - // some more rigid testing is necessary. - const SfxSimpleHint *pSimpleHint = PTR_CAST(SfxSimpleHint, &rHint); - - if(pSimpleHint - && pSimpleHint->GetId() == SFX_HINT_DATACHANGED - && GetSdrObject().IsMasterPageBackgroundObject()) - { - GetSdrObject().GetPage()->ActionChanged(); - } -#endif - if(!bHintUsed) { // forward to SdrObject ATM. Not sure if this will be necessary diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index dcc519148e27..8ad41c90ded5 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -36,11 +36,8 @@ // #i42075# #include - -#ifdef NEWPBG #include #include -#endif ////////////////////////////////////////////////////////////////////////////// @@ -102,16 +99,6 @@ namespace sdr { maVisibleLayers = rNew; GetViewContact().ActionChanged(); - -#ifndef NEWPBG - // #i42075# For AFs convenience, do a change notify at the MasterPageBackgroundObject, too - SdrObject* pObject = GetBackgroundObject(); - - if(pObject) - { - pObject->BroadcastObjectChange(); - } -#endif } } @@ -130,7 +117,6 @@ namespace sdr || maVisibleLayers != rCandidate.maVisibleLayers); } -#ifdef NEWPBG const SfxItemSet& MasterPageDescriptor::getCorrectFillAttributes() const { const SfxItemSet& rOwnerPageAtributes = GetOwnerPage().getSdrPageProperties().GetItemSet(); @@ -142,43 +128,6 @@ namespace sdr return GetUsedPage().getSdrPageProperties().GetItemSet(); } -#else - // #i42075# Get the correct BackgroundObject - SdrObject* MasterPageDescriptor::GetBackgroundObject() const - { - SdrObject* pRetval = 0L; - const SdrPage& rMasterPage = GetUsedPage(); - - // Here i will rely on old knowledge about the 0'st element of a masterpage - // being the PageBackgroundObject. This will be removed again when that definition - // will be changed. -#ifdef DBG_UTIL - const sal_uInt32 nMasterPageObjectCount(rMasterPage.GetObjCount()); - DBG_ASSERT(1 <= nMasterPageObjectCount, - "MasterPageDescriptor::GetBackgroundObject(): MasterPageBackgroundObject missing (!)"); -#endif - pRetval = rMasterPage.GetObj(0L); - - // Test if it's really what we need. There are known problems where - // the 0th object is not the MasterPageBackgroundObject at all. - if(pRetval && !pRetval->IsMasterPageBackgroundObject()) - { - pRetval = 0L; - } - - // Get the evtl. existing page background object from the using page and use it - // preferred to the MasterPageBackgroundObject - const SdrPage& rOwnerPage = GetOwnerPage(); - SdrObject* pCandidate = rOwnerPage.GetBackgroundObj(); - - if(pCandidate) - { - pRetval = pCandidate; - } - - return pRetval; - } -#endif } // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 58f3d4ce2873..1ddbcb2a8b4c 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -375,53 +375,6 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const // DrawContact support: Methods for handling Object changes void SdrObject::ActionChanged() const { -#ifndef NEWPBG - // Forward change call to MasterPageDescriptor if BackgroundObject was changed - const SdrPage* pObjectsPage = GetPage(); - - if(pObjectsPage) - { - // do the necessary ActionChange() forwards when a MasterPageBackgroundObject - // gets changed. This can be removed as soon as the MasterPageBackgroundObject - // handling is replaced with the proper ItemSet handling at the SdrPages. The - // needed ActionChanged calls will then be triggered by changing those ItemSets. - if(pObjectsPage->IsMasterPage()) - { - if(IsMasterPageBackgroundObject()) - { - SdrModel* pObjectsModel = GetModel(); - - if(pObjectsModel) - { - const sal_uInt16 nCount(pObjectsModel->GetPageCount()); - - for(sal_uInt16 a(0); a < nCount; a++) - { - const SdrPage* pUserPage = pObjectsModel->GetPage(a); - - if(pUserPage && pUserPage->TRG_HasMasterPage()) - { - SdrPage& rUsedMasterPage = pUserPage->TRG_GetMasterPage(); - - if(&rUsedMasterPage == pObjectsPage) - { - pUserPage->TRG_GetMasterPageDescriptorViewContact().ActionChanged(); - } - } - } - } - } - } - else - { - if(pObjectsPage->TRG_HasMasterPage() && pObjectsPage->GetBackgroundObj() == this) - { - pObjectsPage->TRG_GetMasterPageDescriptorViewContact().ActionChanged(); - } - } - } -#endif - // Do necessary ViewContact actions GetViewContact().ActionChanged(); } @@ -3119,28 +3072,6 @@ void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const ba SetSnapRect(aBaseRect); } -#ifndef NEWPBG -// #111111# -// Needed again and again i will now add a test for finding out if -// this object is the BackgroundObject of the page. -sal_Bool SdrObject::IsMasterPageBackgroundObject() const -{ - if(pObjList - && pObjList == pPage - && pPage->IsMasterPage() - && pObjList->GetObj(0) == this - && 1L == (pPage->GetPageNum() % 2)) - { - // 0'th object, directly on page, page is MasterPage, - // MasterPagePageNum is 1,3,5,... - // --> It's the background object (!) - return sal_True; - } - - return sal_False; -} -#endif - // #116168# // Give info if object is in destruction sal_Bool SdrObject::IsInDestruction() const diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 7516148d7a47..15a9e1886472 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1177,7 +1177,6 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const } //////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef NEWPBG void SdrPageProperties::ImpRemoveStyleSheet() { @@ -1311,7 +1310,6 @@ SfxStyleSheet* SdrPageProperties::GetStyleSheet() const return mpStyleSheet; } -#endif //////////////////////////////////////////////////////////////////////////////////////////////////// TYPEINIT1(SdrPage,SdrObjList); @@ -1326,11 +1324,7 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) nBordRgt(0L), nBordLwr(0L), pLayerAdmin(new SdrLayerAdmin(&rNewModel.GetLayerAdmin())), -#ifndef NEWPBG - pBackgroundObj(0L), -#else mpSdrPageProperties(0), -#endif mpMasterPageDescriptor(0L), nPageNum(0L), mbMaster(bMasterPage), @@ -1343,9 +1337,7 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) aPrefVisiLayers.SetAll(); eListKind = (bMasterPage) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; -#ifdef NEWPBG mpSdrPageProperties = new SdrPageProperties(*this); -#endif } SdrPage::SdrPage(const SdrPage& rSrcPage) @@ -1359,11 +1351,7 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) nBordRgt(rSrcPage.nBordRgt), nBordLwr(rSrcPage.nBordLwr), pLayerAdmin(new SdrLayerAdmin(rSrcPage.pModel->GetLayerAdmin())), -#ifndef NEWPBG - pBackgroundObj(0L), -#else mpSdrPageProperties(0), -#endif mpMasterPageDescriptor(0L), nPageNum(rSrcPage.nPageNum), mbMaster(rSrcPage.mbMaster), @@ -1398,9 +1386,7 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) xComponent->dispose(); } -#ifdef NEWPBG mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); -#endif } SdrPage::~SdrPage() @@ -1434,9 +1420,6 @@ SdrPage::~SdrPage() // when they get called from PageInDestruction(). maPageUsers.clear(); -#ifndef NEWPBG - SdrObject::Free( pBackgroundObj ); -#endif delete pLayerAdmin; TRG_ClearMasterPage(); @@ -1448,12 +1431,10 @@ SdrPage::~SdrPage() mpViewContact = 0L; } -#ifdef NEWPBG { delete mpSdrPageProperties; mpSdrPageProperties = 0; } -#endif DBG_DTOR(SdrPage,NULL); } @@ -1466,10 +1447,6 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mpViewContact = 0L; } -#ifndef NEWPBG - SdrObject::Free( pBackgroundObj ); -#endif - // Joe also sets some parameters for the class this one // is derived from. SdrObjList does the same bad handling of // copy constructor and operator=, so i better let it stand here. @@ -1503,22 +1480,10 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; -#ifndef NEWPBG - if(rSrcPage.pBackgroundObj) - { - pBackgroundObj = rSrcPage.pBackgroundObj->Clone(); - pBackgroundObj->SetPage( this ); - pBackgroundObj->SetModel( pModel ); - - // #i62000# for single-page MPBGO, force no line - pBackgroundObj->SetMergedItem(XLineStyleItem(XLINE_NONE)); - } -#else { delete mpSdrPageProperties; mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); } -#endif // Now copy the contained obejcts (by cloning them) SdrObjList::operator=(rSrcPage); @@ -1697,16 +1662,9 @@ void SdrPage::SetModel(SdrModel* pNewModel) } pLayerAdmin->SetModel(pNewModel); -#ifndef NEWPBG - if( pBackgroundObj ) - pBackgroundObj->SetModel( pNewModel ); -#else - { - SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); - delete mpSdrPageProperties; - mpSdrPageProperties = pNew; - } -#endif + SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); + delete mpSdrPageProperties; + mpSdrPageProperties = pNew; } // update listeners at possible api wrapper object @@ -1840,24 +1798,6 @@ XubString SdrPage::GetLayoutName() const return String(); } -#ifndef NEWPBG -void SdrPage::SetBackgroundObj( SdrObject* pObj ) -{ - if ( pObj ) - { - pObj->SetPage( this ); - pObj->SetModel( pModel ); - pObj->SetLayer( 1 ); // Nothing known about the backgroundlayer... - - // #i62000# for single-page MPBGO, force no line - pObj->SetMergedItem(XLineStyleItem(XLINE_NONE)); - } - - SdrObject::Free( pBackgroundObj ); - pBackgroundObj = pObj; -} -#endif - void SdrPage::SetInserted( bool bIns ) { if( mbInserted != bIns ) @@ -1931,7 +1871,6 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay ) aColor = pView->GetApplicationDocumentColor(); } -#ifdef NEWPBG const SfxItemSet* pBackgroundFill = &getSdrPageProperties().GetItemSet(); if(!IsMasterPage() && TRG_HasMasterPage()) @@ -1943,39 +1882,6 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay ) } GetDraftFillColor(*pBackgroundFill, aColor); -#else - // first, see if we have a background object - SdrObject* pBackgroundObj2 = NULL; - - if( IsMasterPage() ) - { - if( GetObjCount() ) - pBackgroundObj2 = GetObj( 0 ); - } - else - { - pBackgroundObj2 = GetBackgroundObj(); - if( NULL == pBackgroundObj2 ) - { - // if not, see if we have a masterpage and get that background object - if(TRG_HasMasterPage()) - { - SdrPage& rMasterPage = TRG_GetMasterPage(); - - if(rMasterPage.GetObjCount()) - { - pBackgroundObj2 = rMasterPage.GetObj( 0 ); - } - } - } - } - - if( pBackgroundObj2 ) - { - const SfxItemSet& rSet = pBackgroundObj2->GetMergedItemSet(); - GetDraftFillColor( rSet, aColor ); - } -#endif return aColor; } diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 1e191f3125c1..9218d13a667a 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -618,41 +618,17 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, VirtualDevice aVDev; const MapMode aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY ); -#ifndef NEWPBG - // create a view - SdrView* pView; - - if( PTR_CAST( FmFormModel, mpDoc ) ) - { - pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ); - } - else - { - pView = new SdrView( mpDoc, &aVDev ); - } - - pView->SetBordVisible( FALSE ); - pView->SetPageVisible( FALSE ); - pView->ShowSdrPage( pPage ); -#endif - SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL); maOldCalcFieldValueHdl = rOutl.GetCalcFieldValueHdl(); rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) ); -#ifdef NEWPBG rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor() ); -#else - rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pView->GetSdrPageView()) ); -#endif // #i102251# const sal_uInt32 nOldCntrl(rOutl.GetControlWord()); sal_uInt32 nCntrl = nOldCntrl & ~EE_CNTRL_ONLINESPELLING; rOutl.SetControlWord(nCntrl); -#ifdef NEWPBG SdrObject* pTempBackgroundShape = 0; -#endif std::vector< SdrObject* > aShapes; bool bRet = true; @@ -661,26 +637,10 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, { if( rSettings.mbExportOnlyBackground ) { -#ifdef NEWPBG pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize())); pTempBackgroundShape->SetMergedItemSet(pPage->getSdrPageProperties().GetItemSet()); pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE)); aShapes.push_back(pTempBackgroundShape); -#else - SdrObject* pShape = 0; - if( pPage->IsMasterPage() ) - { - if( pPage->GetObjCount() > 0 ) - pShape = pPage->GetObj(0); - } - else - { - pShape = pPage->GetBackgroundObj(); - } - - if( pShape ) - aShapes.push_back( pShape ); -#endif } else { @@ -759,7 +719,6 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aMtf.Record( &aVDev ); Size aNewSize; -#ifdef NEWPBG // create a view SdrView* pView; @@ -775,7 +734,6 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, pView->SetBordVisible( FALSE ); pView->SetPageVisible( FALSE ); pView->ShowSdrPage( pPage ); -#endif if ( pView && pPage ) { @@ -817,13 +775,12 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aGraphic = Graphic(aMtf); } -#ifdef NEWPBG if ( pView ) { pView->HideSdrPage(); delete pView; } -#endif + if( rSettings.mbTranslucent ) { Size aOutSize; @@ -948,17 +905,6 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, // calculate bound rect for all shapes Rectangle aBound; -#ifndef NEWPBG - if(rSettings.mbExportOnlyBackground) - { - // shape is MPBGO and if it's not yet set, it's size will - // be empty when using GetCurrentBoundRect(). Since anyways - // the page size is used by MPBGO and MPBGO is EOLd, get - // the wanted size from the page model directly - aBound = Rectangle(Point(0,0), pPage->GetSize()); - } - else -#endif { std::vector< SdrObject* >::iterator aIter = aShapes.begin(); const std::vector< SdrObject* >::iterator aEnd = aShapes.end(); @@ -1032,20 +978,10 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, } } -#ifndef NEWPBG - if ( pView ) - { - pView->HideSdrPage(); - delete pView; - } -#endif - -#ifdef NEWPBG if(pTempBackgroundShape) { SdrObject::Free(pTempBackgroundShape); } -#endif rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl ); -- cgit From 7084956e2f62bbe9d1ae9356958ac40f2c3c9784 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 18 Feb 2010 12:19:04 +0100 Subject: aw079: corrected include path --- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index a1ef5d8f0957..a1090d92a889 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -75,7 +75,7 @@ #include #include #include -#include +#include #include #include #include -- cgit From 6184419197b90f2012cb22300f958ca128513669 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Feb 2010 13:04:13 +0100 Subject: autorecovery: oops, GetFormState broke with one of the recent changes - fixed --- svx/source/form/fmshell.cxx | 3 --- 1 file changed, 3 deletions(-) (limited to 'svx') diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 2919ce8640dc..c83df5fa8487 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -1128,9 +1128,6 @@ void FmFormShell::GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich) || m_bDesignMode || !GetImpl()->getActiveForm().is() || GetImpl()->isInFilterMode() - || ( /*GetImpl()->HasPendingCursorAction(GetImpl()->getNavController()) - && */(SID_FM_RECORD_TOTAL != nWhich) - ) ) rSet.DisableItem(nWhich); else -- cgit From fdde6b9aa1922baa6b0248ea35a4d8bb969b1fb8 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Thu, 25 Feb 2010 16:58:44 +0100 Subject: mtaccfixes: #i14114# XAccessibleHypertext for EditEngine --- svx/inc/svx/unoedsrc.hxx | 1 + svx/inc/svx/unofored.hxx | 1 + svx/inc/svx/unoforou.hxx | 2 + svx/inc/svx/unotext.hxx | 2 + .../accessibility/AccessibleEditableTextPara.cxx | 87 ++++++++++++ .../accessibility/AccessibleEditableTextPara.hxx | 11 +- .../accessibility/AccessibleEmptyEditSource.cxx | 2 + svx/source/accessibility/AccessibleHyperlink.cxx | 146 +++++++++++++++++++++ svx/source/accessibility/AccessibleHyperlink.hxx | 82 ++++++++++++ svx/source/accessibility/AccessibleTextHelper.cxx | 4 - svx/source/accessibility/makefile.mk | 1 + svx/source/inc/unoedprx.hxx | 7 +- svx/source/unoedit/unoedprx.cxx | 27 ++++ svx/source/unoedit/unofored.cxx | 5 + svx/source/unoedit/unoforou.cxx | 5 + svx/source/unoedit/unotext.cxx | 4 + svx/xml/AccessibleEditableTextPara.xml | 1 + 17 files changed, 381 insertions(+), 7 deletions(-) create mode 100644 svx/source/accessibility/AccessibleHyperlink.cxx create mode 100644 svx/source/accessibility/AccessibleHyperlink.hxx (limited to 'svx') diff --git a/svx/inc/svx/unoedsrc.hxx b/svx/inc/svx/unoedsrc.hxx index 6c3025072e3c..f2018b49a8b0 100644 --- a/svx/inc/svx/unoedsrc.hxx +++ b/svx/inc/svx/unoedsrc.hxx @@ -174,6 +174,7 @@ public: virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0; + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) = 0; virtual SfxItemPool* GetPool() const = 0; diff --git a/svx/inc/svx/unofored.hxx b/svx/inc/svx/unofored.hxx index a9c72f766a35..0c2f329a7bbc 100644 --- a/svx/inc/svx/unofored.hxx +++ b/svx/inc/svx/unofored.hxx @@ -66,6 +66,7 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); virtual BOOL IsValid() const; virtual LanguageType GetLanguage( USHORT, USHORT ) const; diff --git a/svx/inc/svx/unoforou.hxx b/svx/inc/svx/unoforou.hxx index 75adcc620a47..21b447b5277f 100644 --- a/svx/inc/svx/unoforou.hxx +++ b/svx/inc/svx/unoforou.hxx @@ -85,6 +85,8 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual BOOL IsValid() const; Outliner& GetOutliner() const { return rOutliner; } diff --git a/svx/inc/svx/unotext.hxx b/svx/inc/svx/unotext.hxx index 46e26dbbc0a8..36a685f2f484 100644 --- a/svx/inc/svx/unotext.hxx +++ b/svx/inc/svx/unotext.hxx @@ -215,6 +215,8 @@ public: virtual void QuickInsertLineBreak( const ESelection& rSel ); virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual sal_Bool IsValid() const; virtual void SetNotifyHdl( const Link& ); diff --git a/svx/source/accessibility/AccessibleEditableTextPara.cxx b/svx/source/accessibility/AccessibleEditableTextPara.cxx index 1c0ce04bb1d6..a5be07fc33b2 100644 --- a/svx/source/accessibility/AccessibleEditableTextPara.cxx +++ b/svx/source/accessibility/AccessibleEditableTextPara.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -73,6 +74,7 @@ #include "unolingu.hxx" #include "unopracc.hxx" #include "AccessibleEditableTextPara.hxx" +#include "AccessibleHyperlink.hxx" #include #include "accessibility.hrc" @@ -528,7 +530,9 @@ namespace accessibility { uno::Reference< XAccessible > xPara = xParentContext->getAccessibleChild( nIndex ); if( xPara.is() ) + { return uno::Reference< XAccessibleText > ( xPara, uno::UNO_QUERY ); + } } } @@ -814,6 +818,11 @@ namespace accessibility uno::Reference< XAccessibleEditableText > aAccEditText = this; aRet <<= aAccEditText; } + else if ( rType == ::getCppuType((uno::Reference< XAccessibleHypertext > *)0) ) + { + uno::Reference< XAccessibleHypertext > aAccHyperText = this; + aRet <<= aAccHyperText; + } else { aRet = AccessibleTextParaInterfaceBase::queryInterface(rType); @@ -2066,6 +2075,84 @@ namespace accessibility return aOutSequence; } + // XAccessibleHypertext + ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException) + { + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + const sal_Int32 nPara = GetParagraphIndex(); + + USHORT nHyperLinks = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + nHyperLinks++; + } + return nHyperLinks; + } + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL AccessibleEditableTextPara::getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > xRef; + + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + const sal_Int32 nPara = GetParagraphIndex(); + + USHORT nHyperLink = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + { + if ( nHyperLink == nLinkIndex ) + { + USHORT nEEStart = aField.aPosition.nIndex; + + // Translate EE Index to accessible index + USHORT nStart = rT.CalcEditEngineIndex( nPara, nEEStart ); + USHORT nEnd = nStart + aField.aCurrentText.Len(); + xRef = new AccessibleHyperlink( rT, new SvxFieldItem( *aField.pFieldItem ), nPara, nEEStart, nStart, nEnd, aField.aCurrentText ); + break; + } + nHyperLink++; + } + } + + return xRef; + } + + ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + const sal_Int32 nPara = GetParagraphIndex(); + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + +// SvxAccessibleTextIndex aIndex; +// aIndex.SetIndex(nPara, nCharIndex, rT); +// const USHORT nEEIndex = aIndex.GetEEIndex(); + + const USHORT nEEIndex = rT.CalcEditEngineIndex( nPara, nCharIndex ); + sal_Int32 nHLIndex = 0; + USHORT nHyperLink = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + { + if ( aField.aPosition.nIndex == nEEIndex ) + { + nHLIndex = nHyperLink; + break; + } + nHyperLink++; + } + } + + return nHLIndex; + } + // XAccessibleMultiLineText sal_Int32 SAL_CALL AccessibleEditableTextPara::getLineNumberAtIndex( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { diff --git a/svx/source/accessibility/AccessibleEditableTextPara.hxx b/svx/source/accessibility/AccessibleEditableTextPara.hxx index 4e297f44c3b5..daf4e6e7867c 100644 --- a/svx/source/accessibility/AccessibleEditableTextPara.hxx +++ b/svx/source/accessibility/AccessibleEditableTextPara.hxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -55,12 +56,13 @@ namespace accessibility { - typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::accessibility::XAccessible, + typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleContext, ::com::sun::star::accessibility::XAccessibleComponent, ::com::sun::star::accessibility::XAccessibleEditableText, ::com::sun::star::accessibility::XAccessibleEventBroadcaster, ::com::sun::star::accessibility::XAccessibleTextAttributes, + ::com::sun::star::accessibility::XAccessibleHypertext, ::com::sun::star::accessibility::XAccessibleMultiLineText, ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase; @@ -164,6 +166,11 @@ namespace accessibility virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // XAccessibleHypertext + virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // XAccessibleMultiLineText virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index 8bfc618dfbd9..3ddae99f33a3 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -145,6 +145,8 @@ namespace accessibility { return XubString(); } + void FieldClicked( const SvxFieldItem&, USHORT, xub_StrLen ) {;} + BOOL IsValid() const { return sal_True; } void SetNotifyHdl( const Link& ) {} diff --git a/svx/source/accessibility/AccessibleHyperlink.cxx b/svx/source/accessibility/AccessibleHyperlink.cxx new file mode 100644 index 000000000000..5d0e98f0b0d2 --- /dev/null +++ b/svx/source/accessibility/AccessibleHyperlink.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * 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: AccessibleEditableTextPara.cxx,v $ + * $Revision: 1.53 $ + * + * 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_svx.hxx" + +#include +#include +#include + +#include "AccessibleHyperlink.hxx" +#include "unoedprx.hxx" +#include +#include + +using namespace ::com::sun::star; + + +//------------------------------------------------------------------------ +// +// AccessibleHyperlink implementation +// +//------------------------------------------------------------------------ + +namespace accessibility +{ + + AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, USHORT nP, USHORT nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ) + : rTA( r ) + { + pFld = p; + nPara = nP; + nRealIdx = nR; + nStartIdx = nStt; + nEndIdx = nEnd; + aDescription = rD; + } + + AccessibleHyperlink::~AccessibleHyperlink() + { + delete pFld; + } + + // XAccessibleAction + sal_Int32 SAL_CALL AccessibleHyperlink::getAccessibleActionCount() throw (uno::RuntimeException) + { + return isValid() ? 1 : 0; + } + + sal_Bool SAL_CALL AccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + sal_Bool bRet = sal_False; + if ( isValid() && ( nIndex == 0 ) ) + { + rTA.FieldClicked( *pFld, nPara, nRealIdx ); + bRet = sal_True; + } + return bRet; + } + + ::rtl::OUString SAL_CALL AccessibleHyperlink::getAccessibleActionDescription( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + ::rtl::OUString aDesc; + + if ( isValid() && ( nIndex == 0 ) ) + aDesc = aDescription; + + return aDesc; + } + + uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL AccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > xKeyBinding; + + if( isValid() && ( nIndex == 0 ) ) + { + ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper(); + xKeyBinding = pKeyBindingHelper; + + awt::KeyStroke aKeyStroke; + aKeyStroke.Modifiers = 0; + aKeyStroke.KeyCode = KEY_RETURN; + aKeyStroke.KeyChar = 0; + aKeyStroke.KeyFunc = 0; + pKeyBindingHelper->AddKeyBinding( aKeyStroke ); + } + + return xKeyBinding; + } + + // XAccessibleHyperlink + uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionAnchor( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + return uno::Any(); + } + + uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionObject( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + return uno::Any(); + } + + sal_Int32 SAL_CALL AccessibleHyperlink::getStartIndex() throw (uno::RuntimeException) + { + return nStartIdx; + } + + sal_Int32 SAL_CALL AccessibleHyperlink::getEndIndex() throw (uno::RuntimeException) + { + return nEndIdx; + } + + sal_Bool SAL_CALL AccessibleHyperlink::isValid( ) throw (uno::RuntimeException) + { + return rTA.IsValid(); + } + +} // end of namespace accessibility + +//------------------------------------------------------------------------ diff --git a/svx/source/accessibility/AccessibleHyperlink.hxx b/svx/source/accessibility/AccessibleHyperlink.hxx new file mode 100644 index 000000000000..5192f4b5be0b --- /dev/null +++ b/svx/source/accessibility/AccessibleHyperlink.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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: AccessibleEditableTextPara.hxx,v $ + * $Revision: 1.22 $ + * + * 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 _SVX_ACCESSIBLE_HYPERLINK_HXX +#define _SVX_ACCESSIBLE_HYPERLINK_HXX + +#include +#include +#include +#include + +#include +#include +#include + +#include + +class SvxFieldItem; +class SvxAccessibleTextAdapter; + +namespace accessibility +{ + + class AccessibleHyperlink : public ::cppu::WeakImplHelper1< ::com::sun::star::accessibility::XAccessibleHyperlink > + { + private: + + SvxAccessibleTextAdapter& rTA; + SvxFieldItem* pFld; + USHORT nPara, nRealIdx; // EE values + sal_Int32 nStartIdx, nEndIdx; // translated values + ::rtl::OUString aDescription; + + public: + AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, USHORT nP, USHORT nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ); + ~AccessibleHyperlink(); + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleHyperlink + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getStartIndex() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getEndIndex() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isValid() throw (::com::sun::star::uno::RuntimeException); + }; + +} // end of namespace accessibility + +#endif + diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 5b632115c93c..d186de9d060d 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -52,10 +52,6 @@ #include #include #include -#include -#include -#include -#include #include #include #include diff --git a/svx/source/accessibility/makefile.mk b/svx/source/accessibility/makefile.mk index 8b1802bf1a25..dfc25b00a3bb 100755 --- a/svx/source/accessibility/makefile.mk +++ b/svx/source/accessibility/makefile.mk @@ -68,6 +68,7 @@ LIB2OBJFILES= \ $(SLO)$/AccessibleTextEventQueue.obj \ $(SLO)$/AccessibleStaticTextBase.obj \ $(SLO)$/AccessibleParaManager.obj \ + $(SLO)$/AccessibleHyperlink.obj \ $(SLO)$/AccessibleEditableTextPara.obj \ $(SLO)$/AccessibleImageBullet.obj \ $(SLO)$/ShapeTypeHandler.obj \ diff --git a/svx/source/inc/unoedprx.hxx b/svx/source/inc/unoedprx.hxx index a260063d7525..47c75777acf8 100644 --- a/svx/source/inc/unoedprx.hxx +++ b/svx/source/inc/unoedprx.hxx @@ -53,7 +53,10 @@ public: virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const; - virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; + virtual sal_Int32 CalcLogicalIndex( USHORT nPara, USHORT nEEIndex ); + virtual USHORT CalcEditEngineIndex( USHORT nPara, sal_Int32 nLogicalIndex ); + + virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const; virtual void QuickInsertText( const String& rText, const ESelection& rSel ); @@ -64,6 +67,8 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual BOOL IsValid() const; virtual LanguageType GetLanguage( USHORT, USHORT ) const; diff --git a/svx/source/unoedit/unoedprx.cxx b/svx/source/unoedit/unoedprx.cxx index e7bbcea519b8..72ce7da212da 100644 --- a/svx/source/unoedit/unoedprx.cxx +++ b/svx/source/unoedit/unoedprx.cxx @@ -692,6 +692,33 @@ XubString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, return mrTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + mrTextForwarder->FieldClicked( rField, nPara, nPos ); +} + +sal_Int32 SvxAccessibleTextAdapter::CalcLogicalIndex( USHORT nPara, USHORT nEEIndex ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + SvxAccessibleTextIndex aIndex; + aIndex.SetEEIndex(nPara, nEEIndex, *mrTextForwarder); + return aIndex.GetIndex(); +} + +USHORT SvxAccessibleTextAdapter::CalcEditEngineIndex( USHORT nPara, sal_Int32 nLogicalIndex ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + SvxAccessibleTextIndex aIndex; + aIndex.SetIndex(nPara, nLogicalIndex, *mrTextForwarder); + return aIndex.GetEEIndex(); +} + + + BOOL SvxAccessibleTextAdapter::IsValid() const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); diff --git a/svx/source/unoedit/unofored.cxx b/svx/source/unoedit/unofored.cxx index 14c8fb20a768..3c853580644e 100644 --- a/svx/source/unoedit/unofored.cxx +++ b/svx/source/unoedit/unofored.cxx @@ -174,6 +174,11 @@ XubString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, US return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + rEditEngine.FieldClicked( rField, nPara, nPos ); +} + USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, USHORT nWhich ) { EECharAttribArray aAttribs; diff --git a/svx/source/unoedit/unoforou.cxx b/svx/source/unoedit/unoforou.cxx index a98b6830b698..3a3a93e92a06 100644 --- a/svx/source/unoedit/unoforou.cxx +++ b/svx/source/unoedit/unoforou.cxx @@ -245,6 +245,11 @@ XubString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, USHO return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + rOutliner.FieldClicked( rField, nPara, nPos ); +} + BOOL SvxOutlinerForwarder::IsValid() const { // cannot reliably query outliner state diff --git a/svx/source/unoedit/unotext.cxx b/svx/source/unoedit/unotext.cxx index a4d8c36462e6..92218031fdc2 100644 --- a/svx/source/unoedit/unotext.cxx +++ b/svx/source/unoedit/unotext.cxx @@ -2573,6 +2573,10 @@ XubString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_uInt16, s return XubString(); } +void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, USHORT, xub_StrLen ) +{ +} + sal_Bool SvxDummyTextSource::IsValid() const { return sal_False; diff --git a/svx/xml/AccessibleEditableTextPara.xml b/svx/xml/AccessibleEditableTextPara.xml index 1859980760df..affb15f4dd55 100644 --- a/svx/xml/AccessibleEditableTextPara.xml +++ b/svx/xml/AccessibleEditableTextPara.xml @@ -28,6 +28,7 @@ title="Link to a general description of UNO accessibility"/> com.sun.star.accessibility.XAccessibleEventBroadcaster com.sun.star.accessibility.XAccessibleComponent com.sun.star.accessibility.XAccessibleEditableText +com.sun.star.accessibility.XAccessibleHyperext com.sun.star.accessibility.XAccessibleTextAttributes com.sun.star.lang.XTypeProvider com.sun.star.lang.XServiceInfo -- cgit From 002bb9adfb4b6a4222767dc823d8ba52a1b8786d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 11 Mar 2010 15:53:40 +0100 Subject: autorecovery: include with \\\, not with < > , to fetch the files from the module, not from solver --- svx/source/items/svxitems.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/source/items/svxitems.src b/svx/source/items/svxitems.src index 5faaf1cb31f0..e21ea8fc6e4b 100644 --- a/svx/source/items/svxitems.src +++ b/svx/source/items/svxitems.src @@ -26,8 +26,8 @@ ************************************************************************/ // include ------------------------------------------------------------------ -#include -#include +#include "svx/svxitems.hrc" +#include "svx/svxids.hrc" #include StringArray RID_ATTR_NAMES -- cgit From e327e7e9a2647675a9d09d2df69a086631c5ca68 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Wed, 24 Mar 2010 15:39:09 +0100 Subject: #i108976# applied patch fix a crash when default style is deleted - transplanted from 263352@impresscomments1 --- svx/source/svdraw/svdpntv.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 0d526ff8a279..998c687608fc 100755 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -294,6 +294,9 @@ SdrPaintView::SdrPaintView(SdrModel* pModel1, OutputDevice* pOut) SdrPaintView::~SdrPaintView() { DBG_DTOR(SdrPaintView,NULL); + if (pDefaultStyleSheet) + EndListening(*pDefaultStyleSheet); + maColorConfig.RemoveListener(this); ClearPageView(); @@ -317,8 +320,16 @@ SdrPaintView::~SdrPaintView() //////////////////////////////////////////////////////////////////////////////////////////////////// -void __EXPORT SdrPaintView::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) +void __EXPORT SdrPaintView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { + //If the stylesheet has been destroyed + if (&rBC == pDefaultStyleSheet) + { + if (rHint.ISA(SfxSimpleHint) && ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING) + pDefaultStyleSheet = NULL; + return; + } + BOOL bObjChg=!bSomeObjChgdFlag; // TRUE= auswerten fuer ComeBack-Timer if (bObjChg) { SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint); @@ -1238,7 +1249,12 @@ void SdrPaintView::SetDefaultAttr(const SfxItemSet& rAttr, BOOL bReplaceAll) void SdrPaintView::SetDefaultStyleSheet(SfxStyleSheet* pStyleSheet, BOOL bDontRemoveHardAttr) { + if (pDefaultStyleSheet) + EndListening(*pDefaultStyleSheet); pDefaultStyleSheet=pStyleSheet; + if (pDefaultStyleSheet) + StartListening(*pDefaultStyleSheet); + if (pStyleSheet!=NULL && !bDontRemoveHardAttr) { SfxWhichIter aIter(pStyleSheet->GetItemSet()); USHORT nWhich=aIter.FirstWhich(); -- cgit From 4ec8b42acf54f852e2b3c82d96af1f3e999024a3 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Fri, 5 Mar 2010 13:49:51 +0100 Subject: native0: #161702# New copyright message --- svx/source/intro/ooo.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/source/intro/ooo.src b/svx/source/intro/ooo.src index 6c52a054e3ce..b1960e2f6afb 100644 --- a/svx/source/intro/ooo.src +++ b/svx/source/intro/ooo.src @@ -1,4 +1,4 @@ -/************************************************************************* +/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -86,7 +86,7 @@ ModalDialog RID_DEFAULTABOUT { Pos = MAP_APPFONT ( 54 , 25 ) ; Size = MAP_APPFONT ( 168 , 51 ) ; - Text[ en-US ] ="Copyright 2000-2009 Sun Microsystems Inc.\nThis product was created by " OOO_VENDOR ", based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at http://www.openoffice.org/welcome/credits.html."; + Text[ en-US ] ="Copyright © 2000, 2010 Oracle and/or its affiliates. All rights reserved.\nThis product was created by " OOO_VENDOR ", based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at\n http://www.openoffice.org/welcome/credits.html."; WordBreak = TRUE ; }; StringArray ABOUT_STR_DEVELOPER_ARY -- cgit From ea9bb5252a56e4453b4cbeae7068d1d574788520 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Wed, 17 Mar 2010 16:32:34 +0100 Subject: native0: #161722# Adapt about box to handle long legal text --- svx/source/intro/iso.src | 16 +++++++++++----- svx/source/intro/ooo.src | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) (limited to 'svx') diff --git a/svx/source/intro/iso.src b/svx/source/intro/iso.src index 1b4855228a73..f963d95721fc 100644 --- a/svx/source/intro/iso.src +++ b/svx/source/intro/iso.src @@ -59,7 +59,7 @@ String RID_BUILDVERSION ModalDialog RID_DEFAULTABOUT { OutputSize = TRUE ; - Size = MAP_APPFONT ( 245 , 200 ) ; + Size = MAP_APPFONT ( 245 , 260 ) ; Moveable = TRUE ; SVLook = TRUE ; TEXT_DEFAULTABOUT @@ -76,12 +76,18 @@ ModalDialog RID_DEFAULTABOUT WordBreak = TRUE ; Text = "%PRODUCTNAME %ABOUTBOXPRODUCTVERSION %PRODUCTEXTENSION" ; }; - FixedText ABOUT_FTXT_COPYRIGHT + MultiLineEdit ABOUT_FTXT_COPYRIGHT { + Border = TRUE ; Pos = MAP_APPFONT ( 54 , 25 ) ; Size = MAP_APPFONT ( 168 , 51 ) ; - WordBreak = TRUE ; - Text[ en-US ] = "Copyright © 2005-2009 Sun Microsystems, Inc. All rights reserved. Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Use is subject to license terms. This distribution may include materials developed by third parties. Sun, Sun Microsystems, the Sun logo, Java, Solaris and StarOffice are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd.\n\nThis product is based on the OpenOffice.org project." ; + IgnoreTab = TRUE ; + ReadOnly = TRUE ; + AutoVScroll = TRUE ; + }; + String ABOUT_STR_COPYRIGHT + { + Text[ en-US ] = "Copyright © 1995, 2010, Oracle and/or its affiliates. All rights reserved.\n\nThis software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.\n\nThe information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.\n\nIf this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:\n\nU.S. GOVERNMENT RIGHTS\nPrograms, software, databases, and related documentation and technical data delivered to U.S. Government customers are \"commercial computer software\" or \"commercial technical data\" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.\n\nThis software is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications which may create a risk of personal injury. If you use this software in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software in dangerous applications.\n\nOracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.\n\nThis software and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.\n\nThis product is based on the OpenOffice.org project."; }; StringArray ABOUT_STR_DEVELOPER_ARY { @@ -89,7 +95,7 @@ ModalDialog RID_DEFAULTABOUT }; String ABOUT_STR_FRENCH_COPYRIGHT { - Text = "Copyright © 2005-2009 Sun Microsystems, Inc. Tous droits réservés. Sun Microsystems, Inc. détient les droits de propriété intellectuels relatifs á la technologie incorporée dans le produit qui est décrit dans ce document. En particulier, et ce sans limitation, ces droits de propriété intellectuelle peuvent inclure un ou plus des brevets américains listés á l'adresse http://www.sun.com/patents et un ou les brevets supplémentaires ou les applications de brevet en attente aux Etats - Unis et dans les autres pays. L'utilisation est soumise aux termes du contrat de licence. Cette distribution peut comprendre des composants développés par des tierces parties. Sun, Sun Microsystems, le logo Sun, Java, Solaris et StarOffice sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. aux Etats-Unis et dans d'autres pays. Toutes les marques SPARC sont utilisées sous licence et sont des marques de fabrique ou des marques déposées de SPARC International, Inc. aux Etats-Unis et dans d'autres pays. UNIX est une marque déposée aux Etats-Unis et dans d'autres pays et licenciée exlusivement par X/Open Company, Ltd.\n\nCe produit a été créé á partir du projet OpenOffice.org." ; + Text = "Copyright © 1995, 2010, Oracle and/or its affiliates. All rights reserved.\n\nThis software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.\n\nThe information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.\n\nIf this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:\n\nU.S. GOVERNMENT RIGHTS\nPrograms, software, databases, and related documentation and technical data delivered to U.S. Government customers are ""commercial computer software"" or ""commercial technical data"" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.\n\nThis software is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications which may create a risk of personal injury. If you use this software in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software in dangerous applications.\n\nOracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.\n\nThis software and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.\n\nThis product is based on the OpenOffice.org project." ; }; String ABOUT_STR_ACCEL { diff --git a/svx/source/intro/ooo.src b/svx/source/intro/ooo.src index b1960e2f6afb..b29f3894c0c5 100644 --- a/svx/source/intro/ooo.src +++ b/svx/source/intro/ooo.src @@ -65,7 +65,7 @@ String RID_BUILDVERSION ModalDialog RID_DEFAULTABOUT { OutputSize = TRUE ; - Size = MAP_APPFONT ( 245 , 200 ) ; + Size = MAP_APPFONT ( 245 , 260 ) ; Moveable = TRUE ; SVLook = TRUE ; TEXT_DEFAULTABOUT @@ -81,13 +81,19 @@ ModalDialog RID_DEFAULTABOUT Size = MAP_APPFONT ( 118 , 16 ) ; WordBreak = TRUE ; Text = "%PRODUCTNAME %ABOUTBOXPRODUCTVERSION %PRODUCTEXTENSION" ; - }; - FixedText ABOUT_FTXT_COPYRIGHT + }; + MultiLineEdit ABOUT_FTXT_COPYRIGHT { + Border = TRUE ; Pos = MAP_APPFONT ( 54 , 25 ) ; Size = MAP_APPFONT ( 168 , 51 ) ; - Text[ en-US ] ="Copyright © 2000, 2010 Oracle and/or its affiliates. All rights reserved.\nThis product was created by " OOO_VENDOR ", based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at\n http://www.openoffice.org/welcome/credits.html."; - WordBreak = TRUE ; + IgnoreTab = TRUE ; + ReadOnly = TRUE ; + AutoVScroll = TRUE ; + }; + String ABOUT_STR_COPYRIGHT + { + Text[ en-US ] = "Copyright © 2000, 2010 Oracle and/or its affiliates. All rights reserved.\nThis product was created by " OOO_VENDOR ", based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at\n http://www.openoffice.org/welcome/credits.html."; }; StringArray ABOUT_STR_DEVELOPER_ARY { -- cgit