editeng/inc/EditPaM.hxx | 50 +++++++++++++++++++++++++++++++++++ editeng/inc/EditSelection.hxx | 56 +++++++++++++++++++++++++++++++++++++++ editeng/inc/editdoc.hxx | 60 +----------------------------------------- 3 files changed, 108 insertions(+), 58 deletions(-)
New commits: commit 5c1f9ec049a724071bd47bca2d76553c0dfb1718 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Mon Dec 25 00:16:25 2023 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Sun Dec 31 02:34:59 2023 +0100 editeng: move EditSelection into its own header file Change-Id: Ib56a0d308de700097470d26ebed3dc90d583b616 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161363 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/editeng/inc/EditSelection.hxx b/editeng/inc/EditSelection.hxx new file mode 100644 index 000000000000..c94fce2c0881 --- /dev/null +++ b/editeng/inc/EditSelection.hxx @@ -0,0 +1,56 @@ +/* -*- 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 . + */ + +#pragma once + +#include "EditPaM.hxx" + +class EditSelection +{ +private: + EditPaM aStartPaM; + EditPaM aEndPaM; + +public: + EditSelection(); + + EditSelection(const EditPaM& rStartAndAnd); + EditSelection(const EditPaM& rStart, const EditPaM& rEnd); + + EditPaM& Min() { return aStartPaM; } + EditPaM& Max() { return aEndPaM; } + + const EditPaM& Min() const { return aStartPaM; } + const EditPaM& Max() const { return aEndPaM; } + + bool HasRange() const { return aStartPaM != aEndPaM; } + bool IsInvalid() const { return !aStartPaM || !aEndPaM; } + bool DbgIsBuggy(EditDoc const& rDoc) const; + + void Adjust(const EditDoc& rNodes); + + EditSelection& operator=(const EditPaM& r); + bool operator==(const EditSelection& r) const + { + return (aStartPaM == r.aStartPaM) && (aEndPaM == r.aEndPaM); + } + bool operator!=(const EditSelection& r) const { return !(r == *this); } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index 6bba498440f6..ee4f4433c307 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -35,6 +35,7 @@ #include "ContentNode.hxx" #include "EditLineList.hxx" #include "EditPaM.hxx" +#include "EditSelection.hxx" #include <cstddef> #include <memory> @@ -237,40 +238,6 @@ public: #endif }; - - -class EditSelection -{ -private: - EditPaM aStartPaM; - EditPaM aEndPaM; - -public: - EditSelection(); // No constructor and destructor - // are automatically executed correctly! - EditSelection( const EditPaM& rStartAndAnd ); - EditSelection( const EditPaM& rStart, const EditPaM& rEnd ); - - EditPaM& Min() { return aStartPaM; } - EditPaM& Max() { return aEndPaM; } - - const EditPaM& Min() const { return aStartPaM; } - const EditPaM& Max() const { return aEndPaM; } - - bool HasRange() const { return aStartPaM != aEndPaM; } - bool IsInvalid() const { return !aStartPaM || !aEndPaM; } - bool DbgIsBuggy( EditDoc const & rDoc ) const; - - void Adjust( const EditDoc& rNodes ); - - EditSelection& operator = ( const EditPaM& r ); - bool operator == ( const EditSelection& r ) const - { return ( aStartPaM == r.aStartPaM ) && ( aEndPaM == r.aEndPaM ); } - bool operator != ( const EditSelection& r ) const { return !( r == *this ); } -}; - - - class DeletedNodeInfo { private: commit 291fe245284806538d74b40d45dfa20b3fbab172 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Mon Dec 25 00:14:00 2023 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Sun Dec 31 02:34:52 2023 +0100 editeng: move EditPaM into its own header file Change-Id: I13c5d4f2ea0bd7ef942ac0cacb9dce4b58909b19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161362 Tested-by: Tomaž Vajngerl <[email protected]> Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/editeng/inc/EditPaM.hxx b/editeng/inc/EditPaM.hxx new file mode 100644 index 000000000000..2aa733f5ea74 --- /dev/null +++ b/editeng/inc/EditPaM.hxx @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ContentNode.hxx" + +class EditDoc; + +class EditPaM +{ +private: + ContentNode* pNode; + sal_Int32 nIndex; + +public: + EditPaM(); + EditPaM(ContentNode* p, sal_Int32 n); + + const ContentNode* GetNode() const { return pNode; } + ContentNode* GetNode() { return pNode; } + void SetNode(ContentNode* p); + + sal_Int32 GetIndex() const { return nIndex; } + void SetIndex(sal_Int32 n) { nIndex = n; } + + bool DbgIsBuggy(EditDoc const& rDoc) const; + + friend bool operator==(const EditPaM& r1, const EditPaM& r2); + friend bool operator!=(const EditPaM& r1, const EditPaM& r2); + bool operator!() const { return !pNode && !nIndex; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index e400a3b42e4a..6bba498440f6 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -34,6 +34,7 @@ #include "ItemList.hxx" #include "ContentNode.hxx" #include "EditLineList.hxx" +#include "EditPaM.hxx" #include <cstddef> #include <memory> @@ -107,30 +108,6 @@ public: typedef std::vector<Color> SvxColorList; -class EditPaM -{ -private: - ContentNode* pNode; - sal_Int32 nIndex; - -public: - EditPaM(); - EditPaM(ContentNode* p, sal_Int32 n); - - const ContentNode* GetNode() const { return pNode;} - ContentNode* GetNode() { return pNode;} - void SetNode(ContentNode* p); - - sal_Int32 GetIndex() const { return nIndex; } - void SetIndex( sal_Int32 n ) { nIndex = n; } - - bool DbgIsBuggy( EditDoc const & rDoc ) const; - - friend bool operator == ( const EditPaM& r1, const EditPaM& r2 ); - friend bool operator != ( const EditPaM& r1, const EditPaM& r2 ); - bool operator !() const { return !pNode && !nIndex; } -}; - enum class DeleteMode { Simple, RestOfWord, RestOfContent };
