LibreOffice Module sc (master)  1
Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
ScCheckListMenuControl Class Referencefinal

#include <checklistmenu.hxx>

Collaboration diagram for ScCheckListMenuControl:
[legend]

Classes

class  Action
 Action to perform when an event takes place. More...
 
struct  Config
 Configuration options for this popup window. More...
 
struct  ExtendedData
 Extended data that the client code may need to store. More...
 
struct  MenuItemData
 
struct  ResultEntry
 
struct  SubMenuItemData
 

Public Types

typedef std::set< ResultEntryResultType
 

Public Member Functions

 ScCheckListMenuControl (ScCheckListMenuWindow *pParent, vcl::Window *pContainer, ScDocument *pDoc, bool bCanHaveSubMenu, bool bTreeMode, int nWidth)
 
 ~ScCheckListMenuControl ()
 
void addMenuItem (const OUString &rText, Action *pAction)
 
void addSeparator ()
 
ScCheckListMenuWindowaddSubMenuItem (const OUString &rText, bool bEnabled)
 
void resizeToFitMenuItems ()
 
void selectMenuItem (size_t nPos, bool bSubMenuTimer)
 
void queueLaunchSubMenu (size_t nPos, ScCheckListMenuWindow *pMenu)
 
void setMemberSize (size_t n)
 
void addDateMember (const OUString &rName, double nVal, bool bVisible)
 
void addMember (const OUString &rName, bool bVisible)
 
size_t initMembers (int nMaxMemberWidth=-1)
 
void setConfig (const Config &rConfig)
 
bool isAllSelected () const
 
void getResult (ResultType &rResult)
 
void launch (const tools::Rectangle &rRect)
 
void close (bool bOK)
 
void StartPopupMode (const tools::Rectangle &rRect, FloatWinPopupFlags eFlags)
 
void EndPopupMode ()
 
size_t getSubMenuPos (const ScCheckListMenuControl *pSubMenu)
 
void setSubMenuFocused (const ScCheckListMenuControl *pSubMenu)
 
void queueCloseSubMenu ()
 
void clearSelectedMenuItem ()
 
void setExtendedData (std::unique_ptr< ExtendedData > p)
 Set auxiliary data that the client code might need. More...
 
ExtendedDatagetExtendedData ()
 Get the store auxiliary data, or NULL if no such data is stored. More...
 
void GrabFocus ()
 
void setOKAction (Action *p)
 
void setPopupEndAction (Action *p)
 
int GetTextWidth (const OUString &rsName) const
 
int IncreaseWindowWidthToFitText (int nMaxTextWidth)
 

Static Public Attributes

static constexpr size_t MENU_NOT_SELECTED = 999
 

Private Member Functions

void prepWindow ()
 Calculate the appropriate window size based on the menu items. More...
 
void setAllMemberState (bool bSet)
 
void selectCurrentMemberOnly (bool bSet)
 
void updateMemberParents (const weld::TreeIter *pLeaf, size_t nIdx)
 
std::unique_ptr< weld::TreeIterShowCheckEntry (const OUString &sName, ScCheckListMember &rMember, bool bShow=true, bool bCheck=true)
 
void CheckEntry (std::u16string_view sName, const weld::TreeIter *pParent, bool bCheck)
 
void CheckEntry (const weld::TreeIter &rEntry, bool bCheck)
 
void GetRecursiveChecked (const weld::TreeIter *pEntry, std::unordered_set< OUString > &vOut, OUString &rLabel)
 
std::unordered_set< OUString > GetAllChecked ()
 
bool IsChecked (std::u16string_view sName, const weld::TreeIter *pParent)
 
int GetCheckedEntryCount () const
 
void CheckAllChildren (const weld::TreeIter &rEntry, bool bCheck)
 
void setSelectedMenuItem (size_t nPos, bool bSubMenuTimer)
 
std::unique_ptr< weld::TreeIterFindEntry (const weld::TreeIter *pParent, std::u16string_view sNode)
 
void executeMenuItem (size_t nPos)
 
