compilerplugins/clang/refcounting.cxx | 3 sc/inc/fillinfo.hxx | 29 +++--- sc/inc/formularesult.hxx | 8 - sc/inc/patattr.hxx | 3 sc/inc/scmatrix.hxx | 18 +-- sc/inc/types.hxx | 18 ++- sc/qa/unit/ucalc.cxx | 16 +-- sc/source/core/data/column2.cxx | 4 sc/source/core/data/patattr.cxx | 14 +-- sc/source/core/data/table2.cxx | 10 +- sc/source/core/tool/chartpos.cxx | 33 +++---- sc/source/core/tool/formularesult.cxx | 24 ++--- sc/source/core/tool/interpr1.cxx | 10 +- sc/source/core/tool/interpr2.cxx | 12 +- sc/source/core/tool/interpr4.cxx | 2 sc/source/core/tool/scmatrix.cxx | 12 +- sc/source/filter/excel/colrowst.cxx | 55 +++++------ sc/source/filter/excel/xehelper.cxx | 4 sc/source/filter/excel/xelink.cxx | 45 ++++----- sc/source/filter/excel/xilink.cxx | 6 - sc/source/filter/inc/colrowst.hxx | 23 +++-- sc/source/filter/inc/xelink.hxx | 24 ++++- sc/source/ui/dbgui/csvcontrol.cxx | 22 ++-- sc/source/ui/dbgui/csvgrid.cxx | 16 +-- sc/source/ui/dbgui/csvruler.cxx | 10 +- sc/source/ui/inc/csvcontrol.hxx | 40 ++++---- sc/source/ui/inc/gridwin.hxx | 3 sc/source/ui/view/gridwin.cxx | 16 +-- sc/source/ui/view/output.cxx | 44 ++++----- sc/source/ui/view/output2.cxx | 16 +-- sd/source/ui/animations/CustomAnimationPane.cxx | 25 ++--- sd/source/ui/animations/SlideTransitionPane.cxx | 26 ++--- sd/source/ui/annotations/annotationmanager.cxx | 18 ++- sd/source/ui/inc/EventMultiplexer.hxx | 92 ++++++++++---------- sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx | 33 +++---- sd/source/ui/sidebar/LayoutMenu.cxx | 24 ++--- sd/source/ui/sidebar/SlideBackground.cxx | 30 +++--- sd/source/ui/slidesorter/controller/SlsListener.cxx | 38 ++++---- sd/source/ui/table/TableDesignPane.cxx | 20 ++-- sd/source/ui/tools/EventMultiplexer.cxx | 66 ++++++-------- sd/source/ui/view/FormShellManager.cxx | 12 +- sd/source/ui/view/ToolBarManager.cxx | 14 +-- sd/source/ui/view/outlview.cxx | 10 +- sd/source/ui/view/sdview.cxx | 4 sd/source/ui/view/viewoverlaymanager.cxx | 21 ++-- 45 files changed, 504 insertions(+), 469 deletions(-)
New commits: commit 942716fee138b68c2af9411384f402b5692a88b2 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Oct 12 08:43:44 2016 +0200 convert EID constants to typed_flags Change-Id: I3bcccd8836e54dd33bb079856226fbedd574c824 diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index b5dbe2d..6c363c9 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -310,12 +310,12 @@ void CustomAnimationPane::addListener() Link<tools::EventMultiplexerEvent&,void> aLink( LINK(this,CustomAnimationPane,EventMultiplexerListener) ); mrBase.GetEventMultiplexer()->AddEventListener ( aLink, - tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION - | tools::EventMultiplexerEvent::EID_CURRENT_PAGE - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED - | tools::EventMultiplexerEvent::EID_DISPOSING - | tools::EventMultiplexerEvent::EID_END_TEXT_EDIT); + EventMultiplexerEventId::EditViewSelection + | EventMultiplexerEventId::CurrentPageChanged + | EventMultiplexerEventId::MainViewRemoved + | EventMultiplexerEventId::MainViewAdded + | EventMultiplexerEventId::Disposing + | EventMultiplexerEventId::EndTextEdit); } void CustomAnimationPane::removeListener() @@ -329,15 +329,15 @@ IMPL_LINK(CustomAnimationPane,EventMultiplexerListener, { switch (rEvent.meEventId) { - case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION: + case EventMultiplexerEventId::EditViewSelection: onSelectionChanged(); break; - case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: + case EventMultiplexerEventId::CurrentPageChanged: onChangeCurrentPage(); break; - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: + case EventMultiplexerEventId::MainViewAdded: // At this moment the controller may not yet been set at model // or ViewShellBase. Take it from the view shell passed with // the event. @@ -352,21 +352,22 @@ IMPL_LINK(CustomAnimationPane,EventMultiplexerListener, } } SAL_FALLTHROUGH; - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: + case EventMultiplexerEventId::MainViewRemoved: mxView = nullptr; mxCurrentPage = nullptr; updateControls(); break; - case tools::EventMultiplexerEvent::EID_DISPOSING: + case EventMultiplexerEventId::Disposing: mxView.clear(); onSelectionChanged(); onChangeCurrentPage(); break; - case tools::EventMultiplexerEvent::EID_END_TEXT_EDIT: + case EventMultiplexerEventId::EndTextEdit: if( mpMainSequence.get() && rEvent.mpUserData ) mpCustomAnimationList->update( mpMainSequence ); break; + default: break; } } diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index bc04d6b..b80be66 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -957,12 +957,12 @@ void SlideTransitionPane::addListener() Link<tools::EventMultiplexerEvent&,void> aLink( LINK(this,SlideTransitionPane,EventMultiplexerListener) ); mrBase.GetEventMultiplexer()->AddEventListener ( aLink, - tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION - | tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION - | tools::EventMultiplexerEvent::EID_CURRENT_PAGE - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED - | tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED); + EventMultiplexerEventId::EditViewSelection + | EventMultiplexerEventId::SlideSortedSelection + | EventMultiplexerEventId::CurrentPageChanged + | EventMultiplexerEventId::MainViewRemoved + | EventMultiplexerEventId::MainViewAdded + | EventMultiplexerEventId::ConfigurationUpdated); } void SlideTransitionPane::removeListener() @@ -976,26 +976,26 @@ IMPL_LINK(SlideTransitionPane,EventMultiplexerListener, { switch (rEvent.meEventId) { - case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION: + case EventMultiplexerEventId::EditViewSelection: onSelectionChanged(); break; - case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: - case tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION: + case EventMultiplexerEventId::CurrentPageChanged: + case EventMultiplexerEventId::SlideSortedSelection: onChangeCurrentPage(); break; - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: + case EventMultiplexerEventId::MainViewRemoved: mxView.clear(); onSelectionChanged(); onChangeCurrentPage(); break; - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: + case EventMultiplexerEventId::MainViewAdded: mbIsMainViewChangePending = true; break; - case tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED: + case EventMultiplexerEventId::ConfigurationUpdated: if (mbIsMainViewChangePending) { mbIsMainViewChangePending = false; @@ -1013,7 +1013,7 @@ IMPL_LINK(SlideTransitionPane,EventMultiplexerListener, break; default: - if (rEvent.meEventId != tools::EventMultiplexerEvent::EID_DISPOSING) + if (rEvent.meEventId != EventMultiplexerEventId::Disposing) { onSelectionChanged(); onChangeCurrentPage(); diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index b2e6c9a..76703f8 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -868,10 +868,10 @@ void AnnotationManagerImpl::addListener() Link<tools::EventMultiplexerEvent&,void> aLink( LINK(this,AnnotationManagerImpl,EventMultiplexerListener) ); mrBase.GetEventMultiplexer()->AddEventListener ( aLink, - tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION - | tools::EventMultiplexerEvent::EID_CURRENT_PAGE - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED); + EventMultiplexerEventId::EditViewSelection + | EventMultiplexerEventId::CurrentPageChanged + | EventMultiplexerEventId::MainViewRemoved + | EventMultiplexerEventId::MainViewAdded); } void AnnotationManagerImpl::removeListener() @@ -885,20 +885,22 @@ IMPL_LINK(AnnotationManagerImpl,EventMultiplexerListener, { switch (rEvent.meEventId) { - case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: - case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION: + case EventMultiplexerEventId::CurrentPageChanged: + case EventMultiplexerEventId::EditViewSelection: onSelectionChanged(); break; - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: + case EventMultiplexerEventId::MainViewRemoved: mxView.clear(); onSelectionChanged(); break; - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: + case EventMultiplexerEventId::MainViewAdded: mxView.set( mrBase.GetController(), UNO_QUERY ); onSelectionChanged(); break; + + default: break; } } diff --git a/sd/source/ui/inc/EventMultiplexer.hxx b/sd/source/ui/inc/EventMultiplexer.hxx index f5b4ade..2e8aeb2 100644 --- a/sd/source/ui/inc/EventMultiplexer.hxx +++ b/sd/source/ui/inc/EventMultiplexer.hxx @@ -25,6 +25,7 @@ #include <rtl/ref.hxx> #include <svl/lstner.hxx> #include <tools/link.hxx> +#include <o3tl/typed_flags_set.hxx> #include <set> #include <memory> @@ -33,108 +34,113 @@ namespace sd { class ViewShellBase; } -namespace sd { namespace tools { -class EventMultiplexerEvent -{ -public: - typedef sal_uInt32 EventId; +enum class EventMultiplexerEventId : sal_uInt32 { /** The EventMultiplexer itself is being disposed. Called for a live EventMultiplexer. Removing a listener as response is not necessary, though. */ - static const EventId EID_DISPOSING = 0x00000001; + Disposing = 0x00000001, /** The selection in the center pane has changed. */ - static const EventId EID_EDIT_VIEW_SELECTION = 0x00000002; + EditViewSelection = 0x00000002, /** The selection in the slide sorter has changed, regardless of whether the slide sorter is displayed in the left pane or the center pane. */ - static const EventId EID_SLIDE_SORTER_SELECTION = 0x00000004; + SlideSortedSelection = 0x00000004, /** The current page has changed. */ - static const EventId EID_CURRENT_PAGE = 0x00000008; + CurrentPageChanged = 0x00000008, /** The current MainViewShell (the ViewShell displayed in the center pane) has been removed. */ - static const EventId EID_MAIN_VIEW_REMOVED = 0x00000010; + MainViewRemoved = 0x00000010, /** A new ViewShell has been made the MainViewShell. */ - static const EventId EID_MAIN_VIEW_ADDED = 0x00000020; - - /** A ViewShell has been removed from one of the panes. Note that for - the ViewShell in the center pane bth this event type and - EID_MAIN_VIEW_REMOVED is broadcasted. - */ - static const EventId EID_VIEW_REMOVED = 0x00000040; + MainViewAdded = 0x00000020, /** A new ViewShell is being displayed in one of the panes. Note that for the ViewShell in the center pane both this event type and - EID_MAIN_VIEW_ADDED is broadcasted. + EventId::MainViewAdded is broadcasted. */ - static const EventId EID_VIEW_ADDED = 0x00000080; + ViewAdded = 0x00000040, /** The PaneManager is being destroyed. */ - static const EventId EID_PANE_MANAGER_DYING = 0x00000100; + PaneManagerDying = 0x00000080, /** Edit mode was (or is being) switched to normal mode. Find - EID_EDIT_MODE_MASTER below. + EventId::EditModeMaster below. */ - static const EventId EID_EDIT_MODE_NORMAL = 0x00000200; + EditModeNormal = 0x00000100, /** One or more pages have been inserted into or deleted from the model. */ - static const EventId EID_PAGE_ORDER = 0x00000400; + PageOrder = 0x00000200, /** Text editing in one of the shapes in the MainViewShell has started. */ - static const EventId EID_BEGIN_TEXT_EDIT = 0x00000800; + BeginTextEdit = 0x00000400, /** Text editing in one of the shapes in the MainViewShell has ended. */ - static const EventId EID_END_TEXT_EDIT = 0x00001000; + EndTextEdit = 0x00000800, /** A UNO controller has been attached to the UNO frame. */ - static const EventId EID_CONTROLLER_ATTACHED = 0x00002000; + ControllerAttached = 0x00001000, /** A UNO controller has been detached to the UNO frame. */ - static const EventId EID_CONTROLLER_DETACHED = 0x00004000; + ControllerDetached = 0x00002000, /** The state of a shape has changed. The page is available in the user data. */ - static const EventId EID_SHAPE_CHANGED = 0x00008000; + ShapeChanged = 0x00004000, /** A shape has been inserted to a page. The page is available in the user data. */ - static const EventId EID_SHAPE_INSERTED = 0x00010000; + ShapeInserted = 0x00008000, /** A shape has been removed from a page. The page is available in the user data. */ - static const EventId EID_SHAPE_REMOVED = 0x00020000; + ShapeRemoved = 0x00010000, /** A configuration update has been completed. */ - static const EventId EID_CONFIGURATION_UPDATED = 0x00040000; + ConfigurationUpdated = 0x00020000, /** Edit mode was (or is being) switched to master mode. */ - static const EventId EID_EDIT_MODE_MASTER = 0x00080000; + EditModeMaster = 0x00040000, - EventId meEventId; + /** Some constants that make it easier to remove a listener for all + event types at once. + */ + AllMask = 0x0007ffff, + NONE = 0x00000000 +}; +namespace o3tl { + template<> struct typed_flags<EventMultiplexerEventId> : is_typed_flags<EventMultiplexerEventId, 0x0007ffff> {}; +} + +namespace sd { namespace tools { + +class EventMultiplexerEvent +{ +public: + EventMultiplexerEventId meEventId; const void* mpUserData; EventMultiplexerEvent ( - EventId eEventId, + EventMultiplexerEventId eEventId, const void* pUserData); }; @@ -150,8 +156,8 @@ public: mrViewShellBase.GetEventMultiplexer().AddEventListener ( LINK(this,MasterPagesSelector,EventMultiplexerListener), - tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED); + EventMultiplexerEventId::MainViewAdded + | EventMultiplexerEventId::MainViewRemoved); */ class EventMultiplexer { @@ -161,12 +167,6 @@ public: EventMultiplexer (ViewShellBase& rBase); ~EventMultiplexer(); - /** Some constants that make it easier to remove a listener for all - event types at once. - */ - static const EventMultiplexerEvent::EventId EID_FULL_SET = 0xffffffff; - static const EventMultiplexerEvent::EventId EID_EMPTY_SET = 0x00000000; - /** Add an event listener that will be informed about the specified event types. @param rCallback @@ -178,18 +178,18 @@ public: */ void AddEventListener ( const Link<EventMultiplexerEvent&,void>& rCallback, - EventMultiplexerEvent::EventId aEventTypeSet); + EventMultiplexerEventId aEventTypeSet); /** Remove an event listener for the specified event types. @param aEventTypeSet The listener will not be called anymore for any of the event - types in this set. Use EID_FULL_SET, the default value, to + types in this set. Use EventMultiplexerEventId::AllMask, the default value, to remove the listener for all event types it has been registered for. */ void RemoveEventListener ( const Link<EventMultiplexerEvent&,void>& rCallback, - EventMultiplexerEvent::EventId aEventTypeSet = EID_FULL_SET); + EventMultiplexerEventId aEventTypeSet = EventMultiplexerEventId::AllMask); /** This method is used for out-of-line events. An event of the specified type will be sent to all listeners that are registered for @@ -200,7 +200,7 @@ public: Some data sent to the listeners along with the event. */ void MultiplexEvent( - EventMultiplexerEvent::EventId eEventId, + EventMultiplexerEventId eEventId, void* pUserData); private: diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx index 09458ac..465938a 100644 --- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx @@ -75,13 +75,13 @@ CurrentMasterPagesSelector::CurrentMasterPagesSelector ( { Link<sd::tools::EventMultiplexerEvent&,void> aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener)); rBase.GetEventMultiplexer()->AddEventListener(aLink, - sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE - | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL - | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER - | sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER - | sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED - | sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED - | sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED); + EventMultiplexerEventId::CurrentPageChanged + | EventMultiplexerEventId::EditModeNormal + | EventMultiplexerEventId::EditModeMaster + | EventMultiplexerEventId::PageOrder + | EventMultiplexerEventId::ShapeChanged + | EventMultiplexerEventId::ShapeInserted + | EventMultiplexerEventId::ShapeRemoved); } CurrentMasterPagesSelector::~CurrentMasterPagesSelector() @@ -255,14 +255,14 @@ IMPL_LINK(CurrentMasterPagesSelector,EventMultiplexerListener, { switch (rEvent.meEventId) { - case sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE: - case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL: - case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER: - case sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION: + case EventMultiplexerEventId::CurrentPageChanged: + case EventMultiplexerEventId::EditModeNormal: + case EventMultiplexerEventId::EditModeMaster: + case EventMultiplexerEventId::SlideSortedSelection: UpdateSelection(); break; - case sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER: + case EventMultiplexerEventId::PageOrder: // This is tricky. If a master page is removed, moved, or // added we have to wait until both the notes master page // and the standard master page have been removed, moved, @@ -274,11 +274,12 @@ IMPL_LINK(CurrentMasterPagesSelector,EventMultiplexerListener, MasterPagesSelector::Fill(); break; - case sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED: - case sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED: - case sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED: - InvalidatePreview(static_cast<const SdPage*>(rEvent.mpUserData)); + case EventMultiplexerEventId::ShapeChanged: + case EventMultiplexerEventId::ShapeInserted: + case EventMultiplexerEventId::ShapeRemoved: + InvalidatePreview(static_cast<const SdPage*>(rEvent.mpUserData)); break; + default: break; } } diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 9169178..16ae669 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -169,13 +169,13 @@ void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) Link<::sd::tools::EventMultiplexerEvent&,void> aEventListenerLink (LINK(this,LayoutMenu,EventMultiplexerListener)); mrBase.GetEventMultiplexer()->AddEventListener(aEventListenerLink, - ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE - | ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION - | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED - | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED - | ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED - | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL - | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER); + EventMultiplexerEventId::CurrentPageChanged + | EventMultiplexerEventId::SlideSortedSelection + | EventMultiplexerEventId::MainViewAdded + | EventMultiplexerEventId::MainViewRemoved + | EventMultiplexerEventId::ConfigurationUpdated + | EventMultiplexerEventId::EditModeNormal + | EventMultiplexerEventId::EditModeMaster); Window::SetHelpId(HID_SD_TASK_PANE_PREVIEW_LAYOUTS); SetAccessibleName(SdResId(STR_TASKPANEL_LAYOUT_MENU_TITLE)); @@ -710,21 +710,21 @@ IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEve { switch (rEvent.meEventId) { - case ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE: - case ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION: + case EventMultiplexerEventId::CurrentPageChanged: + case EventMultiplexerEventId::SlideSortedSelection: if ( ! mbSelectionUpdatePending) UpdateSelection(); break; - case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: + case EventMultiplexerEventId::MainViewAdded: mbIsMainViewChangePending = true; break; - case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: + case EventMultiplexerEventId::MainViewRemoved: HideFocus(); break; - case ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED: + case EventMultiplexerEventId::ConfigurationUpdated: if (mbIsMainViewChangePending) { mbIsMainViewChangePending = false; diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index ec23617..89587c5 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -332,14 +332,14 @@ void SlideBackground::addListener() Link<tools::EventMultiplexerEvent&,void> aLink( LINK(this, SlideBackground, EventMultiplexerListener) ); mrBase.GetEventMultiplexer()->AddEventListener ( aLink, - tools::EventMultiplexerEvent::EID_CURRENT_PAGE | - tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED | - tools::EventMultiplexerEvent::EID_SHAPE_CHANGED | - tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL | - tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER | - tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION | - tools::EventMultiplexerEvent::EID_END_TEXT_EDIT | - tools::EventMultiplexerEvent::EID_VIEW_ADDED); + EventMultiplexerEventId::CurrentPageChanged | + EventMultiplexerEventId::MainViewAdded | + EventMultiplexerEventId::ShapeChanged | + EventMultiplexerEventId::EditModeNormal | + EventMultiplexerEventId::EditModeMaster | + EventMultiplexerEventId::EditViewSelection | + EventMultiplexerEventId::EndTextEdit | + EventMultiplexerEventId::ViewAdded); } void SlideBackground::removeListener() @@ -355,15 +355,15 @@ IMPL_LINK(SlideBackground, EventMultiplexerListener, { // add more events as per requirement // Master Page change triggers a shape change event. Solves sync problem. - case tools::EventMultiplexerEvent::EID_SHAPE_CHANGED: + case EventMultiplexerEventId::ShapeChanged: populateMasterSlideDropdown(); break; - case tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL: - case tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER: + case EventMultiplexerEventId::EditModeNormal: + case EventMultiplexerEventId::EditModeMaster: mbEditModeChangePending = true; break; - case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION: - case tools::EventMultiplexerEvent::EID_END_TEXT_EDIT: + case EventMultiplexerEventId::EditViewSelection: + case EventMultiplexerEventId::EndTextEdit: { if (mbEditModeChangePending) { @@ -407,7 +407,7 @@ IMPL_LINK(SlideBackground, EventMultiplexerListener, } } break; - case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: + case EventMultiplexerEventId::CurrentPageChanged: { static sal_uInt16 SidArray[] = { SID_ATTR_PAGE_COLOR, @@ -422,7 +422,7 @@ IMPL_LINK(SlideBackground, EventMultiplexerListener, GetBindings()->Invalidate( SidArray ); } break; - case tools::EventMultiplexerEvent::EID_VIEW_ADDED: + case EventMultiplexerEventId::ViewAdded: { if(!mbTitle) { diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx index d4cf350..5203b87 100644 --- a/sd/source/ui/slidesorter/controller/SlsListener.cxx +++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx @@ -128,11 +128,11 @@ Listener::Listener ( Link<tools::EventMultiplexerEvent&,void> aLink (LINK(this, Listener, EventMultiplexerCallback)); mpBase->GetEventMultiplexer()->AddEventListener( aLink, - tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED - | tools::EventMultiplexerEvent::EID_CONTROLLER_ATTACHED - | tools::EventMultiplexerEvent::EID_CONTROLLER_DETACHED - | tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED); + EventMultiplexerEventId::MainViewRemoved + | EventMultiplexerEventId::MainViewAdded + | EventMultiplexerEventId::ControllerAttached + | EventMultiplexerEventId::ControllerDetached + | EventMultiplexerEventId::ConfigurationUpdated); } } @@ -188,11 +188,11 @@ void Listener::ReleaseListeners() Link<sd::tools::EventMultiplexerEvent&,void> aLink (LINK(this, Listener, EventMultiplexerCallback)); mpBase->GetEventMultiplexer()->RemoveEventListener( aLink, - tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED - | tools::EventMultiplexerEvent::EID_CONTROLLER_ATTACHED - | tools::EventMultiplexerEvent::EID_CONTROLLER_DETACHED - | tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED); + EventMultiplexerEventId::MainViewRemoved + | EventMultiplexerEventId::MainViewAdded + | EventMultiplexerEventId::ControllerAttached + | EventMultiplexerEventId::ControllerDetached + | EventMultiplexerEventId::ConfigurationUpdated); } } @@ -348,7 +348,7 @@ IMPL_LINK(Listener, EventMultiplexerCallback, ::sd::tools::EventMultiplexerEvent { switch (rEvent.meEventId) { - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: + case EventMultiplexerEventId::MainViewRemoved: { if (mpBase != nullptr) { @@ -359,11 +359,11 @@ IMPL_LINK(Listener, EventMultiplexerCallback, ::sd::tools::EventMultiplexerEvent } break; - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: + case EventMultiplexerEventId::MainViewAdded: mbIsMainViewChangePending = true; break; - case tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED: + case EventMultiplexerEventId::ConfigurationUpdated: if (mbIsMainViewChangePending && mpBase != nullptr) { mbIsMainViewChangePending = false; @@ -376,7 +376,7 @@ IMPL_LINK(Listener, EventMultiplexerCallback, ::sd::tools::EventMultiplexerEvent } break; - case tools::EventMultiplexerEvent::EID_CONTROLLER_ATTACHED: + case EventMultiplexerEventId::ControllerAttached: { ConnectToController(); // mrController.GetPageSelector().GetCoreSelection(); @@ -384,17 +384,17 @@ IMPL_LINK(Listener, EventMultiplexerCallback, ::sd::tools::EventMultiplexerEvent } break; - case tools::EventMultiplexerEvent::EID_CONTROLLER_DETACHED: + case EventMultiplexerEventId::ControllerDetached: DisconnectFromController(); break; - case tools::EventMultiplexerEvent::EID_SHAPE_CHANGED: - case tools::EventMultiplexerEvent::EID_SHAPE_INSERTED: - case tools::EventMultiplexerEvent::EID_SHAPE_REMOVED: + case EventMultiplexerEventId::ShapeChanged: + case EventMultiplexerEventId::ShapeInserted: + case EventMultiplexerEventId::ShapeRemoved: HandleShapeModification(static_cast<const SdrPage*>(rEvent.mpUserData)); break; - case tools::EventMultiplexerEvent::EID_END_TEXT_EDIT: + case EventMultiplexerEventId::EndTextEdit: if (rEvent.mpUserData != nullptr) { const SdrObject* pObject = static_cast<const SdrObject*>(rEvent.mpUserData); diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 9233453..f09f52d 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -424,11 +424,11 @@ void TableDesignWidget::addListener() Link<tools::EventMultiplexerEvent&,void> aLink( LINK(this,TableDesignWidget,EventMultiplexerListener) ); mrBase.GetEventMultiplexer()->AddEventListener ( aLink, - tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION - | tools::EventMultiplexerEvent::EID_CURRENT_PAGE - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED - | tools::EventMultiplexerEvent::EID_DISPOSING); + EventMultiplexerEventId::EditViewSelection + | EventMultiplexerEventId::CurrentPageChanged + | EventMultiplexerEventId::MainViewRemoved + | EventMultiplexerEventId::MainViewAdded + | EventMultiplexerEventId::Disposing); } void TableDesignWidget::removeListener() @@ -442,20 +442,22 @@ IMPL_LINK(TableDesignWidget,EventMultiplexerListener, { switch (rEvent.meEventId) { - case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: - case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION: + case EventMultiplexerEventId::CurrentPageChanged: + case EventMultiplexerEventId::EditViewSelection: onSelectionChanged(); break; - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: + case EventMultiplexerEventId::MainViewRemoved: mxView.clear(); onSelectionChanged(); break; - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: + case EventMultiplexerEventId::MainViewAdded: mxView.set( mrBase.GetController(), UNO_QUERY ); onSelectionChanged(); break; + + default: break; } } diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx index d51d5b9..fc5aae4 100644 --- a/sd/source/ui/tools/EventMultiplexer.cxx +++ b/sd/source/ui/tools/EventMultiplexer.cxx @@ -69,11 +69,11 @@ public: void AddEventListener ( const Link<EventMultiplexerEvent&,void>& rCallback, - EventMultiplexerEvent::EventId aEventTypes); + EventMultiplexerEventId aEventTypes); void RemoveEventListener ( const Link<EventMultiplexerEvent&,void>& rCallback, - EventMultiplexerEvent::EventId aEventTypes); + EventMultiplexerEventId aEventTypes); void CallListeners (EventMultiplexerEvent& rEvent); @@ -118,7 +118,7 @@ protected: private: ViewShellBase& mrBase; - typedef ::std::pair<Link<EventMultiplexerEvent&,void>,EventMultiplexerEvent::EventId> ListenerDescriptor; + typedef ::std::pair<Link<EventMultiplexerEvent&,void>,EventMultiplexerEventId> ListenerDescriptor; typedef ::std::vector<ListenerDescriptor> ListenerList; ListenerList maListeners; @@ -139,7 +139,7 @@ private: void DisconnectFromController(); void CallListeners ( - EventMultiplexerEvent::EventId eId, + EventMultiplexerEventId eId, void* pUserData = nullptr); /** This method throws a DisposedException when the object has already been @@ -177,20 +177,20 @@ EventMultiplexer::~EventMultiplexer() void EventMultiplexer::AddEventListener ( const Link<EventMultiplexerEvent&,void>& rCallback, - EventMultiplexerEvent::EventId aEventTypes) + EventMultiplexerEventId aEventTypes) { mpImpl->AddEventListener (rCallback, aEventTypes); } void EventMultiplexer::RemoveEventListener ( const Link<EventMultiplexerEvent&,void>& rCallback, - EventMultiplexerEvent::EventId aEventTypes) + EventMultiplexerEventId aEventTypes) { mpImpl->RemoveEventListener (rCallback, aEventTypes); } void EventMultiplexer::MultiplexEvent( - EventMultiplexerEvent::EventId eEventId, + EventMultiplexerEventId eEventId, void* pUserData ) { EventMultiplexerEvent aEvent(eEventId, pUserData); @@ -307,7 +307,7 @@ void EventMultiplexer::Implementation::ReleaseListeners() void EventMultiplexer::Implementation::AddEventListener ( const Link<EventMultiplexerEvent&,void>& rCallback, - EventMultiplexerEvent::EventId aEventTypes) + EventMultiplexerEventId aEventTypes) { ListenerList::iterator iListener (maListeners.begin()); ListenerList::const_iterator iEnd (maListeners.end()); @@ -327,7 +327,7 @@ void EventMultiplexer::Implementation::AddEventListener ( void EventMultiplexer::Implementation::RemoveEventListener ( const Link<EventMultiplexerEvent&,void>& rCallback, - EventMultiplexerEvent::EventId aEventTypes) + EventMultiplexerEventId aEventTypes) { ListenerList::iterator iListener (maListeners.begin()); ListenerList::const_iterator iEnd (maListeners.end()); @@ -339,7 +339,7 @@ void EventMultiplexer::Implementation::RemoveEventListener ( // Update the event type set. iListener->second &= ~aEventTypes; // When no events remain in the set then remove the listener. - if (iListener->second == EID_EMPTY_SET) + if (iListener->second == EventMultiplexerEventId::NONE) maListeners.erase (iListener); } } @@ -488,16 +488,16 @@ void SAL_CALL EventMultiplexer::Implementation::propertyChange ( if ( rEvent.PropertyName == aCurrentPagePropertyName ) { - CallListeners(EventMultiplexerEvent::EID_CURRENT_PAGE); + CallListeners(EventMultiplexerEventId::CurrentPageChanged); } else if ( rEvent.PropertyName == aEditModePropertyName ) { bool bIsMasterPageMode (false); rEvent.NewValue >>= bIsMasterPageMode; if (bIsMasterPageMode) - CallListeners(EventMultiplexerEvent::EID_EDIT_MODE_MASTER); + CallListeners(EventMultiplexerEventId::EditModeMaster); else - CallListeners(EventMultiplexerEvent::EID_EDIT_MODE_NORMAL); + CallListeners(EventMultiplexerEventId::EditModeNormal); } } @@ -513,19 +513,19 @@ void SAL_CALL EventMultiplexer::Implementation::frameAction ( { case frame::FrameAction_COMPONENT_DETACHING: DisconnectFromController(); - CallListeners (EventMultiplexerEvent::EID_CONTROLLER_DETACHED); + CallListeners (EventMultiplexerEventId::ControllerDetached); break; case frame::FrameAction_COMPONENT_REATTACHED: - CallListeners (EventMultiplexerEvent::EID_CONTROLLER_DETACHED); + CallListeners (EventMultiplexerEventId::ControllerDetached); DisconnectFromController(); ConnectToController(); - CallListeners (EventMultiplexerEvent::EID_CONTROLLER_ATTACHED); + CallListeners (EventMultiplexerEventId::ControllerAttached); break; case frame::FrameAction_COMPONENT_ATTACHED: ConnectToController(); - CallListeners (EventMultiplexerEvent::EID_CONTROLLER_ATTACHED); + CallListeners (EventMultiplexerEventId::ControllerAttached); break; default: @@ -539,7 +539,7 @@ void SAL_CALL EventMultiplexer::Implementation::selectionChanged ( const lang::EventObject& ) throw (css::uno::RuntimeException, std::exception) { - CallListeners (EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION); + CallListeners (EventMultiplexerEventId::EditViewSelection); } //===== drawing::framework::XConfigurationChangeListener ================== @@ -555,12 +555,12 @@ void SAL_CALL EventMultiplexer::Implementation::notifyConfigurationChange ( case ResourceActivationEvent: if (rEvent.ResourceId->getResourceURL().match(FrameworkHelper::msViewURLPrefix)) { - CallListeners (EventMultiplexerEvent::EID_VIEW_ADDED); + CallListeners (EventMultiplexerEventId::ViewAdded); if (rEvent.ResourceId->isBoundToURL( FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT)) { - CallListeners (EventMultiplexerEvent::EID_MAIN_VIEW_ADDED); + CallListeners (EventMultiplexerEventId::MainViewAdded); } // Add selection change listener at slide sorter. @@ -582,12 +582,10 @@ void SAL_CALL EventMultiplexer::Implementation::notifyConfigurationChange ( case ResourceDeactivationEvent: if (rEvent.ResourceId->getResourceURL().match(FrameworkHelper::msViewURLPrefix)) { - CallListeners (EventMultiplexerEvent::EID_VIEW_REMOVED); - if (rEvent.ResourceId->isBoundToURL( FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT)) { - CallListeners (EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED); + CallListeners (EventMultiplexerEventId::MainViewRemoved); } // Remove selection change listener from slide sorter. Add @@ -608,7 +606,7 @@ void SAL_CALL EventMultiplexer::Implementation::notifyConfigurationChange ( break; case ConfigurationUpdateEvent: - CallListeners (EventMultiplexerEvent::EID_CONFIGURATION_UPDATED); + CallListeners (EventMultiplexerEventId::ConfigurationUpdated); break; } @@ -616,7 +614,7 @@ void SAL_CALL EventMultiplexer::Implementation::notifyConfigurationChange ( void SAL_CALL EventMultiplexer::Implementation::disposing() { - CallListeners (EventMultiplexerEvent::EID_DISPOSING); + CallListeners (EventMultiplexerEventId::Disposing); ReleaseListeners(); } @@ -642,25 +640,25 @@ void EventMultiplexer::Implementation::Notify ( { case SdrHintKind::ModelCleared: case SdrHintKind::PageOrderChange: - CallListeners (EventMultiplexerEvent::EID_PAGE_ORDER); + CallListeners (EventMultiplexerEventId::PageOrder); break; case SdrHintKind::SwitchToPage: - CallListeners (EventMultiplexerEvent::EID_CURRENT_PAGE); + CallListeners (EventMultiplexerEventId::CurrentPageChanged); break; case SdrHintKind::ObjectChange: - CallListeners(EventMultiplexerEvent::EID_SHAPE_CHANGED, + CallListeners(EventMultiplexerEventId::ShapeChanged, const_cast<void*>(static_cast<const void*>(pSdrHint->GetPage()))); break; case SdrHintKind::ObjectInserted: - CallListeners(EventMultiplexerEvent::EID_SHAPE_INSERTED, + CallListeners(EventMultiplexerEventId::ShapeInserted, const_cast<void*>(static_cast<const void*>(pSdrHint->GetPage()))); break; case SdrHintKind::ObjectRemoved: - CallListeners(EventMultiplexerEvent::EID_SHAPE_REMOVED, + CallListeners(EventMultiplexerEventId::ShapeRemoved, const_cast<void*>(static_cast<const void*>(pSdrHint->GetPage()))); break; default: @@ -675,7 +673,7 @@ void EventMultiplexer::Implementation::Notify ( } void EventMultiplexer::Implementation::CallListeners ( - EventMultiplexerEvent::EventId eId, + EventMultiplexerEventId eId, void* pUserData) { EventMultiplexerEvent aEvent(eId, pUserData); @@ -689,20 +687,20 @@ void EventMultiplexer::Implementation::CallListeners (EventMultiplexerEvent& rEv ListenerList::const_iterator iListenerEnd (aCopyListeners.end()); for (; iListener!=iListenerEnd; ++iListener) { - if ((iListener->second && rEvent.meEventId)) + if (iListener->second & rEvent.meEventId) iListener->first.Call(rEvent); } } IMPL_LINK_NOARG(EventMultiplexer::Implementation, SlideSorterSelectionChangeListener, LinkParamNone*, void) { - CallListeners(EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION); + CallListeners(EventMultiplexerEventId::SlideSortedSelection); } //===== EventMultiplexerEvent ================================================= EventMultiplexerEvent::EventMultiplexerEvent ( - EventId eEventId, + EventMultiplexerEventId eEventId, const void* pUserData) : meEventId(eEventId), mpUserData(pUserData) diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx index 613d8b2..fc57bec 100644 --- a/sd/source/ui/view/FormShellManager.cxx +++ b/sd/source/ui/view/FormShellManager.cxx @@ -60,9 +60,9 @@ FormShellManager::FormShellManager (ViewShellBase& rBase) Link<sd::tools::EventMultiplexerEvent&,void> aLink (LINK(this, FormShellManager, ConfigurationUpdateHandler)); mrBase.GetEventMultiplexer()->AddEventListener( aLink, - sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED - | sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED - | sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED); + EventMultiplexerEventId::MainViewRemoved + | EventMultiplexerEventId::MainViewAdded + | EventMultiplexerEventId::ConfigurationUpdated); RegisterAtCenterPane(); } @@ -202,15 +202,15 @@ IMPL_LINK(FormShellManager, ConfigurationUpdateHandler, sd::tools::EventMultiple { switch (rEvent.meEventId) { - case sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: + case EventMultiplexerEventId::MainViewRemoved: UnregisterAtCenterPane(); break; - case sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: + case EventMultiplexerEventId::MainViewAdded: mbIsMainViewChangePending = true; break; - case sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED: + case EventMultiplexerEventId::ConfigurationUpdated: if (mbIsMainViewChangePending) { mbIsMainViewChangePending = false; diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index d97d91a..eb40f3c 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -538,9 +538,9 @@ ToolBarManager::Implementation::Implementation ( Link<tools::EventMultiplexerEvent&,void> aLink (LINK(this,ToolBarManager::Implementation,EventMultiplexerCallback)); mpEventMultiplexer->AddEventListener( aLink, - tools::EventMultiplexerEvent::EID_CONTROLLER_ATTACHED - | tools::EventMultiplexerEvent::EID_CONTROLLER_DETACHED - | tools::EventMultiplexerEvent::EID_PANE_MANAGER_DYING); + EventMultiplexerEventId::ControllerAttached + | EventMultiplexerEventId::ControllerDetached + | EventMultiplexerEventId::PaneManagerDying); } /** The order of statements is important. @@ -867,19 +867,21 @@ IMPL_LINK(ToolBarManager::Implementation,EventMultiplexerCallback, SolarMutexGuard g; switch (rEvent.meEventId) { - case tools::EventMultiplexerEvent::EID_CONTROLLER_ATTACHED: + case EventMultiplexerEventId::ControllerAttached: if (mnPendingSetValidCall == nullptr) mnPendingSetValidCall = Application::PostUserEvent(LINK(this,Implementation,SetValidCallback)); break; - case tools::EventMultiplexerEvent::EID_CONTROLLER_DETACHED: + case EventMultiplexerEventId::ControllerDetached: SetValid(false); break; - case tools::EventMultiplexerEvent::EID_PANE_MANAGER_DYING: + case EventMultiplexerEventId::PaneManagerDying: SetValid(false); break; + + default: break; } } diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 83e8992..3288f7f 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -129,8 +129,8 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineVie Link<tools::EventMultiplexerEvent&,void> aLink( LINK(this,OutlineView,EventMultiplexerListener) ); mrOutlineViewShell.GetViewShellBase().GetEventMultiplexer()->AddEventListener( aLink, - tools::EventMultiplexerEvent::EID_CURRENT_PAGE - | tools::EventMultiplexerEvent::EID_PAGE_ORDER); + EventMultiplexerEventId::CurrentPageChanged + | EventMultiplexerEventId::PageOrder); LanguageType eLang = mrOutliner.GetDefaultLanguage(); maPageNumberFont = OutputDevice::GetDefaultFont( DefaultFontType::SANS_UNICODE, eLang, GetDefaultFontFlags::NONE ); @@ -1427,11 +1427,11 @@ IMPL_LINK(OutlineView, EventMultiplexerListener, ::sd::tools::EventMultiplexerEv { switch (rEvent.meEventId) { - case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: + case EventMultiplexerEventId::CurrentPageChanged: SetActualPage(mrOutlineViewShell.GetActualPage()); break; - case tools::EventMultiplexerEvent::EID_PAGE_ORDER: + case EventMultiplexerEventId::PageOrder: if (dynamic_cast<Outliner&>(mrOutliner).GetIgnoreCurrentPageChangesLevel()==0) { if (((mrDoc.GetPageCount()-1)%2) == 0) @@ -1444,6 +1444,8 @@ IMPL_LINK(OutlineView, EventMultiplexerListener, ::sd::tools::EventMultiplexerEv } } break; + + default: break; } } diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 7853f40..247fe71 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -665,7 +665,7 @@ bool View::SdrBeginTextEdit( bool bMasterPage = pPage && pPage->IsMasterPage(); GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent( - sd::tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT, static_cast<void*>(pObj) ); + EventMultiplexerEventId::BeginTextEdit, static_cast<void*>(pObj) ); if( pOutl==nullptr && pObj ) pOutl = SdrMakeOutliner(OutlinerMode::TextObject, *pObj->GetModel()); @@ -801,7 +801,7 @@ SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally) } GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent( - sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, + EventMultiplexerEventId::EndTextEdit, static_cast<void*>(xObj.get()) ); if( xObj.is() ) diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index 5b6729f..6cff6d7 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -399,11 +399,11 @@ ViewOverlayManager::ViewOverlayManager( ViewShellBase& rViewShellBase ) , mnUpdateTagsEvent( nullptr ) { Link<tools::EventMultiplexerEvent&,void> aLink( LINK(this,ViewOverlayManager,EventMultiplexerListener) ); - mrBase.GetEventMultiplexer()->AddEventListener(aLink, tools::EventMultiplexerEvent::EID_CURRENT_PAGE - | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED - | tools::EventMultiplexerEvent::EID_VIEW_ADDED - | tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT - | tools::EventMultiplexerEvent::EID_END_TEXT_EDIT ); + mrBase.GetEventMultiplexer()->AddEventListener(aLink, EventMultiplexerEventId::CurrentPageChanged + | EventMultiplexerEventId::MainViewAdded + | EventMultiplexerEventId::ViewAdded + | EventMultiplexerEventId::BeginTextEdit + | EventMultiplexerEventId::EndTextEdit ); StartListening( *mrBase.GetDocShell() ); } @@ -506,13 +506,14 @@ IMPL_LINK(ViewOverlayManager,EventMultiplexerListener, { switch (rEvent.meEventId) { - case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: - case tools::EventMultiplexerEvent::EID_VIEW_ADDED: - case tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT: - case tools::EventMultiplexerEvent::EID_END_TEXT_EDIT: - case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: + case EventMultiplexerEventId::MainViewAdded: + case EventMultiplexerEventId::ViewAdded: + case EventMultiplexerEventId::BeginTextEdit: + case EventMultiplexerEventId::EndTextEdit: + case EventMultiplexerEventId::CurrentPageChanged: UpdateTags(); break; + default: break; } } commit b417930dce9570ad16d04a1f834f5be2738b19ed Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Oct 11 16:25:54 2016 +0200 convert SC_NESTEDBUTTON constants to scoped enum Change-Id: Ic0bc7036972d0577c4c910ee63f92690d9c0a14d diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 7272cc0..2eb028c 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -143,7 +143,8 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou sal_uInt16 nButtonDown; sal_uInt8 nMouseStatus; - sal_uInt8 nNestedButtonState; // track nested button up/down calls + enum class ScNestedButtonState { NONE, Down, Up }; + ScNestedButtonState nNestedButtonState; // track nested button up/down calls long nDPField; ScDPObject* pDragDPObj; //! name? diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index c404148..96b4033 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -147,10 +147,6 @@ using namespace css; using namespace css::uno; -const sal_uInt8 SC_NESTEDBUTTON_NONE = 0; -const sal_uInt8 SC_NESTEDBUTTON_DOWN = 1; -const sal_uInt8 SC_NESTEDBUTTON_UP = 2; - #define SC_AUTOFILTER_ALL 0 #define SC_AUTOFILTER_TOP10 1 #define SC_AUTOFILTER_CUSTOM 2 @@ -442,7 +438,7 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos nCursorHideCount( 0 ), nButtonDown( 0 ), nMouseStatus( SC_GM_NONE ), - nNestedButtonState( SC_NESTEDBUTTON_NONE ), + nNestedButtonState( ScNestedButtonState::NONE ), nDPField( 0 ), pDragDPObj( nullptr ), nRFIndex( 0 ), @@ -1524,14 +1520,14 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction ) void ScGridWindow::MouseButtonDown( const MouseEvent& rMEvt ) { - nNestedButtonState = SC_NESTEDBUTTON_DOWN; + nNestedButtonState = ScNestedButtonState::Down; MouseEventState aState; HandleMouseButtonDown(rMEvt, aState); if (aState.mbActivatePart) pViewData->GetView()->ActivatePart(eWhich); - if ( nNestedButtonState == SC_NESTEDBUTTON_UP ) + if ( nNestedButtonState == ScNestedButtonState::Up ) { // #i41690# If an object is deactivated from MouseButtonDown, it might reschedule, // so MouseButtonUp comes before the MouseButtonDown call is finished. In this case, @@ -1543,7 +1539,7 @@ void ScGridWindow::MouseButtonDown( const MouseEvent& rMEvt ) if ( IsTracking() ) EndTracking(); // normally done in VCL as part of MouseButtonUp handling } - nNestedButtonState = SC_NESTEDBUTTON_NONE; + nNestedButtonState = ScNestedButtonState::NONE; } bool ScGridWindow::IsCellCoveredByText(SCsCOL nPosX, SCsROW nPosY, SCTAB nTab, SCsCOL &rTextStartPosX) @@ -1964,8 +1960,8 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) // #i41690# detect a MouseButtonUp call from within MouseButtonDown // (possible through Reschedule from storing an OLE object that is deselected) - if ( nNestedButtonState == SC_NESTEDBUTTON_DOWN ) - nNestedButtonState = SC_NESTEDBUTTON_UP; + if ( nNestedButtonState == ScNestedButtonState::Down ) + nNestedButtonState = ScNestedButtonState::Up; if (nButtonDown != rMEvt.GetButtons()) nMouseStatus = SC_GM_IGNORE; // reset and return commit f553ce143af702e93dd62c24cf489ac94dedc6c5 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Oct 11 16:18:24 2016 +0200 convert CSV_DIFF constants to typed_flags_set Change-Id: Ib4aea2d8288ee25cb14514c38bc8809e08e61985 diff --git a/sc/source/ui/dbgui/csvcontrol.cxx b/sc/source/ui/dbgui/csvcontrol.cxx index b868b58..666dc0f 100644 --- a/sc/source/ui/dbgui/csvcontrol.cxx +++ b/sc/source/ui/dbgui/csvcontrol.cxx @@ -42,17 +42,17 @@ ScCsvLayoutData::ScCsvLayoutData() : ScCsvDiff ScCsvLayoutData::GetDiff( const ScCsvLayoutData& rData ) const { - ScCsvDiff nRet = CSV_DIFF_EQUAL; - if( mnPosCount != rData.mnPosCount ) nRet |= CSV_DIFF_POSCOUNT; - if( mnPosOffset != rData.mnPosOffset ) nRet |= CSV_DIFF_POSOFFSET; - if( mnHdrWidth != rData.mnHdrWidth ) nRet |= CSV_DIFF_HDRWIDTH; - if( mnCharWidth != rData.mnCharWidth ) nRet |= CSV_DIFF_CHARWIDTH; - if( mnLineCount != rData.mnLineCount ) nRet |= CSV_DIFF_LINECOUNT; - if( mnLineOffset != rData.mnLineOffset ) nRet |= CSV_DIFF_LINEOFFSET; - if( mnHdrHeight != rData.mnHdrHeight ) nRet |= CSV_DIFF_HDRHEIGHT; - if( mnLineHeight != rData.mnLineHeight ) nRet |= CSV_DIFF_LINEHEIGHT; - if( mnPosCursor != rData.mnPosCursor ) nRet |= CSV_DIFF_RULERCURSOR; - if( mnColCursor != rData.mnColCursor ) nRet |= CSV_DIFF_GRIDCURSOR; + ScCsvDiff nRet = ScCsvDiff::Equal; + if( mnPosCount != rData.mnPosCount ) nRet |= ScCsvDiff::PosCount; + if( mnPosOffset != rData.mnPosOffset ) nRet |= ScCsvDiff::PosOffset; + if( mnHdrWidth != rData.mnHdrWidth ) nRet |= ScCsvDiff::HeaderWidth; + if( mnCharWidth != rData.mnCharWidth ) nRet |= ScCsvDiff::CharWidth; + if( mnLineCount != rData.mnLineCount ) nRet |= ScCsvDiff::LineCount; + if( mnLineOffset != rData.mnLineOffset ) nRet |= ScCsvDiff::LineOffset; + if( mnHdrHeight != rData.mnHdrHeight ) nRet |= ScCsvDiff::HeaderHeight; + if( mnLineHeight != rData.mnLineHeight ) nRet |= ScCsvDiff::LineHeight; + if( mnPosCursor != rData.mnPosCursor ) nRet |= ScCsvDiff::RulerCursor; + if( mnColCursor != rData.mnColCursor ) nRet |= ScCsvDiff::GridCursor; return nRet; } diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 34cbd32..2a26cc9 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -136,17 +136,17 @@ void ScCsvGrid::UpdateOffsetX() void ScCsvGrid::ApplyLayout( const ScCsvLayoutData& rOldData ) { ScCsvDiff nDiff = GetLayoutData().GetDiff( rOldData ); - if( nDiff == CSV_DIFF_EQUAL ) return; + if( nDiff == ScCsvDiff::Equal ) return; DisableRepaint(); - if( nDiff & CSV_DIFF_RULERCURSOR ) + if( nDiff & ScCsvDiff::RulerCursor ) { ImplInvertCursor( rOldData.mnPosCursor ); ImplInvertCursor( GetRulerCursorPos() ); } - if( nDiff & CSV_DIFF_POSCOUNT ) + if( nDiff & ScCsvDiff::PosCount ) { if( GetPosCount() < rOldData.mnPosCount ) { @@ -159,21 +159,21 @@ void ScCsvGrid::ApplyLayout( const ScCsvLayoutData& rOldData ) maColStates.resize( maSplits.Count() - 1 ); } - if( nDiff & CSV_DIFF_LINEOFFSET ) + if( nDiff & ScCsvDiff::LineOffset ) { Execute( CSVCMD_UPDATECELLTEXTS ); UpdateOffsetX(); } - ScCsvDiff nHVDiff = nDiff & (CSV_DIFF_HORIZONTAL | CSV_DIFF_VERTICAL); - if( nHVDiff == CSV_DIFF_POSOFFSET ) + ScCsvDiff nHVDiff = nDiff & (ScCsvDiff::HorizontalMask | ScCsvDiff::VerticalMask); + if( nHVDiff == ScCsvDiff::PosOffset ) ImplDrawHorzScrolled( rOldData.mnPosOffset ); - else if( nHVDiff != CSV_DIFF_EQUAL ) + else if( nHVDiff != ScCsvDiff::Equal ) InvalidateGfx(); EnableRepaint(); - if( nDiff & (CSV_DIFF_POSOFFSET | CSV_DIFF_LINEOFFSET) ) + if( nDiff & (ScCsvDiff::PosOffset | ScCsvDiff::LineOffset) ) AccSendVisibleEvent(); } diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx index 17ac609..3c53c12 100644 --- a/sc/source/ui/dbgui/csvruler.cxx +++ b/sc/source/ui/dbgui/csvruler.cxx @@ -118,24 +118,24 @@ void ScCsvRuler::setPosSizePixel( void ScCsvRuler::ApplyLayout( const ScCsvLayoutData& rOldData ) { - ScCsvDiff nDiff = GetLayoutData().GetDiff( rOldData ) & (CSV_DIFF_HORIZONTAL | CSV_DIFF_RULERCURSOR); - if( nDiff == CSV_DIFF_EQUAL ) return; + ScCsvDiff nDiff = GetLayoutData().GetDiff( rOldData ) & (ScCsvDiff::HorizontalMask | ScCsvDiff::RulerCursor); + if( nDiff == ScCsvDiff::Equal ) return; DisableRepaint(); - if( nDiff & CSV_DIFF_HORIZONTAL ) + if( nDiff & ScCsvDiff::HorizontalMask ) { InitSizeData(); if( GetRulerCursorPos() >= GetPosCount() ) MoveCursor( GetPosCount() - 1 ); } - if( nDiff & CSV_DIFF_RULERCURSOR ) + if( nDiff & ScCsvDiff::RulerCursor ) { ImplInvertCursor( rOldData.mnPosCursor ); ImplInvertCursor( GetRulerCursorPos() ); } EnableRepaint(); - if( nDiff & CSV_DIFF_POSOFFSET ) + if( nDiff & ScCsvDiff::PosOffset ) AccSendVisibleEvent(); } diff --git a/sc/source/ui/inc/csvcontrol.hxx b/sc/source/ui/inc/csvcontrol.hxx index 1406e71..ac724af 100644 --- a/sc/source/ui/inc/csvcontrol.hxx +++ b/sc/source/ui/inc/csvcontrol.hxx @@ -26,6 +26,7 @@ #include "address.hxx" #include "csvsplits.hxx" #include <com/sun/star/uno/Reference.hxx> +#include <o3tl/typed_flags_set.hxx> class ScAccessibleCsvControl; namespace com { namespace sun { namespace star { namespace accessibility { @@ -88,23 +89,26 @@ enum ScMoveMode }; /** Flags for comparison of old and new control layout data. */ -typedef sal_uInt32 ScCsvDiff; - -const ScCsvDiff CSV_DIFF_EQUAL = 0x00000000; -const ScCsvDiff CSV_DIFF_POSCOUNT = 0x00000001; -const ScCsvDiff CSV_DIFF_POSOFFSET = 0x00000002; -const ScCsvDiff CSV_DIFF_HDRWIDTH = 0x00000004; -const ScCsvDiff CSV_DIFF_CHARWIDTH = 0x00000008; -const ScCsvDiff CSV_DIFF_LINECOUNT = 0x00000010; -const ScCsvDiff CSV_DIFF_LINEOFFSET = 0x00000020; -const ScCsvDiff CSV_DIFF_HDRHEIGHT = 0x00000040; -const ScCsvDiff CSV_DIFF_LINEHEIGHT = 0x00000080; -const ScCsvDiff CSV_DIFF_RULERCURSOR = 0x00000100; -const ScCsvDiff CSV_DIFF_GRIDCURSOR = 0x00000200; - -const ScCsvDiff CSV_DIFF_HORIZONTAL = CSV_DIFF_POSCOUNT | CSV_DIFF_POSOFFSET | CSV_DIFF_HDRWIDTH | CSV_DIFF_CHARWIDTH; -const ScCsvDiff CSV_DIFF_VERTICAL = CSV_DIFF_LINECOUNT | CSV_DIFF_LINEOFFSET | CSV_DIFF_HDRHEIGHT | CSV_DIFF_LINEHEIGHT; -const ScCsvDiff CSV_DIFF_CURSOR = CSV_DIFF_RULERCURSOR | CSV_DIFF_GRIDCURSOR; +enum class ScCsvDiff : sal_uInt32 { + Equal = 0x0000, + PosCount = 0x0001, + PosOffset = 0x0002, + HeaderWidth = 0x0004, + CharWidth = 0x0008, + LineCount = 0x0010, + LineOffset = 0x0020, + HeaderHeight = 0x0040, + LineHeight = 0x0080, + RulerCursor = 0x0100, + GridCursor = 0x0200, + + HorizontalMask = PosCount | PosOffset | HeaderWidth | CharWidth, + VerticalMask = LineCount | LineOffset | HeaderHeight | LineHeight +}; +namespace o3tl { + template<> struct typed_flags<ScCsvDiff> : is_typed_flags<ScCsvDiff, 0x03ff> {}; +} + /** A structure containing all layout data valid for both ruler and data grid (i.e. scroll position or column width). */ @@ -142,7 +146,7 @@ struct ScCsvLayoutData inline bool operator==( const ScCsvLayoutData& rData1, const ScCsvLayoutData& rData2 ) { - return rData1.GetDiff( rData2 ) == CSV_DIFF_EQUAL; + return rData1.GetDiff( rData2 ) == ScCsvDiff::Equal; } inline bool operator!=( const ScCsvLayoutData& rData1, const ScCsvLayoutData& rData2 ) commit f50678bf9e8a1d9f4f05de974da1d685fc48aa96 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Oct 11 16:06:20 2016 +0200 convert EXC_TABBUF constants to typed_flags_set Change-Id: I40b5d94fc559350f7dd4e0efde8f71be9518b87c diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 8c7b139..b850510 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -657,12 +657,6 @@ private: // Excel sheet indexes ======================================================== -const sal_uInt8 EXC_TABBUF_IGNORE = 0x01; /// Sheet will be ignored completely. -const sal_uInt8 EXC_TABBUF_EXTERN = 0x02; /// Sheet is linked externally. -const sal_uInt8 EXC_TABBUF_SKIPMASK = 0x0F; /// Sheet will be skipped, if any flag is set. -const sal_uInt8 EXC_TABBUF_VISIBLE = 0x10; /// Sheet is visible. -const sal_uInt8 EXC_TABBUF_SELECTED = 0x20; /// Sheet is selected. -const sal_uInt8 EXC_TABBUF_MIRRORED = 0x40; /// Sheet is mirrored (right-to-left). XclExpTabInfo::XclExpTabInfo( const XclExpRoot& rRoot ) : XclExpRoot( rRoot ), @@ -690,13 +684,13 @@ XclExpTabInfo::XclExpTabInfo( const XclExpRoot& rRoot ) : // ignored sheets (skipped by export, with invalid Excel sheet index) if( rDoc.IsScenario( nScTab ) ) { - SetFlag( nScTab, EXC_TABBUF_IGNORE ); + SetFlag( nScTab, ExcTabBufFlags::Ignore ); } // external sheets (skipped, but with valid Excel sheet index for ref's) else if( rDoc.GetLinkMode( nScTab ) == ScLinkMode::VALUE ) { - SetFlag( nScTab, EXC_TABBUF_EXTERN ); + SetFlag( nScTab, ExcTabBufFlags::Extern ); } // exported sheets @@ -713,14 +707,14 @@ XclExpTabInfo::XclExpTabInfo( const XclExpRoot& rRoot ) : nFirstVisScTab = nScTab; // sheet visible (only exported sheets) - SetFlag( nScTab, EXC_TABBUF_VISIBLE, rDoc.IsVisible( nScTab ) ); + SetFlag( nScTab, ExcTabBufFlags::Visible, rDoc.IsVisible( nScTab ) ); // sheet selected (only exported sheets) if( const ScExtTabSettings* pTabSett = rDocOpt.GetTabSettings( nScTab ) ) - SetFlag( nScTab, EXC_TABBUF_SELECTED, pTabSett->mbSelected ); + SetFlag( nScTab, ExcTabBufFlags::Selected, pTabSett->mbSelected ); // sheet mirrored (only exported sheets) - SetFlag( nScTab, EXC_TABBUF_MIRRORED, rDoc.IsLayoutRTL( nScTab ) ); + SetFlag( nScTab, ExcTabBufFlags::Mirrored, rDoc.IsLayoutRTL( nScTab ) ); } } @@ -737,15 +731,15 @@ XclExpTabInfo::XclExpTabInfo( const XclExpRoot& rRoot ) : { // no exportable sheet at all -> use active sheet and export it nFirstVisScTab = nDisplScTab; - SetFlag( nFirstVisScTab, EXC_TABBUF_SKIPMASK, false ); // clear skip flags + SetFlag( nFirstVisScTab, ExcTabBufFlags::SkipMask, false ); // clear skip flags } - SetFlag( nFirstVisScTab, EXC_TABBUF_VISIBLE ); // must be visible, even if originally hidden + SetFlag( nFirstVisScTab, ExcTabBufFlags::Visible ); // must be visible, even if originally hidden } // find currently displayed sheet if( !IsExportTab( nDisplScTab ) ) // selected sheet not exported (i.e. scenario) -> use first visible nDisplScTab = nFirstVisScTab; - SetFlag( nDisplScTab, EXC_TABBUF_VISIBLE | EXC_TABBUF_SELECTED ); + SetFlag( nDisplScTab, ExcTabBufFlags::Visible | ExcTabBufFlags::Selected ); // number of selected sheets for( nScTab = 0; nScTab < mnScCnt; ++nScTab ) @@ -766,24 +760,24 @@ XclExpTabInfo::XclExpTabInfo( const XclExpRoot& rRoot ) : bool XclExpTabInfo::IsExportTab( SCTAB nScTab ) const { /* Check sheet index before to avoid assertion in GetFlag(). */ - return (nScTab < mnScCnt && nScTab >= 0) && !GetFlag( nScTab, EXC_TABBUF_SKIPMASK ); + return (nScTab < mnScCnt && nScTab >= 0) && !GetFlag( nScTab, ExcTabBufFlags::SkipMask ); } bool XclExpTabInfo::IsExternalTab( SCTAB nScTab ) const { /* Check sheet index before to avoid assertion (called from formula compiler also for deleted references). */ - return (nScTab < mnScCnt && nScTab >= 0) && GetFlag( nScTab, EXC_TABBUF_EXTERN ); + return (nScTab < mnScCnt && nScTab >= 0) && GetFlag( nScTab, ExcTabBufFlags::Extern ); } bool XclExpTabInfo::IsVisibleTab( SCTAB nScTab ) const { - return GetFlag( nScTab, EXC_TABBUF_VISIBLE ); + return GetFlag( nScTab, ExcTabBufFlags::Visible ); } bool XclExpTabInfo::IsSelectedTab( SCTAB nScTab ) const { - return GetFlag( nScTab, EXC_TABBUF_SELECTED ); + return GetFlag( nScTab, ExcTabBufFlags::Selected ); } bool XclExpTabInfo::IsDisplayedTab( SCTAB nScTab ) const @@ -794,7 +788,7 @@ bool XclExpTabInfo::IsDisplayedTab( SCTAB nScTab ) const bool XclExpTabInfo::IsMirroredTab( SCTAB nScTab ) const { - return GetFlag( nScTab, EXC_TABBUF_MIRRORED ); + return GetFlag( nScTab, ExcTabBufFlags::Mirrored ); } OUString XclExpTabInfo::GetScTabName( SCTAB nScTab ) const @@ -814,17 +808,22 @@ SCTAB XclExpTabInfo::GetRealScTab( SCTAB nSortedScTab ) const return (nSortedScTab < mnScCnt && nSortedScTab >= 0) ? maFromSortedVec[ nSortedScTab ] : SCTAB_INVALID; } -bool XclExpTabInfo::GetFlag( SCTAB nScTab, sal_uInt8 nFlags ) const +bool XclExpTabInfo::GetFlag( SCTAB nScTab, ExcTabBufFlags nFlags ) const { OSL_ENSURE( nScTab < mnScCnt && nScTab >= 0, "XclExpTabInfo::GetFlag - sheet out of range" ); - return (nScTab < mnScCnt && nScTab >= 0) && ::get_flag( maTabInfoVec[ nScTab ].mnFlags, nFlags ); + return (nScTab < mnScCnt && nScTab >= 0) && (maTabInfoVec[ nScTab ].mnFlags & nFlags); } -void XclExpTabInfo::SetFlag( SCTAB nScTab, sal_uInt8 nFlags, bool bSet ) +void XclExpTabInfo::SetFlag( SCTAB nScTab, ExcTabBufFlags nFlags, bool bSet ) { OSL_ENSURE( nScTab < mnScCnt && nScTab >= 0, "XclExpTabInfo::SetFlag - sheet out of range" ); if( nScTab < mnScCnt && nScTab >= 0 ) - ::set_flag( maTabInfoVec[ nScTab ].mnFlags, nFlags, bSet ); + { + if (bSet) + maTabInfoVec[ nScTab ].mnFlags |= nFlags; + else + maTabInfoVec[ nScTab ].mnFlags &= ~nFlags; + } } void XclExpTabInfo::CalcXclIndexes() diff --git a/sc/source/filter/inc/xelink.hxx b/sc/source/filter/inc/xelink.hxx index 86eceb1..b8f0868 100644 --- a/sc/source/filter/inc/xelink.hxx +++ b/sc/source/filter/inc/xelink.hxx @@ -26,6 +26,7 @@ #include "xehelper.hxx" #include "xeformula.hxx" #include "externalrefmgr.hxx" +#include <o3tl/typed_flags_set.hxx> #include <memory> struct ScSingleRefData; @@ -44,6 +45,19 @@ Classes for export of different kinds of internal/external references. // Excel sheet indexes ======================================================== +enum class ExcTabBufFlags : sal_uInt8 { + NONE = 0x00, + Ignore = 0x01, /// Sheet will be ignored completely. + Extern = 0x02, /// Sheet is linked externally. + SkipMask = 0x03, /// Sheet will be skipped, if any flag is set. + Visible = 0x10, /// Sheet is visible. + Selected = 0x20, /// Sheet is selected. + Mirrored = 0x40 /// Sheet is mirrored (right-to-left). +}; +namespace o3tl { + template<> struct typed_flags<ExcTabBufFlags> : is_typed_flags<ExcTabBufFlags, 0x73> {}; +} + /** Stores the correct Excel sheet index for each Calc sheet. @descr The class knows all sheets which will not exported (i.e. external link sheets, scenario sheets). */ @@ -91,9 +105,9 @@ public: private: /** Returns true, if any of the passed flags is set for the specified Calc sheet. */ - bool GetFlag( SCTAB nScTab, sal_uInt8 nFlags ) const; + bool GetFlag( SCTAB nScTab, ExcTabBufFlags nFlags ) const; /** Sets or clears (depending on bSet) all passed flags for the specified Calc sheet. */ - void SetFlag( SCTAB nScTab, sal_uInt8 nFlags, bool bSet = true ); + void SetFlag( SCTAB nScTab, ExcTabBufFlags nFlags, bool bSet = true ); /** Searches for sheets not to be exported. */ void CalcXclIndexes(); @@ -104,10 +118,10 @@ private: /** Data structure with information about one Calc sheet. */ struct XclExpTabInfoEntry { - OUString maScName; + OUString maScName; sal_uInt16 mnXclTab; - sal_uInt8 mnFlags; - inline explicit XclExpTabInfoEntry() : mnXclTab( 0 ), mnFlags( 0 ) {} + ExcTabBufFlags mnFlags; + inline explicit XclExpTabInfoEntry() : mnXclTab( 0 ), mnFlags( ExcTabBufFlags::NONE ) {} }; typedef ::std::vector< XclExpTabInfoEntry > XclExpTabInfoVec; commit ed8952596750cfef30594d5eba5012e667edb968 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Oct 11 15:57:21 2016 +0200 improve error message in refcounting plugin Change-Id: I02b483c1d696913b33112b9248747f9c3d28dc55 diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index bcfc11b..ffbe478 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -340,7 +340,8 @@ void RefCounting::checkUnoReference(QualType qt, const Decl* decl, const std::st DiagnosticsEngine::Warning, "uno::Reference " + rDeclName + " with template parameter that does not contain ::static_type() " + qt.getAsString() - + ", parent is " + rParentName, + + ", parent is " + rParentName + + ", should probably be using rtl::Reference instead" decl->getLocation()) << decl->getSourceRange(); } commit 20eed8b73d683a649d33d7d77e23b6f0c97d7e78 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Oct 11 15:56:18 2016 +0200 convert EXC_COLROW constants to typed_flags_set Change-Id: I08f06aa24228c0967ba1af139ac5b710537a2de5 diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx index 59dd1b0..2850622 100644 --- a/sc/source/filter/excel/colrowst.cxx +++ b/sc/source/filter/excel/colrowst.cxx @@ -30,17 +30,12 @@ #include "queryparam.hxx" #include "excimp8.hxx" -const sal_uInt8 EXC_COLROW_USED = 0x01; -const sal_uInt8 EXC_COLROW_DEFAULT = 0x02; -const sal_uInt8 EXC_COLROW_HIDDEN = 0x04; -const sal_uInt8 EXC_COLROW_MAN = 0x08; - XclImpColRowSettings::XclImpColRowSettings( const XclImpRoot& rRoot ) : XclImpRoot( rRoot ), maColWidths(0, MAXCOLCOUNT, 0), - maColFlags(0, MAXCOLCOUNT, 0), + maColFlags(0, MAXCOLCOUNT, ExcColRowFlags::NONE), maRowHeights(0, MAXROWCOUNT, 0), - maRowFlags(0, MAXROWCOUNT, 0), + maRowFlags(0, MAXROWCOUNT, ExcColRowFlags::NONE), maHiddenRows(0, MAXROWCOUNT, false), mnLastScRow( -1 ), mnDefWidth( STD_COL_WIDTH ), @@ -85,7 +80,7 @@ void XclImpColRowSettings::SetWidthRange( SCCOL nCol1, SCCOL nCol2, sal_uInt16 n // We need to apply flag values individually since all flag values are aggregated for each column. for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) - ApplyColFlag(nCol, EXC_COLROW_USED); + ApplyColFlag(nCol, ExcColRowFlags::Used); } void XclImpColRowSettings::HideCol( SCCOL nCol ) @@ -93,7 +88,7 @@ void XclImpColRowSettings::HideCol( SCCOL nCol ) if (!ValidCol(nCol)) return; - ApplyColFlag(nCol, EXC_COLROW_HIDDEN); + ApplyColFlag(nCol, ExcColRowFlags::Hidden); } void XclImpColRowSettings::HideColRange( SCCOL nCol1, SCCOL nCol2 ) @@ -102,7 +97,7 @@ void XclImpColRowSettings::HideColRange( SCCOL nCol1, SCCOL nCol2 ) nCol1 = ::std::min( nCol1, nCol2 ); for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) - ApplyColFlag(nCol, EXC_COLROW_HIDDEN); + ApplyColFlag(nCol, ExcColRowFlags::Hidden); } void XclImpColRowSettings::SetDefHeight( sal_uInt16 nDefHeight, sal_uInt16 nFlags ) @@ -125,12 +120,12 @@ void XclImpColRowSettings::SetHeight( SCROW nScRow, sal_uInt16 nHeight ) sal_uInt16 nRawHeight = nHeight & EXC_ROW_HEIGHTMASK; bool bDefHeight = ::get_flag( nHeight, EXC_ROW_FLAGDEFHEIGHT ) || (nRawHeight == 0); maRowHeights.insert_back(nScRow, nScRow+1, nRawHeight); - sal_uInt8 nFlagVal = 0; + ExcColRowFlags nFlagVal = ExcColRowFlags::NONE; if (!maRowFlags.search(nScRow, nFlagVal).second) return; - ::set_flag(nFlagVal, EXC_COLROW_USED); - ::set_flag(nFlagVal, EXC_COLROW_DEFAULT, bDefHeight); + ::set_flag(nFlagVal, ExcColRowFlags::Used); + ::set_flag(nFlagVal, ExcColRowFlags::Default, bDefHeight); maRowFlags.insert_back(nScRow, nScRow+1, nFlagVal); @@ -145,12 +140,12 @@ void XclImpColRowSettings::SetRowSettings( SCROW nScRow, sal_uInt16 nHeight, sal SetHeight(nScRow, nHeight); - sal_uInt8 nFlagVal = 0; + ExcColRowFlags nFlagVal = ExcColRowFlags::NONE; if (!maRowFlags.search(nScRow, nFlagVal).second) return; if (::get_flag(nFlags, EXC_ROW_UNSYNCED)) - ::set_flag(nFlagVal, EXC_COLROW_MAN); + ::set_flag(nFlagVal, ExcColRowFlags::Man); maRowFlags.insert_back(nScRow, nScRow+1, nFlagVal); @@ -163,11 +158,11 @@ void XclImpColRowSettings::SetManualRowHeight( SCROW nScRow ) if (!ValidRow(nScRow)) return; - sal_uInt8 nFlagVal = 0; + ExcColRowFlags nFlagVal = ExcColRowFlags::NONE; if (!maRowFlags.search(nScRow, nFlagVal).second) return; - ::set_flag(nFlagVal, EXC_COLROW_MAN); + nFlagVal |= ExcColRowFlags::Man; maRowFlags.insert_back(nScRow, nScRow+1, nFlagVal); } @@ -196,7 +191,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) for( SCCOL nCol = 0; nCol <= MAXCOL; ++nCol ) { sal_uInt16 nWidth = mnDefWidth; - if (GetColFlag(nCol, EXC_COLROW_USED)) + if (GetColFlag(nCol, ExcColRowFlags::Used)) { sal_uInt16 nTmp; if (maColWidths.search_tree(nCol, nTmp).second) @@ -208,7 +203,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) document, until filters and outlines are inserted. */ if( nWidth == 0 ) { - ApplyColFlag(nCol, EXC_COLROW_HIDDEN); + ApplyColFlag(nCol, ExcColRowFlags::Hidden); nWidth = mnDefWidth; } rDoc.SetColWidthOnly( nCol, nScTab, nWidth ); @@ -228,18 +223,18 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) ColRowFlagsType::const_iterator itrFlags = maRowFlags.begin(), itrFlagsEnd = maRowFlags.end(); SCROW nPrevRow = -1; - sal_uInt8 nPrevFlags = 0; + ExcColRowFlags nPrevFlags = ExcColRowFlags::NONE; for (; itrFlags != itrFlagsEnd; ++itrFlags) { SCROW nRow = itrFlags->first; - sal_uInt8 nFlags = itrFlags->second; + ExcColRowFlags nFlags = itrFlags->second; if (nPrevRow >= 0) { sal_uInt16 nHeight = 0; - if (::get_flag(nPrevFlags, EXC_COLROW_USED)) + if (nPrevFlags & ExcColRowFlags::Used) { - if (::get_flag(nPrevFlags, EXC_COLROW_DEFAULT)) + if (nPrevFlags & ExcColRowFlags::Default) { nHeight = mnDefHeight; rDoc.SetRowHeightOnly(nPrevRow, nRow-1, nScTab, nHeight); @@ -263,7 +258,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) } } - if (::get_flag(nPrevFlags, EXC_COLROW_MAN)) + if (nPrevFlags & ExcColRowFlags::Man) rDoc.SetManualHeight(nPrevRow, nRow-1, nScTab, true); } else @@ -286,7 +281,7 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) // hide the columns for( SCCOL nCol = 0; nCol <= MAXCOL; ++nCol ) - if (GetColFlag(nCol, EXC_COLROW_HIDDEN)) + if (GetColFlag(nCol, ExcColRowFlags::Hidden)) rDoc.ShowCol( nCol, nScTab, false ); // #i38093# rows hidden by filter need extra flag @@ -345,10 +340,10 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) rDoc.ShowRows( mnLastScRow + 1, MAXROW, nScTab, false ); } -void XclImpColRowSettings::ApplyColFlag(SCCOL nCol, sal_uInt8 nNewVal) +void XclImpColRowSettings::ApplyColFlag(SCCOL nCol, ExcColRowFlags nNewVal) { // Get the original flag value. - sal_uInt8 nFlagVal = 0; + ExcColRowFlags nFlagVal = ExcColRowFlags::NONE; std::pair<ColRowFlagsType::const_iterator,bool> r = maColFlags.search(nCol, nFlagVal); if (!r.second) // Search failed. @@ -360,14 +355,14 @@ void XclImpColRowSettings::ApplyColFlag(SCCOL nCol, sal_uInt8 nNewVal) maColFlags.insert(r.first, nCol, nCol+1, nFlagVal); } -bool XclImpColRowSettings::GetColFlag(SCCOL nCol, sal_uInt8 nMask) const +bool XclImpColRowSettings::GetColFlag(SCCOL nCol, ExcColRowFlags nMask) const { - sal_uInt8 nFlagVal = 0; + ExcColRowFlags nFlagVal = ExcColRowFlags::NONE; if (!maColFlags.search(nCol, nFlagVal).second) return false; // Search failed. - return ::get_flag(nFlagVal, nMask); + return bool(nFlagVal & nMask); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/inc/colrowst.hxx b/sc/source/filter/inc/colrowst.hxx index af8bf38..d9838fb 100644 --- a/sc/source/filter/inc/colrowst.hxx +++ b/sc/source/filter/inc/colrowst.hxx @@ -22,6 +22,19 @@ #include "xiroot.hxx" #include <mdds/flat_segment_tree.hpp> +#include <o3tl/typed_flags_set.hxx> + +enum class ExcColRowFlags : sal_uInt8 { + NONE = 0x00, + Used = 0x01, + Default = 0x02, + Hidden = 0x04, + Man = 0x08, +}; +namespace o3tl { + template<> struct typed_flags<ExcColRowFlags> : is_typed_flags<ExcColRowFlags, 0x0f> {}; +} + class XclImpColRowSettings : protected XclImpRoot { @@ -46,13 +59,13 @@ public: void ConvertHiddenFlags( SCTAB nScTab ); private: - void ApplyColFlag(SCCOL nCol, sal_uInt8 nNewVal); - bool GetColFlag(SCCOL nCol, sal_uInt8 nMask) const; + void ApplyColFlag(SCCOL nCol, ExcColRowFlags nNewVal); + bool GetColFlag(SCCOL nCol, ExcColRowFlags nMask) const; private: - typedef ::mdds::flat_segment_tree<SCROW, sal_uInt16> WidthHeightStoreType; - typedef ::mdds::flat_segment_tree<SCROW, sal_uInt8> ColRowFlagsType; - typedef ::mdds::flat_segment_tree<SCROW, bool> RowHiddenType; + typedef ::mdds::flat_segment_tree<SCROW, sal_uInt16> WidthHeightStoreType; + typedef ::mdds::flat_segment_tree<SCROW, ExcColRowFlags> ColRowFlagsType; + typedef ::mdds::flat_segment_tree<SCROW, bool> RowHiddenType; WidthHeightStoreType maColWidths; ColRowFlagsType maColFlags; commit 6b1d5c9fdbdaa277eac66245cc4d76c53742c5a7 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Oct 11 15:43:56 2016 +0200 convert constants to scoped enum Change-Id: I189027a05a49b362fb24047ff9a84521ab39ece3 diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx index 81b1d96..cd891b5 100644 --- a/sc/source/core/tool/chartpos.cxx +++ b/sc/source/core/tool/chartpos.cxx @@ -168,13 +168,10 @@ void ScChartPositioner::GlueState() Another optimization would be to store only used rows/columns in the array, but would mean another iteration of the RangeList indirect access to the array. */ - const sal_uInt8 nHole = 0; - const sal_uInt8 nOccu = 1; - const sal_uInt8 nFree = 2; - const sal_uInt8 nGlue = 3; - sal_uInt8* p; - std::unique_ptr<sal_uInt8[]> pA(new sal_uInt8[ nCR ]); - memset( pA.get(), 0, nCR * sizeof(sal_uInt8) ); + enum class CellState : sal_uInt8 { Hole, Occupied, Free, Glue }; + CellState* p; + std::unique_ptr<CellState[]> pA(new CellState[ nCR ]); + memset( pA.get(), 0, nCR * sizeof(CellState) ); SCCOL nCol, nCol1, nCol2; SCROW nRow, nRow1, nRow2; @@ -189,7 +186,7 @@ void ScChartPositioner::GlueState() { p = pA.get() + (sal_uLong)nCol * nR + nRow1; for ( nRow = nRow1; nRow <= nRow2; nRow++, p++ ) - *p = nOccu; + *p = CellState::Occupied; } } bool bGlue = true; @@ -200,7 +197,7 @@ void ScChartPositioner::GlueState() p = pA.get() + (sal_uLong)nCol * nR; for ( nRow = 0; bGlue && nRow < nR; nRow++, p++ ) { - if ( *p == nOccu ) + if ( *p == CellState::Occupied ) { // If there's one right in the middle, we can't combine. // If it were at the edge, we could combine, if in this Column // in every set line, one is set. @@ -210,11 +207,11 @@ void ScChartPositioner::GlueState() nRow = nR; } else - *p = nFree; + *p = CellState::Free; } - if ( bGlue && *(p = (pA.get() + ((((sal_uLong)nCol+1) * nR) - 1))) == nFree ) + if ( bGlue && *(p = (pA.get() + ((((sal_uLong)nCol+1) * nR) - 1))) == CellState::Free ) { // mark column as totally unused - *p = nGlue; + *p = CellState::Glue; bGlueCols = true; // one unused column at least } } @@ -225,7 +222,7 @@ void ScChartPositioner::GlueState() p = pA.get() + nRow; for ( nCol = 0; bGlue && nCol < nC; nCol++, p+=nR ) { - if ( *p == nOccu ) + if ( *p == CellState::Occupied ) { if ( nCol > 0 && nRow > 0 ) bGlue = false; // nRow==0 can be DummyUpperLeft @@ -233,11 +230,11 @@ void ScChartPositioner::GlueState() nCol = nC; } else - *p = nFree; + *p = CellState::Free; } - if ( bGlue && *(p = (pA.get() + ((((sal_uLong)nC-1) * nR) + nRow))) == nFree ) + if ( bGlue && *(p = (pA.get() + ((((sal_uLong)nC-1) * nR) + nRow))) == CellState::Free ) { // mark row as totally unused - *p = nGlue; + *p = CellState::Glue; bGlueRows = true; // one unused row at least } } @@ -247,7 +244,7 @@ void ScChartPositioner::GlueState() for ( sal_uLong n = 1; bGlue && n < nCR; n++, p++ ) { // An untouched field means we could neither reach it through rows nor columns, // thus we can't combine anything - if ( *p == nHole ) + if ( *p == CellState::Hole ) bGlue = false; } if ( bGlue ) @@ -258,7 +255,7 @@ void ScChartPositioner::GlueState() eGlue = SC_CHARTGLUE_ROWS; else eGlue = SC_CHARTGLUE_COLS; - if ( pA[0] != nOccu ) + if ( pA[0] != CellState::Occupied ) bDummyUpperLeft = true; } else commit fa25280bf83689aa92abbd5777a30c6fb4edd296 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Oct 11 15:36:41 2016 +0200 convert SC_MATVAL constants to typed_flags_set Change-Id: I973c5253b385a5495bec38201655e3dbcb9a6f81 diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index d26961d..7fdcb1d 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -70,7 +70,7 @@ struct ScMatrixValue /// Only valid if ScMatrix methods indicate that this is a boolean bool GetBoolean() const { return fVal != 0.0; } - ScMatrixValue() : fVal(0.0), nType(SC_MATVAL_EMPTY) {} + ScMatrixValue() : fVal(0.0), nType(ScMatValType::Empty) {} ScMatrixValue(const ScMatrixValue& r) : fVal(r.fVal), aStr(r.aStr), nType(r.nType) {} @@ -82,8 +82,8 @@ struct ScMatrixValue switch (nType) { - case SC_MATVAL_VALUE: - case SC_MATVAL_BOOLEAN: + case ScMatValType::Value: + case ScMatValType::Boolean: return fVal == r.fVal; break; default: @@ -176,19 +176,19 @@ public: /// Value or boolean. inline static bool IsValueType( ScMatValType nType ) { - return nType <= SC_MATVAL_BOOLEAN; + return nType <= ScMatValType::Boolean; } /// Boolean. inline static bool IsBooleanType( ScMatValType nType ) { - return nType == SC_MATVAL_BOOLEAN; + return nType == ScMatValType::Boolean; } /// String, empty or empty path, but not value nor boolean. inline static bool IsNonValueType( ScMatValType nType ) { - return (nType & SC_MATVAL_NONVALUE) != 0; + return bool(nType & ScMatValType::NonvalueMask); } /** String, but not empty or empty path or any other type. @@ -196,19 +196,19 @@ public: IsNonValueType was named IsStringType. */ inline static bool IsRealStringType( ScMatValType nType ) { - return (nType & SC_MATVAL_NONVALUE) == SC_MATVAL_STRING; + return (nType & ScMatValType::NonvalueMask) == ScMatValType::String; } /// Empty, but not empty path or any other type. inline static bool IsEmptyType( ScMatValType nType ) { - return (nType & SC_MATVAL_NONVALUE) == SC_MATVAL_EMPTY; + return (nType & ScMatValType::NonvalueMask) == ScMatValType::Empty; } /// Empty path, but not empty or any other type. inline static bool IsEmptyPathType( ScMatValType nType ) { - return (nType & SC_MATVAL_NONVALUE) == SC_MATVAL_EMPTYPATH; + return (nType & ScMatValType::NonvalueMask) == ScMatValType::EmptyPath; } ScMatrix() : nRefCnt(0), mbCloneIfConst(true) {} diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx index 15ebf75..1398393 100644 --- a/sc/inc/types.hxx +++ b/sc/inc/types.hxx @@ -35,13 +35,17 @@ typedef ::boost::intrusive_ptr<const ScMatrix> ScConstMatrixRef; namespace formula { class FormulaToken; } typedef ::boost::intrusive_ptr<formula::FormulaToken> ScTokenRef; -typedef sal_uInt8 ScMatValType; -const ScMatValType SC_MATVAL_VALUE = 0x00; -const ScMatValType SC_MATVAL_BOOLEAN = 0x01; -const ScMatValType SC_MATVAL_STRING = 0x02; -const ScMatValType SC_MATVAL_EMPTY = SC_MATVAL_STRING | 0x04; // STRING plus flag -const ScMatValType SC_MATVAL_EMPTYPATH = SC_MATVAL_EMPTY | 0x08; // EMPTY plus flag -const ScMatValType SC_MATVAL_NONVALUE = SC_MATVAL_EMPTYPATH; // mask of all non-value bits +enum class ScMatValType : sal_uInt8 { + Value = 0x00, + Boolean = 0x01, + String = 0x02, + Empty = String | 0x04, // STRING plus flag + EmptyPath = Empty | 0x08, // EMPTY plus flag + NonvalueMask = EmptyPath // mask of all non-value bits +}; +namespace o3tl{ + template<> struct typed_flags<ScMatValType> : o3tl::is_typed_flags<ScMatValType, 0x0f> {}; +} struct ScFormulaCellGroup; typedef ::boost::intrusive_ptr<ScFormulaCellGroup> ScFormulaCellGroupRef; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index d925b83c..049835f 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1562,7 +1562,7 @@ struct AllZeroMatrix { void operator() (SCSIZE /*nCol*/, SCSIZE /*nRow*/, const ScMatrixValue& rVal) const { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of numeric type", SC_MATVAL_VALUE, rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of numeric type", (int)ScMatValType::Value, (int)rVal.nType); ASSERT_DOUBLES_EQUAL_MESSAGE("element value must be zero", 0.0, rVal.fVal); } }; @@ -1571,7 +1571,7 @@ struct PartiallyFilledZeroMatrix { void operator() (SCSIZE nCol, SCSIZE nRow, const ScMatrixValue& rVal) const { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of numeric type", SC_MATVAL_VALUE, rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of numeric type", (int)ScMatValType::Value, (int)rVal.nType); if (1 <= nCol && nCol <= 2 && 2 <= nRow && nRow <= 8) { ASSERT_DOUBLES_EQUAL_MESSAGE("element value must be 3.0", 3.0, rVal.fVal); @@ -1587,7 +1587,7 @@ struct AllEmptyMatrix { void operator() (SCSIZE /*nCol*/, SCSIZE /*nRow*/, const ScMatrixValue& rVal) const { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty type", SC_MATVAL_EMPTY, rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty type", (int)ScMatValType::Empty, (int)rVal.nType); ASSERT_DOUBLES_EQUAL_MESSAGE("value of \"empty\" element is expected to be zero", 0.0, rVal.fVal); } }; @@ -1598,27 +1598,27 @@ struct PartiallyFilledEmptyMatrix { if (nCol == 1 && nRow == 1) { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of boolean type", SC_MATVAL_BOOLEAN, rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of boolean type", (int)ScMatValType::Boolean, (int)rVal.nType); ASSERT_DOUBLES_EQUAL_MESSAGE("element value is not what is expected", 1.0, rVal.fVal); } else if (nCol == 4 && nRow == 5) { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of value type", SC_MATVAL_VALUE, rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of value type", (int)ScMatValType::Value, (int)rVal.nType); ASSERT_DOUBLES_EQUAL_MESSAGE("element value is not what is expected", -12.5, rVal.fVal); } else if (nCol == 8 && nRow == 2) { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of value type", SC_MATVAL_STRING, rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of value type", (int)ScMatValType::String, (int)rVal.nType); CPPUNIT_ASSERT_EQUAL_MESSAGE("element value is not what is expected", OUString("Test"), rVal.aStr.getString()); } else if (nCol == 8 && nRow == 11) { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty path type", SC_MATVAL_EMPTYPATH, rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty path type", (int)ScMatValType::EmptyPath, (int)rVal.nType); ASSERT_DOUBLES_EQUAL_MESSAGE("value of \"empty\" element is expected to be zero", 0.0, rVal.fVal); } else { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty type", SC_MATVAL_EMPTY, rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty type", (int)ScMatValType::Empty, (int)rVal.nType); ASSERT_DOUBLES_EQUAL_MESSAGE("value of \"empty\" element is expected to be zero", 0.0, rVal.fVal); } } diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index aca7342..51e33c7 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -1964,7 +1964,7 @@ void ScInterpreter::ScIsLogical() double fVal; svl::SharedString aStr; ScMatValType nMatValType = GetDoubleOrStringFromMatrix( fVal, aStr); - bRes = (nMatValType == SC_MATVAL_BOOLEAN); + bRes = (nMatValType == ScMatValType::Boolean); } break; default: @@ -3151,14 +3151,14 @@ void ScInterpreter::ScValue() aInputString = aSS.getString(); switch (nType) { - case SC_MATVAL_EMPTY: + case ScMatValType::Empty: fVal = 0.0; SAL_FALLTHROUGH; - case SC_MATVAL_VALUE: - case SC_MATVAL_BOOLEAN: + case ScMatValType::Value: + case ScMatValType::Boolean: PushDouble( fVal); return; - case SC_MATVAL_STRING: + case ScMatValType::String: // evaluated below break; default: diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 086a8cc..19a68ac 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -3140,7 +3140,7 @@ void ScInterpreter::ScHyperLink() { double fVal = 0.0; svl::SharedString aStr; - ScMatValType nResultType = SC_MATVAL_STRING; + ScMatValType nResultType = ScMatValType::String; if ( nParamCount == 2 ) { @@ -3148,7 +3148,7 @@ void ScInterpreter::ScHyperLink() { case svDouble: fVal = GetDouble(); - nResultType = SC_MATVAL_VALUE; + nResultType = ScMatValType::Value; break; case svString: aStr = GetString(); @@ -3162,7 +3162,7 @@ void ScInterpreter::ScHyperLink() ScRefCellValue aCell(*pDok, aAdr); if (aCell.hasEmptyValue()) - nResultType = SC_MATVAL_EMPTY; + nResultType = ScMatValType::Empty; else { FormulaError nErr = GetCellErrCode(aCell); @@ -3171,7 +3171,7 @@ void ScInterpreter::ScHyperLink() else if (aCell.hasNumeric()) { fVal = GetCellValue(aAdr, aCell); - nResultType = SC_MATVAL_VALUE; + nResultType = ScMatValType::Value; } else GetCellString(aStr, aCell); @@ -3186,7 +3186,7 @@ void ScInterpreter::ScHyperLink() Pop(); // mimic xcl fVal = 0.0; - nResultType = SC_MATVAL_VALUE; + nResultType = ScMatValType::Value; break; default: PopError(); @@ -3198,7 +3198,7 @@ void ScInterpreter::ScHyperLink() if (nGlobalError != FormulaError::NONE) { fVal = CreateDoubleError( nGlobalError); - nResultType = SC_MATVAL_VALUE; + nResultType = ScMatValType::Value; } if (nParamCount == 2 || nGlobalError != FormulaError::NONE) { diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 4d697f9..475e4ad 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -2401,7 +2401,7 @@ ScMatValType ScInterpreter::GetDoubleOrStringFromMatrix( rDouble = 0.0; rString = svl::SharedString::getEmptyString(); - ScMatValType nMatValType = SC_MATVAL_EMPTY; + ScMatValType nMatValType = ScMatValType::Empty; ScMatrixRef pMat; StackVar eType = GetStackType(); diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index e9dc4f8..273a5fb 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -582,7 +582,7 @@ double ScMatrixImpl::GetDouble( SCSIZE nIndex) const double ScMatrixImpl::GetDoubleWithStringConversion(SCSIZE nC, SCSIZE nR) const { ScMatrixValue aMatVal = Get(nC, nR); - if (aMatVal.nType == SC_MATVAL_STRING) + if (aMatVal.nType == ScMatValType::String) return convertStringToValue( pErrorInterpreter, aMatVal.aStr.getString()); return aMatVal.fVal; } @@ -682,15 +682,15 @@ ScMatrixValue ScMatrixImpl::Get(SCSIZE nC, SCSIZE nR) const switch (eType) { case mdds::mtm::element_boolean: - aVal.nType = SC_MATVAL_BOOLEAN; + aVal.nType = ScMatValType::Boolean; aVal.fVal = double(maMat.get_boolean(aPos)); break; case mdds::mtm::element_numeric: - aVal.nType = SC_MATVAL_VALUE; + aVal.nType = ScMatValType::Value; aVal.fVal = maMat.get_numeric(aPos); break; case mdds::mtm::element_string: - aVal.nType = SC_MATVAL_STRING; + aVal.nType = ScMatValType::String; aVal.aStr = maMat.get_string(aPos); break; case mdds::mtm::element_empty: @@ -699,11 +699,11 @@ ScMatrixValue ScMatrixImpl::Get(SCSIZE nC, SCSIZE nR) const switch (maMatFlag.get_type(nR, nC)) { case mdds::mtm::element_empty: - aVal.nType = SC_MATVAL_EMPTY; + aVal.nType = ScMatValType::Empty; break; case mdds::mtm::element_numeric: aVal.nType = maMatFlag.get<TMatFlag>(nR, nC) - == SC_MATFLAG_EMPTYPATH ? SC_MATVAL_EMPTYPATH : SC_MATVAL_EMPTY; + == SC_MATFLAG_EMPTYPATH ? ScMatValType::EmptyPath : ScMatValType::Empty; break; default: assert(false); diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index e0e8dfa..05201d6 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -1028,7 +1028,7 @@ void XclExpCachedMatrix::Save( XclExpStream& rStrm ) const ScMatrixValue nMatVal = mrMatrix.Get( nCol, nRow ); FormulaError nScError; - if( SC_MATVAL_EMPTY == nMatVal.nType ) + if( ScMatValType::Empty == nMatVal.nType ) { rStrm.SetSliceSize( 9 ); rStrm << EXC_CACHEDVAL_EMPTY; @@ -1040,7 +1040,7 @@ void XclExpCachedMatrix::Save( XclExpStream& rStrm ) const rStrm.SetSliceSize( 6 ); rStrm << EXC_CACHEDVAL_STRING << aStr; } - else if( SC_MATVAL_BOOLEAN == nMatVal.nType ) + else if( ScMatValType::Boolean == nMatVal.nType ) { sal_Int8 nBool = sal_Int8(nMatVal.GetBoolean()); rStrm.SetSliceSize( 9 ); diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 38cdc4ce..ebc9b8b 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -512,20 +512,20 @@ bool XclImpExtName::CreateOleData(ScDocument& rDoc, const OUString& rUrl, ScMatrixValue aVal = rCache.Get(j, i); switch (aVal.nType) { - case SC_MATVAL_BOOLEAN: + case ScMatValType::Boolean: { bool b = aVal.GetBoolean(); ScExternalRefCache::TokenRef pToken(new formula::FormulaDoubleToken(b ? 1.0 : 0.0)); xTab->setCell(nCol, nRow, pToken, 0, false); } break; - case SC_MATVAL_VALUE: + case ScMatValType::Value: { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits