diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-04-07 22:36:24 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-04-07 22:36:24 +0200 |
commit | 46a3b5deb5df0bc8dc64d2a01956dab08dd7798f (patch) | |
tree | 7f8b9076771ab3f84a96fee15b6661c8761233bf /sd | |
parent | 17d7bf8f871c2b2e04a14c3d9cca27e7e6c84cac (diff) |
slidecopy: outsourced the TaskPane/ToolPanel's drawer (TitleBar, type TBT_CONTROL_TITLE) from sd to svtools, to be used with generic tool panel decks, not only within sd
diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_down.png
Binary file default_images/sd/res/triangle_down.png has changed
diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_down_hc.png
Binary file default_images/sd/res/triangle_down_hc.png has changed
diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_right.png
Binary file default_images/sd/res/triangle_right.png has changed
diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_right_hc.png
Binary file default_images/sd/res/triangle_right_hc.png has changed
diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_down.png
Binary file default_images/svtools/res/triangle_down.png has changed
diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_down_hc.png
Binary file default_images/svtools/res/triangle_down_hc.png has changed
diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_right.png
Binary file default_images/svtools/res/triangle_right.png has changed
diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_right_hc.png
Binary file default_images/svtools/res/triangle_right_hc.png has changed
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/accessibility/AccessibleTreeNode.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/app/res_bmp.src | 16 | ||||
-rw-r--r-- | sd/source/ui/inc/res_bmp.hrc | 8 | ||||
-rw-r--r-- | sd/source/ui/inc/taskpane/TitleBar.hxx | 24 | ||||
-rw-r--r-- | sd/source/ui/inc/taskpane/TitledControl.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/TitleBar.cxx | 103 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/TitleToolBox.cxx | 49 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/TitleToolBox.hxx | 18 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/TitledControl.cxx | 3 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/ToolPanelDeck.cxx | 6 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 282 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/ToolPanelDrawer.hxx | 101 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/makefile.mk | 1 |
13 files changed, 12 insertions, 606 deletions
diff --git a/sd/source/ui/accessibility/AccessibleTreeNode.cxx b/sd/source/ui/accessibility/AccessibleTreeNode.cxx index e4626711df82..f7b7b4d3b7db 100644 --- a/sd/source/ui/accessibility/AccessibleTreeNode.cxx +++ b/sd/source/ui/accessibility/AccessibleTreeNode.cxx @@ -717,6 +717,7 @@ IMPL_LINK(AccessibleTreeNode, WindowEventListener, VclWindowEvent*, pEvent) case VCLEVENT_WINDOW_GETFOCUS: case VCLEVENT_WINDOW_LOSEFOCUS: UpdateStateSet(); + break; } return 1; } diff --git a/sd/source/ui/app/res_bmp.src b/sd/source/ui/app/res_bmp.src index 77ef817e4c44..1f8712369637 100644 --- a/sd/source/ui/app/res_bmp.src +++ b/sd/source/ui/app/res_bmp.src @@ -530,22 +530,6 @@ Bitmap BMP_CLOSE_DOC_H { File = "closedochc.bmp"; }; -Bitmap BMP_TRIANGLE_RIGHT -{ - File = "triangle_right.bmp"; -}; -Bitmap BMP_TRIANGLE_RIGHT_H -{ - File = "triangle_right_hc.bmp"; -}; -Bitmap BMP_TRIANGLE_DOWN -{ - File = "triangle_down.bmp"; -}; -Bitmap BMP_TRIANGLE_DOWN_H -{ - File = "triangle_down_hc.bmp"; -}; Bitmap BMP_FADE_EFFECT_INDICATOR { File = "fade_effect_indicator.bmp"; diff --git a/sd/source/ui/inc/res_bmp.hrc b/sd/source/ui/inc/res_bmp.hrc index 0dd5451c1f45..61f9130f547b 100644 --- a/sd/source/ui/inc/res_bmp.hrc +++ b/sd/source/ui/inc/res_bmp.hrc @@ -224,10 +224,10 @@ #define BMP_CLOSE_DOC RID_SD_START+325 #define BMP_CLOSE_DOC_H RID_SD_START+326 -#define BMP_TRIANGLE_RIGHT RID_SD_START+327 -#define BMP_TRIANGLE_RIGHT_H RID_SD_START+328 -#define BMP_TRIANGLE_DOWN RID_SD_START+329 -#define BMP_TRIANGLE_DOWN_H RID_SD_START+330 + // FREE + // FREE + // FREE + // FREE #define BMP_FADE_EFFECT_INDICATOR RID_SD_START+331 #define BMP_FADE_EFFECT_INDICATOR_H RID_SD_START+332 diff --git a/sd/source/ui/inc/taskpane/TitleBar.hxx b/sd/source/ui/inc/taskpane/TitleBar.hxx index 7998599b2e11..6128d39aecc3 100644 --- a/sd/source/ui/inc/taskpane/TitleBar.hxx +++ b/sd/source/ui/inc/taskpane/TitleBar.hxx @@ -44,12 +44,7 @@ class VirtualDevice; namespace sd { namespace toolpanel { -/** The title bar above a control in a tool panel or sub tool panel. - The way the title bar is displayed depends on the TitleBarType - given to the constructor. TBT_CONTROL_TITLE and - TBT_SUB_CONTROL_HEADLINE both show a expansion indicator in front of - the title string that shows whether the associated control is - visible (expanded) or not. +/** The title bar above a control in a sub tool panel. <p>The title bar shows two kinds of indicators: 1) Expansion is displayed by two sets of two bitmaps, a triangle pointing to the right @@ -63,9 +58,8 @@ class TitleBar { public: enum TitleBarType { - TBT_CONTROL_TITLE, TBT_SUB_CONTROL_HEADLINE - }; + }; /** Create a new title bar whose content, the given title string, will be formatted according to the given type. @@ -113,17 +107,10 @@ private: String msTitle; bool mbExpanded; bool mbFocused; - bool mbMouseOver; // Size of the bounding box that encloses the title string. - Size maStringBox; ::std::auto_ptr<VirtualDevice> mpDevice; bool mbIsExpandable; - /** Set the mbMouseOver flag to the given value and paint the - title bar accordingly. - */ - void SetMouseOver (bool bFlag); - /** Return whether this TitleBar object has an expansion indicator bitmap. It is safe to call GetExpansionIndicator() when this method returns <FALSE/> but unnecessary. @@ -157,7 +144,6 @@ private: const Rectangle& rTextBox, int nTitleBarWidth); - void PaintPanelControlTitle (void); void PaintSubPanelHeadLineBar (void); void PaintBackground (const Rectangle& rTextBox); @@ -165,12 +151,6 @@ private: /// Paint a focus indicator that encloses the given rectangle. void PaintFocusIndicator (const Rectangle& rIndicatorBox); - /** Paint a mouse over indicator. If the mouse is over the title - bar than the text enclosed by the given rectangle is - underlined. - */ - void PaintMouseOverIndicator (const Rectangle& rIndicatorBox); - Rectangle PaintExpansionIndicator (const Rectangle& rTextBox); void PaintText (const Rectangle& rTextBox); diff --git a/sd/source/ui/inc/taskpane/TitledControl.hxx b/sd/source/ui/inc/taskpane/TitledControl.hxx index 44ebcf4e5834..e79aeb170507 100644 --- a/sd/source/ui/inc/taskpane/TitledControl.hxx +++ b/sd/source/ui/inc/taskpane/TitledControl.hxx @@ -153,12 +153,6 @@ private: void* mpUserData; ::std::auto_ptr<ClickHandler> mpClickHandler; - /** Remember whether to toggle (true) the expansion state when the title - bar is clicked on. When set to false then the control is always - expanded. - */ - bool mbExpansionModeIsToggle; - /// Do not use! Assignment operator is not supported. const TitledControl& operator= ( const TitledControl& aDescriptor); diff --git a/sd/source/ui/toolpanel/TitleBar.cxx b/sd/source/ui/toolpanel/TitleBar.cxx index e54c98428065..a81d478c068c 100644 --- a/sd/source/ui/toolpanel/TitleBar.cxx +++ b/sd/source/ui/toolpanel/TitleBar.cxx @@ -69,7 +69,6 @@ TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eTyp , msTitle(rsTitle) , mbExpanded(false) , mbFocused(false) -, mbMouseOver(false) , mpDevice(new VirtualDevice (*this)) , mbIsExpandable (bIsExpandable) { @@ -80,7 +79,6 @@ TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eTyp // Change the mouse pointer shape so that it acts as a mouse over effect. switch (meType) { - case TBT_CONTROL_TITLE: case TBT_SUB_CONTROL_HEADLINE: if (mbIsExpandable) SetPointer (POINTER_REFHAND); @@ -170,10 +168,6 @@ void TitleBar::Paint (const Rectangle& rBoundingBox) switch (meType) { - case TBT_CONTROL_TITLE: - PaintPanelControlTitle (); - break; - case TBT_SUB_CONTROL_HEADLINE: PaintSubPanelHeadLineBar (); break; @@ -239,18 +233,6 @@ void TitleBar::LoseFocus() -void TitleBar::SetMouseOver (bool bFlag) -{ - if (bFlag != mbMouseOver) - { - mbMouseOver = bFlag; - // Invalidate(); - } -} - - - - bool TitleBar::HasExpansionIndicator (void) const { bool bHasExpansionIndicator (false); @@ -258,7 +240,6 @@ bool TitleBar::HasExpansionIndicator (void) const { switch (meType) { - case TBT_CONTROL_TITLE: case TBT_SUB_CONTROL_HEADLINE: bHasExpansionIndicator = true; break; @@ -279,21 +260,6 @@ Image TitleBar::GetExpansionIndicator (void) const USHORT nResourceId = 0; switch (meType) { - case TBT_CONTROL_TITLE: - if (mbExpanded) - if (bHighContrastMode) - nResourceId = BMP_TRIANGLE_DOWN_H; - else - nResourceId = BMP_TRIANGLE_DOWN; - else - if (bHighContrastMode) - nResourceId = BMP_TRIANGLE_RIGHT_H; - else - nResourceId = BMP_TRIANGLE_RIGHT; - - aIndicator = IconCache::Instance().GetIcon(nResourceId); - break; - case TBT_SUB_CONTROL_HEADLINE: if (mbExpanded) if (bHighContrastMode) @@ -317,22 +283,6 @@ Image TitleBar::GetExpansionIndicator (void) const -void TitleBar::PaintPanelControlTitle (void) -{ - int nWidth (GetOutputSizePixel().Width()); - Rectangle aTextBox (CalculateTextBoundingBox (nWidth, true)); - PaintBackground(CalculateTitleBarBox(aTextBox, nWidth)); - Rectangle aFocusBox (PaintExpansionIndicator (aTextBox)); - PaintText (aTextBox); - aFocusBox.Union (aTextBox); - aFocusBox.Left() += 2; - PaintFocusIndicator (aFocusBox); - PaintMouseOverIndicator (aTextBox); -} - - - - void TitleBar::PaintSubPanelHeadLineBar (void) { int nWidth (GetOutputSizePixel().Width()); @@ -353,7 +303,6 @@ void TitleBar::PaintSubPanelHeadLineBar (void) aFocusBox.Left() -= 2; aFocusBox.Right() += 1; PaintFocusIndicator (aFocusBox); - PaintMouseOverIndicator (aTextBox); } @@ -390,21 +339,6 @@ void TitleBar::PaintFocusIndicator (const Rectangle& rTextBox) -void TitleBar::PaintMouseOverIndicator (const Rectangle& rTextBox) -{ - if (mbMouseOver) - { - Rectangle aBox (rTextBox); - // Show the line below the focus rectangle (which is painted - // after and over the mouse over indicator.) - // aBox.Bottom() += 2; - // DrawLine (aBox.BottomLeft(), aBox.BottomRight()); - } -} - - - - Rectangle TitleBar::PaintExpansionIndicator (const Rectangle& rTextBox) { Rectangle aExpansionIndicatorArea; @@ -466,29 +400,6 @@ void TitleBar::PaintBackground (const Rectangle& rTitleBarBox) switch (meType) { - case TBT_CONTROL_TITLE: - { - mpDevice->SetFillColor ( - GetSettings().GetStyleSettings().GetDialogColor()); - mpDevice->DrawRect(rTitleBarBox); - - mpDevice->SetFillColor(); - mpDevice->SetLineColor ( - GetSettings().GetStyleSettings().GetLightColor()); - mpDevice->DrawLine( - rTitleBarBox.TopLeft(),rTitleBarBox.TopRight()); - mpDevice->DrawLine( - rTitleBarBox.TopLeft(),rTitleBarBox.BottomLeft()); - - mpDevice->SetLineColor ( - GetSettings().GetStyleSettings().GetShadowColor()); - mpDevice-> DrawLine( - rTitleBarBox.BottomLeft(), rTitleBarBox.BottomRight()); - mpDevice->DrawLine( - rTitleBarBox.TopRight(), rTitleBarBox.BottomRight()); - } - break; - case TBT_SUB_CONTROL_HEADLINE: { Color aColor (GetSettings().GetStyleSettings().GetDialogColor()); @@ -568,11 +479,6 @@ Rectangle TitleBar::CalculateTitleBarBox ( switch (meType) { - case TBT_CONTROL_TITLE: - aTitleBarBox.Bottom() += aTitleBarBox.Top(); - aTitleBarBox.Top() = 0; - break; - case TBT_SUB_CONTROL_HEADLINE: aTitleBarBox.Top() -= 3; aTitleBarBox.Bottom() += 3; @@ -589,15 +495,8 @@ Rectangle TitleBar::CalculateTitleBarBox ( -void TitleBar::MouseMove (const MouseEvent& rEvent) +void TitleBar::MouseMove (const MouseEvent& ) { - Point aRelativePosition = rEvent.GetPosPixel() - GetPosPixel(); - Size aSize = GetSizePixel(); - SetMouseOver ( - aRelativePosition.X() >= 0 - && aRelativePosition.Y() >= 0 - && aRelativePosition.X() < aSize.Width() - && aRelativePosition.Y() < aSize.Height()); } diff --git a/sd/source/ui/toolpanel/TitleToolBox.cxx b/sd/source/ui/toolpanel/TitleToolBox.cxx index d108724f03d4..c6d69c7d494a 100644 --- a/sd/source/ui/toolpanel/TitleToolBox.cxx +++ b/sd/source/ui/toolpanel/TitleToolBox.cxx @@ -45,18 +45,6 @@ namespace sd { namespace toolpanel { TitleToolBox::TitleToolBox (::Window* pParent, WinBits nStyle ) : ToolBox( pParent, nStyle ) { - lastSize = -1; - - Bitmap aBitmap (SdResId (BMP_CLOSE_DOC)); - Bitmap aBitmapHC (SdResId (BMP_CLOSE_DOC_H)); - Bitmap aTriangleRight (SdResId (BMP_TRIANGLE_RIGHT)); - Bitmap aTriangleDown (SdResId (BMP_TRIANGLE_DOWN)); - - maImage = Image (aBitmap, Color (COL_LIGHTMAGENTA)); - maImageHC = Image (aBitmapHC, Color (BMP_COLOR_HIGHCONTRAST)); - maTriangleRight = Image (aTriangleRight, Color (COL_LIGHTMAGENTA)); - maTriangleDown = Image (aTriangleDown, Color (COL_LIGHTMAGENTA)); - SetOutStyle (TOOLBOX_STYLE_FLAT); SetBackground (Wallpaper ( GetSettings().GetStyleSettings().GetDialogColor())); @@ -65,43 +53,6 @@ TitleToolBox::TitleToolBox (::Window* pParent, WinBits nStyle ) -void TitleToolBox::AddItem (ToolBoxId aId) -{ - switch (aId) - { - case TBID_PANEL_MENU: - InsertItem (TBID_PANEL_MENU, - String::CreateFromAscii ("Panel"), - TIB_DROPDOWN); - break; - - case TBID_DOCUMENT_CLOSE: - InsertItem (TBID_DOCUMENT_CLOSE, - GetSettings().GetStyleSettings().GetHighContrastMode() - ? maImageHC : maImage, 0 ); - break; - - case TBID_TRIANGLE_RIGHT: - InsertItem (TBID_TRIANGLE_RIGHT, - maTriangleRight, 0); - break; - - case TBID_TRIANGLE_DOWN: - InsertItem (TBID_TRIANGLE_DOWN, - maTriangleDown, 0); - break; - - case TBID_TEST: - InsertItem (TBID_TEST, - String::CreateFromAscii ("Test"), - TIB_DROPDOWN); - break; - } -} - - - - void TitleToolBox::DataChanged (const DataChangedEvent& rDCEvt) { Window::DataChanged (rDCEvt); diff --git a/sd/source/ui/toolpanel/TitleToolBox.hxx b/sd/source/ui/toolpanel/TitleToolBox.hxx index eef202ad7d72..5cdd14c46020 100644 --- a/sd/source/ui/toolpanel/TitleToolBox.hxx +++ b/sd/source/ui/toolpanel/TitleToolBox.hxx @@ -45,27 +45,9 @@ class TitleToolBox : public ToolBox { public: - enum ToolBoxId { - TBID_DOCUMENT_CLOSE = 1, - TBID_PANEL_MENU = 2, - TBID_TRIANGLE_RIGHT = 3, - TBID_TRIANGLE_DOWN = 4, - TBID_TEST - }; - TitleToolBox (::Window* pParent, WinBits nStyle = 0); - void AddItem (ToolBoxId aId); - void DataChanged (const DataChangedEvent& rDCEvt); - -private: - Image maImage; - Image maImageHC; - Image maTriangleRight; - Image maTriangleDown; - - long lastSize; }; } } // end of namespace ::sd::toolbox diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx index 921b37335048..4c62d1dea178 100644 --- a/sd/source/ui/toolpanel/TitledControl.cxx +++ b/sd/source/ui/toolpanel/TitledControl.cxx @@ -55,8 +55,7 @@ TitledControl::TitledControl ( msTitle(rTitle), mbVisible(true), mpUserData(NULL), - mpClickHandler(new ClickHandler(rClickHandler)), - mbExpansionModeIsToggle(eType!=TitleBar::TBT_CONTROL_TITLE) + mpClickHandler(new ClickHandler(rClickHandler)) { if (pControl.get() != NULL) { diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx index a6fc04ded305..53a1caff73d9 100755 --- a/sd/source/ui/toolpanel/ToolPanelDeck.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDeck.cxx @@ -28,7 +28,6 @@ #include "ToolPanelDeck.hxx" #include "taskpane/ToolPanelViewShell.hxx" -#include "ToolPanelDrawer.hxx" #include "taskpane/ControlContainer.hxx" #include "framework/FrameworkHelper.hxx" #include "TaskPaneToolPanel.hxx" @@ -40,6 +39,7 @@ /** === end UNO includes === **/ #include <svtools/toolpanel/tablayouter.hxx> +#include <svtools/toolpanel/drawerlayouter.hxx> #include <tools/diagnose_ex.h> //...................................................................................................................... @@ -88,11 +88,11 @@ namespace sd { namespace toolpanel void ToolPanelDeck::SetDrawersLayout() { const ::svt::PDeckLayouter pLayouter( GetLayouter() ); - const ToolPanelDrawer* pDrawerLayouter = dynamic_cast< const ToolPanelDrawer* >( pLayouter.get() ); + const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() ); if ( pDrawerLayouter != NULL ) // already have the proper layout return; - SetLayouter( new ToolPanelDrawer( *this, *this ) ); + SetLayouter( new ::svt::DrawerDeckLayouter( *this, *this ) ); } //------------------------------------------------------------------------------------------------------------------ diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx deleted file mode 100755 index 86406fdff5b4..000000000000 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx +++ /dev/null @@ -1,282 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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 "precompiled_sd.hxx" - -#include "ToolPanelDrawer.hxx" -#include "taskpane/TitleBar.hxx" - -#include <tools/diagnose_ex.h> - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::accessibility::XAccessible; - /** === end UNO using === **/ - - //================================================================================================================== - //= ToolPanelDrawer - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - ToolPanelDrawer::ToolPanelDrawer( ::Window& i_rParentWindow, ::svt::IToolPanelDeck& i_rPanels ) - :m_rParentWindow( i_rParentWindow ) - ,m_rPanelDeck( i_rPanels ) - ,m_aDrawers() - ,m_aLastKnownActivePanel() - { - m_rPanelDeck.AddListener( *this ); - - // simulate PanelInserted events for the panels which are already there - for ( size_t i=0; i<m_rPanelDeck.GetPanelCount(); ++i ) - PanelInserted( m_rPanelDeck.GetPanel( i ), i ); - } - - //------------------------------------------------------------------------------------------------------------------ - ToolPanelDrawer::~ToolPanelDrawer() - { - } - - //------------------------------------------------------------------------------------------------------------------ - IMPLEMENT_IREFERENCE( ToolPanelDrawer ) - - //------------------------------------------------------------------------------------------------------------------ - Rectangle ToolPanelDrawer::Layout( const Rectangle& i_rDeckPlayground ) - { - const size_t nPanelCount( m_rPanelDeck.GetPanelCount() ); - if ( nPanelCount == 0 ) - return i_rDeckPlayground; - - const int nWidth( i_rDeckPlayground.GetWidth() ); - ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() ); - if ( !aActivePanel ) - aActivePanel = m_aLastKnownActivePanel; - - // arrange the title bars which are *above* the active panel (or *all* if there is no active panel), plus - // the title bar of the active panel itself - Point aUpperDrawerPos( i_rDeckPlayground.TopLeft() ); - const size_t nUpperBound = !!aActivePanel ? *aActivePanel : nPanelCount - 1; - for ( size_t i=0; i<=nUpperBound; ++i ) - { - sal_uInt32 nDrawerHeight = m_aDrawers[i]->GetPreferredHeight( nWidth ); - m_aDrawers[i]->GetWindow()->SetPosSizePixel( - aUpperDrawerPos, Size( nWidth, nDrawerHeight ) ); - aUpperDrawerPos.Move( 0, nDrawerHeight ); - } - - // arrange title bars which are below the active panel (or *none* if there is no active panel) - Point aLowerDrawerPos( i_rDeckPlayground.BottomLeft() ); - for ( size_t j = nPanelCount - 1; j > nUpperBound; --j ) - { - sal_uInt32 nDrawerHeight = m_aDrawers[j]->GetPreferredHeight( nWidth ); - m_aDrawers[j]->GetWindow()->SetPosSizePixel( - Point( aLowerDrawerPos.X(), aLowerDrawerPos.Y() - nDrawerHeight + 1 ), - Size( nWidth, nDrawerHeight ) - ); - aLowerDrawerPos.Move( 0, -nDrawerHeight ); - } - - // fincally calculate the rectangle for the active panel - return Rectangle( - aUpperDrawerPos, - Size( nWidth, aLowerDrawerPos.Y() - aUpperDrawerPos.Y() + 1 ) - ); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::Destroy() - { - while ( !m_aDrawers.empty() ) - impl_removeTitleBar( 0 ); - m_rPanelDeck.RemoveListener( *this ); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::SetFocusToPanelSelector() - { - const size_t nPanelCount( m_rPanelDeck.GetPanelCount() ); - if ( !nPanelCount ) - // nothing to focus - return; - ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() ); - if ( !aActivePanel ) - aActivePanel = 0; - ENSURE_OR_RETURN_VOID( *aActivePanel < m_aDrawers.size(), "ToolPanelDrawer::SetFocusToPanelSelector: invalid active panel, or inconsistent drawers!" ); - m_aDrawers[ *aActivePanel ]->GetWindow()->GrabFocus(); - } - - //------------------------------------------------------------------------------------------------------------------ - size_t ToolPanelDrawer::GetAccessibleChildCount() const - { - return m_aDrawers.size(); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > ToolPanelDrawer::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible ) - { - ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", NULL ); - - const PTitleBar pTitleBar( m_aDrawers[ i_nChildIndex ] ); - Window* pItemWindow( pTitleBar->GetWindow() ); - - Reference< XAccessible > xItemAccessible( pItemWindow->GetAccessible( FALSE ) ); - if ( !xItemAccessible.is() ) - { - xItemAccessible = pTitleBar->CreateAccessibleObject( i_rParentAccessible ); - OSL_ENSURE( xItemAccessible.is(), "ToolPanelDrawer::GetAccessibleChild: invalid XAccessible returned by CreateAccessibleObject!" ); - pItemWindow->SetAccessible( xItemAccessible ); - } - - return xItemAccessible; - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) - { - OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "ToolPanelDrawer::PanelInserted: inconsistency!" ); - - ::boost::shared_ptr< TitleBar > pTitleBar( new TitleBar( &m_rParentWindow, i_pPanel->GetDisplayName(), TitleBar::TBT_CONTROL_TITLE, true ) ); - pTitleBar->GetWindow()->Show(); - pTitleBar->GetWindow()->AddEventListener( LINK( this, ToolPanelDrawer, OnWindowEvent ) ); - m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pTitleBar ); - impl_triggerRearrange(); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::PanelRemoved( const size_t i_nPosition ) - { - impl_removeTitleBar( i_nPosition ); - impl_triggerRearrange(); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::impl_triggerRearrange() const - { - // this is somewhat hacky, it assumes that the parent of our panels is a tool panel deck, which, in its - // Resize implementation, rearrances all elements. - m_rParentWindow.Resize(); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - if ( !!i_rOldActive ) - { - OSL_ENSURE( *i_rOldActive < m_aDrawers.size(), "ToolPanelDrawer::ActivePanelChanged: illegal old index!" ); - m_aDrawers[ *i_rOldActive ]->Expand( false ); - } - - if ( !!i_rNewActive ) - { - OSL_ENSURE( *i_rNewActive < m_aDrawers.size(), "ToolPanelDrawer::ActivePanelChanged: illegal new index!" ); - m_aDrawers[ *i_rNewActive ]->Expand( true ); - } - - impl_triggerRearrange(); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) - { - // not interested in - (void)i_rNewLayouter; - } - - //------------------------------------------------------------------------------------------------------------------ - size_t ToolPanelDrawer::impl_getPanelPositionFromWindow( const Window* i_pTitleBarWindow ) const - { - for ( ::std::vector< PTitleBar >::const_iterator drawerPos = m_aDrawers.begin(); - drawerPos != m_aDrawers.end(); - ++drawerPos - ) - { - if ( (*drawerPos)->GetWindow() == i_pTitleBarWindow ) - return drawerPos - m_aDrawers.begin(); - } - return m_aDrawers.size(); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::impl_removeTitleBar( const size_t i_nPosition ) - { - OSL_PRECOND( i_nPosition < m_aDrawers.size(), "ToolPanelDrawer::impl_removeTitleBar: invalid panel position!" ); - m_aDrawers[ i_nPosition ]->GetWindow()->RemoveEventListener( LINK( this, ToolPanelDrawer, OnWindowEvent ) ); - OSL_ENSURE( m_aDrawers[ i_nPosition ].unique(), "ToolPanelDrawer::impl_removeTitleBar: somebody else is still holding a reference!" ); - m_aDrawers.erase( m_aDrawers.begin() + i_nPosition ); - } - - //------------------------------------------------------------------------------------------------------------------ - IMPL_LINK( ToolPanelDrawer, OnWindowEvent, VclSimpleEvent*, i_pEvent ) - { - const VclWindowEvent* pWindowEvent = PTR_CAST( VclWindowEvent, i_pEvent ); - ENSURE_OR_RETURN( pWindowEvent, "no WindowEvent", 0L ); - - bool bActivatePanel = false; - switch ( pWindowEvent->GetId() ) - { - case VCLEVENT_WINDOW_MOUSEBUTTONUP: - { - const MouseEvent* pMouseEvent = static_cast< const MouseEvent* >( pWindowEvent->GetData() ); - ENSURE_OR_RETURN( pMouseEvent, "no mouse event with MouseButtonUp", 0L ); - if ( pMouseEvent->GetButtons() == MOUSE_LEFT ) - { - bActivatePanel = true; - } - } - break; - case VCLEVENT_WINDOW_KEYINPUT: - { - const KeyEvent* pKeyEvent = static_cast< const KeyEvent* >( pWindowEvent->GetData() ); - ENSURE_OR_RETURN( pKeyEvent, "no key event with KeyInput", 0L ); - const KeyCode& rKeyCode( pKeyEvent->GetKeyCode() ); - if ( ( rKeyCode.GetModifier() == 0 ) && ( rKeyCode.GetCode() == KEY_RETURN ) ) - { - bActivatePanel = true; - } - } - break; - } - if ( bActivatePanel ) - { - const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() ); - m_rPanelDeck.ActivatePanel( nPanelPos ); - return 1L; - } - return 0L; - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::Dying() - { - Destroy(); - } - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx b/sd/source/ui/toolpanel/ToolPanelDrawer.hxx deleted file mode 100755 index 0d850ab1d7a2..000000000000 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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. - * -************************************************************************/ - -#ifndef SD_TOOLPANEL_TOOLPANELDRAWER_HXX -#define SD_TOOLPANEL_TOOLPANELDRAWER_HXX - -#include <svtools/toolpanel/refbase.hxx> -#include <svtools/toolpanel/toolpaneldeck.hxx> -#include <svtools/toolpanel/decklayouter.hxx> - -#include <boost/shared_ptr.hpp> - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - class ToolPanelViewShell; - class TitleBar; - typedef ::boost::shared_ptr< TitleBar > PTitleBar; - - //================================================================================================================== - //= ToolPanelDrawer - //================================================================================================================== - /** a class which implements a tool panel selector in the form of the classical drawers - */ - class ToolPanelDrawer :public ::svt::RefBase - ,public ::svt::IDeckLayouter - ,public ::svt::IToolPanelDeckListener - { - public: - ToolPanelDrawer( - ::Window& i_rParentWindow, - ::svt::IToolPanelDeck& i_rPanels - ); - ~ToolPanelDrawer(); - - // IReference - DECLARE_IREFERENCE() - - // IDeckLayouter - virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); - virtual void Destroy(); - virtual void SetFocusToPanelSelector(); - virtual size_t GetAccessibleChildCount() const; - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - GetAccessibleChild( - const size_t i_nChildIndex, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible - ); - - // IToolPanelDeckListener - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); - virtual void PanelRemoved( const size_t i_nPosition ); - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); - virtual void Dying(); - - private: - // triggers a re-arrance of the panel deck elements - void impl_triggerRearrange() const; - size_t impl_getPanelPositionFromWindow( const Window* i_pTitleBarWindow ) const; - void impl_removeTitleBar( const size_t i_nPosition ); - - DECL_LINK( OnWindowEvent, VclSimpleEvent* ); - -private: - Window& m_rParentWindow; - ::svt::IToolPanelDeck& m_rPanelDeck; - ::std::vector< PTitleBar > m_aDrawers; - ::boost::optional< size_t > m_aLastKnownActivePanel; - }; - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... - -#endif // SD_TOOLPANEL_TOOLPANELDRAWER_HXX diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk index 837ffb710499..f9cd156855d0 100644 --- a/sd/source/ui/toolpanel/makefile.mk +++ b/sd/source/ui/toolpanel/makefile.mk @@ -60,7 +60,6 @@ SLOFILES = \ $(SLO)$/TaskPaneTreeNode.obj \ $(SLO)$/ToolPanelViewShell.obj \ $(SLO)$/ToolPanelDeck.obj \ - $(SLO)$/ToolPanelDrawer.obj \ $(SLO)$/TaskPaneToolPanel.obj \ $(SLO)$/CustomToolPanel.obj \ $(SLO)$/StandardToolPanel.obj \ |