void terminateAllPopupMenus ()
 Dismiss all visible popup menus and set focus back to the application window. More...
 
void endSubMenu (ScCheckListMenuControl &rSubMenu)
 
void handleMenuTimeout (const SubMenuItemData *pTimer)
 
void launchSubMenu (bool bSetMenuPos)
 
void CreateDropDown ()
 
void NotifyCloseLOK ()
 
 DECL_LINK (ButtonHdl, weld::Button &, void)
 
 DECL_LINK (TriStateHdl, weld::ToggleButton &, void)
 
void Check (const weld::TreeIter *pIter)
 
 DECL_LINK (CheckHdl, const weld::TreeView::iter_col &, void)
 
 DECL_LINK (PopupModeEndHdl, FloatingWindow *, void)
 
 DECL_LINK (EdModifyHdl, weld::Entry &, void)
 
 DECL_LINK (EdActivateHdl, weld::Entry &, bool)
 
 DECL_LINK (FocusHdl, weld::Widget &, void)
 
 DECL_LINK (RowActivatedHdl, weld::TreeView &rMEvt, bool)
 
 DECL_LINK (SelectHdl, weld::TreeView &, void)
 
 DECL_LINK (TreeSizeAllocHdl, const Size &, void)
 
 DECL_LINK (KeyInputHdl, const KeyEvent &, bool)
 
 DECL_LINK (MenuKeyInputHdl, const KeyEvent &, bool)
 
 DECL_LINK (PostPopdownHdl, void *, void)
 

Private Attributes

std::vector< MenuItemDatamaMenuItems
 
VclPtr< ScCheckListMenuWindowmxFrame
 
std::unique_ptr< weld::BuildermxBuilder
 
std::unique_ptr< weld::ContainermxContainer
 
std::unique_ptr< weld::TreeViewmxMenu
 
std::unique_ptr< weld::TreeItermxScratchIter
 
std::unique_ptr< weld::EntrymxEdSearch
 
std::unique_ptr< weld::WidgetmxBox
 
std::unique_ptr< weld::TreeViewmxListChecks
 
std::unique_ptr< weld::TreeViewmxTreeChecks
 
weld::TreeViewmpChecks
 
std::unique_ptr< weld::CheckButtonmxChkToggleAll
 
std::unique_ptr< weld::ButtonmxBtnSelectSingle
 
std::unique_ptr< weld::ButtonmxBtnUnselectSingle
 
std::unique_ptr< weld::BoxmxButtonBox
 
std::unique_ptr< weld::ButtonmxBtnOk
 
std::unique_ptr< weld::ButtonmxBtnCancel
 
ScopedVclPtr< VirtualDevicemxDropDown
 
std::vector< ScCheckListMembermaMembers
 
std::map< OUString, size_t > maYearMonthMap
 
std::unique_ptr< ExtendedDatamxExtendedData
 
std::unique_ptr< ActionmxOKAction
 
std::unique_ptr< ActionmxPopupEndAction
 
Config maConfig
 
int mnCheckWidthReq
 
int mnWndWidth
 matching width request for mxChecks More...
 
TriState mePrevToggleAllState
 whole window width. More...
 
size_t mnSelectedMenu
 
ScDocumentmpDoc
 
ImplSVEventmnAsyncPostPopdownId
 
bool mbHasDates
 
bool mbCanHaveSubMenu
 
SubMenuItemData maOpenTimer
 
SubMenuItemData maCloseTimer
 

Detailed Description

Definition at line 51 of file checklistmenu.hxx.

Member Typedef Documentation

Definition at line 85 of file checklistmenu.hxx.

Constructor & Destructor Documentation

ScCheckListMenuControl::ScCheckListMenuControl ( ScCheckListMenuWindow pParent,
vcl::Window pContainer,
ScDocument pDoc,
bool  bCanHaveSubMenu,
bool  bTreeMode,
int  nWidth 
)
ScCheckListMenuControl::~ScCheckListMenuControl ( )

Member Function Documentation

