[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sd/inc sd/sdi sd/source sfx2/inc sfx2/Library_sfx.mk sfx2/Package_inc.mk sfx2/source svtools/source vcl/inc vcl/source
Andre Fischer
af at apache.org
Wed Jun 5 09:07:47 PDT 2013
sd/inc/app.hrc | 2
sd/sdi/ViewShellBase.sdi | 5
sd/sdi/sdraw.sdi | 27 --
sd/source/ui/app/sdmod1.cxx | 11
sd/source/ui/framework/tools/FrameworkHelper.cxx | 51 ----
sd/source/ui/inc/framework/FrameworkHelper.hxx | 19 -
sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 11
sd/source/ui/table/tablefunction.cxx | 10
sd/source/ui/view/GraphicViewShellBase.cxx | 1
sd/source/ui/view/ViewShellBase.cxx | 50 ----
sd/source/ui/view/ViewShellImplementation.cxx | 25 --
sd/source/ui/view/drviews6.cxx | 22 +
sfx2/Library_sfx.mk | 1
sfx2/Package_inc.mk | 1
sfx2/inc/sfx2/sidebar/Sidebar.hxx | 60 +++++
sfx2/source/sidebar/AsynchronousCall.cxx | 9
sfx2/source/sidebar/AsynchronousCall.hxx | 1
sfx2/source/sidebar/Sidebar.cxx | 65 ++---
sfx2/source/sidebar/Sidebar.hxx | 68 -----
sfx2/source/sidebar/SidebarController.cxx | 66 ++++-
sfx2/source/sidebar/SidebarController.hxx | 23 +-
sfx2/source/sidebar/SidebarDockingWindow.hxx | 1
sfx2/source/sidebar/TabBar.cxx | 12 -
svtools/source/control/ctrlbox.cxx | 14 -
svtools/source/control/valueset.cxx | 14 -
vcl/inc/vcl/bitmap.hxx | 30 --
vcl/inc/vcl/bitmapex.hxx | 32 ++
vcl/source/control/ilstbox.cxx | 32 +-
vcl/source/gdi/bitmap4.cxx | 194 -----------------
vcl/source/gdi/bitmapex.cxx | 149 +++++++++++++
vcl/source/gdi/outdev2.cxx | 9
31 files changed, 428 insertions(+), 587 deletions(-)
New commits:
commit 7b26aba94e5544937f1e37e34915bcb276bc3c27
Author: Andre Fischer <af at apache.org>
Date: Wed Jun 5 15:40:56 2013 +0000
122470: Fixed programmatic triggered switching of sidebar decks.
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 5d8bcd4..5abda4c 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -487,7 +487,7 @@
#define SID_TP_USE_FOR_NEW_PRESENTATIONS (SID_SD_START+427)
#define SID_TP_SHOW_LARGE_PREVIEW (SID_SD_START+428)
#define SID_TP_SHOW_SMALL_PREVIEW (SID_SD_START+429)
-#define SID_SHOW_TOOL_PANEL (SID_SD_START+430)
+// SID_SD_START+430 is unused
#define SID_INSERT_MASTER_PAGE (SID_SD_START+431)
#define SID_DELETE_MASTER_PAGE (SID_SD_START+432)
#define SID_RENAME_MASTER_PAGE (SID_SD_START+433)
diff --git a/sd/sdi/ViewShellBase.sdi b/sd/sdi/ViewShellBase.sdi
index 341ba23..833ce9d 100644
--- a/sd/sdi/ViewShellBase.sdi
+++ b/sd/sdi/ViewShellBase.sdi
@@ -82,11 +82,6 @@ interface ViewShellBaseView
ExecMethod = Execute;
StateMethod = GetState;
]
- SID_SHOW_TOOL_PANEL
- [
- ExecMethod = Execute;
- StateMethod = GetState;
- ]
SID_WIN_FULLSCREEN
[
ExecMethod = Execute;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index e7907b4..b1cfb38 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -7366,30 +7366,3 @@ SfxBoolItem SlideSorterMultiPaneGUI SID_SLIDE_SORTER_MULTI_PANE_GUI
ToolBoxConfig = TRUE,
GroupId = GID_MODIFY;
]
-
-SfxVoidItem TaskPaneShowPanel SID_SHOW_TOOL_PANEL (
- SfxBoolItem IsPanelVisible ID_VAL_ISVISIBLE,
- SfxUInt32Item PanelId ID_VAL_PANEL_INDEX)
-[
- /* flags: */
- AutoUpdate = TRUE,
- Cachable = Cachable,
- FastCall = FALSE,
- HasCoreId = FALSE,
- HasDialog = FALSE,
- ReadOnlyDoc = FALSE,
- Toggle = FALSE,
- Container = TRUE,
- RecordAbsolute = FALSE,
- RecordPerSet;
- Synchron;
-
- /* config: */
- AccelConfig = FALSE,
- MenuConfig = FALSE,
- StatusBarConfig = FALSE,
- ToolBoxConfig = FALSE,
- GroupId = GID_VIEW;
-]
-
-
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 5b9901c..2934033 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -746,17 +746,6 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
}
}
}
-
- if (bMakeLayoutVisible && pViewFrame!=NULL)
- {
- // Make the layout menu visible in the tool pane.
- ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase(pViewFrame);
- if (pBase != NULL)
- {
- FrameworkHelper::Instance(*pBase)->RequestSidebarPanel(
- FrameworkHelper::msLayoutTaskPanelURL);
- }
- }
}
return pFrame;
diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx
index 5f79903..09ebe86 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -637,57 +637,6 @@ Reference<XResourceId> FrameworkHelper::RequestView (
-Reference<XResourceId> FrameworkHelper::RequestSidebarPanel (
- const OUString& rsTaskPanelURL,
- const bool bEnsureTaskPaneIsVisible)
-{
- try
- {
- if (mxConfigurationController.is())
- {
- // Check the existence of the task pane.
- if ( ! bEnsureTaskPaneIsVisible)
- {
- Reference<XConfiguration> xConfiguration (
- mxConfigurationController->getCurrentConfiguration());
- if (xConfiguration.is())
- if ( ! xConfiguration->hasResource(
- CreateResourceId(msSidebarViewURL, msSidebarPaneURL)))
- {
- // Task pane is not active. Do not force it.
- return NULL;
- }
- }
-
- // Create the resource id from URLs for the sidebar pane
- // and view and the requested panel.
- mxConfigurationController->requestResourceActivation(
- CreateResourceId(msSidebarPaneURL),
- ResourceActivationMode_ADD);
- mxConfigurationController->requestResourceActivation(
- CreateResourceId(msSidebarViewURL, msSidebarPaneURL),
- ResourceActivationMode_REPLACE);
- Reference<XResourceId> xPanelId (CreateResourceId(rsTaskPanelURL, msSidebarViewURL, msSidebarPaneURL));
- mxConfigurationController->requestResourceActivation(
- xPanelId,
- ResourceActivationMode_REPLACE);
-
- return xPanelId;
- }
- }
- catch (lang::DisposedException&)
- {
- Dispose();
- }
- catch (RuntimeException&)
- {}
-
- return NULL;
-}
-
-
-
-
void FrameworkHelper::RequestResourceDeactivation (const cssu::Reference<cssdf::XResourceId>& rxResourceId)
{
try
diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx
index d8ac6a3..1417fe2 100644
--- a/sd/source/ui/inc/framework/FrameworkHelper.hxx
+++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx
@@ -229,25 +229,6 @@ public:
const ::rtl::OUString& rsResourceURL,
const ::rtl::OUString& rsAnchorURL);
- /** Request the activation of the specified panel in the
- sidebar.
- @param rsSidebarPanelURL
- The panel that is to be activated.
- @param bEnsurePaneIsVisible
- When this is <TRUE/> then the sidebar pane is activated when not
- yet active.
- When this flag is <FALSE/> then the requested panel
- is activated only when the task pane is already active. When it
- is not active then this call is silently ignored.
- @return
- The resource id of the requested sidebar panel is returned. With that
- the caller can, for example, call RunOnResourceActivation() to
- do some initialization after the requested view becomes active.
- */
- cssu::Reference<cssdf::XResourceId> RequestSidebarPanel (
- const ::rtl::OUString& rsSidebarPanelURL,
- const bool bEnsureTaskPaneIsVisible = true);
-
/** Request the deactivation of the specified resource.
*/
void RequestResourceDeactivation (
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 2fd7549..42bc76d 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -76,6 +76,7 @@
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/Sidebar.hxx>
#include <svx/svxids.hrc>
#include <svx/zoomitem.hxx>
#include <svx/svxdlg.hxx>
@@ -187,12 +188,10 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_SLIDE_TRANSITIONS_PANEL:
{
- // Make the slide transition panel visible (expand it)
- // in the tool pane.
- if (mrSlideSorter.GetViewShellBase() != NULL)
- framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())
- ->RequestSidebarPanel(
- sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
+ // Make the slide transition panel visible in the sidebar.
+ ::sfx2::sidebar::Sidebar::ShowPanel(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SlideTransitionPanel")),
+ pShell->GetViewFrame()->GetFrame().GetFrameInterface());
rRequest.Ignore ();
break;
}
diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index 69760a9..ddced59 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -55,6 +55,7 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/request.hxx>
+#include <sfx2/sidebar/Sidebar.hxx>
#include <svl/style.hxx>
#include "framework/FrameworkHelper.hxx"
@@ -204,10 +205,11 @@ SfxViewShell* pViewShell = GetViewShell();
}
else
{
- // Make the slide transition panel visible (expand it) in the
- // tool pane.
- framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
- framework::FrameworkHelper::msTableDesignPanelURL);
+ // Make the table design panel visible (expand it) in the
+ // sidebar.
+ ::sfx2::sidebar::Sidebar::ShowPanel(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImpressTableDesignPanel")),
+ GetViewFrame()->GetFrame().GetFrameInterface());
}
Cancel();
diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx
index d666c52..e97fb6d 100644
--- a/sd/source/ui/view/GraphicViewShellBase.cxx
+++ b/sd/source/ui/view/GraphicViewShellBase.cxx
@@ -96,7 +96,6 @@ void GraphicViewShellBase::Execute (SfxRequest& rRequest)
case SID_OUTLINEMODE:
case SID_NOTESMODE:
case SID_HANDOUTMODE:
- case SID_SHOW_TOOL_PANEL:
// Prevent some Impress-only slots from being executed.
rRequest.Cancel();
break;
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 6704a21..b59c39e 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -198,7 +198,6 @@ public:
void GetSlotState (SfxItemSet& rSet);
void ProcessRestoreEditingViewSlot (void);
- void ProcessTaskPaneSlot (SfxRequest& rRequest);
private:
ViewShellBase& mrBase;
@@ -743,10 +742,6 @@ void ViewShellBase::Execute (SfxRequest& rRequest)
// The full screen mode is not supported. Ignore the request.
break;
- case SID_SHOW_TOOL_PANEL:
- mpImpl->ProcessTaskPaneSlot(rRequest);
- break;
-
case SID_RESTORE_EDITING_VIEW:
mpImpl->ProcessRestoreEditingViewSlot();
break;
@@ -1535,51 +1530,6 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
-
-void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest)
-{
- // Set the visibility state of the toolpanel and one of its top
- // level panels.
- sal_Bool bShowToolPanel = sal_True;
- sidebar::PanelId nPanelId (sidebar::PID_UNKNOWN);
- bool bPanelIdGiven = false;
-
- // Extract the given arguments.
- const SfxItemSet* pArgs = rRequest.GetArgs();
- if (pArgs)
- {
- if ((pArgs->Count() == 1) || (pArgs->Count() == 2))
- {
- SFX_REQUEST_ARG (rRequest, pIsPanelVisible,
- SfxBoolItem, ID_VAL_ISVISIBLE, sal_False);
- if (pIsPanelVisible != NULL)
- bShowToolPanel = pIsPanelVisible->GetValue();
- }
- if (pArgs->Count() == 2)
- {
- SFX_REQUEST_ARG (rRequest, pPanelId, SfxUInt32Item,
- ID_VAL_PANEL_INDEX, sal_False);
- if (pPanelId != NULL)
- {
- nPanelId = static_cast<sidebar::PanelId>(pPanelId->GetValue());
- bPanelIdGiven = true;
- }
- }
- }
-
- // Ignore the request for some combinations of panels and view
- // shell types.
- if (bPanelIdGiven
- && ! (nPanelId==sidebar::PID_LAYOUT
- && mrBase.GetMainViewShell()!=NULL
- && mrBase.GetMainViewShell()->GetShellType()==ViewShell::ST_OUTLINE))
- {
- framework::FrameworkHelper::Instance(mrBase)->RequestSidebarPanel(
- framework::FrameworkHelper::msLayoutTaskPanelURL);
- }
-}
-
-
} // end of namespace sd
diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx
index c507d00..65ba91f 100644
--- a/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -53,6 +53,7 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
+#include <sfx2/sidebar/Sidebar.hxx>
#include <svl/aeitem.hxx>
#include <svx/imapdlg.hxx>
#include <vcl/msgbox.hxx>
@@ -147,27 +148,9 @@ void ViewShell::Implementation::ProcessModifyPageSlot (
}
// Make the layout menu visible in the tool pane.
- SfxBoolItem aMakeToolPaneVisible (ID_VAL_ISVISIBLE, sal_True);
- SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, sidebar::PID_LAYOUT);
- SfxViewFrame* pFrame = mrViewShell.GetViewFrame();
- if (pFrame!=NULL && pFrame->GetDispatcher()!=NULL)
- {
- pFrame->GetDispatcher()->Execute (
- SID_SHOW_TOOL_PANEL,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
- &aMakeToolPaneVisible,
- &aPanelId,
- NULL);
- }
- else
- {
- DBG_ASSERT(pFrame!=NULL && pFrame->GetDispatcher()!=NULL,
- "ViewShell::Implementation::ProcessModifyPageSlot(): can not get dispatcher");
- }
-
- // We have activated a non-modal control in the task pane.
- // Because it does not return anything we can not do anything
- // more right now and have to exit here.
+ sfx2::sidebar::Sidebar::ShowPanel(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImpressLayoutsPanel")),
+ mrViewShell.GetViewFrame()->GetFrame().GetFrameInterface());
break;
}
else if (pArgs->Count() == 4)
diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx
index 9c8d44e..8c63595 100644
--- a/sd/source/ui/view/drviews6.cxx
+++ b/sd/source/ui/view/drviews6.cxx
@@ -78,6 +78,12 @@
#include "DrawDocShell.hxx"
#include "framework/FrameworkHelper.hxx"
#include <svx/svdoashp.hxx>
+#include <sfx2/sidebar/Sidebar.hxx>
+
+namespace {
+ static const ::rtl::OUString CustomAnimationPanelId (RTL_CONSTASCII_USTRINGPARAM("CustomAnimationPanel"));
+ static const ::rtl::OUString SlideTransitionPanelId (RTL_CONSTASCII_USTRINGPARAM("SlideTransitionPanel"));
+}
namespace sd {
@@ -574,10 +580,10 @@ void DrawViewShell::FuTemp04(SfxRequest& rReq)
case SID_CUSTOM_ANIMATION_PANEL:
{
- // Make the slide transition panel visible (expand it) in the
- // tool pane.
- framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
- framework::FrameworkHelper::msCustomAnimationTaskPanelURL);
+ // Make the slide transition panel visible in the sidebar.
+ ::sfx2::sidebar::Sidebar::ShowPanel(
+ CustomAnimationPanelId,
+ GetViewFrame()->GetFrame().GetFrameInterface());
Cancel();
rReq.Done ();
@@ -586,10 +592,10 @@ void DrawViewShell::FuTemp04(SfxRequest& rReq)
case SID_SLIDE_TRANSITIONS_PANEL:
{
- // Make the slide transition panel visible (expand it) in the
- // tool pane.
- framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
- framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
+ // Make the slide transition panel visible in the sidebar.
+ ::sfx2::sidebar::Sidebar::ShowPanel(
+ SlideTransitionPanelId,
+ GetViewFrame()->GetFrame().GetFrameInterface());
Cancel();
rReq.Done ();
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 38625ca..6200e18 100755
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -213,6 +213,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/menu/virtmenu \
sfx2/source/notify/eventsupplier \
sfx2/source/notify/hintpost \
+ sfx2/source/sidebar/Sidebar \
sfx2/source/sidebar/SidebarChildWindow \
sfx2/source/sidebar/SidebarDockingWindow \
sfx2/source/sidebar/SidebarController \
diff --git a/sfx2/Package_inc.mk b/sfx2/Package_inc.mk
index f3b113a..22eae63 100644
--- a/sfx2/Package_inc.mk
+++ b/sfx2/Package_inc.mk
@@ -139,6 +139,7 @@ $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/EnumContext.hxx,sfx2
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/IContextChangeReceiver.hxx,sfx2/sidebar/IContextChangeReceiver.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ILayoutableWindow.hxx,sfx2/sidebar/ILayoutableWindow.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ResourceDefinitions.hrc,sfx2/sidebar/ResourceDefinitions.hrc))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Sidebar.hxx,sfx2/sidebar/Sidebar.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarChildWindow.hxx,sfx2/sidebar/SidebarChildWindow.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarPanelBase.hxx,sfx2/sidebar/SidebarPanelBase.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarToolBox.hxx,sfx2/sidebar/SidebarToolBox.hxx))
diff --git a/sfx2/source/sidebar/Sidebar.hxx b/sfx2/inc/sfx2/sidebar/Sidebar.hxx
similarity index 56%
rename from sfx2/source/sidebar/Sidebar.hxx
rename to sfx2/inc/sfx2/sidebar/Sidebar.hxx
index c6c5a92..924b332 100644
--- a/sfx2/source/sidebar/Sidebar.hxx
+++ b/sfx2/inc/sfx2/sidebar/Sidebar.hxx
@@ -19,50 +19,42 @@
*
*************************************************************/
-#ifndef SFX_SIDEBAR_HXX
-#define SFX_SIDEBAR_HXX
+#ifndef SFX_SIDEBAR_SIDEBAR_HXX
+#define SFX_SIDEBAR_SIDEBAR_HXX
#include "sfx2/dllapi.h"
-#include <vcl/window.hxx>
#include <com/sun/star/frame/XFrame.hpp>
-
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
-namespace sfx2 { namespace sidebar {
+namespace sfx2 { namespace sidebar {
-/** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective
- module's configuration
+/** Accept requests for switching to certain panels or decks.
*/
class SFX2_DLLPUBLIC Sidebar
- : public Window
{
public:
- /** creates a new instance
- @param i_rParentWindow
- the parent window
- @param i_rDocumentFrame
- the frame to which the task pane belongs. Will be passed to any custom tool panels created
- via an XUIElementFactory. Also, it is used to determine the module which the task pane is
- responsible for, thus controlling which tool panels are actually available.
- */
- Sidebar(
- Window& rParentWindow,
- const cssu::Reference<css::frame::XFrame>& rxDocumentFrame);
-
-
- virtual ~Sidebar (void);
-
-protected:
- virtual void Resize (void);
- virtual void GetFocus (void);
-
-private:
+ /** Switch to the deck that contains the specified panel and make
+ sure that the panel is visible (expanded and scrolled into the
+ visible area.)
+ Note that most of the work is done asynchronously and that
+ this function probably returns before the requested panel is visible.
+ */
+ static void ShowPanel (
+ const ::rtl::OUString& rsPanelId,
+ const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+ /** Switch to the specified deck.
+ Note that most of the work is done asynchronously and that
+ this function probably returns before the requested deck is visible.
+ */
+ static void ShowDeck (
+ const ::rtl::OUString& rsDeckId,
+ const cssu::Reference<css::frame::XFrame>& rxFrame);
};
-
} } // end of namespace sfx2::sidebar
#endif
diff --git a/sfx2/source/sidebar/AsynchronousCall.cxx b/sfx2/source/sidebar/AsynchronousCall.cxx
index ad3231a..557997b 100755
--- a/sfx2/source/sidebar/AsynchronousCall.cxx
+++ b/sfx2/source/sidebar/AsynchronousCall.cxx
@@ -28,6 +28,15 @@
namespace sfx2 { namespace sidebar {
+AsynchronousCall::AsynchronousCall (void)
+ : maAction(),
+ mnCallId(0)
+{
+}
+
+
+
+
AsynchronousCall::AsynchronousCall (const Action& rAction)
: maAction(rAction),
mnCallId(0)
diff --git a/sfx2/source/sidebar/AsynchronousCall.hxx b/sfx2/source/sidebar/AsynchronousCall.hxx
index f6366a0..9cc4ab3 100755
--- a/sfx2/source/sidebar/AsynchronousCall.hxx
+++ b/sfx2/source/sidebar/AsynchronousCall.hxx
@@ -35,6 +35,7 @@ class AsynchronousCall
public:
typedef ::boost::function<void(void)> Action;
+ AsynchronousCall (void);
AsynchronousCall (const Action& rAction);
~AsynchronousCall (void);
diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx
index c6b6d76..8e26495 100644
--- a/sfx2/source/sidebar/Sidebar.cxx
+++ b/sfx2/source/sidebar/Sidebar.cxx
@@ -21,7 +21,8 @@
#include "precompiled_sfx2.hxx"
-#include "Sidebar.hxx"
+#include "sfx2/sidebar/Sidebar.hxx"
+#include "SidebarController.hxx"
#include "ResourceManager.hxx"
using namespace css;
@@ -29,53 +30,37 @@ using namespace cssu;
namespace sfx2 { namespace sidebar {
-Sidebar::Sidebar(
- Window& rParentWindow,
- const Reference<frame::XFrame>& rxDocumentFrame)
- : Window(&rParentWindow, WB_DIALOGCONTROL)
-{
- ContentPanelManager::Instance();
-}
-
-
-
-
-Sidebar::~Sidebar (void)
-{
-}
-
-
-
-void Sidebar::Resize (void)
+void Sidebar::ShowPanel (
+ const ::rtl::OUString& rsPanelId,
+ const Reference<frame::XFrame>& rxFrame)
{
- Window::Resize();
- // m_pImpl->OnResize();
-}
-
-
-
-
-void Sidebar::GetFocus (void)
-{
- Window::GetFocus();
- // m_pImpl->OnGetFocus();
+ SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
+ const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
+ if (pController!=NULL && pPanelDescriptor != NULL)
+ {
+ // This should be a lot more sophisticated:
+ // - Make the deck switching asynchronous
+ // - Make sure that the panel is visible and expanded after
+ // the switch.
+ // - Make sure to use a context that really shows the panel
+ //
+ // All that is not necessary for the current use cases so lets
+ // keep it simple for the time being.
+ pController->RequestSwitchToDeck(pPanelDescriptor->msDeckId);
+ }
}
-void Sidebar::DataChanged (const DataChangedEvent& rDataChangedEvent)
+void Sidebar::ShowDeck (
+ const ::rtl::OUString& rsDeckId,
+ const Reference<frame::XFrame>& rxFrame)
{
- if (rDataChangedEvent.GetType() == DATACHANGED_SETTINGS
- && (rDataChangedEvent.GetFlags() & SETTINGS_STYLE)!= 0)
- {
- Invalidate();
- }
- else
- Window::DataChanged(rDataChangedEvent);
+ SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
+ if (pController != NULL)
+ pController->RequestSwitchToDeck(rsDeckId);
}
-
-
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 067349a..730bbc5 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -83,6 +83,8 @@ namespace
namespace sfx2 { namespace sidebar {
+SidebarController::SidebarControllerContainer SidebarController::maSidebarControllerContainer;
+
namespace {
enum MenuId
{
@@ -119,6 +121,7 @@ SidebarController::SidebarController (
msCurrentDeckTitle(),
maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this)),
maContextChangeUpdate(::boost::bind(&SidebarController::UpdateConfigurations, this)),
+ maAsynchronousDeckSwitch(),
mbIsDeckRequestedOpen(),
mbIsDeckOpen(),
mbCanDeckBeOpened(true),
@@ -161,6 +164,12 @@ SidebarController::SidebarController (
mxReadOnlyModeDispatch->addStatusListener(this, aURL);
SwitchToDeck(A2S("default"));
+
+ WeakReference<SidebarController> xWeakController (this);
+ maSidebarControllerContainer.insert(
+ SidebarControllerContainer::value_type(
+ rxFrame,
+ xWeakController));
}
@@ -173,8 +182,29 @@ SidebarController::~SidebarController (void)
+SidebarController* SidebarController::GetSidebarControllerForFrame (
+ const cssu::Reference<css::frame::XFrame>& rxFrame)
+{
+ SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(rxFrame));
+ if (iEntry == maSidebarControllerContainer.end())
+ return NULL;
+
+ cssu::Reference<XInterface> xController (iEntry->second.get());
+ if ( ! xController.is())
+ return NULL;
+
+ return dynamic_cast<SidebarController*>(xController.get());
+}
+
+
+
+
void SAL_CALL SidebarController::disposing (void)
{
+ SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame));
+ if (iEntry != maSidebarControllerContainer.end())
+ maSidebarControllerContainer.erase(iEntry);
+
maFocusManager.Clear();
cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
@@ -212,6 +242,7 @@ void SAL_CALL SidebarController::disposing (void)
static_cast<css::beans::XPropertyChangeListener*>(this));
maContextChangeUpdate.CancelRequest();
+ maAsynchronousDeckSwitch.CancelRequest();
}
@@ -227,7 +258,10 @@ void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::Contex
rEvent.ApplicationName,
rEvent.ContextName);
if (maRequestedContext != maCurrentContext)
+ {
+ maAsynchronousDeckSwitch.CancelRequest();
maContextChangeUpdate.RequestCall();
+ }
}
@@ -270,6 +304,7 @@ void SAL_CALL SidebarController::statusChanged (const css::frame::FeatureStateEv
if ( ! mbIsDocumentReadOnly)
msCurrentDeckId = gsDefaultDeckId;
mnRequestedForceFlags |= SwitchFlag_ForceSwitch;
+ maAsynchronousDeckSwitch.CancelRequest();
maContextChangeUpdate.RequestCall();
}
}
@@ -442,16 +477,6 @@ void SidebarController::UpdateConfigurations (void)
SwitchToDeck(
*ResourceManager::Instance().GetDeckDescriptor(sNewDeckId),
maCurrentContext);
-
-#ifdef DEBUG
- // Show the context name in the deck title bar.
- if (mpCurrentDeck)
- {
- DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
- if (pTitleBar != NULL)
- pTitleBar->SetTitle(msCurrentDeckTitle+A2S(" (")+maCurrentContext.msContext+A2S(")"));
- }
-#endif
}
}
@@ -463,6 +488,18 @@ void SidebarController::OpenThenSwitchToDeck (
{
RequestOpenDeck();
SwitchToDeck(rsDeckId);
+ mpTabBar->Invalidate();
+}
+
+
+
+
+void SidebarController::RequestSwitchToDeck (
+ const ::rtl::OUString& rsDeckId)
+{
+ maContextChangeUpdate.CancelRequest();
+ maAsynchronousDeckSwitch.RequestCall(
+ ::boost::bind(&SidebarController::OpenThenSwitchToDeck, this, rsDeckId));
}
@@ -546,10 +583,18 @@ void SidebarController::SwitchToDeck (
mpParentWindow,
::boost::bind(&SidebarController::RequestCloseDeck, this)));
msCurrentDeckTitle = rDeckDescriptor.msTitle;
+
}
if ( ! mpCurrentDeck)
return;
+#ifdef DEBUG
+ // Show the context name in the deck title bar.
+ DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
+ if (pTitleBar != NULL)
+ pTitleBar->SetTitle(rDeckDescriptor.msTitle+A2S(" (")+maCurrentContext.msContext+A2S(")"));
+#endif
+
// Update the panel list.
const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size());
SharedPanelContainer aNewPanels;
@@ -758,6 +803,7 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
UpdateTitleBarIcons();
mpParentWindow->Invalidate();
mnRequestedForceFlags |= SwitchFlag_ForceNewDeck | SwitchFlag_ForceNewPanels;
+ maAsynchronousDeckSwitch.CancelRequest();
maContextChangeUpdate.RequestCall();
break;
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 36389b6..2b4be32 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -42,6 +42,9 @@
#include <boost/optional.hpp>
#include <cppuhelper/compbase4.hxx>
#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/stl_types.hxx>
+
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
@@ -80,6 +83,15 @@ public:
const cssu::Reference<css::frame::XFrame>& rxFrame);
virtual ~SidebarController (void);
+ /** Return the SidebarController object that is associated with
+ the given XFrame.
+ @return
+ When there is no SidebarController object for the given
+ XFrame then <NULL/> is returned.
+ */
+ static SidebarController* GetSidebarControllerForFrame (
+ const cssu::Reference<css::frame::XFrame>& rxFrame);
+
// ui::XContextChangeEventListener
virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
throw(cssu::RuntimeException);
@@ -113,7 +125,7 @@ public:
const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02;
const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02;
- void SwitchToDeck (
+ void RequestSwitchToDeck (
const ::rtl::OUString& rsDeckId);
void OpenThenSwitchToDeck (
const ::rtl::OUString& rsDeckId);
@@ -129,6 +141,12 @@ public:
FocusManager& GetFocusManager (void);
private:
+ typedef ::std::map<
+ const cssu::Reference<css::frame::XFrame>,
+ cssu::WeakReference<SidebarController>
+ > SidebarControllerContainer;
+ static SidebarControllerContainer maSidebarControllerContainer;
+
::boost::scoped_ptr<Deck> mpCurrentDeck;
SidebarDockingWindow* mpParentWindow;
::boost::scoped_ptr<TabBar> mpTabBar;
@@ -141,6 +159,7 @@ private:
::rtl::OUString msCurrentDeckTitle;
AsynchronousCall maPropertyChangeForwarder;
AsynchronousCall maContextChangeUpdate;
+ AsynchronousCall maAsynchronousDeckSwitch;
/** Two flags control whether the deck is displayed or if only the
tab bar remains visible.
@@ -188,6 +207,8 @@ private:
const bool bIsInitiallyExpanded,
const Context& rContext);
void SwitchToDeck (
+ const ::rtl::OUString& rsDeckId);
+ void SwitchToDeck (
const DeckDescriptor& rDeckDescriptor,
const Context& rContext);
void ShowPopupMenu (
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.hxx b/sfx2/source/sidebar/SidebarDockingWindow.hxx
index 338e31e..1ee9b22 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.hxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.hxx
@@ -24,7 +24,6 @@
#include "sfx2/dockwin.hxx"
#include "sfx2/dockwin.hxx"
-#include "Sidebar.hxx"
#include <rtl/ref.hxx>
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 2da81a5..184e13f 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -236,9 +236,15 @@ void TabBar::Layout (void)
void TabBar::HighlightDeck (const ::rtl::OUString& rsDeckId)
{
- Item* pItem = GetItemForId(rsDeckId);
- if (pItem != NULL)
- pItem->mpButton->Check();
+ for (ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
+ iItem!=iEnd;
+ ++iItem)
+ {
+ if (iItem->msDeckId.equals(rsDeckId))
+ iItem->mpButton->Check(sal_True);
+ else
+ iItem->mpButton->Check(sal_False);
+ }
}
commit 136976efb17b8617a83c7f26601cd04031b51e7f
Author: Armin Le Grand <alg at apache.org>
Date: Wed Jun 5 14:51:49 2013 +0000
i122418 Added workaround to not use GetBitmap on windows
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 6e17dc1..537e4e6 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -232,16 +232,14 @@ void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt )
if(nEdgeBlendingPercent)
{
- Bitmap aBitmap(rUDEvt.GetDevice()->GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+ const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
+ const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
+ const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
+ const BitmapEx aBlendFrame(createBlendFrame(aRect.GetSize(), nAlpha, rTopLeft, rBottomRight));
- if(!aBitmap.IsEmpty())
+ if(!aBlendFrame.IsEmpty())
{
- const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
- const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
- const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
-
- aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight);
- rUDEvt.GetDevice()->DrawBitmap(aRect.TopLeft(), aBitmap);
+ rUDEvt.GetDevice()->DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
}
}
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index eb0d2d1..819bcb5 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -330,16 +330,14 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem )
if(nEdgeBlendingPercent)
{
- Bitmap aBitmap(maVirDev.GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+ const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
+ const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
+ const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
+ const BitmapEx aBlendFrame(createBlendFrame(aRect.GetSize(), nAlpha, rTopLeft, rBottomRight));
- if(!aBitmap.IsEmpty())
+ if(!aBlendFrame.IsEmpty())
{
- const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
- const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
- const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
-
- aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight);
- maVirDev.DrawBitmap(aRect.TopLeft(), aBitmap);
+ maVirDev.DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
}
}
}
diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx
index 855d107..9a8ee88 100644
--- a/vcl/inc/vcl/bitmap.hxx
+++ b/vcl/inc/vcl/bitmap.hxx
@@ -884,36 +884,6 @@ public:
const BmpFilterParam* pFilterParam = NULL,
const Link* pProgress = NULL );
- /** Draw a blend frame to the Bitmap
-
- @param nAlpha
- The blend value defines how strong the frame will be blended with the
- existing content, 255 == full coverage, 0 == no frame will be drawn
-
- @param aColorTopLeft, aColorBottomRight, aColorTopRight, aColorBottomLeft
- The colors defining the frame. If the version without aColorTopRight and
- aColorBottomLeft is used, these colors are linearly interpolated from
- aColorTopLeft and aColorBottomRight using the width and height of the area
-
- @param rTopLeft
- The start point of the frame in pixels
-
- @param rSize
- The size of the frame in pixels
- */
- void DrawBlendFrame(
- sal_uInt8 nAlpha = 128,
- Color aColorTopLeft = Color(COL_WHITE),
- Color aColorBottomRight = Color(COL_BLACK));
- void DrawBlendFrame(
- const Point& rTopLeft,
- const Size& rSize,
- sal_uInt8 nAlpha = 128,
- Color aColorTopLeft = Color(COL_WHITE),
- Color aColorTopRight = Color(COL_GRAY),
- Color aColorBottomRight = Color(COL_BLACK),
- Color aColorBottomLeft = Color(COL_GRAY));
-
BitmapReadAccess* AcquireReadAccess();
BitmapWriteAccess* AcquireWriteAccess();
void ReleaseAccess( BitmapReadAccess* pAccess );
diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx
index 0ba8ebb..a7663bd 100644
--- a/vcl/inc/vcl/bitmapex.hxx
+++ b/vcl/inc/vcl/bitmapex.hxx
@@ -421,4 +421,36 @@ public:
BitmapEx ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorModifierStack) const;
};
+// ------------------------------------------------------------------
+/** Create a blend frame as BitmapEx
+
+ @param nAlpha
+ The blend value defines how strong the frame will be blended with the
+ existing content, 255 == full coverage, 0 == no frame will be drawn
+
+ @param aColorTopLeft, aColorBottomRight, aColorTopRight, aColorBottomLeft
+ The colors defining the frame. If the version without aColorTopRight and
+ aColorBottomLeft is used, these colors are linearly interpolated from
+ aColorTopLeft and aColorBottomRight using the width and height of the area
+
+ @param rSize
+ The size of the frame in pixels
+ */
+
+BitmapEx VCL_DLLPUBLIC createBlendFrame(
+ const Size& rSize,
+ sal_uInt8 nAlpha,
+ Color aColorTopLeft,
+ Color aColorBottomRight);
+
+BitmapEx VCL_DLLPUBLIC createBlendFrame(
+ const Size& rSize,
+ sal_uInt8 nAlpha,
+ Color aColorTopLeft,
+ Color aColorTopRight,
+ Color aColorBottomRight,
+ Color aColorBottomLeft);
+
+// ------------------------------------------------------------------
+
#endif // _SV_BITMAPEX_HXX
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 3dbce51..c4d36d0 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -1856,19 +1856,16 @@ void ImplListBoxWindow::DrawEntry( sal_uInt16 nPos, sal_Bool bDrawImage, sal_Boo
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0);
- if(nEdgeBlendingPercent)
+ if(nEdgeBlendingPercent && aImgSz.Width() && aImgSz.Height())
{
- const Rectangle aRect(aPtImg, aImgSz);
- Bitmap aBitmap(GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+ const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
+ const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
+ const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
+ const BitmapEx aBlendFrame(createBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight));
- if(!aBitmap.IsEmpty())
+ if(!aBlendFrame.IsEmpty())
{
- const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
- const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
- const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
-
- aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight);
- DrawBitmap(aRect.TopLeft(), aBitmap);
+ DrawBitmapEx(aPtImg, aBlendFrame);
}
}
}
@@ -2996,17 +2993,14 @@ void ImplWin::DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDraw
if(nEdgeBlendingPercent)
{
- const Rectangle aRect(aPtImg, aImgSz);
- Bitmap aBitmap(GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+ const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
+ const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
+ const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
+ const BitmapEx aBlendFrame(createBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight));
- if(!aBitmap.IsEmpty())
+ if(!aBlendFrame.IsEmpty())
{
- const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
- const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
- const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
-
- aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight);
- DrawBitmap(aRect.TopLeft(), aBitmap);
+ DrawBitmapEx(aPtImg, aBlendFrame);
}
}
}
diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx
index 34238ca..a765d4e 100644
--- a/vcl/source/gdi/bitmap4.cxx
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -1005,198 +1005,4 @@ sal_Bool Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link*
}
// -----------------------------------------------------------------------------
-
-void impMixPixel(BitmapWriteAccess& rAcc, long y, long x, const Color& rColor, sal_uInt8 nAlpha)
-{
- const BitmapColor aBitmapColor(rColor);
-
- if(nAlpha)
- {
- if(255 != nAlpha)
- {
- BitmapColor aTarget(rAcc.GetColor(y, x));
-
- aTarget.Merge(aBitmapColor, nAlpha);
- rAcc.SetPixel(y, x, aTarget);
- }
- }
- else
- {
- rAcc.SetPixel(y, x, aBitmapColor);
- }
-}
-
-inline bool impVisibleX(long x, const Size& rSizePixel)
-{
- return x >= 0 && x < rSizePixel.Width();
-}
-
-inline bool impVisibleY(long y, const Size& rSizePixel)
-{
- return y >= 0 && y < rSizePixel.Width();
-}
-
-inline bool impVisibleXY(long y, long x, const Size& rSizePixel)
-{
- return impVisibleX(x, rSizePixel) && impVisibleY(y, rSizePixel);
-}
-
-void Bitmap::DrawBlendFrame(
- const Point& rTopLeft,
- const Size& rSize,
- sal_uInt8 nAlpha,
- Color aColorTopLeft,
- Color aColorTopRight,
- Color aColorBottomRight,
- Color aColorBottomLeft)
-{
- if(!IsEmpty())
- {
- const Size aSizePixel(GetSizePixel());
-
- if(aSizePixel.Width() && aSizePixel.Height())
- {
- const long nW(rSize.Width());
- const long nH(rSize.Height());
-
- if(nW || nH)
- {
- BitmapWriteAccess* pAcc = AcquireWriteAccess();
- const long nStartX(rTopLeft.X());
- const long nStartY(rTopLeft.X());
- const long nEndX(rTopLeft.X() + nW);
- const long nEndY(rTopLeft.X() + nH);
- long x(nStartX);
- long y(nStartY);
-
- if(pAcc)
- {
- if(impVisibleXY(y, x, aSizePixel))
- {
- // x == nStartX, y == nStartY
- impMixPixel(*pAcc, y, x, aColorTopLeft, nAlpha);
- }
-
- if(impVisibleY(y, aSizePixel))
- {
- for(x = 1; x < nEndX - 1; x++) // y == nStartY
- {
- if(impVisibleX(x, aSizePixel))
- {
- Color aMix(aColorTopLeft);
- aMix.Merge(aColorTopRight, 255 - sal_uInt8(((x - nStartX) * 255) / nW));
- impMixPixel(*pAcc, y, x, aMix, nAlpha);
- }
- }
- }
- else
- {
- x = nEndX - 1;
- }
-
- if(impVisibleXY(y, x, aSizePixel))
- {
- // x == nEndX - 1, y == nStartY
- impMixPixel(*pAcc, y, x, aColorTopRight, nAlpha);
- }
-
- const bool bLeftVisible(impVisibleX(nStartX, aSizePixel));
- const bool bRightVisible(impVisibleX(x, aSizePixel));
-
- if(bLeftVisible || bRightVisible)
- {
- if(bLeftVisible)
- {
- for(y = 1; y < nEndY - 1; y++) // x == nStartX and nEndX-1
- {
- if(impVisibleY(y, aSizePixel))
- {
- Color aMix(aColorTopLeft);
- aMix.Merge(aColorBottomLeft, 255 - sal_uInt8(((y - nStartY) * 255) / nH));
- impMixPixel(*pAcc, y, nStartX, aMix, nAlpha);
- }
- }
- }
-
- if(bRightVisible)
- {
- for(y = 1; y < nEndY - 1; y++) // x == nStartX and nEndX-1
- {
- if(impVisibleY(y, aSizePixel))
- {
- Color aMix(aColorTopRight);
- aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((y -nStartY) * 255) / nH));
- impMixPixel(*pAcc, y, x, aMix, nAlpha);
- }
- }
- }
- }
- else
- {
- y = nEndY - 1;
- }
-
- if(impVisibleXY(y, x, aSizePixel))
- {
- x = nStartX; // x == nStartX, y == nEndY-1
- impMixPixel(*pAcc, y, x, aColorBottomLeft, nAlpha);
- }
-
- if(impVisibleY(y, aSizePixel))
- {
- for(x = 1; x < nEndX - 1; x++) // y == nEndY-1
- {
- if(impVisibleX(x, aSizePixel))
- {
- Color aMix(aColorBottomLeft);
- aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((x - nStartX)* 255) / nW));
- impMixPixel(*pAcc, y, x, aMix, nAlpha);
- }
- }
- }
- else
- {
- x = nEndX - 1;
- }
-
- if(impVisibleXY(y, x, aSizePixel))
- {
- // x == nEndX - 1, y == nEndY - 1
- impMixPixel(*pAcc, y, x, aColorBottomRight, nAlpha);
- }
-
- ReleaseAccess(pAcc);
- }
- }
- }
- }
-}
-
-void Bitmap::DrawBlendFrame(
- sal_uInt8 nAlpha,
- Color aColorTopLeft,
- Color aColorBottomRight)
-{
- if(!IsEmpty())
- {
- const Point aTopLeft(0, 0);
- const Size aSize(GetSizePixel());
- const sal_uInt32 nW(aSize.Width());
- const sal_uInt32 nH(aSize.Height());
-
- if(nW || nH)
- {
- Color aColTopRight(aColorTopLeft);
- Color aColBottomLeft(aColorTopLeft);
- const sal_uInt32 nDE(nW + nH);
-
- aColTopRight.Merge(aColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE));
- aColBottomLeft.Merge(aColorBottomRight, 255 - sal_uInt8((nH * 255) / nDE));
-
- DrawBlendFrame(aTopLeft, aSize, nAlpha, aColorTopLeft, aColTopRight, aColorBottomRight, aColBottomLeft);
- }
- }
-}
-
-// -----------------------------------------------------------------------------
// eof
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index e8ce7b9..f86ebe0 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -1200,5 +1200,154 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod
}
}
+// -----------------------------------------------------------------------------
+
+BitmapEx VCL_DLLPUBLIC createBlendFrame(
+ const Size& rSize,
+ sal_uInt8 nAlpha,
+ Color aColorTopLeft,
+ Color aColorBottomRight)
+{
+ const sal_uInt32 nW(rSize.Width());
+ const sal_uInt32 nH(rSize.Height());
+
+ if(nW || nH)
+ {
+ Color aColTopRight(aColorTopLeft);
+ Color aColBottomLeft(aColorTopLeft);
+ const sal_uInt32 nDE(nW + nH);
+
+ aColTopRight.Merge(aColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE));
+ aColBottomLeft.Merge(aColorBottomRight, 255 - sal_uInt8((nH * 255) / nDE));
+
+ return createBlendFrame(rSize, nAlpha, aColorTopLeft, aColTopRight, aColorBottomRight, aColBottomLeft);
+ }
+
+ return BitmapEx();
+}
+
+BitmapEx VCL_DLLPUBLIC createBlendFrame(
+ const Size& rSize,
+ sal_uInt8 nAlpha,
+ Color aColorTopLeft,
+ Color aColorTopRight,
+ Color aColorBottomRight,
+ Color aColorBottomLeft)
+{
+ static Size aLastSize(0, 0);
+ static sal_uInt8 nLastAlpha(0);
+ static Color aLastColorTopLeft(COL_BLACK);
+ static Color aLastColorTopRight(COL_BLACK);
+ static Color aLastColorBottomRight(COL_BLACK);
+ static Color aLastColorBottomLeft(COL_BLACK);
+ static BitmapEx aLastResult;
+
+ if(aLastSize == rSize
+ && nLastAlpha == nAlpha
+ && aLastColorTopLeft == aLastColorTopLeft
+ && aLastColorTopRight == aLastColorTopRight
+ && aLastColorBottomRight == aLastColorBottomRight
+ && aLastColorBottomLeft == aLastColorBottomLeft)
+ {
+ return aLastResult;
+ }
+
+ aLastSize = rSize;
+ nLastAlpha = nAlpha;
+ aLastColorTopLeft = aLastColorTopLeft;
+ aLastColorTopRight = aLastColorTopRight;
+ aLastColorBottomRight = aLastColorBottomRight;
+ aLastColorBottomLeft = aLastColorBottomLeft;
+ aLastResult.Clear();
+
+ const long nW(rSize.Width());
+ const long nH(rSize.Height());
+
+ if(nW && nH)
+ {
+ sal_uInt8 aEraseTrans(0xff);
+ Bitmap aContent(rSize, 24);
+ AlphaMask aAlpha(rSize, &aEraseTrans);
+
+ aContent.Erase(COL_BLACK);
+
+ BitmapWriteAccess* pContent = aContent.AcquireWriteAccess();
+ BitmapWriteAccess* pAlpha = aAlpha.AcquireWriteAccess();
+
+ if(pContent && pAlpha)
+ {
+ long x(0);
+ long y(0);
+
+ // x == 0, y == 0
+ pContent->SetPixel(y, x, aColorTopLeft);
+ pAlpha->SetPixelIndex(y, x, nAlpha);
+
+ for(x = 1; x < nW - 1; x++) // y == 0
+ {
+ Color aMix(aColorTopLeft);
+
+ aMix.Merge(aColorTopRight, 255 - sal_uInt8((x * 255) / nW));
+ pContent->SetPixel(y, x, aMix);
+ pAlpha->SetPixelIndex(y, x, nAlpha);
+ }
+
+ // x == nW - 1, y == 0
+ pContent->SetPixel(y, x, aColorTopRight);
+ pAlpha->SetPixelIndex(y, x, nAlpha);
+
+ for(y = 1; y < nH - 1; y++) // x == 0 and nW - 1
+ {
+ Color aMixA(aColorTopLeft);
+ Color aMixB(aColorTopRight);
+
+ aMixA.Merge(aColorBottomLeft, 255 - sal_uInt8((y * 255) / nH));
+ pContent->SetPixel(y, 0, aMixA);
+ pAlpha->SetPixelIndex(y, 0, nAlpha);
+
+ aMixB.Merge(aColorBottomRight, 255 - sal_uInt8((y * 255) / nH));
+ pContent->SetPixel(y, nW - 1, aMixB);
+ pAlpha->SetPixelIndex(y, nW - 1, nAlpha);
+ }
+
+ x = 0; // x == 0, y == nH - 1
+ pContent->SetPixel(y, x, aColorBottomLeft);
+ pAlpha->SetPixelIndex(y, x, nAlpha);
+
+ for(x = 1; x < nW - 1; x++) // y == nH - 1
+ {
+ Color aMix(aColorBottomLeft);
+
+ aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((x - 0)* 255) / nW));
+ pContent->SetPixel(y, x, aMix);
+ pAlpha->SetPixelIndex(y, x, nAlpha);
+ }
+
+ // x == nW - 1, y == nH - 1
+ pContent->SetPixel(y, x, aColorBottomRight);
+ pAlpha->SetPixelIndex(y, x, nAlpha);
+
+ aContent.ReleaseAccess(pContent);
+ aAlpha.ReleaseAccess(pAlpha);
+
+ aLastResult = BitmapEx(aContent, aAlpha);
+ }
+ else
+ {
+ if(pContent)
+ {
+ aContent.ReleaseAccess(pContent);
+ }
+
+ if(pAlpha)
+ {
+ aAlpha.ReleaseAccess(pAlpha);
+ }
+ }
+ }
+
+ return aLastResult;
+}
+
// ------------------------------------------------------------------
// eof
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 1ca43f1..1ec5f75 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1388,6 +1388,7 @@ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
{
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ OSL_ENSURE(OUTDEV_PRINTER != GetOutDevType(), "OutputDevice::GetBitmap with sorce type OUTDEV_PRINTER should not be used (!)");
Bitmap aBmp;
long nX = ImplLogicXToDevicePixel( rSrcPt.X() );
@@ -1397,7 +1398,7 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
if ( mpGraphics || ( (OutputDevice*) this )->ImplGetGraphics() )
{
- if ( nWidth && nHeight )
+ if ( nWidth > 0 && nHeight > 0 && nX <= (mnOutWidth + mnOutOffX) && nY <= (mnOutHeight + mnOutOffY))
{
Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
sal_Bool bClipped = sal_False;
@@ -1456,7 +1457,13 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
aPosAry.mnDestHeight = nHeight;
if ( (nWidth > 0) && (nHeight > 0) )
+ {
(((OutputDevice*)&aVDev)->mpGraphics)->CopyBits( aPosAry, mpGraphics, this, this );
+ }
+ else
+ {
+ OSL_ENSURE(false, "CopyBits with negative width or height (!)");
+ }
aBmp = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
}
More information about the Libreoffice-commits
mailing list