summaryrefslogtreecommitdiff
path: root/sw/source/uibase/docvw/PostItMgr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/docvw/PostItMgr.cxx')
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 2355151e851c..b702fd4bccbe 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -52,6 +52,7 @@
#include <ndtxt.hxx>
#include <redline.hxx>
#include <docary.hxx>
+#include <rootfrm.hxx>
#include <SwRewriter.hxx>
#include <tools/color.hxx>
#include <unotools/datetime.hxx>
@@ -240,13 +241,15 @@ SwPostItMgr::~SwPostItMgr()
void SwPostItMgr::CheckForRemovedPostIts()
{
+ IDocumentRedlineAccess const& rIDRA(mpWrtShell->getIDocumentRedlineAccess());
bool bRemoved = false;
auto currentIt = mvPostItFields.begin();
while(currentIt != mvPostItFields.end())
{
auto it = currentIt++;
- if ( !(*it)->UseElement() )
+ if (!(*it)->UseElement(*mpWrtShell->GetLayout(), rIDRA))
{
+ EndListening(const_cast<SfxBroadcaster&>(*(*it)->GetBroadCaster()));
SwSidebarItem* p = (*it);
currentIt = mvPostItFields.erase(std::remove(mvPostItFields.begin(), mvPostItFields.end(), *it), mvPostItFields.end());
if (GetActiveSidebarWin() == p->pPostIt)
@@ -531,9 +534,10 @@ bool SwPostItMgr::CalcRects()
PreparePageContainer();
if ( !mvPostItFields.empty() )
{
+ IDocumentRedlineAccess const& rIDRA(mpWrtShell->getIDocumentRedlineAccess());
for (auto const& pItem : mvPostItFields)
{
- if ( !pItem->UseElement() )
+ if (!pItem->UseElement(*mpWrtShell->GetLayout(), rIDRA))
{
OSL_FAIL("PostIt is not in doc or other wrong use");
bRepair = true;
@@ -887,10 +891,11 @@ void SwPostItMgr::LayoutPostIts()
if (!ShowNotes())
{ // we do not want to see the notes anymore -> Options-Writer-View-Notes
+ IDocumentRedlineAccess const& rIDRA(mpWrtShell->getIDocumentRedlineAccess());
bool bRepair = false;
for (auto const& postItField : mvPostItFields)
{
- if ( !postItField->UseElement() )
+ if (!postItField->UseElement(*mpWrtShell->GetLayout(), rIDRA))
{
OSL_FAIL("PostIt is not in doc!");
bRepair = true;
@@ -1298,8 +1303,13 @@ void SwPostItMgr::AddPostIts(bool bCheckExistence, bool bFocus)
{
if ( pSwFormatField->GetTextField())
{
- if ( pSwFormatField->IsFieldInDoc() )
+ IDocumentRedlineAccess const& rIDRA(mpWrtShell->getIDocumentRedlineAccess());
+ if (pSwFormatField->IsFieldInDoc()
+ && (!mpWrtShell->GetLayout()->IsHideRedlines()
+ || !sw::IsFieldDeletedInModel(rIDRA, *pSwFormatField->GetTextField())))
+ {
InsertItem(pSwFormatField,bCheckExistence,bFocus);
+ }
}
pSwFormatField = aIter.Next();
}