void ScCheckListMenuControl::addDateMember ( const OUString &  rName,
double  nVal,
bool  bVisible 
)
void ScCheckListMenuControl::addMember ( const OUString &  rName,
bool  bVisible 
)
void ScCheckListMenuControl::addMenuItem ( const OUString &  rText,
Action pAction 
)
void ScCheckListMenuControl::addSeparator ( )

Definition at line 139 of file checklistmenu.cxx.

References maMenuItems, and mxMenu.

Referenced by ScGridWindow::LaunchAutoFilterMenu().

ScCheckListMenuWindow * ScCheckListMenuControl::addSubMenuItem ( const OUString &  rText,
bool  bEnabled 
)
void ScCheckListMenuControl::Check ( const weld::TreeIter pIter)
private
void ScCheckListMenuControl::CheckAllChildren ( const weld::TreeIter rEntry,
bool  bCheck 
)
private
void ScCheckListMenuControl::CheckEntry ( std::u16string_view  sName,
const weld::TreeIter pParent,
bool  bCheck 
)
private

Definition at line 1084 of file checklistmenu.cxx.

References FindEntry().

Referenced by Check(), initMembers(), and ShowCheckEntry().

void ScCheckListMenuControl::CheckEntry ( const weld::TreeIter rEntry,
bool  bCheck 
)
private
void ScCheckListMenuControl::clearSelectedMenuItem ( )

Definition at line 369 of file checklistmenu.cxx.

References MENU_NOT_SELECTED, and selectMenuItem().

Referenced by ScCheckListMenuWindow::EventNotify().

void ScCheckListMenuControl::close ( bool  bOK)
void ScCheckListMenuControl::CreateDropDown ( )
private
ScCheckListMenuControl::DECL_LINK ( ButtonHdl  ,
weld::Button ,
void   
)
private
ScCheckListMenuControl::DECL_LINK ( TriStateHdl  ,
weld::ToggleButton ,
void   
)
private
ScCheckListMenuControl::DECL_LINK ( CheckHdl  ,
const weld::TreeView::iter_col ,
void   
)
private
ScCheckListMenuControl::DECL_LINK ( PopupModeEndHdl  ,
FloatingWindow ,
void   
)
private
ScCheckListMenuControl::DECL_LINK ( EdModifyHdl  ,
weld::Entry ,
void   
)
private
ScCheckListMenuControl::DECL_LINK ( EdActivateHdl  ,
weld::Entry ,
bool   
)
private
ScCheckListMenuControl::DECL_LINK ( FocusHdl  ,
weld::Widget ,
void   
)
private
ScCheckListMenuControl::DECL_LINK ( RowActivatedHdl  ,
weld::TreeView rMEvt,
bool   
)
private
ScCheckListMenuControl::DECL_LINK ( SelectHdl  ,
weld::TreeView ,
void   
)
private
ScCheckListMenuControl::DECL_LINK ( TreeSizeAllocHdl  ,
const Size ,
void   
)
private
ScCheckListMenuControl::DECL_LINK ( KeyInputHdl  ,
const KeyEvent ,
bool   
)
private
ScCheckListMenuControl::DECL_LINK ( MenuKeyInputHdl  ,
const KeyEvent ,
bool   
)
private
ScCheckListMenuControl::DECL_LINK ( PostPopdownHdl  ,
void ,
void   
)
private
void ScCheckListMenuControl::EndPopupMode ( )
void ScCheckListMenuControl::endSubMenu ( ScCheckListMenuControl rSubMenu)
private
void ScCheckListMenuControl::executeMenuItem ( size_t  nPos)
private

Definition at line 189 of file checklistmenu.cxx.

References maMenuItems, and terminateAllPopupMenus().

Referenced by IMPL_LINK_NOARG().

std::unique_ptr< weld::TreeIter > ScCheckListMenuControl::FindEntry ( const weld::TreeIter pParent,
std::u16string_view  sNode 
)
private
std::unordered_set< OUString > ScCheckListMenuControl::GetAllChecked ( )
private
int ScCheckListMenuControl::GetCheckedEntryCount ( ) const
private
ScCheckListMenuControl::ExtendedData * ScCheckListMenuControl::getExtendedData ( )

