summaryrefslogtreecommitdiff
path: root/sdext/source/presenter/PresenterProtocolHandler.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2011-12-02 17:47:11 +0000
committerMichael Meeks <michael.meeks@suse.com>2011-12-05 20:53:23 +0000
commit857b4f5357ba53bdfaf59671b219d74ae8c5945a (patch)
treecc3a2612e220bfb837c4f008e3741c0d336dc085 /sdext/source/presenter/PresenterProtocolHandler.cxx
parentb35b7080980c0ba43f411db469feb30f8a5c6881 (diff)
presenter console: add 'Switch monitors' button to help get setup
For years, we've been carefully detecting the laptop display, and choosing it as the default display to project to - thus many of our users have configured around this. Provide a way for them to undo the folly, and any subsequent mis-detections easily. Initial Artwork is clearly in need of some bug-fixing. Cleanup hyper-pre-optimised madness in ProtocolHandler.cxx too, called a few dozen times - and has nested switch statements on characters.
Diffstat (limited to 'sdext/source/presenter/PresenterProtocolHandler.cxx')
-rw-r--r--sdext/source/presenter/PresenterProtocolHandler.cxx130
1 files changed, 60 insertions, 70 deletions
diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx b/sdext/source/presenter/PresenterProtocolHandler.cxx
index 1c19fc4ce48a..f5be51f8bd20 100644
--- a/sdext/source/presenter/PresenterProtocolHandler.cxx
+++ b/sdext/source/presenter/PresenterProtocolHandler.cxx
@@ -109,6 +109,19 @@ namespace {
rtl::Reference<PresenterController> mpPresenterController;
};
+ class SwitchMonitorCommand : public Command
+ {
+ public:
+ SwitchMonitorCommand (
+ const rtl::Reference<PresenterController>& rpPresenterController);
+ virtual ~SwitchMonitorCommand (void) {}
+ virtual void Execute (void);
+ virtual bool IsEnabled (void) const;
+ virtual Any GetState (void) const;
+ private:
+ rtl::Reference<PresenterController> mpPresenterController;
+ };
+
class SetNotesViewCommand : public Command
{
public:
@@ -426,76 +439,31 @@ Command* PresenterProtocolHandler::Dispatch::CreateCommand (
{
if (rsURLPath.getLength() <= 5)
return NULL;
- switch (rsURLPath[0])
- {
- case sal_Char('C') :
- switch (rsURLPath[5])
- {
- case sal_Char('N'):
- if (rsURLPath == A2S("CloseNotes"))
- return new SetNotesViewCommand(false, rpPresenterController);
- break;
- case sal_Char('S'):
- if (rsURLPath == A2S("CloseSlideSorter"))
- return new SetSlideSorterCommand(false, rpPresenterController);
- break;
- case sal_Char('H'):
- if (rsURLPath == A2S("CloseHelp"))
- return new SetHelpViewCommand(false, rpPresenterController);
- break;
- }
- break;
- case sal_Char('G') :
- if (rsURLPath == A2S("GrowNotesFont"))
- return new NotesFontSizeCommand(rpPresenterController, +1);
- break;
-
- case sal_Char('N') :
- switch (rsURLPath[4])
- {
- case sal_Char('E'):
- if (rsURLPath == A2S("NextEffect"))
- return new GotoNextEffectCommand(rpPresenterController);
- case sal_Char('S'):
- if (rsURLPath == A2S("NextSlide"))
- return new GotoNextSlideCommand(rpPresenterController);
- break;
- }
- break;
- case sal_Char('P') :
- if (rsURLPath == A2S("PrevSlide"))
- return new GotoPreviousSlideCommand(rpPresenterController);
- break;
-
- case sal_Char('S') :
- switch (rsURLPath[4])
- {
- case sal_Char('N'):
- if (rsURLPath == A2S("ShowNotes"))
- return new SetNotesViewCommand(true, rpPresenterController);
- break;
-
- case sal_Char('S'):
- if (rsURLPath == A2S("ShowSlideSorter"))
- return new SetSlideSorterCommand(true, rpPresenterController);
- break;
-
- case sal_Char('H'):
- if (rsURLPath == A2S("ShowHelp"))
- return new SetHelpViewCommand(true, rpPresenterController);
- break;
-
- case sal_Char('n'):
- if (rsURLPath == A2S("ShrinkNotesFont"))
- return new NotesFontSizeCommand(rpPresenterController, -1);
- break;
- }
- break;
-
- default:
- break;
- }
+ if (rsURLPath == A2S("CloseNotes"))
+ return new SetNotesViewCommand(false, rpPresenterController);
+ if (rsURLPath == A2S("CloseSlideSorter"))
+ return new SetSlideSorterCommand(false, rpPresenterController);
+ if (rsURLPath == A2S("CloseHelp"))
+ return new SetHelpViewCommand(false, rpPresenterController);
+ if (rsURLPath == A2S("GrowNotesFont"))
+ return new NotesFontSizeCommand(rpPresenterController, +1);
+ if (rsURLPath == A2S("NextEffect"))
+ return new GotoNextEffectCommand(rpPresenterController);
+ if (rsURLPath == A2S("NextSlide"))
+ return new GotoNextSlideCommand(rpPresenterController);
+ if (rsURLPath == A2S("PrevSlide"))
+ return new GotoPreviousSlideCommand(rpPresenterController);
+ if (rsURLPath == A2S("SwitchMonitor"))
+ return new SwitchMonitorCommand(rpPresenterController);
+ if (rsURLPath == A2S("ShowNotes"))
+ return new SetNotesViewCommand(true, rpPresenterController);
+ if (rsURLPath == A2S("ShowSlideSorter"))
+ return new SetSlideSorterCommand(true, rpPresenterController);
+ if (rsURLPath == A2S("ShowHelp"))
+ return new SetHelpViewCommand(true, rpPresenterController);
+ if (rsURLPath == A2S("ShrinkNotesFont"))
+ return new NotesFontSizeCommand(rpPresenterController, -1);
return NULL;
}
@@ -686,7 +654,6 @@ Any GotoPreviousSlideCommand::GetState (void) const
-
//===== GotoNextEffect ========================================================
GotoNextEffectCommand::GotoNextEffectCommand (
@@ -771,6 +738,29 @@ Any GotoNextSlideCommand::GetState (void) const
}
+//===== SwitchMonitorCommand ==============================================
+
+SwitchMonitorCommand::SwitchMonitorCommand (
+ const rtl::Reference<PresenterController>& rpPresenterController)
+ : mpPresenterController(rpPresenterController)
+{
+}
+
+void SwitchMonitorCommand::Execute (void)
+{
+ fprintf (stderr, "Switch monitor !\n");
+}
+
+bool SwitchMonitorCommand::IsEnabled (void) const
+{
+ fprintf (stderr, "FIXME - check me !\n");
+ return true;
+}
+
+Any SwitchMonitorCommand::GetState (void) const
+{
+ return Any(sal_False);
+}
//===== SetNotesViewCommand ===================================================