/* -*- 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_SWCRSR_HXX #define INCLUDED_SW_INC_SWCRSR_HXX
class SfxItemSet; struct SwCursor_SavePos; class SvxSearchItem; namespace i18nutil { struct SearchOptions2;
}
// Base structure for parameters of the find-methods. // Returns values of found-call. constint FIND_NOT_FOUND = 0; constint FIND_FOUND = 1; constint FIND_NO_RING = 2;
struct SwFindParas
{ // @param xSearchItem allocate in parent so we can do so outside the calling loop virtualint DoFind(SwPaM &, SwMoveFnCollection const &, const SwPaM&, bool, std::unique_ptr<SvxSearchItem>& xSearchItem) = 0; virtualbool IsReplaceMode() const = 0;
// define for cursor travelling normally in western text cells and chars do // the same, but in complex text cell skip over ligatures and char skip // into it. // These defines exist only to cut off the dependencies to I18N project. enumclass SwCursorSkipMode { Chars = 0, Cells = 1, Hidden = 2 }; namespace o3tl { template<> struct typed_flags<SwCursorSkipMode> : is_typed_flags<SwCursorSkipMode, 0x3> {};
}
/// SwCursor is a base class for UI/shell, table and UNO/API cursors. /// /// It's more than just a pair of doc model positions (SwPaM), e.g. can go left/right or up/down. class SAL_DLLPUBLIC_RTTI SwCursor : public SwPaM
{ friendclass SwCursorSaveState;
std::vector<SwCursor_SavePos> m_vSavePos; // the current entry is the last element
sal_Int32 m_nRowSpanOffset; // required for travelling in tabs with rowspans
sal_uInt8 m_nCursorBidiLevel; // bidi level of the cursor bool m_bColumnSelection; // true: cursor is aprt of a column selection
public: // single argument ctors shall be explicit.
SW_DLLPUBLIC SwCursor( const SwPosition &rPos, SwPaM* pRing );
SW_DLLPUBLIC virtual ~SwCursor() override;
inline SwCursor & operator =(SwCursor const &);
/// this takes a second parameter, which indicates the Ring that /// the new cursor should be part of (may be null)
SwCursor(SwCursor const& rCursor, SwPaM* pRing);
// Is there a selection of content in table? // Return value indicates if cursor remains at its old position. virtualbool IsSelOvr( SwCursorSelOverFlags eFlags =
SwCursorSelOverFlags::CheckNodeSection |
SwCursorSelOverFlags::Toggle |
SwCursorSelOverFlags::ChangePos ); bool IsInProtectTable( bool bMove = false, bool bChgCursor = true ); bool IsNoContent() const;
/** Restore cursor state to the one saved by SwCursorSaveState **/ void RestoreSavePos();
// true: cursor can be set at this position. virtualbool IsAtValidPos( bool bPoint = true ) const;
// Is cursor allowed in ready only ranges? virtualbool IsReadOnlyAvailable() const;
/** A helper class to save cursor state (position). Create SwCursorSaveState object to save current state, use SwCursor::RestoreSavePos() to actually restore cursor state to the saved state (SwCursorSaveState destructor only removes the saved state from an internal stack). It is possible to stack several SwCursorSaveState objects.
**/ class SwCursorSaveState
{ private:
SwCursor& m_rCursor; public:
SwCursorSaveState( SwCursor& rC ) : m_rCursor( rC ) { rC.SaveState(); }
~SwCursorSaveState() { m_rCursor.RestoreState(); }
};
// internal, used by SwCursor::SaveState() etc. struct SwCursor_SavePos final
{
SwNodeOffset nNode;
sal_Int32 nContent;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.