Get the store auxiliary data, or NULL if no such data is stored.

Definition at line 1431 of file checklistmenu.cxx.

References mxExtendedData.

Referenced by ScGridWindow::UpdateAutoFilterFromMenu(), and ScGridWindow::UpdateDPFromFieldPopupMenu().

void ScCheckListMenuControl::GetRecursiveChecked ( const weld::TreeIter pEntry,
std::unordered_set< OUString > &  vOut,
OUString &  rLabel 
)
private
void ScCheckListMenuControl::getResult ( ResultType rResult)
size_t ScCheckListMenuControl::getSubMenuPos ( const ScCheckListMenuControl pSubMenu)

Definition at line 374 of file checklistmenu.cxx.

References i, maMenuItems, MENU_NOT_SELECTED, and n.

Referenced by endSubMenu(), and setSubMenuFocused().

int ScCheckListMenuControl::GetTextWidth ( const OUString &  rsName) const

Definition at line 1456 of file checklistmenu.cxx.

References mxDropDown.

Referenced by ScGridWindow::LaunchAutoFilterMenu().

void ScCheckListMenuControl::GrabFocus ( )

Definition at line 548 of file checklistmenu.cxx.

References mxEdSearch, and mxMenu.

Referenced by launchSubMenu().

void ScCheckListMenuControl::handleMenuTimeout ( const SubMenuItemData pTimer)
private
int ScCheckListMenuControl::IncreaseWindowWidthToFitText ( int  nMaxTextWidth)
size_t ScCheckListMenuControl::initMembers ( int  nMaxMemberWidth = -1)
bool ScCheckListMenuControl::isAllSelected ( ) const

Definition at line 1327 of file checklistmenu.cxx.

References mxChkToggleAll, and TRISTATE_TRUE.

Referenced by ScGridWindow::UpdateAutoFilterFromMenu().

bool ScCheckListMenuControl::IsChecked ( std::u16string_view  sName,
const weld::TreeIter pParent 
)
private

Definition at line 1078 of file checklistmenu.cxx.

References FindEntry(), weld::TreeView::get_toggle(), mpChecks, and TRISTATE_TRUE.

Referenced by initMembers().

void ScCheckListMenuControl::launch ( const tools::Rectangle rRect)
void ScCheckListMenuControl::launchSubMenu ( bool  bSetMenuPos)
private
void ScCheckListMenuControl::NotifyCloseLOK ( )
private
void ScCheckListMenuControl::prepWindow ( )
private

Calculate the appropriate window size based on the menu items.

Definition at line 618 of file checklistmenu.cxx.

References vcl::Window::get_border_width(), mnSelectedMenu, mnWndWidth, mxContainer, mxFrame, and mxMenu.

Referenced by launch().

void ScCheckListMenuControl::queueCloseSubMenu ( )
void ScCheckListMenuControl::queueLaunchSubMenu ( size_t  nPos,
ScCheckListMenuWindow pMenu 
)
void ScCheckListMenuControl::resizeToFitMenuItems ( )

Definition at line 331 of file checklistmenu.cxx.

References mxMenu.

Referenced by ScGridWindow::DPLaunchFieldPopupMenu().

void ScCheckListMenuControl::selectCurrentMemberOnly ( bool  bSet)
private
void ScCheckListMenuControl::selectMenuItem ( size_t  nPos,
bool  bSubMenuTimer 
)
void ScCheckListMenuControl::setAllMemberState ( bool  bSet)
private
void ScCheckListMenuControl::setConfig ( const Config rConfig)
void ScCheckListMenuControl::setExtendedData ( std::unique_ptr< ExtendedData p)

Set auxiliary data that the client code might need.

Note that this popup window class manages its life time; no explicit deletion of the instance is needed in the client code.

Definition at line 1426 of file checklistmenu.cxx.

