/* -*- 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
#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) #error"don't use this in new code" #endif
class SvTreeListBox; class SvTreeListEntry; struct SvViewDataItem; class SvViewDataEntry; class SvInplaceEdit2; class SvLBoxString; class SvImpLBox; class SvLBoxButtonData; class Timer; class Edit;
enumclass SvLBoxTabFlags
{
NONE = 0x0000,
DYNAMIC = 0x0001, // Item's output column changes according to the Child Depth
ADJUST_RIGHT = 0x0002, // Item's right margin at the tabulator
ADJUST_LEFT = 0x0004, // Left margin
ADJUST_CENTER = 0x0008, // Center the item at the tabulator
SHOW_SELECTION = 0x0010, // Visualize selection state // Item needs to be able to return the surrounding polygon (D'n'D cursor)
EDITABLE = 0x0020, // Item editable at the tabulator
FORCE = 0x0040, // Switch off the default calculation of the first tabulator // (on which Abo Tabpage/Extras/Option/Customize, etc. rely on) // The first tab's position corresponds precisely to the Flags set // and column widths
virtualvoid InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry, // If != 0: this Pointer must be used! // If == 0: it needs to be retrieved via the View
SvViewDataItem* pViewData = nullptr) = 0; // View-dependent data is not cloned virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const = 0;
};
enumclass DragDropMode
{
NONE = 0x0000,
CTRL_MOVE = 0x0001,
APP_COPY = 0x0004, // Entries may be dropped via the uppermost Entry // The DropTarget is 0 in that case
ENABLE_TOP = 0x0010,
ALL = 0x0015,
}; namespace o3tl
{ template<> struct typed_flags<DragDropMode> : is_typed_flags<DragDropMode, 0x0015> {};
}
short nContextBmpWidthMax; short nEntryHeightOffs; short nIndent; short nFocusWidth;
sal_uInt16 nFirstSelTab;
sal_uInt16 nLastSelTab;
tools::Long mnCheckboxItemWidth; bool mbContextBmpExpanded; bool mbQuickSearch; // Enables type-ahead search in the check list box. bool mbActivateOnSingleClick; // Make single click "activate" a row like a double-click normally does bool mbHoverSelection; // Make mouse over a row "select" a row like a single-click normally does bool mbSelectingByHover; // true during "Select" if it was due to hover bool mbIsTextColumEnabled; // true if the property name text-column is enabled
sal_Int8 mnClicksToToggle; // 0 == Click on a row not toggle its checkbox. // 1 == Every click on row toggle its checkbox. // 2 == First click select, second click toggle.
protected:
std::unique_ptr<SvImpLBox> pImpl; short nColumns; short nEntryHeight; short nEntryWidth; bool mbCenterAndClipText;
Link<SvTreeListBox*,bool> aDoubleClickHdl;
SvTreeListEntry* pTargetEntry;
SvLBoxButtonData* pCheckButtonData;
std::vector<std::unique_ptr<SvLBoxTab>> aTabs;
SvTreeFlags nTreeFlags;
SvTreeListBoxFlags nImpFlags; // Move/CopySelection: Position of the current Entry in SelectionList
sal_uInt16 nCurEntrySelPos;
private:
DECL_DLLPRIVATE_LINK( CheckButtonClick, SvLBoxButtonData *, void );
DECL_DLLPRIVATE_LINK( TextEditEndedHdl_Impl, SvInplaceEdit2&, void ); // Handler that is called by TreeList to clone an Entry
DECL_DLLPRIVATE_LINK( CloneHdl_Impl, SvTreeListEntry*, SvTreeListEntry* );
// Handler and methods for Drag - finished handler. // The Handle retrieved by GetDragFinishedHdl can be set on the // TransferDataContainer. This link is a callback for the DragFinished // call. The AddBox method is called from the GetDragFinishedHdl() and the // remove is called in the link callback and in the dtor. So it can't be // called for a deleted object.
SAL_DLLPRIVATE staticvoid AddBoxToDDList_Impl( const SvTreeListBox& rB );
SAL_DLLPRIVATE staticvoid RemoveBoxFromDDList_Impl( const SvTreeListBox& rB );
DECL_DLLPRIVATE_LINK( DragFinishHdl_Impl, sal_Int8, void );
// after a checkbox entry is inserted, use this to get its width to support // autowidth for the 1st checkbox column
SAL_DLLPRIVATE void CheckBoxInserted(SvTreeListEntry* pEntry);
// InitViewData is called right after CreateViewData // The Entry is has not yet been added to the View in InitViewData! virtualvoid InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry ) override; // Calls InitViewData for all Items void RecalcViewData();
// Handler and methods for Drag - finished handler. This link can be set // to the TransferDataContainer. The AddBox/RemoveBox methods must be // called before the StartDrag call. // The Remove will be called from the handler, which then calls DragFinish. // The Remove is also called in the DTOR of the SvTreeListBox - // so it can't be called for a deleted object.
Link<sal_Int8,void> GetDragFinishedHdl() const;
// Is called for an Entry that gets expanded with the Flag // ENTRYFLAG_CHILDREN_ON_DEMAND set. virtualvoid RequestingChildren( SvTreeListEntry* pParent );
// Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
TriState NotifyMoving(
SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel() const SvTreeListEntry* pEntry, // Entry to be moved from GetSourceListBox()->GetModel()
SvTreeListEntry*& rpNewParent, // New TargetParent
sal_uInt32& rNewChildPos); // The TargetParent's position in Childlist
// Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
TriState NotifyCopying(
SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel() const SvTreeListEntry* pEntry, // Entry to be copied from GetSourceListBox()->GetModel()
SvTreeListEntry*& rpNewParent, // New TargetParent
sal_uInt32& rNewChildPos); // The TargetParent's position in Childlist
/** Creates and returns the accessible object of the Box. */ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
/** Fills the StateSet of one entry. */ void FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, sal_Int64& rStateSet ) const;
/** Calculate and return the bounding rectangle of an entry. @param pEntry The entry.
@return The bounding rectangle of an entry. */
tools::Rectangle GetBoundingRect(const SvTreeListEntry* pEntry);
// true if rPos is over the SvTreeListBox body, i.e. not over a // scrollbar
SAL_DLLPRIVATE bool PosOverBody(const Point& rPos) const; public:
void SetNoAutoCurEntry( bool b );
void EnableCheckButton(SvLBoxButtonData&);
/** Returns the default image which clients should use for expanded nodes, to have a consistent user interface experience in the whole product.
*/ staticconst Image& GetDefaultExpandedNodeImage( );
/** Returns the default image which clients should use for expanded nodes, to have a consistent user interface experience in the whole product.
*/ staticconst Image& GetDefaultCollapsedNodeImage( );
/** Sets default bitmaps for collapsed and expanded nodes.
*/ void SetNodeDefaultImages();
// Enables type-ahead search in the check list box. void SetQuickSearch(bool bEnable) { mbQuickSearch = bEnable; }
// Make single click "activate" a row like a double-click normally does void SetActivateOnSingleClick(bool bEnable) { mbActivateOnSingleClick = bEnable; } bool GetActivateOnSingleClick() const { return mbActivateOnSingleClick; }
// Make mouse over a row "select" a row like a single-click normally does void SetHoverSelection(bool bEnable) { mbHoverSelection = bEnable; } bool GetHoverSelection() const { return mbHoverSelection; }
// to get enable or disable the text-column void SetTextColumnEnabled(bool bEnable) { mbIsTextColumEnabled = bEnable; } bool IsTextColumnEnabled() const { return mbIsTextColumEnabled; }
// only true during Select if the Select is due to a Hover bool IsSelectDueToHover() const { return mbSelectingByHover; }
// Set when clicks toggle the checkbox of the row. void SetClicksToToggle(sal_Int8 nCount) { mnClicksToToggle = nCount; }
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.