diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-12-25 00:16:25 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-12-31 02:34:59 +0100 |
commit | 5c1f9ec049a724071bd47bca2d76553c0dfb1718 (patch) | |
tree | b24901f7e30a62b7a17d66c165f43ebbb3e5dcf3 /editeng/inc | |
parent | 291fe245284806538d74b40d45dfa20b3fbab172 (diff) |
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 <quikee@gmail.com>
Diffstat (limited to 'editeng/inc')
-rw-r--r-- | editeng/inc/EditSelection.hxx | 56 | ||||
-rw-r--r-- | editeng/inc/editdoc.hxx | 35 |
2 files changed, 57 insertions, 34 deletions
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: |