References mxExtendedData.

Referenced by ScGridWindow::DPLaunchFieldPopupMenu(), and ScGridWindow::LaunchAutoFilterMenu().

void ScCheckListMenuControl::setMemberSize ( size_t  n)
void ScCheckListMenuControl::setOKAction ( Action p)
void ScCheckListMenuControl::setPopupEndAction ( Action p)

Definition at line 1441 of file checklistmenu.cxx.

References mxPopupEndAction.

Referenced by ScGridWindow::LaunchAutoFilterMenu().

void ScCheckListMenuControl::setSelectedMenuItem ( size_t  nPos,
bool  bSubMenuTimer 
)
private

Definition at line 203 of file checklistmenu.cxx.

References mnSelectedMenu, and selectMenuItem().

Referenced by IMPL_LINK_NOARG(), and launchSubMenu().

void ScCheckListMenuControl::setSubMenuFocused ( const ScCheckListMenuControl pSubMenu)
std::unique_ptr< weld::TreeIter > ScCheckListMenuControl::ShowCheckEntry ( const OUString &  sName,
ScCheckListMember rMember,
bool  bShow = true,
bool  bCheck = true 
)
private
void ScCheckListMenuControl::StartPopupMode ( const tools::Rectangle rRect,
FloatWinPopupFlags  eFlags 
)
void ScCheckListMenuControl::terminateAllPopupMenus ( )
private

Dismiss all visible popup menus and set focus back to the application window.

This method is called e.g. when a menu action is fired.

Definition at line 412 of file checklistmenu.cxx.

References EndPopupMode(), ScCheckListMenuWindow::get_widget(), ScCheckListMenuWindow::GetParentMenu(), comphelper::LibreOfficeKit::isActive(), mxFrame, NotifyCloseLOK(), and terminateAllPopupMenus().

Referenced by executeMenuItem(), and terminateAllPopupMenus().

void ScCheckListMenuControl::updateMemberParents ( const weld::TreeIter pLeaf,
size_t  nIdx 
)
private

Member Data Documentation

SubMenuItemData ScCheckListMenuControl::maCloseTimer
private
Config ScCheckListMenuControl::maConfig
private

Definition at line 263 of file checklistmenu.hxx.

Referenced by Check(), launch(), setAllMemberState(), and setConfig().

std::vector<ScCheckListMember> ScCheckListMenuControl::maMembers
private
std::vector<MenuItemData> ScCheckListMenuControl::maMenuItems
private
SubMenuItemData ScCheckListMenuControl::maOpenTimer
private
std::map<OUString, size_t> ScCheckListMenuControl::maYearMonthMap
private

Definition at line 257 of file checklistmenu.hxx.

Referenced by addDateMember(), and updateMemberParents().

bool ScCheckListMenuControl::mbCanHaveSubMenu
private

Definition at line 275 of file checklistmenu.hxx.

Referenced by addMenuItem(), addSubMenuItem(), IMPL_LINK(), and ScCheckListMenuControl().

bool ScCheckListMenuControl::mbHasDates
private

Definition at line 274 of file checklistmenu.hxx.

Referenced by initMembers(), and ScCheckListMenuControl().

constexpr size_t ScCheckListMenuControl::MENU_NOT_SELECTED = 999
static
TriState ScCheckListMenuControl::mePrevToggleAllState
private

whole window width.

Definition at line 266 of file checklistmenu.hxx.

Referenced by Check(), and initMembers().

ImplSVEvent* ScCheckListMenuControl::mnAsyncPostPopdownId
private

Definition at line 272 of file checklistmenu.hxx.

Referenced by endSubMenu(), IMPL_LINK_NOARG(), and ~ScCheckListMenuControl().

int ScCheckListMenuControl::mnCheckWidthReq
private
size_t ScCheckListMenuControl::mnSelectedMenu
private
int ScCheckListMenuControl::mnWndWidth
private

matching width request for mxChecks

Definition at line 265 of file checklistmenu.hxx.

Referenced by launch(), and prepWindow().

