diff --git a/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.cpp b/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.cpp index 3497367..6349891 100644 --- a/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.cpp +++ b/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2004-2010 Geometer Plus - * Copyright (C) 2016 Slava Monich + * Copyright (C) 2016-2017 Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,6 +69,15 @@ void ZLTextArea::clear() { myTextElementMap.clear(); myTreeNodeMap.clear(); + clearSelection(); +} + +bool ZLTextArea::selectionIsEmpty() const +{ + return mySelectionModel.isNull() || mySelectionModel->isEmpty(); +} + +void ZLTextArea::clearSelection() const { if (!mySelectionModel.isNull()) { mySelectionModel->clear(); } diff --git a/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.h b/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.h index dd21b08..60aca29 100644 --- a/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.h +++ b/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2004-2010 Geometer Plus - * Copyright (C) 2016 Slava Monich + * Copyright (C) 2016-2017 Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -89,6 +89,8 @@ public: int paragraphIndexByCoordinates(int x, int y, bool absolute = true) const; ZLTextSelectionModel &selectionModel(); + bool selectionIsEmpty() const; + void clearSelection() const; void paint(ZLSize *size = 0);