summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-02-14 18:42:52 +0100
committerPetr Mladek <pmladek@suse.cz>2013-02-18 19:24:06 +0000
commit806403f366f5cdfbb73438dd4004ed6c8fbd696d (patch)
treed2feabb44679dea58ca694124dbcf2205ce29a31 /sw
parent7ae175f5e818100fe6aecaecc8da7701c05c6a6b (diff)
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 <pmladek@suse.cz> Tested-by: Petr Mladek <pmladek@suse.cz>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/crsrsh.hxx2
-rw-r--r--sw/inc/pam.hxx2
-rw-r--r--sw/source/core/crsr/crsrsh.cxx4
-rw-r--r--sw/source/core/crsr/pam.cxx6
-rw-r--r--sw/source/ui/docvw/PostItMgr.cxx2
-rw-r--r--sw/source/ui/inc/view.hxx5
-rw-r--r--sw/source/ui/uiview/view.cxx5
-rw-r--r--sw/source/ui/uiview/view2.cxx5
8 files changed, 21 insertions, 10 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 6d479273e214..5a061dbfa466 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 bfe7214bc332..b74f990a6304 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 3486a74209cb..379af07d0035 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 e745e80d75d9..c36b5820c2d4 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 83b1cc9b278d..3a2456594e99 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 c1be2bb1b2b5..4df29ac9e862 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 df77bd165e69..d192dd9e6c3a 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 61b9440530e8..b6a7d1020280 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
--------------------------------------------------------------------*/