weld::TreeView* ScCheckListMenuControl::mpChecks
private
ScDocument* ScCheckListMenuControl::mpDoc
private

Definition at line 270 of file checklistmenu.hxx.

Referenced by addDateMember(), and addSubMenuItem().

std::unique_ptr<weld::Widget> ScCheckListMenuControl::mxBox
private

Definition at line 240 of file checklistmenu.hxx.

Referenced by ScCheckListMenuControl().

std::unique_ptr<weld::Button> ScCheckListMenuControl::mxBtnCancel
private

Definition at line 251 of file checklistmenu.hxx.

Referenced by ScCheckListMenuControl().

std::unique_ptr<weld::Button> ScCheckListMenuControl::mxBtnOk
private

Definition at line 250 of file checklistmenu.hxx.

Referenced by Check(), launch(), ScCheckListMenuControl(), and setAllMemberState().

std::unique_ptr<weld::Button> ScCheckListMenuControl::mxBtnSelectSingle
private

Definition at line 246 of file checklistmenu.hxx.

Referenced by ScCheckListMenuControl().

std::unique_ptr<weld::Button> ScCheckListMenuControl::mxBtnUnselectSingle
private

Definition at line 247 of file checklistmenu.hxx.

Referenced by ScCheckListMenuControl().

std::unique_ptr<weld::Builder> ScCheckListMenuControl::mxBuilder
private

Definition at line 235 of file checklistmenu.hxx.

std::unique_ptr<weld::Box> ScCheckListMenuControl::mxButtonBox
private

Definition at line 249 of file checklistmenu.hxx.

Referenced by ScCheckListMenuControl().

std::unique_ptr<weld::CheckButton> ScCheckListMenuControl::mxChkToggleAll
private

Definition at line 245 of file checklistmenu.hxx.

Referenced by Check(), initMembers(), isAllSelected(), and ScCheckListMenuControl().

std::unique_ptr<weld::Container> ScCheckListMenuControl::mxContainer
private

Definition at line 236 of file checklistmenu.hxx.

Referenced by prepWindow(), and ScCheckListMenuControl().

ScopedVclPtr<VirtualDevice> ScCheckListMenuControl::mxDropDown
private

Definition at line 253 of file checklistmenu.hxx.

Referenced by addSubMenuItem(), CreateDropDown(), and GetTextWidth().

std::unique_ptr<weld::Entry> ScCheckListMenuControl::mxEdSearch
private

Definition at line 239 of file checklistmenu.hxx.

Referenced by GrabFocus(), and ScCheckListMenuControl().

std::unique_ptr<ExtendedData> ScCheckListMenuControl::mxExtendedData
private

Definition at line 259 of file checklistmenu.hxx.

Referenced by getExtendedData(), and setExtendedData().

VclPtr<ScCheckListMenuWindow> ScCheckListMenuControl::mxFrame
private
std::unique_ptr<weld::TreeView> ScCheckListMenuControl::mxListChecks
private

Definition at line 241 of file checklistmenu.hxx.

Referenced by ScCheckListMenuControl().

std::unique_ptr<weld::TreeView> ScCheckListMenuControl::mxMenu
private
std::unique_ptr<Action> ScCheckListMenuControl::mxOKAction
private

Definition at line 260 of file checklistmenu.hxx.

Referenced by close(), and setOKAction().

std::unique_ptr<Action> ScCheckListMenuControl::mxPopupEndAction
private

Definition at line 261 of file checklistmenu.hxx.

Referenced by setPopupEndAction().

std::unique_ptr<weld::TreeIter> ScCheckListMenuControl::mxScratchIter
private

Definition at line 238 of file checklistmenu.hxx.

Referenced by IMPL_LINK_NOARG(), and launchSubMenu().

std::unique_ptr<weld::TreeView> ScCheckListMenuControl::mxTreeChecks
private

Definition at line 242 of file checklistmenu.hxx.

Referenced by ScCheckListMenuControl().


The documentation for this class was generated from the following files: