summaryrefslogtreecommitdiff
path: root/sdext/source/presenter/PresenterPaintManager.cxx
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-05-13 13:32:24 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-05-13 13:32:24 +0000
commit7a4d603d26046d9f2083324de5613ba3d3440793 (patch)
tree065016e6fced0eeb12a0adc705a64513a653e854 /sdext/source/presenter/PresenterPaintManager.cxx
parent4a1c78712fc5b538ba805393296584a786bbc214 (diff)
INTEGRATION: CWS presenterscreen (1.1.2); FILE ADDED
2008/05/13 13:51:01 af 1.1.2.2: #i18486# Updated license header. 2008/04/16 14:35:31 af 1.1.2.1: #i18486# Initial revision.
Diffstat (limited to 'sdext/source/presenter/PresenterPaintManager.cxx')
-rw-r--r--sdext/source/presenter/PresenterPaintManager.cxx156
1 files changed, 156 insertions, 0 deletions
diff --git a/sdext/source/presenter/PresenterPaintManager.cxx b/sdext/source/presenter/PresenterPaintManager.cxx
new file mode 100644
index 000000000000..341454e8cf74
--- /dev/null
+++ b/sdext/source/presenter/PresenterPaintManager.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: PresenterPaintManager.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "PresenterPaintManager.hxx"
+
+#include "PresenterPaneContainer.hxx"
+#include <com/sun/star/awt/InvalidateStyle.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sdext { namespace presenter {
+
+PresenterPaintManager::PresenterPaintManager (
+ const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
+ const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
+ const rtl::Reference<PresenterPaneContainer>& rpPaneContainer)
+ : mxParentWindow(rxParentWindow),
+ mxParentWindowPeer(rxParentWindow, UNO_QUERY),
+ mxPresenterHelper(rxPresenterHelper),
+ mpPaneContainer(rpPaneContainer)
+{
+}
+
+
+
+
+void PresenterPaintManager::Invalidate (
+ const css::uno::Reference<css::awt::XWindow>& rxWindow,
+ const bool bSynchronous)
+{
+ sal_Int16 nInvalidateMode (awt::InvalidateStyle::CHILDREN);
+ if (bSynchronous)
+ nInvalidateMode |= awt::InvalidateStyle::UPDATE;
+
+ PresenterPaneContainer::SharedPaneDescriptor pDescriptor(
+ mpPaneContainer->FindContentWindow(rxWindow));
+ if (pDescriptor.get()==NULL || ! pDescriptor->mbIsOpaque)
+ nInvalidateMode |= awt::InvalidateStyle::TRANSPARENT;
+ else
+ nInvalidateMode |= awt::InvalidateStyle::NOTRANSPARENT;
+
+ Invalidate(rxWindow, nInvalidateMode);
+}
+
+
+
+
+void PresenterPaintManager::Invalidate (
+ const css::uno::Reference<css::awt::XWindow>& rxWindow,
+ const sal_Int16 nInvalidateFlags)
+{
+ if ((nInvalidateFlags & awt::InvalidateStyle::TRANSPARENT) != 0)
+ {
+ // Window is transparent and parent window(s) have to be painted as
+ // well. Invalidate the parent explicitly.
+ if (mxPresenterHelper.is() && mxParentWindowPeer.is())
+ {
+ const awt::Rectangle aBBox (
+ mxPresenterHelper->getWindowExtentsRelative(rxWindow, mxParentWindow));
+ mxParentWindowPeer->invalidateRect(aBBox, nInvalidateFlags);
+ }
+ }
+ else
+ {
+ Reference<awt::XWindowPeer> xPeer (rxWindow, UNO_QUERY);
+ if (xPeer.is())
+ xPeer->invalidate(nInvalidateFlags);
+ }
+}
+
+
+
+
+void PresenterPaintManager::Invalidate (
+ const css::uno::Reference<css::awt::XWindow>& rxWindow,
+ const css::awt::Rectangle& rRepaintBox,
+ const bool bSynchronous)
+{
+ sal_Int16 nInvalidateMode (awt::InvalidateStyle::CHILDREN);
+ if (bSynchronous)
+ nInvalidateMode |= awt::InvalidateStyle::UPDATE;
+
+ PresenterPaneContainer::SharedPaneDescriptor pDescriptor(
+ mpPaneContainer->FindContentWindow(rxWindow));
+ if (pDescriptor.get()==NULL || ! pDescriptor->mbIsOpaque)
+ nInvalidateMode |= awt::InvalidateStyle::TRANSPARENT;
+ else
+ nInvalidateMode |= awt::InvalidateStyle::NOTRANSPARENT;
+
+ Invalidate(rxWindow, rRepaintBox, nInvalidateMode);
+}
+
+
+
+
+void PresenterPaintManager::Invalidate (
+ const css::uno::Reference<css::awt::XWindow>& rxWindow,
+ const css::awt::Rectangle& rRepaintBox,
+ const sal_Int16 nInvalidateFlags)
+{
+ if ((nInvalidateFlags & awt::InvalidateStyle::TRANSPARENT) != 0)
+ {
+ // Window is transparent and parent window(s) have to be painted as
+ // well. Invalidate the parent explicitly.
+ if (mxPresenterHelper.is() && mxParentWindowPeer.is())
+ {
+ const awt::Rectangle aBBox (
+ mxPresenterHelper->getWindowExtentsRelative(rxWindow, mxParentWindow));
+ mxParentWindowPeer->invalidateRect(
+ awt::Rectangle(
+ rRepaintBox.X + aBBox.X,
+ rRepaintBox.Y + aBBox.Y,
+ rRepaintBox.Width,
+ rRepaintBox.Height),
+ nInvalidateFlags);
+ }
+ }
+ else
+ {
+ Reference<awt::XWindowPeer> xPeer (rxWindow, UNO_QUERY);
+ if (xPeer.is())
+ xPeer->invalidateRect(rRepaintBox, nInvalidateFlags);
+ }
+}
+
+} }