sw/inc/crsrsh.hxx | 2 +- sw/inc/pam.hxx | 2 +- sw/source/core/crsr/crsrsh.cxx | 4 ++-- sw/source/core/crsr/pam.cxx | 6 +++--- sw/source/ui/docvw/PostItMgr.cxx | 2 ++ sw/source/ui/inc/view.hxx | 5 ++++- sw/source/ui/uiview/view.cxx | 5 +++-- sw/source/ui/uiview/view2.cxx | 5 +++++ 8 files changed, 21 insertions(+), 10 deletions(-)
New commits: commit 806403f366f5cdfbb73438dd4004ed6c8fbd696d Author: Miklos Vajna <vmik...@suse.cz> Date: Thu Feb 14 18:42:52 2013 +0100 fdo#60738 SwPostItMgr: let the cursor know if we're in annotation mode This solves the conflicting requirements: If the annotation has focus ("in annotation mode"), then we want to be read-only only in case the comment anchor is inside a protected section, or so. Ignoring the fact that in the main document, the cursor is right before the annotation anchor, which is a read-only position. OTOH, if the annotation has no focus and the cursor position is before the annotation anchor position, then we do want to be read-only. With this commit, the first case passes around a boolean flag, so the annotation frame won't be read-only without a reason. (cherry picked from commit 9104d5e8905c2ec2b576b5ca452d3e23d5555e49) Conflicts: sw/inc/pam.hxx sw/source/core/crsr/pam.cxx Change-Id: I25781a4501f752f7c4d024795d57b884cb800547 Reviewed-on: https://gerrit.libreoffice.org/2163 Reviewed-by: Petr Mladek <pmla...@suse.cz> Tested-by: Petr Mladek <pmla...@suse.cz> diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 6d47927..5a061db 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -476,7 +476,7 @@ public: // Cursor is placed in something that is protected or selection contains // something that is protected. - sal_Bool HasReadonlySel() const; + sal_Bool HasReadonlySel(bool bAnnotationMode = false) const; // Can the cursor be set to read only ranges? sal_Bool IsReadOnlyAvailable() const { return bSetCrsrInReadOnly; } diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index bfe7214..b74f990 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -287,7 +287,7 @@ public: /** Is in something protected (readonly) or selection contains something protected. */ - sal_Bool HasReadonlySel( bool bFormView ) const; + sal_Bool HasReadonlySel( bool bFormView, bool bAnnotationMode = false ) const; sal_Bool ContainsPosition(const SwPosition & rPos) { return *Start() <= rPos && rPos <= *End(); } diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 3486a74..379af07 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2888,7 +2888,7 @@ void SwCrsrShell::SetReadOnlyAvailable( sal_Bool bFlag ) } } -sal_Bool SwCrsrShell::HasReadonlySel() const +sal_Bool SwCrsrShell::HasReadonlySel(bool bAnnotationMode) const { sal_Bool bRet = sal_False; if( IsReadOnlyAvailable() || GetViewOptions()->IsFormView() ) @@ -2901,7 +2901,7 @@ sal_Bool SwCrsrShell::HasReadonlySel() const const SwPaM* pCrsr = pCurCrsr; do { - if( pCrsr->HasReadonlySel( GetViewOptions()->IsFormView() ) ) + if( pCrsr->HasReadonlySel( GetViewOptions()->IsFormView(), bAnnotationMode ) ) bRet = sal_True; } while( !bRet && pCurCrsr != ( pCrsr = (SwPaM*)pCrsr->GetNext() )); } diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index e745e80..c36b582 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -589,7 +589,7 @@ static const SwFrm* lcl_FindEditInReadonlyFrm( const SwFrm& rFrm ) } /// is in protected section or selection surrounds something protected -sal_Bool SwPaM::HasReadonlySel( bool bFormView ) const +sal_Bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const { sal_Bool bRet = sal_False; Point aTmpPt; @@ -731,8 +731,8 @@ sal_Bool SwPaM::HasReadonlySel( bool bFormView ) const } // Don't allow inserting characters between the 'field mark end' and - // the 'comment anchor'. - if (!bRet) + // the 'comment anchor', unless the cursor is inside the annotation. + if (!bRet && !bAnnotationMode) { if (!pA && GetPoint() && GetPoint()->nNode.GetNode().IsTxtNode() && GetPoint()->nContent.GetIndex() > 0) { diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx index 83b1cc9..3a24565 100644 --- a/sw/source/ui/docvw/PostItMgr.cxx +++ b/sw/source/ui/docvw/PostItMgr.cxx @@ -1626,7 +1626,9 @@ void SwPostItMgr::SetActiveSidebarWin( SwSidebarWin* p) if (mpActivePostIt) { mpActivePostIt->GotoPos(); + mpView->SetAnnotationMode(true); mpView->AttrChangedNotify(0); + mpView->SetAnnotationMode(false); mpActivePostIt->ActivatePostIt(); } } diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index c1be2bb..4df29ac 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -265,7 +265,8 @@ class SW_DLLPUBLIC SwView: public SfxViewShell bInDtor : 1, //detect destructor to prevent creating of sub shells while closing bOldShellWasPagePreView : 1, bIsPreviewDoubleClick : 1, // #i114045# - bMakeSelectionVisible : 1; // transport the bookmark selection + bMakeSelectionVisible : 1, // transport the bookmark selection + m_bAnnotationMode; ///< The real cursor position is inside an annotation. // methods for searching // set search context @@ -658,6 +659,8 @@ public: void SelectShellForDrop(); void UpdateDocStats(); + /// Where is the real cursor: in the annotation or in the main document? + void SetAnnotationMode(bool bMode); }; // ----------------- inline Methoden ---------------------- diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index df77bd1..d192dd9 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -653,7 +653,7 @@ void SwView::_CheckReadonlySelection() sal_uInt32 nDisableFlags = 0; SfxDispatcher &rDis = GetDispatcher(); - if( pWrtShell->HasReadonlySel() && + if( pWrtShell->HasReadonlySel(m_bAnnotationMode) && ( !pWrtShell->GetDrawView() || !pWrtShell->GetDrawView()->GetMarkedObjectList().GetMarkCount() )) nDisableFlags |= SW_DISABLE_ON_PROTECTED_CURSOR; @@ -747,7 +747,8 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) bInMailMerge(sal_False), bInDtor(sal_False), bOldShellWasPagePreView(sal_False), - bIsPreviewDoubleClick(sal_False) + bIsPreviewDoubleClick(sal_False), + m_bAnnotationMode(false) { // According to discussion with MBA and further // investigations, no old SfxViewShell will be set as parameter <pOldSh>, diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 61b9440..b6a7d10 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -1210,6 +1210,11 @@ void SwView::UpdateDocStats() rBnd.Update( FN_STAT_WORDCOUNT ); } +void SwView::SetAnnotationMode(bool bMode) +{ + m_bAnnotationMode = bMode; +} + /*-------------------------------------------------------------------- Beschreibung: Status der Stauszeile --------------------------------------------------------------------*/ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits