Kaydet (Commit) 7032d7b3 authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Ashod Nakashian

sw: improve undo handling of Paragraph Signature

Change-Id: I46f395d5f9105d1d3dac6d2af6e9b43ae95ec78e
Reviewed-on: https://gerrit.libreoffice.org/42733Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAshod Nakashian <ashnakash@gmail.com>
üst 9679fb26
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SW_INC_UNDOPARAGRAPHSIGNATURE_HXX
#define INCLUDED_SW_INC_UNDOPARAGRAPHSIGNATURE_HXX
#include <undobj.hxx>
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XTextField.hpp>
struct SwPosition;
class SwDoc;
/// Undo/Redo Paragraph Signature.
class SwUndoParagraphSigning : public SwUndo
{
private:
SwDoc* m_pDoc;
uno::Reference<text::XTextField> m_xField;
uno::Reference<text::XTextContent> m_xParent;
OUString m_signature;
OUString m_display;
const bool m_bRemove;
public:
SwUndoParagraphSigning(const SwPosition& rPos,
const uno::Reference<text::XTextField>& xField,
const uno::Reference<text::XTextContent>& xParent,
const bool bRemove);
virtual void UndoImpl(::sw::UndoRedoContext&) override;
virtual void RedoImpl(::sw::UndoRedoContext&) override;
virtual void RepeatImpl(::sw::RepeatContext&) override;
private:
void Insert();
void Remove();
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -946,6 +946,16 @@ public:
OUString DeleteExtTextInput( bool bInsText = true);
void SetExtTextInputData( const CommandExtTextInputData& );
/// Returns true iff paragraph signature validation is enabled.
bool IsParagraphSignatureValidationEnabled() const { return m_bDoParagraphSignatureValidation; }
/// Enable/Disable paragraph signature validation and return the previous value.
bool SetParagraphSignatureValidation(const bool bEnable)
{
const bool bOldFlag = m_bDoParagraphSignatureValidation;
m_bDoParagraphSignatureValidation = bEnable;
return bOldFlag;
}
/// Interface for access to AutoComplete-list.
static SwAutoCompleteWord& GetAutoCompleteWords();
......@@ -975,7 +985,7 @@ private:
* the existing nb-space will be removed. Bear this in mind if that problem
* arises. */
bool m_bNbspRunNext; ///< NO-BREAK SPACE state flag passed to and maintained by SvxAutoCorrect::DoAutoCorrect()
bool m_bIsValidatingParagraphSignature; ///< Prevent nested calls of ValidateParagraphSignatures.
bool m_bDoParagraphSignatureValidation; ///< Prevent nested calls of ValidateParagraphSignatures.
};
inline const sfx2::LinkManager& SwEditShell::GetLinkManager() const
......
This diff is collapsed.
......@@ -37,14 +37,14 @@
SwEditShell::SwEditShell( SwEditShell& rEdSH, vcl::Window *pWindow )
: SwCursorShell( rEdSH, pWindow )
, m_bNbspRunNext(false) // TODO: would copying that make sense? only if editing continues
, m_bIsValidatingParagraphSignature(false)
, m_bDoParagraphSignatureValidation(true)
{
}
SwEditShell::SwEditShell( SwDoc& rDoc, vcl::Window *pWindow, const SwViewOption *pOptions )
: SwCursorShell( rDoc, pWindow, pOptions )
, m_bNbspRunNext(false)
, m_bIsValidatingParagraphSignature(false)
, m_bDoParagraphSignatureValidation(true)
{
if (!utl::ConfigManager::IsAvoidConfig() && 0 < officecfg::Office::Common::Undo::Steps::get())
{
......
......@@ -1214,7 +1214,7 @@ void SwTextNode::Update(
// Update the paragraph signatures.
if (SwEditShell* pEditShell = GetDoc()->GetEditShell())
{
pEditShell->ValidateParagraphSignatures(false);
pEditShell->ValidateParagraphSignatures(true);
}
// Inform LOK clients about change in position of redlines (if any)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment