diff options
author | Tor Lillqvist <tml@collabora.com> | 2014-03-31 16:13:14 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2014-03-31 16:13:14 +0300 |
commit | 7eef30b03e6c854edc6e3c23ea2c73910291fcdf (patch) | |
tree | b5e2cc4c5b987fee1db08dab743deadf884b8353 /svx | |
parent | c184d44449fe120653630ecd450e96e8ceab6fdc (diff) |
No need for <svx/sdr/event/eventhandler.hxx> to be public
Only used inside svx so move there.
Change-Id: I91a4b1964edab589ec8542255a2ca611f0d903a2
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/inc/eventhandler.hxx | 132 | ||||
-rw-r--r-- | svx/source/sdr/contact/objectcontact.cxx | 5 | ||||
-rw-r--r-- | svx/source/sdr/contact/objectcontactofpageview.cxx | 5 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofgraphic.cxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontactofgraphic.cxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/event/eventhandler.cxx | 4 |
6 files changed, 137 insertions, 16 deletions
diff --git a/svx/source/inc/eventhandler.hxx b/svx/source/inc/eventhandler.hxx new file mode 100644 index 000000000000..36b27a1a3d1e --- /dev/null +++ b/svx/source/inc/eventhandler.hxx @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_EVENT_EVENTHANDLER_HXX +#define INCLUDED_SVX_SDR_EVENT_EVENTHANDLER_HXX + +#include <sal/types.h> + +#include <vector> +#include <vcl/timer.hxx> + + +// predeclarations + +namespace sdr +{ + namespace event + { + class BaseEvent; + class EventHandler; + + // typedefs for a list of BaseEvents + typedef ::std::vector< BaseEvent* > BaseEventVector; + } // end of namespace event +} // end of namespace sdr + + + +namespace sdr +{ + namespace event + { + class BaseEvent + { + // the EventHandler this event is registered at + EventHandler& mrEventHandler; + + public: + // basic constructor. + BaseEvent(EventHandler& rEventHandler); + + // destructor + virtual ~BaseEvent(); + + // the called method if the event is triggered + virtual void ExecuteEvent() = 0; + }; + } // end of namespace event +} // end of namespace sdr + + + +namespace sdr +{ + namespace event + { + class EventHandler + { + BaseEventVector maVector; + + // to allow BaseEvents to use the add/remove functionality + friend class BaseEvent; + + // methods to add/remove events. These are private since + // they are used from BaseEvent only. + void AddEvent(BaseEvent& rBaseEvent); + void RemoveEvent(BaseEvent& rBaseEvent); + + // access to a event, 0L when no more events + BaseEvent* GetEvent(); + + public: + // basic constructor. + EventHandler(); + + // destructor + virtual ~EventHandler(); + + // Trigger and consume the events + virtual void ExecuteEvents(); + + // for control + bool IsEmpty() const; + }; + } // end of namespace event +} // end of namespace sdr + + + +namespace sdr +{ + namespace event + { + class TimerEventHandler : public EventHandler, public Timer + { + public: + // basic constructor. + TimerEventHandler(sal_uInt32 nTimeout = 1L); + + // destructor + virtual ~TimerEventHandler(); + + // The timer when it is triggered; from class Timer + virtual void Timeout() SAL_OVERRIDE; + + // reset the timer + void Restart(); + }; + } // end of namespace event +} // end of namespace sdr + + + +#endif // INCLUDED_SVX_SDR_EVENT_EVENTHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sdr/contact/objectcontact.cxx b/svx/source/sdr/contact/objectcontact.cxx index 1d3dca64c04c..259aea7afbd7 100644 --- a/svx/source/sdr/contact/objectcontact.cxx +++ b/svx/source/sdr/contact/objectcontact.cxx @@ -22,16 +22,13 @@ #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/svdpage.hxx> #include <svx/sdr/contact/viewcontact.hxx> -#include <svx/sdr/event/eventhandler.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <svx/sdr/animation/objectanimator.hxx> - +#include "eventhandler.hxx" using namespace com::sun::star; - - namespace sdr { namespace contact diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx index ff31f90b7d23..76f7d0525834 100644 --- a/svx/source/sdr/contact/objectcontactofpageview.cxx +++ b/svx/source/sdr/contact/objectcontactofpageview.cxx @@ -26,7 +26,6 @@ #include <svx/svdview.hxx> #include <svx/sdr/contact/viewcontact.hxx> #include <svx/sdr/animation/objectanimator.hxx> -#include <svx/sdr/event/eventhandler.hxx> #include <svx/sdrpagewindow.hxx> #include <svx/sdrpaintwindow.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -35,12 +34,10 @@ #include <drawinglayer/processor2d/processor2dtools.hxx> #include <svx/unoapi.hxx> - +#include "eventhandler.hxx" using namespace com::sun::star; - - namespace sdr { namespace contact diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index a5d65724396b..4ec782596115 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -27,7 +27,6 @@ #include <svx/sdr/contact/displayinfo.hxx> #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/sdr/contact/objectcontact.hxx> -#include <svx/sdr/event/eventhandler.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <svx/sdr/primitive2d/sdrgrafprimitive2d.hxx> #include "svx/svdstr.hrc" @@ -46,7 +45,7 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> - +#include "eventhandler.hxx" namespace sdr { diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx index 4b2243258469..037e8c55c0b4 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx @@ -17,16 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include <svx/sdr/contact/viewobjectcontactofgraphic.hxx> #include <svx/sdr/contact/viewcontactofgraphic.hxx> -#include <svx/sdr/event/eventhandler.hxx> #include <svx/svdograf.hxx> #include <svx/sdr/contact/objectcontact.hxx> #include <svx/svdmodel.hxx> #include <svx/svdpage.hxx> - +#include "eventhandler.hxx" namespace sdr { diff --git a/svx/source/sdr/event/eventhandler.cxx b/svx/source/sdr/event/eventhandler.cxx index 0c31a9dd1be5..cf9b2f599ed5 100644 --- a/svx/source/sdr/event/eventhandler.cxx +++ b/svx/source/sdr/event/eventhandler.cxx @@ -17,15 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <svx/sdr/event/eventhandler.hxx> +#include "eventhandler.hxx" // for SOLARIS compiler include of algorithm part of _STL is necessary to // get access to basic algos like ::std::find #include <algorithm> #include <tools/debug.hxx> - - namespace sdr { namespace event |