hwpfilter/source/hwpreader.cxx | 2 sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc | 4 sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx | 9 + sfx2/source/dialog/templdlg.cxx | 2 sfx2/source/sidebar/Deck.cxx | 1 sfx2/source/sidebar/DeckLayouter.cxx | 4 sfx2/source/sidebar/FocusManager.cxx | 1 sfx2/source/sidebar/Panel.cxx | 13 - sfx2/source/sidebar/Panel.hxx | 3 sfx2/source/sidebar/PanelTitleBar.cxx | 68 +++++--- sfx2/source/sidebar/PanelTitleBar.hxx | 8 sfx2/source/sidebar/SidebarController.cxx | 15 + sfx2/source/sidebar/SidebarToolBox.cxx | 94 +++++++++-- sfx2/source/sidebar/TitleBar.cxx | 2 sfx2/source/sidebar/TitleBar.hxx | 4 svx/source/svdraw/svdfmtf.cxx | 177 ++++++++++++++------- vcl/source/window/dockwin.cxx | 15 + 17 files changed, 306 insertions(+), 116 deletions(-)
New commits: commit 58b44ad7c8d46904da750c4820f4bde675953fa9 Author: Armin Le Grand <[email protected]> Date: Fri May 17 09:58:33 2013 +0000 i122326 added text clipping, corrected text box distances diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index e214558..3e7cc6e 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -75,6 +75,9 @@ #include <svx/xflbmtit.hxx> #include <svx/xflbstit.hxx> #include <svx/svdpntv.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <svx/svditer.hxx> +#include <svx/svdogrp.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -484,63 +487,130 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale) const SdrLayerID aOldLayer(pObj->GetLayer()); const SfxItemSet aOldItemSet(pObj->GetMergedItemSet()); const SdrGrafObj* pSdrGrafObj = dynamic_cast< SdrGrafObj* >(pObj); - BitmapEx aBitmapEx; + const SdrTextObj* pSdrTextObj = dynamic_cast< SdrTextObj* >(pObj); - if(pSdrGrafObj) + if(pSdrTextObj && pSdrTextObj->HasText()) { - aBitmapEx = pSdrGrafObj->GetGraphic().GetBitmapEx(); - } + // all text objects are created from ImportText and have no line or fill attributes, so + // it is okay to concentrate on the text itself + while(true) + { + const basegfx::B2DPolyPolygon aTextContour(pSdrTextObj->TakeContour()); + const basegfx::B2DRange aTextRange(aTextContour.getB2DRange()); + const basegfx::B2DRange aClipRange(maClip.getB2DRange()); + + // no overlap -> completely outside + if(!aClipRange.overlaps(aTextRange)) + { + SdrObject::Free(pObj); + break; + } + + // when the clip is a rectangle fast check for inside is possible + if(basegfx::tools::isRectangle(maClip) && aClipRange.isInside(aTextRange)) + { + // completely inside ClipRect + break; + } - SdrObject::Free(pObj); + // here text needs to be clipped; to do so, convert to SdrObjects with polygons + // and add these recursively. Delete original object, do not add in this run + SdrObject* pConverted = pSdrTextObj->ConvertToPolyObj(true, true); + SdrObject::Free(pObj); - if(!aOldRange.isEmpty()) + if(pConverted) + { + // recursively add created conversion; per definition this shall not + // contain further SdrTextObjs. Visit only non-group objects + SdrObjListIter aIter(*pConverted, IM_DEEPNOGROUPS); + + // work with clones; the created conversion may contain group objects + // and when working with the original objects the loop itself could + // break and the cleanup later would be pretty complicated (only delete group + // objects, are these empty, ...?) + while(aIter.IsMore()) + { + SdrObject* pCandidate = aIter.Next(); + OSL_ENSURE(pCandidate && 0 == dynamic_cast< SdrObjGroup* >(pCandidate), "SdrObjListIter with IM_DEEPNOGROUPS error (!)"); + SdrObject* pNewClone = pCandidate->Clone(); + + if(pNewClone) + { + InsertObj(pNewClone, false); + } + else + { + OSL_ENSURE(false, "SdrObject::Clone() failed (!)"); + } + } + + // cleanup temporary conversion objects + SdrObject::Free(pConverted); + } + + break; + } + } + else { - // clip against ClipRegion - const basegfx::B2DPolyPolygon aNewPoly( - basegfx::tools::clipPolyPolygonOnPolyPolygon( - aPoly, - maClip, - true, - aPoly.isClosed() ? false : true)); - const basegfx::B2DRange aNewRange(aNewPoly.getB2DRange()); - - if(!aNewRange.isEmpty()) + BitmapEx aBitmapEx; + + if(pSdrGrafObj) { - pObj = new SdrPathObj( - aNewPoly.isClosed() ? OBJ_POLY : OBJ_PLIN, - aNewPoly); + aBitmapEx = pSdrGrafObj->GetGraphic().GetBitmapEx(); + } - pObj->SetLayer(aOldLayer); - pObj->SetMergedItemSet(aOldItemSet); + SdrObject::Free(pObj); - if(!!aBitmapEx) + if(!aOldRange.isEmpty()) + { + // clip against ClipRegion + const basegfx::B2DPolyPolygon aNewPoly( + basegfx::tools::clipPolyPolygonOnPolyPolygon( + aPoly, + maClip, + true, + aPoly.isClosed() ? false : true)); + const basegfx::B2DRange aNewRange(aNewPoly.getB2DRange()); + + if(!aNewRange.isEmpty()) { - // aNewRange is inside of aOldRange and defines which part of aBitmapEx is used - const double fScaleX(aBitmapEx.GetSizePixel().Width() / (aOldRange.getWidth() ? aOldRange.getWidth() : 1.0)); - const double fScaleY(aBitmapEx.GetSizePixel().Height() / (aOldRange.getHeight() ? aOldRange.getHeight() : 1.0)); - basegfx::B2DRange aPixel(aNewRange); - basegfx::B2DHomMatrix aTrans; - - aTrans.translate(-aOldRange.getMinX(), -aOldRange.getMinY()); - aTrans.scale(fScaleX, fScaleY); - aPixel.transform(aTrans); - - const Size aOrigSizePixel(aBitmapEx.GetSizePixel()); - const Point aClipTopLeft( - basegfx::fround(floor(std::max(0.0, aPixel.getMinX()))), - basegfx::fround(floor(std::max(0.0, aPixel.getMinY())))); - const Size aClipSize( - basegfx::fround(ceil(std::min((double)aOrigSizePixel.Width(), aPixel.getWidth()))), - basegfx::fround(ceil(std::min((double)aOrigSizePixel.Height(), aPixel.getHeight())))); - const BitmapEx aClippedBitmap( - aBitmapEx, - aClipTopLeft, - aClipSize); - - pObj->SetMergedItem(XFillStyleItem(XFILL_BITMAP)); - pObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aClippedBitmap))); - pObj->SetMergedItem(XFillBmpTileItem(false)); - pObj->SetMergedItem(XFillBmpStretchItem(true)); + pObj = new SdrPathObj( + aNewPoly.isClosed() ? OBJ_POLY : OBJ_PLIN, + aNewPoly); + + pObj->SetLayer(aOldLayer); + pObj->SetMergedItemSet(aOldItemSet); + + if(!!aBitmapEx) + { + // aNewRange is inside of aOldRange and defines which part of aBitmapEx is used + const double fScaleX(aBitmapEx.GetSizePixel().Width() / (aOldRange.getWidth() ? aOldRange.getWidth() : 1.0)); + const double fScaleY(aBitmapEx.GetSizePixel().Height() / (aOldRange.getHeight() ? aOldRange.getHeight() : 1.0)); + basegfx::B2DRange aPixel(aNewRange); + basegfx::B2DHomMatrix aTrans; + + aTrans.translate(-aOldRange.getMinX(), -aOldRange.getMinY()); + aTrans.scale(fScaleX, fScaleY); + aPixel.transform(aTrans); + + const Size aOrigSizePixel(aBitmapEx.GetSizePixel()); + const Point aClipTopLeft( + basegfx::fround(floor(std::max(0.0, aPixel.getMinX()))), + basegfx::fround(floor(std::max(0.0, aPixel.getMinY())))); + const Size aClipSize( + basegfx::fround(ceil(std::min((double)aOrigSizePixel.Width(), aPixel.getWidth()))), + basegfx::fround(ceil(std::min((double)aOrigSizePixel.Height(), aPixel.getHeight())))); + const BitmapEx aClippedBitmap( + aBitmapEx, + aClipTopLeft, + aClipSize); + + pObj->SetMergedItem(XFillStyleItem(XFILL_BITMAP)); + pObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aClippedBitmap))); + pObj->SetMergedItem(XFillBmpTileItem(false)); + pObj->SetMergedItem(XFillBmpStretchItem(true)); + } } } } @@ -959,19 +1029,22 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const XubString& rS Rectangle aTextRect( aPos, aSize ); SdrRectObj* pText =new SdrRectObj( OBJ_TEXT, aTextRect ); + pText->SetMergedItem ( SdrTextUpperDistItem (0)); + pText->SetMergedItem ( SdrTextLowerDistItem (0)); + pText->SetMergedItem ( SdrTextRightDistItem (0)); + pText->SetMergedItem ( SdrTextLeftDistItem (0)); + if ( aFnt.GetWidth() || ( rAct.GetType() == META_STRETCHTEXT_ACTION ) ) { pText->ClearMergedItem( SDRATTR_TEXT_AUTOGROWWIDTH ); pText->SetMergedItem( SdrTextAutoGrowHeightItem( false ) ); // don't let the margins eat the space needed for the text - pText->SetMergedItem ( SdrTextUpperDistItem (0)); - pText->SetMergedItem ( SdrTextLowerDistItem (0)); - pText->SetMergedItem ( SdrTextRightDistItem (0)); - pText->SetMergedItem ( SdrTextLeftDistItem (0)); pText->SetMergedItem( SdrTextFitToSizeTypeItem( SDRTEXTFIT_ALLLINES ) ); } else + { pText->SetMergedItem( SdrTextAutoGrowWidthItem( true ) ); + } pText->SetModel(mpModel); pText->SetLayer(mnLayer); commit 10e1831ad2e9597c5197bafb6e03b098f8e81454 Author: Andre Fischer <[email protected]> Date: Fri May 17 09:44:46 2013 +0000 122315: Disable 'More Options' buttons when their commands are disabled. diff --git a/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx b/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx index 74ad5f5..bfe2adc 100644 --- a/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx +++ b/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx @@ -52,6 +52,8 @@ public: Window* pParentWindow, const ResId& rResId, const cssu::Reference<css::frame::XFrame>& rxFrame); + SidebarToolBox ( + Window* pParentWindow); virtual ~SidebarToolBox (void); void SetBorderWindow (const Window* pBorderWindow); @@ -71,6 +73,11 @@ public: sal_uInt16 GetItemIdForSubToolbarName ( const ::rtl::OUString& rsCOmmandName) const; + void SetController ( + const sal_uInt16 nItemId, + const cssu::Reference<css::frame::XToolbarController>& rxController, + const ::rtl::OUString& rsCommandName); + private: bool mbParentIsBorder; Image maItemSeparator; @@ -83,6 +90,7 @@ private: }; typedef ::std::map<sal_uInt16, ItemDescriptor> ControllerContainer; ControllerContainer maControllers; + bool mbAreHandlersRegistered; DECL_LINK(DropDownClickHandler, ToolBox*); DECL_LINK(ClickHandler, ToolBox*); @@ -97,6 +105,7 @@ private: const sal_Int32 nItemWidth = 0); void UpdateIcons ( const cssu::Reference<css::frame::XFrame>& rxFrame); + void RegisterHandlers (void); }; diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 4de29cd..76a83b1 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -26,6 +26,7 @@ #include "DeckLayouter.hxx" #include "DrawHelper.hxx" #include "DeckTitleBar.hxx" +#include "PanelTitleBar.hxx" #include "Paint.hxx" #include "Panel.hxx" #include "ToolBoxBackground.hxx" diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx index fed77b2..4b2fc18 100644 --- a/sfx2/source/sidebar/DeckLayouter.cxx +++ b/sfx2/source/sidebar/DeckLayouter.cxx @@ -24,7 +24,7 @@ #include "DeckLayouter.hxx" #include "sfx2/sidebar/Theme.hxx" #include "Panel.hxx" -#include "TitleBar.hxx" +#include "PanelTitleBar.hxx" #include "Deck.hxx" #include <vcl/window.hxx> @@ -222,7 +222,7 @@ sal_Int32 DeckLayouter::PlacePanels ( nY += nDeckSeparatorHeight; // Place the title bar. - TitleBar* pTitleBar = rPanel.GetTitleBar(); + PanelTitleBar* pTitleBar = rPanel.GetTitleBar(); if (pTitleBar != NULL) { if (iItem->mbShowTitleBar) diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx index 5416c76..9d29355 100644 --- a/sfx2/source/sidebar/FocusManager.cxx +++ b/sfx2/source/sidebar/FocusManager.cxx @@ -24,6 +24,7 @@ #include "FocusManager.hxx" #include "Panel.hxx" #include "DeckTitleBar.hxx" +#include "PanelTitleBar.hxx" #include "sfx2/sidebar/Tools.hxx" #include "TitleBar.hxx" #include <vcl/button.hxx> diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx index cf414a7..da30757 100644 --- a/sfx2/source/sidebar/Panel.cxx +++ b/sfx2/source/sidebar/Panel.cxx @@ -87,17 +87,6 @@ Panel::~Panel (void) -void Panel::SetShowMenuFunctor( const ::boost::function<void(void)>& rShowMenuFunctor ) -{ - if ( mpTitleBar.get() ) - { - mpTitleBar->SetMenuAction( rShowMenuFunctor ); - } -} - - - - void Panel::Dispose (void) { mxPanelComponent = NULL; @@ -128,7 +117,7 @@ void Panel::Dispose (void) -TitleBar* Panel::GetTitleBar (void) const +PanelTitleBar* Panel::GetTitleBar (void) const { return mpTitleBar.get(); } diff --git a/sfx2/source/sidebar/Panel.hxx b/sfx2/source/sidebar/Panel.hxx index 983c160..a6c7306 100644 --- a/sfx2/source/sidebar/Panel.hxx +++ b/sfx2/source/sidebar/Panel.hxx @@ -57,8 +57,7 @@ public: void Dispose (void); - void SetShowMenuFunctor( const ::boost::function<void(void)>& rShowMenuFunctor ); - TitleBar* GetTitleBar (void) const; + PanelTitleBar* GetTitleBar (void) const; bool IsTitleBarOptional (void) const; void SetUIElement (const cssu::Reference<css::ui::XUIElement>& rxElement); cssu::Reference<css::ui::XSidebarPanel> GetPanelComponent (void) const; diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx index 7a5191e..9c46e5e 100644 --- a/sfx2/source/sidebar/PanelTitleBar.cxx +++ b/sfx2/source/sidebar/PanelTitleBar.cxx @@ -28,15 +28,18 @@ #include "Paint.hxx" #include "Panel.hxx" #include "sfx2/sidebar/Theme.hxx" - +#include "sfx2/sidebar/ControllerFactory.hxx" #include <tools/svborder.hxx> #include <vcl/gradient.hxx> #include <vcl/image.hxx> +#include <toolkit/helper/vclunohelper.hxx> #ifdef DEBUG #include "sfx2/sidebar/Tools.hxx" #endif +using namespace css; +using namespace cssu; namespace sfx2 { namespace sidebar { @@ -53,7 +56,8 @@ PanelTitleBar::PanelTitleBar ( mbIsLeftButtonDown(false), mpPanel(pPanel), mnMenuItemIndex(1), - maMenuAction() + mxFrame(), + msMoreOptionsCommand() { OSL_ASSERT(mpPanel != NULL); @@ -78,23 +82,38 @@ PanelTitleBar::~PanelTitleBar (void) -void PanelTitleBar::SetMenuAction ( const ::boost::function<void(void)>& rMenuAction ) +void PanelTitleBar::SetMoreOptionsCommand ( + const ::rtl::OUString& rsCommandName, + const ::cssu::Reference<css::frame::XFrame>& rxFrame) { - if ( !maMenuAction && rMenuAction ) - { - maToolBox.InsertItem( - mnMenuItemIndex, - Theme::GetImage(Theme::Image_PanelMenu)); - maToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT); - maToolBox.SetQuickHelpText( - mnMenuItemIndex, - String(SfxResId(SFX_STR_SIDEBAR_MORE_OPTIONS))); - } - else if ( maMenuAction && !rMenuAction ) + if ( ! rsCommandName.equals(msMoreOptionsCommand)) { - maToolBox.RemoveItem( maToolBox.GetItemPos( mnMenuItemIndex ) ); + if (msMoreOptionsCommand.getLength() > 0) + maToolBox.RemoveItem(maToolBox.GetItemPos(mnMenuItemIndex)); + + msMoreOptionsCommand = rsCommandName; + mxFrame = rxFrame; + + if (msMoreOptionsCommand.getLength() > 0) + { + maToolBox.InsertItem( + mnMenuItemIndex, + Theme::GetImage(Theme::Image_PanelMenu)); + Reference<frame::XToolbarController> xController ( + ControllerFactory::CreateToolBoxController( + &maToolBox, + mnMenuItemIndex, + msMoreOptionsCommand, + rxFrame, + VCLUnoHelper::GetInterface(&maToolBox), + 0)); + maToolBox.SetController(mnMenuItemIndex, xController, msMoreOptionsCommand); + maToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT); + maToolBox.SetQuickHelpText( + mnMenuItemIndex, + String(SfxResId(SFX_STR_SIDEBAR_MORE_OPTIONS))); + } } - maMenuAction = rMenuAction; } @@ -158,8 +177,21 @@ Color PanelTitleBar::GetTextColor (void) void PanelTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex) { if (nItemIndex == mnMenuItemIndex) - if (maMenuAction) - maMenuAction(); + if (msMoreOptionsCommand.getLength() > 0) + { + try + { + const util::URL aURL (Tools::GetURL(msMoreOptionsCommand)); + Reference<frame::XDispatch> xDispatch (Tools::GetDispatch(mxFrame, aURL)); + if (xDispatch.is()) + xDispatch->dispatch(aURL, Sequence<beans::PropertyValue>()); + } + catch(Exception& rException) + { + OSL_TRACE("caught exception: %s", + OUStringToOString(rException.Message, RTL_TEXTENCODING_ASCII_US).getStr()); + } + } } diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/sfx2/source/sidebar/PanelTitleBar.hxx index 0861738..517d759 100644 --- a/sfx2/source/sidebar/PanelTitleBar.hxx +++ b/sfx2/source/sidebar/PanelTitleBar.hxx @@ -24,6 +24,7 @@ #include "TitleBar.hxx" +#include <com/sun/star/frame/XFrame.hpp> #include <boost/function.hpp> @@ -41,7 +42,9 @@ public: Panel* pPanel ); virtual ~PanelTitleBar (void); - void SetMenuAction ( const ::boost::function<void(void)>& rMenuAction ); + void SetMoreOptionsCommand ( + const ::rtl::OUString& rsCommandName, + const ::cssu::Reference<css::frame::XFrame>& rxFrame); virtual void DataChanged (const DataChangedEvent& rEvent); virtual void MouseButtonDown (const MouseEvent& rMouseEvent); @@ -58,7 +61,8 @@ private: bool mbIsLeftButtonDown; Panel* mpPanel; const sal_uInt16 mnMenuItemIndex; - ::boost::function<void(void)> maMenuAction; + cssu::Reference<css::frame::XFrame> mxFrame; + ::rtl::OUString msMoreOptionsCommand; }; diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index f2f9a4d..8e230c1 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -25,6 +25,7 @@ #include "Deck.hxx" #include "DeckTitleBar.hxx" #include "Panel.hxx" +#include "PanelTitleBar.hxx" #include "SidebarPanel.hxx" #include "SidebarResource.hxx" #include "TabBar.hxx" @@ -586,11 +587,15 @@ void SidebarController::SwitchToDeck ( } if (aNewPanels[nWriteIndex] != NULL) { - // Depending on the context we have to apply the show menu functor. - aNewPanels[nWriteIndex]->SetShowMenuFunctor( - rPanelContexDescriptor.msMenuCommand.getLength()>0 - ? ::boost::bind(&SidebarController::ShowDetailMenu,this,rPanelContexDescriptor.msMenuCommand) - : ::boost::function<void(void)>() ); + // Depending on the context we have to change the command + // for the "more options" dialog. + PanelTitleBar* pTitleBar = aNewPanels[nWriteIndex]->GetTitleBar(); + if (pTitleBar != NULL) + { + pTitleBar->SetMoreOptionsCommand( + rPanelContexDescriptor.msMenuCommand, + mxFrame); + } ++nWriteIndex; } diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx index 9bab344..bf7997e 100644 --- a/sfx2/source/sidebar/SidebarToolBox.cxx +++ b/sfx2/source/sidebar/SidebarToolBox.cxx @@ -48,7 +48,9 @@ SidebarToolBox::SidebarToolBox ( const cssu::Reference<css::frame::XFrame>& rxFrame) : ToolBox(pParentWindow, rResId), mbParentIsBorder(false), - maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)) + maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)), + maControllers(), + mbAreHandlersRegistered(false) { SetBackground(Wallpaper()); SetPaintTransparent(true); @@ -69,12 +71,7 @@ SidebarToolBox::SidebarToolBox ( SetSizePixel(CalcWindowSizePixel()); - SetDropdownClickHdl(LINK(this, SidebarToolBox, DropDownClickHandler)); - SetClickHdl(LINK(this, SidebarToolBox, ClickHandler)); - SetDoubleClickHdl(LINK(this, SidebarToolBox, DoubleClickHandler)); - SetSelectHdl(LINK(this, SidebarToolBox, SelectHandler)); - SetActivateHdl(LINK(this, SidebarToolBox, Activate)); - SetDeactivateHdl(LINK(this, SidebarToolBox, Deactivate)); + RegisterHandlers(); } #ifdef DEBUG @@ -85,6 +82,24 @@ SidebarToolBox::SidebarToolBox ( +SidebarToolBox::SidebarToolBox (Window* pParentWindow) + : ToolBox(pParentWindow, 0), + mbParentIsBorder(false), + maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)), + maControllers(), + mbAreHandlersRegistered(false) +{ + SetBackground(Wallpaper()); + SetPaintTransparent(true); + +#ifdef DEBUG + SetText(A2S("SidebarToolBox")); +#endif +} + + + + SidebarToolBox::~SidebarToolBox (void) { ControllerContainer aControllers; @@ -98,13 +113,15 @@ SidebarToolBox::~SidebarToolBox (void) xComponent->dispose(); } - SetDropdownClickHdl(Link()); - SetClickHdl(Link()); - SetDoubleClickHdl(Link()); - SetSelectHdl(Link()); - SetActivateHdl(Link()); - SetDeactivateHdl(Link()); - + if (mbAreHandlersRegistered) + { + SetDropdownClickHdl(Link()); + SetClickHdl(Link()); + SetDoubleClickHdl(Link()); + SetSelectHdl(Link()); + SetActivateHdl(Link()); + SetDeactivateHdl(Link()); + } } @@ -265,6 +282,37 @@ Reference<frame::XToolbarController> SidebarToolBox::GetControllerForItemId (con +void SidebarToolBox::SetController( + const sal_uInt16 nItemId, + const cssu::Reference<css::frame::XToolbarController>& rxController, + const ::rtl::OUString& rsCommandName) +{ + ItemDescriptor aDescriptor; + aDescriptor.mxController = rxController; + aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(rsCommandName); + aDescriptor.msCurrentCommand = rsCommandName; + + ControllerContainer::iterator iController (maControllers.find(nItemId)); + if (iController != maControllers.end()) + { + Reference<lang::XComponent> xComponent (iController->second.mxController, UNO_QUERY); + if (xComponent.is()) + xComponent->dispose(); + + iController->second = aDescriptor; + } + else + { + maControllers[nItemId] = aDescriptor; + } + + if (rxController.is()) + RegisterHandlers(); +} + + + + void SidebarToolBox::UpdateIcons (const Reference<frame::XFrame>& rxFrame) { const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge()); @@ -303,6 +351,24 @@ sal_uInt16 SidebarToolBox::GetItemIdForSubToolbarName (const OUString& rsSubTool + +void SidebarToolBox::RegisterHandlers (void) +{ + if ( ! mbAreHandlersRegistered) + { + mbAreHandlersRegistered = true; + SetDropdownClickHdl(LINK(this, SidebarToolBox, DropDownClickHandler)); + SetClickHdl(LINK(this, SidebarToolBox, ClickHandler)); + SetDoubleClickHdl(LINK(this, SidebarToolBox, DoubleClickHandler)); + SetSelectHdl(LINK(this, SidebarToolBox, SelectHandler)); + SetActivateHdl(LINK(this, SidebarToolBox, Activate)); + SetDeactivateHdl(LINK(this, SidebarToolBox, Deactivate)); + } +} + + + + IMPL_LINK(SidebarToolBox, DropDownClickHandler, ToolBox*, pToolBox) { if (pToolBox != NULL) diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx index 6c6f3e8..d04dd4f 100644 --- a/sfx2/source/sidebar/TitleBar.cxx +++ b/sfx2/source/sidebar/TitleBar.cxx @@ -124,7 +124,7 @@ void TitleBar::SetPosSizePixel ( // Place the toolbox. const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth()); - maToolBox.SetPosSizePixel(nWidth-nToolBoxWidth,0,nToolBoxWidth,nHeight); + maToolBox.SetPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE); maToolBox.Show(); } diff --git a/sfx2/source/sidebar/TitleBar.hxx b/sfx2/source/sidebar/TitleBar.hxx index cf4a830..5167749 100644 --- a/sfx2/source/sidebar/TitleBar.hxx +++ b/sfx2/source/sidebar/TitleBar.hxx @@ -25,7 +25,7 @@ #include "Paint.hxx" #include <vcl/window.hxx> -#include <vcl/toolbox.hxx> +#include "sfx2/sidebar/SidebarToolBox.hxx" namespace sfx2 { namespace sidebar { @@ -56,7 +56,7 @@ public: const ToolBox& GetToolBox (void) const; protected: - ToolBox maToolBox; + SidebarToolBox maToolBox; virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0; virtual void PaintDecoration (const Rectangle& rTitleBarBox) = 0; commit 8dc875f17c0cdd41e7ba6ad2f4c1ea3bda1a8be2 Author: Andre Fischer <[email protected]> Date: Fri May 17 08:56:55 2013 +0000 122329: Disable undocking of stylist in the sidebar. diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index f571daf..e2754ad 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -419,6 +419,8 @@ SfxTemplatePanelControl::SfxTemplatePanelControl ( OSL_ASSERT(mpBindings!=NULL); pImpl->updateNonFamilyImages(); + + SetStyle(GetStyle() & ~WB_DOCKABLE); } diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index d8d70f7..bee7abf 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -762,10 +762,19 @@ void DockingWindow::Resizing( Size& ) void DockingWindow::StateChanged( StateChangedType nType ) { - if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) + switch(nType) { - ImplInitSettings(); - Invalidate(); + case STATE_CHANGE_CONTROLBACKGROUND: + ImplInitSettings(); + Invalidate(); + break; + + case STATE_CHANGE_STYLE: + mbDockable = (GetStyle() & WB_DOCKABLE) != 0; + break; + + default: + break; } Window::StateChanged( nType ); commit 8fd2d48a89963893ce11960d561f065f0255ec58 Author: Pavel JanÃk <[email protected]> Date: Fri May 17 08:38:59 2013 +0000 Use sal's size_t printf type modifier to prevent compiler warning. diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index a141b2d..78ab043 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -1944,7 +1944,7 @@ void HwpReader::makeTableStyle(Table *tbl) // --------------- row ---------------- // for (size_t i = 0 ; i < tbl->rows.nCount -1 ; i++) { - sprintf(buf,"Table%d.row%ld",hbox->style.boxnum, i + 1); + sprintf(buf,"Table%d.row%" SAL_PRI_SIZET "d",hbox->style.boxnum, i + 1); padd(ascii("style:name"), sXML_CDATA, ascii( buf )); padd(ascii("style:family"), sXML_CDATA,ascii("table-row")); rstartEl(ascii("style:style"), rList); commit 3a01ed4d74ab4035e40102e74670f868ff8317a5 Author: Pavel JanÃk <[email protected]> Date: Fri May 17 08:34:38 2013 +0000 Rename local macro TOOLBOX_ITEM_HEIGHT which hides the same macro from sfx2. diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc index 9c4777a..4572b22 100755 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc @@ -37,7 +37,7 @@ //===============================================================position============================================= #define MBOX_WIDTH 28 -#define TOOLBOX_ITEM_HEIGHT 12 +#define LOCAL_TOOLBOX_ITEM_HEIGHT 12 #define CHECKBOX_HEIGHT 10 #define FT_CATEGORY_X SECTIONPAGE_MARGIN_HORIZONTAL @@ -49,7 +49,7 @@ #define TBX_CATEGORY_Y LB_CATEGORY_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL #define FT_DECIMALS_X SECTIONPAGE_MARGIN_HORIZONTAL -#define FT_DECIMALS_Y TBX_CATEGORY_Y + TOOLBOX_ITEM_HEIGHT + 4 + CONTROL_SPACING_VERTICAL +#define FT_DECIMALS_Y TBX_CATEGORY_Y + LOCAL_TOOLBOX_ITEM_HEIGHT + 4 + CONTROL_SPACING_VERTICAL #define LB_DECIMALS_X FT_CATEGORY_X #define LB_DECIMALS_Y FT_DECIMALS_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
