Kaydet (Commit) 3b252796 authored tarafından Andre Fischer's avatar Andre Fischer

122302: Use tool bar controls for color controls in text property panel.

üst de52e4d0
...@@ -224,6 +224,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ ...@@ -224,6 +224,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/sidebar/ContextChangeBroadcaster \ sfx2/source/sidebar/ContextChangeBroadcaster \
sfx2/source/sidebar/ContextList \ sfx2/source/sidebar/ContextList \
sfx2/source/sidebar/ControlFactory \ sfx2/source/sidebar/ControlFactory \
sfx2/source/sidebar/ControllerFactory \
sfx2/source/sidebar/ControllerItem \ sfx2/source/sidebar/ControllerItem \
sfx2/source/sidebar/CustomImageRadioButton \ sfx2/source/sidebar/CustomImageRadioButton \
sfx2/source/sidebar/Deck \ sfx2/source/sidebar/Deck \
......
...@@ -131,15 +131,16 @@ $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/userinputinterception.hxx,sf ...@@ -131,15 +131,16 @@ $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/userinputinterception.hxx,sf
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewfac.hxx,sfx2/viewfac.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewfac.hxx,sfx2/viewfac.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewfrm.hxx,sfx2/viewfrm.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewfrm.hxx,sfx2/viewfrm.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewsh.hxx,sfx2/viewsh.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewsh.hxx,sfx2/viewsh.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/CommandInfoProvider.hxx,sfx2/sidebar/CommandInfoProvider.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/ControlFactory.hxx,sfx2/sidebar/ControlFactory.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControllerFactory.hxx,sfx2/sidebar/ControllerFactory.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControllerItem.hxx,sfx2/sidebar/ControllerItem.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControllerItem.hxx,sfx2/sidebar/ControllerItem.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/EnumContext.hxx,sfx2/sidebar/EnumContext.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/EnumContext.hxx,sfx2/sidebar/EnumContext.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControlFactory.hxx,sfx2/sidebar/ControlFactory.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Theme.hxx,sfx2/sidebar/Theme.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/IContextChangeReceiver.hxx,sfx2/sidebar/IContextChangeReceiver.hxx)) $(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/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))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Theme.hxx,sfx2/sidebar/Theme.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Tools.hxx,sfx2/sidebar/Tools.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Tools.hxx,sfx2/sidebar/Tools.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/CommandInfoProvider.hxx,sfx2/sidebar/CommandInfoProvider.hxx))
...@@ -23,21 +23,34 @@ ...@@ -23,21 +23,34 @@
#define SFX_SIDEBAR_CONTROL_FACTORY_HXX #define SFX_SIDEBAR_CONTROL_FACTORY_HXX
#include <sfx2/dllapi.h> #include <sfx2/dllapi.h>
#include <sfx2/sidebar/SidebarToolBox.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <com/sun/star/frame/XFrame.hpp>
class ToolBox; class ToolBox;
namespace sfx2 { namespace sidebar { namespace sfx2 { namespace sidebar {
class ToolBoxBackground; class ToolBoxBackground;
class SFX2_DLLPUBLIC ControlFactory class SFX2_DLLPUBLIC ControlFactory
{ {
public: public:
static CheckBox* CreateMenuButton (Window* pParentWindow); static CheckBox* CreateMenuButton (Window* pParentWindow);
static ImageRadioButton* CreateTabItem (Window* pParentWindow); static ImageRadioButton* CreateTabItem (Window* pParentWindow);
static ToolBox* CreateToolBox (Window* pParentWindow, const ResId& rResId);
/** Create a tool box that does *not* handle its items.
*/
static SidebarToolBox* CreateToolBox (
Window* pParentWindow,
const ResId& rResId);
/** Create a tool box that *does* handle its items.
*/
static SidebarToolBox* CreateToolBox (
Window* pParentWindow,
const ResId& rResId,
const ::com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rxFrame);
static Window* CreateToolBoxBackground (Window* pParentWindow); static Window* CreateToolBoxBackground (Window* pParentWindow);
static ImageRadioButton* CreateCustomImageRadionButton( static ImageRadioButton* CreateCustomImageRadionButton(
Window* pParentWindow, Window* pParentWindow,
......
...@@ -19,36 +19,28 @@ ...@@ -19,36 +19,28 @@
* *
*************************************************************/ *************************************************************/
#ifndef SFX_SIDEBAR_TOOLBOX_HXX #ifndef SFX_SIDEBAR_CONTROLLER_FACTORY_HXX
#define SFX_SIDEBAR_TOOLBOX_HXX #define SFX_SIDEBAR_CONTROLLER_FACTORY_HXX
#include "vcl/toolbox.hxx" #include "sfx2/dllapi.h"
#include <com/sun/star/frame/XToolbarController.hpp>
#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 {
class SidebarToolBox /** Convenience class for easy creation of toolbox controllers.
: public ToolBox */
class SFX2_DLLPUBLIC ControllerFactory
{ {
public: public:
SidebarToolBox (Window* pParentWindow, const ResId& rResId); static cssu::Reference<css::frame::XToolbarController> CreateToolBoxController(
virtual ~SidebarToolBox (void); ToolBox* pToolBox,
const sal_uInt16 nItemId,
void SetBorderWindow (const Window* pBorderWindow); const ::rtl::OUString& rsCommandName,
virtual void Paint (const Rectangle& rRect); const cssu::Reference<css::frame::XFrame>& rxFrame);
virtual Point GetPosPixel (void) const;
virtual void SetPosSizePixel (
long nX,
long nY,
long nWidth,
long nHeight,
sal_uInt16 nFlags);
virtual long Notify (NotifyEvent& rEvent);
private:
bool mbParentIsBorder;
Image maItemSeparator;
}; };
......
...@@ -129,6 +129,9 @@ public: ...@@ -129,6 +129,9 @@ public:
sal_Int32 GetCombinedContext_DI(void) const; sal_Int32 GetCombinedContext_DI(void) const;
const ::rtl::OUString& GetApplicationName (void) const; const ::rtl::OUString& GetApplicationName (void) const;
Application GetApplication (void) const;
Application GetApplication_DI (void) const;
const ::rtl::OUString& GetContextName (void) const; const ::rtl::OUString& GetContextName (void) const;
bool operator == (const EnumContext aOther); bool operator == (const EnumContext aOther);
......
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef SFX_SIDEBAR_TOOLBOX_HXX
#define SFX_SIDEBAR_TOOLBOX_HXX
#include "sfx2/dllapi.h"
#include "vcl/toolbox.hxx"
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XToolbarController.hpp>
#include <com/sun/star/util/URL.hpp>
#include <map>
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
namespace sfx2 { namespace sidebar {
/** The sidebar tool box has two responsibilities:
1. Coordinated location, size, and other states with its parent
background window.
2. Create and handle tool bar controller for its items.
*/
class SFX2_DLLPUBLIC SidebarToolBox
: public ToolBox
{
public:
/** Create a new tool box.
When a valid XFrame is given then the tool box will handle its
buttons and drop-downs. Otherwise the caller has to do that.
*/
SidebarToolBox (
Window* pParentWindow,
const ResId& rResId,
const cssu::Reference<css::frame::XFrame>& rxFrame);
virtual ~SidebarToolBox (void);
void SetBorderWindow (const Window* pBorderWindow);
virtual void Paint (const Rectangle& rRect);
virtual Point GetPosPixel (void) const;
virtual void SetPosSizePixel (
long nX,
long nY,
long nWidth,
long nHeight,
sal_uInt16 nFlags);
virtual long Notify (NotifyEvent& rEvent);
cssu::Reference<css::frame::XToolbarController> GetControllerForItemId (
const sal_uInt16 nItemId) const;
sal_uInt16 GetItemIdForSubToolbarName (
const ::rtl::OUString& rsCOmmandName) const;
private:
bool mbParentIsBorder;
Image maItemSeparator;
class ItemDescriptor
{
public:
cssu::Reference<css::frame::XToolbarController> mxController;
css::util::URL maURL;
rtl::OUString msCurrentCommand;
cssu::Reference<css::frame::XDispatch> mxDispatch;
};
typedef ::std::map<sal_uInt16, ItemDescriptor> ControllerContainer;
ControllerContainer maControllers;
DECL_LINK(DropDownClickHandler, ToolBox*);
DECL_LINK(ClickHandler, ToolBox*);
DECL_LINK(DoubleClickHandler, ToolBox*);
DECL_LINK(SelectHandler, ToolBox*);
DECL_LINK(Activate, ToolBox*);
DECL_LINK(Deactivate, ToolBox*);
void CreateController (
const sal_uInt16 nItemId,
const cssu::Reference<css::frame::XFrame>& rxFrame);
void UpdateIcons (
const cssu::Reference<css::frame::XFrame>& rxFrame);
};
} } // end of namespace sfx2::sidebar
#endif
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "MenuButton.hxx" #include "MenuButton.hxx"
#include "TabItem.hxx" #include "TabItem.hxx"
#include "SidebarToolBox.hxx" #include "sfx2/sidebar/SidebarToolBox.hxx"
#include "ToolBoxBackground.hxx" #include "ToolBoxBackground.hxx"
#include "CustomImageRadioButton.hxx" #include "CustomImageRadioButton.hxx"
#include <vcl/toolbox.hxx> #include <vcl/toolbox.hxx>
...@@ -50,11 +50,27 @@ ImageRadioButton* ControlFactory::CreateTabItem (Window* pParentWindow) ...@@ -50,11 +50,27 @@ ImageRadioButton* ControlFactory::CreateTabItem (Window* pParentWindow)
ToolBox* ControlFactory::CreateToolBox ( SidebarToolBox* ControlFactory::CreateToolBox (
Window* pParentWindow, Window* pParentWindow,
const ResId& rResId) const ResId& rResId)
{ {
SidebarToolBox* pToolBox = new SidebarToolBox(pParentWindow, rResId); SidebarToolBox* pToolBox = new SidebarToolBox(pParentWindow, rResId, NULL);
pToolBox->SetBorderWindow(pParentWindow);
pToolBox->Invalidate();
return pToolBox;
}
SidebarToolBox* ControlFactory::CreateToolBox (
Window* pParentWindow,
const ResId& rResId,
const cssu::Reference<css::frame::XFrame>& rxFrame)
{
SidebarToolBox* pToolBox = new SidebarToolBox(pParentWindow, rResId, rxFrame);
pToolBox->SetBorderWindow(pParentWindow); pToolBox->SetBorderWindow(pParentWindow);
pToolBox->Invalidate(); pToolBox->Invalidate();
......
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#include "precompiled_sfx2.hxx"
#include "sfx2/sidebar/ControllerFactory.hxx"
#include "sfx2/sidebar/CommandInfoProvider.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include <com/sun/star/frame/XToolbarController.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <framework/sfxhelperfunctions.hxx>
#include <svtools/generictoolboxcontroller.hxx>
#include <comphelper/processfactory.hxx>
using namespace css;
using namespace cssu;
using ::rtl::OUString;
namespace sfx2 { namespace sidebar {
Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
ToolBox* pToolBox,
const sal_uInt16 nItemId,
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
// Create a controller for the new item.
Reference<frame::XToolbarController> xController(
static_cast<XWeak*>(::framework::CreateToolBoxController(
rxFrame,
pToolBox,
nItemId,
rsCommandName)),
UNO_QUERY);
if ( ! xController.is())
xController.set(
static_cast<XWeak*>(new svt::GenericToolboxController(
::comphelper::getProcessServiceFactory(),
rxFrame,
pToolBox,
nItemId,
rsCommandName)),
UNO_QUERY);
// Initialize the controller with eg a service factory.
Reference<lang::XInitialization> xInitialization (xController, UNO_QUERY);
if (xInitialization.is())
{
beans::PropertyValue aPropValue;
std::vector<Any> aPropertyVector;
aPropValue.Name = A2S("Frame");
aPropValue.Value <<= rxFrame;
aPropertyVector.push_back(makeAny(aPropValue));
aPropValue.Name = A2S("ServiceManager");
aPropValue.Value <<= ::comphelper::getProcessServiceFactory();
aPropertyVector.push_back(makeAny(aPropValue));
aPropValue.Name = A2S("CommandURL");
aPropValue.Value <<= rsCommandName;
aPropertyVector.push_back(makeAny(aPropValue));
Sequence<Any> aArgs (comphelper::containerToSequence(aPropertyVector));
xInitialization->initialize(aArgs);
}
Reference<util::XUpdatable> xUpdatable (xController, UNO_QUERY);
if (xUpdatable.is())
xUpdatable->update();
// Add label.
if (xController.is())
{
const OUString sLabel (sfx2::sidebar::CommandInfoProvider::Instance().GetLabelForCommand(
rsCommandName,
rxFrame));
pToolBox->SetQuickHelpText(nItemId, sLabel);
pToolBox->EnableItem(nItemId);
}
return xController;
}
} } // end of namespace sfx2::sidebar
...@@ -88,23 +88,39 @@ sal_Int32 EnumContext::GetCombinedContext (void) const ...@@ -88,23 +88,39 @@ sal_Int32 EnumContext::GetCombinedContext (void) const
sal_Int32 EnumContext::GetCombinedContext_DI (void) const sal_Int32 EnumContext::GetCombinedContext_DI (void) const
{ {
switch (meApplication) return CombinedEnumContext(GetApplication_DI(), meContext);
{ }
case Application_Draw:
case Application_Impress:
return CombinedEnumContext(Application_DrawImpress, meContext);
case Application_Writer: EnumContext::Application EnumContext::GetApplication_DI (void) const
case Application_WriterGlobal: {
case Application_WriterWeb: switch (meApplication)
case Application_WriterXML: {
case Application_WriterForm: case Application_Draw:
case Application_WriterReport: case Application_Impress:
return CombinedEnumContext(Application_WriterVariants, meContext); return Application_DrawImpress;
default: case Application_Writer:
return CombinedEnumContext(meApplication, meContext); case Application_WriterGlobal:
} case Application_WriterWeb:
case Application_WriterXML:
case Application_WriterForm:
case Application_WriterReport:
return Application_WriterVariants;
default:
return meApplication;
}
}
EnumContext::Application EnumContext::GetApplication (void) const
{
return meApplication;
} }
......
...@@ -580,7 +580,8 @@ void SidebarController::SwitchToDeck ( ...@@ -580,7 +580,8 @@ void SidebarController::SwitchToDeck (
aNewPanels[nWriteIndex] = CreatePanel( aNewPanels[nWriteIndex] = CreatePanel(
rPanelContexDescriptor.msId, rPanelContexDescriptor.msId,
mpCurrentDeck->GetPanelParentWindow(), mpCurrentDeck->GetPanelParentWindow(),
rPanelContexDescriptor.mbIsInitiallyVisible); rPanelContexDescriptor.mbIsInitiallyVisible,
rContext);
bHasPanelSetChanged = true; bHasPanelSetChanged = true;
} }
if (aNewPanels[nWriteIndex] != NULL) if (aNewPanels[nWriteIndex] != NULL)
...@@ -649,7 +650,8 @@ bool SidebarController::ArePanelSetsEqual ( ...@@ -649,7 +650,8 @@ bool SidebarController::ArePanelSetsEqual (
SharedPanel SidebarController::CreatePanel ( SharedPanel SidebarController::CreatePanel (
const OUString& rsPanelId, const OUString& rsPanelId,
::Window* pParentWindow, ::Window* pParentWindow,
const bool bIsInitiallyExpanded) const bool bIsInitiallyExpanded,
const Context& rContext)
{ {
const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId); const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
if (pPanelDescriptor == NULL) if (pPanelDescriptor == NULL)
...@@ -667,7 +669,8 @@ SharedPanel SidebarController::CreatePanel ( ...@@ -667,7 +669,8 @@ SharedPanel SidebarController::CreatePanel (
Reference<ui::XUIElement> xUIElement (CreateUIElement( Reference<ui::XUIElement> xUIElement (CreateUIElement(
pPanel->GetComponentInterface(), pPanel->GetComponentInterface(),
pPanelDescriptor->msImplementationURL, pPanelDescriptor->msImplementationURL,
pPanelDescriptor->mbWantsCanvas)); pPanelDescriptor->mbWantsCanvas,
rContext));
if (xUIElement.is()) if (xUIElement.is())
{ {
// Initialize the panel and add it to the active deck. // Initialize the panel and add it to the active deck.
...@@ -687,7 +690,8 @@ SharedPanel SidebarController::CreatePanel ( ...@@ -687,7 +690,8 @@ SharedPanel SidebarController::CreatePanel (
Reference<ui::XUIElement> SidebarController::CreateUIElement ( Reference<ui::XUIElement> SidebarController::CreateUIElement (
const Reference<awt::XWindowPeer>& rxWindow, const Reference<awt::XWindowPeer>& rxWindow,
const ::rtl::OUString& rsImplementationURL, const ::rtl::OUString& rsImplementationURL,
const bool bWantsCanvas) const bool bWantsCanvas,
const Context& rContext)
{ {
try try
{ {
...@@ -710,6 +714,8 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement ( ...@@ -710,6 +714,8 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement (
Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas()); Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas());
aCreationArguments.put("Canvas", makeAny(xCanvas)); aCreationArguments.put("Canvas", makeAny(xCanvas));
} }
aCreationArguments.put("ApplicationName", makeAny(rContext.msApplication));
aCreationArguments.put("ContextName", makeAny(rContext.msContext));
Reference<ui::XUIElement> xUIElement( Reference<ui::XUIElement> xUIElement(
xUIElementFactory->createUIElement( xUIElementFactory->createUIElement(
......
...@@ -169,11 +169,13 @@ private: ...@@ -169,11 +169,13 @@ private:
cssu::Reference<css::ui::XUIElement> CreateUIElement ( cssu::Reference<css::ui::XUIElement> CreateUIElement (
const cssu::Reference<css::awt::XWindowPeer>& rxWindow, const cssu::Reference<css::awt::XWindowPeer>& rxWindow,
const ::rtl::OUString& rsImplementationURL, const ::rtl::OUString& rsImplementationURL,
const bool bWantsCanvas); const bool bWantsCanvas,
const Context& rContext);
SharedPanel CreatePanel ( SharedPanel CreatePanel (
const ::rtl::OUString& rsPanelId, const ::rtl::OUString& rsPanelId,
::Window* pParentWindow, ::Window* pParentWindow,
const bool bIsInitiallyExpanded); const bool bIsInitiallyExpanded,
const Context& rContext);
void SwitchToDeck ( void SwitchToDeck (
const DeckDescriptor& rDeckDescriptor, const DeckDescriptor& rDeckDescriptor,
const Context& rContext); const Context& rContext);
......
...@@ -21,8 +21,9 @@ ...@@ -21,8 +21,9 @@
#include "precompiled_sfx2.hxx" #include "precompiled_sfx2.hxx"
#include "SidebarToolBox.hxx" #include "sfx2/sidebar/SidebarToolBox.hxx"
#include "ToolBoxBackground.hxx" #include "ToolBoxBackground.hxx"
#include "sfx2/sidebar/ControllerFactory.hxx"
#include "sfx2/sidebar/Theme.hxx" #include "sfx2/sidebar/Theme.hxx"
#include "sfx2/sidebar/Tools.hxx" #include "sfx2/sidebar/Tools.hxx"
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using ::rtl::OUString;
namespace sfx2 { namespace sidebar { namespace sfx2 { namespace sidebar {
...@@ -38,13 +40,32 @@ namespace sfx2 { namespace sidebar { ...@@ -38,13 +40,32 @@ namespace sfx2 { namespace sidebar {
SidebarToolBox::SidebarToolBox ( SidebarToolBox::SidebarToolBox (
Window* pParentWindow, Window* pParentWindow,
const ResId& rResId) const ResId& rResId,
const cssu::Reference<css::frame::XFrame>& rxFrame)
: ToolBox(pParentWindow, rResId), : ToolBox(pParentWindow, rResId),
mbParentIsBorder(false), mbParentIsBorder(false),
maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)) maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator))
{ {
SetBackground(Wallpaper()); SetBackground(Wallpaper());
SetPaintTransparent(true); SetPaintTransparent(true);
if (rxFrame.is())
{
const sal_uInt16 nItemCount (GetItemCount());
for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex)
CreateController(GetItemId(nItemIndex), rxFrame);
UpdateIcons(rxFrame);
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));
}
#ifdef DEBUG #ifdef DEBUG
SetText(A2S("SidebarToolBox")); SetText(A2S("SidebarToolBox"));
#endif #endif
...@@ -55,6 +76,24 @@ SidebarToolBox::SidebarToolBox ( ...@@ -55,6 +76,24 @@ SidebarToolBox::SidebarToolBox (
SidebarToolBox::~SidebarToolBox (void) SidebarToolBox::~SidebarToolBox (void)
{ {
ControllerContainer aControllers;
aControllers.swap(maControllers);
for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
iController!=iEnd;
++iController)
{
Reference<lang::XComponent> xComponent (iController->second.mxController, UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
}
SetDropdownClickHdl(Link());
SetClickHdl(Link());
SetDoubleClickHdl(Link());
SetSelectHdl(Link());
SetActivateHdl(Link());
SetDeactivateHdl(Link());
} }
...@@ -173,4 +212,158 @@ long SidebarToolBox::Notify (NotifyEvent& rEvent) ...@@ -173,4 +212,158 @@ long SidebarToolBox::Notify (NotifyEvent& rEvent)
} }
void SidebarToolBox::CreateController (
const sal_uInt16 nItemId,
const cssu::Reference<css::frame::XFrame>& rxFrame)
{
ItemDescriptor aDescriptor;
const OUString sCommandName (GetItemCommand(nItemId));
aDescriptor.mxController = sfx2::sidebar::ControllerFactory::CreateToolBoxController(
this,
nItemId,
sCommandName,
rxFrame);
aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(sCommandName);
aDescriptor.msCurrentCommand = sCommandName;
aDescriptor.mxDispatch = sfx2::sidebar::Tools::GetDispatch(rxFrame, aDescriptor.maURL);
if (aDescriptor.mxController.is() && aDescriptor.mxDispatch.is())
maControllers.insert(::std::make_pair(nItemId, aDescriptor));
}
Reference<frame::XToolbarController> SidebarToolBox::GetControllerForItemId (const sal_uInt16 nItemId) const
{
ControllerContainer::const_iterator iController (maControllers.find(nItemId));
if (iController != maControllers.end())
return iController->second.mxController;
else
return NULL;
}
void SidebarToolBox::UpdateIcons (const Reference<frame::XFrame>& rxFrame)
{
const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
const bool bIsHighContrastActive (sfx2::sidebar::Theme::IsHighContrastMode());
for (ControllerContainer::iterator iController(maControllers.begin()), iEnd(maControllers.end());
iController!=iEnd;
++iController)
{
const ::rtl::OUString sCommandURL (iController->second.msCurrentCommand);
Image aImage (framework::GetImageFromURL(rxFrame, sCommandURL, bBigImages, bIsHighContrastActive));
SetItemImage(iController->first, aImage);
}
}
sal_uInt16 SidebarToolBox::GetItemIdForSubToolbarName (const OUString& rsSubToolbarName) const
{
for (ControllerContainer::const_iterator iController(maControllers.begin()), iEnd(maControllers.end());
iController!=iEnd;
++iController)
{
Reference<frame::XToolbarController> xController (iController->second.mxController);
Reference<frame::XSubToolbarController> xSubToolbarController (xController, UNO_QUERY);
if (xSubToolbarController.is())
{
const OUString sName (xSubToolbarController->getSubToolbarName());
if (sName.equals(rsSubToolbarName))
return iController->first;
}
}
return 0;
}
IMPL_LINK(SidebarToolBox, DropDownClickHandler, ToolBox*, pToolBox)
{
if (pToolBox != NULL)
{
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
{
Reference<awt::XWindow> xWindow = xController->createPopupWindow();
if (xWindow.is() )
xWindow->setFocus();
}
}
return 1;
}
IMPL_LINK(SidebarToolBox, ClickHandler, ToolBox*, pToolBox)
{
if (pToolBox == NULL)
return 0;
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
xController->click();
return 1;
}
IMPL_LINK(SidebarToolBox, DoubleClickHandler, ToolBox*, pToolBox)
{
if (pToolBox == NULL)
return 0;
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
xController->doubleClick();
return 1;
}
IMPL_LINK(SidebarToolBox, SelectHandler, ToolBox*, pToolBox)
{
if (pToolBox == NULL)
return 0;
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
xController->execute((sal_Int16)pToolBox->GetModifier());
return 1;
}
IMPL_LINK(SidebarToolBox, Activate, ToolBox*, EMPTYARG)
{
return 1;
}
IMPL_LINK(SidebarToolBox, Deactivate, ToolBox*, EMPTYARG)
{
return 1;
}
} } // end of namespace sfx2::sidebar } } // end of namespace sfx2::sidebar
...@@ -138,10 +138,6 @@ IMPL_LINK(ToolBoxBackground, WindowEventHandler, VclWindowEvent*, pEvent) ...@@ -138,10 +138,6 @@ IMPL_LINK(ToolBoxBackground, WindowEventHandler, VclWindowEvent*, pEvent)
Hide(); Hide();
break; break;
case SFX_HINT_DYING:
doLazyDelete();
break;
default: default:
break; break;
} }
......
...@@ -118,6 +118,9 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( ...@@ -118,6 +118,9 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>())); Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
::sfx2::sidebar::EnumContext aContext (
aArguments.getOrDefault("ApplicationName", OUString()),
aArguments.getOrDefault("ContextName", OUString()));
::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==NULL) if ( ! xParentWindow.is() || pParentWindow==NULL)
...@@ -139,7 +142,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( ...@@ -139,7 +142,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s)) #define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
if (DoesResourceEndWith("/TextPropertyPanel")) if (DoesResourceEndWith("/TextPropertyPanel"))
{ {
pControl = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings); pControl = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings, aContext);
} }
else if (DoesResourceEndWith("/ParaPropertyPanel")) else if (DoesResourceEndWith("/ParaPropertyPanel"))
{ {
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/Tools.hxx> #include <sfx2/sidebar/Tools.hxx>
#include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/sidebar/ControlFactory.hxx>
#include <sfx2/sidebar/ControllerFactory.hxx>
#include <svx/dialmgr.hxx> #include <svx/dialmgr.hxx>
#include <svtools/miscopt.hxx> #include <svtools/miscopt.hxx>
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
using namespace css; using namespace css;
using namespace cssu; using namespace cssu;
using ::rtl::OUString; using ::rtl::OUString;
using ::sfx2::sidebar::SidebarToolBox;
namespace svx { namespace sidebar { namespace svx { namespace sidebar {
...@@ -56,20 +58,17 @@ InsertPropertyPanel::InsertPropertyPanel ( ...@@ -56,20 +58,17 @@ InsertPropertyPanel::InsertPropertyPanel (
mpStandardShapesBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), mpStandardShapesBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
mpStandardShapesToolBox(sfx2::sidebar::ControlFactory::CreateToolBox( mpStandardShapesToolBox(sfx2::sidebar::ControlFactory::CreateToolBox(
mpStandardShapesBackground.get(), mpStandardShapesBackground.get(),
SVX_RES(TB_INSERT_STANDARD))), SVX_RES(TB_INSERT_STANDARD),
rxFrame)),
mpCustomShapesBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), mpCustomShapesBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
mpCustomShapesToolBox(sfx2::sidebar::ControlFactory::CreateToolBox( mpCustomShapesToolBox(sfx2::sidebar::ControlFactory::CreateToolBox(
mpCustomShapesBackground.get(), mpCustomShapesBackground.get(),
SVX_RES(TB_INSERT_CUSTOM))), SVX_RES(TB_INSERT_CUSTOM),
maControllers(), rxFrame)),
mxFrame(rxFrame) mxFrame(rxFrame)
{ {
SetupToolBox(*mpStandardShapesToolBox);
SetupToolBox(*mpCustomShapesToolBox);
FreeResource(); FreeResource();
UpdateIcons();
mpStandardShapesToolBox->Show(); mpStandardShapesToolBox->Show();
mpCustomShapesToolBox->Show(); mpCustomShapesToolBox->Show();
...@@ -85,17 +84,6 @@ InsertPropertyPanel::InsertPropertyPanel ( ...@@ -85,17 +84,6 @@ InsertPropertyPanel::InsertPropertyPanel (
InsertPropertyPanel::~InsertPropertyPanel (void) InsertPropertyPanel::~InsertPropertyPanel (void)
{ {
ControllerContainer aControllers;
aControllers.swap(maControllers);
for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
iController!=iEnd;
++iController)
{
Reference<lang::XComponent> xComponent (iController->second.mxController, UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
}
// Remove window child listener. // Remove window child listener.
Window* pTopWindow = this; Window* pTopWindow = this;
while (pTopWindow->GetParent() != NULL) while (pTopWindow->GetParent() != NULL)
...@@ -111,88 +99,6 @@ InsertPropertyPanel::~InsertPropertyPanel (void) ...@@ -111,88 +99,6 @@ InsertPropertyPanel::~InsertPropertyPanel (void)
void InsertPropertyPanel::SetupToolBox (ToolBox& rToolBox)
{
const sal_uInt16 nItemCount (rToolBox.GetItemCount());
for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex)
CreateController(rToolBox.GetItemId(nItemIndex));
rToolBox.SetDropdownClickHdl(LINK(this, InsertPropertyPanel, DropDownClickHandler));
rToolBox.SetClickHdl(LINK(this, InsertPropertyPanel, ClickHandler));
rToolBox.SetDoubleClickHdl(LINK(this, InsertPropertyPanel, DoubleClickHandler));
rToolBox.SetSelectHdl(LINK(this, InsertPropertyPanel, SelectHandler));
rToolBox.SetActivateHdl(LINK(this, InsertPropertyPanel, Activate));
rToolBox.SetDeactivateHdl(LINK(this, InsertPropertyPanel, Deactivate));
rToolBox.SetSizePixel(rToolBox.CalcWindowSizePixel());
}
IMPL_LINK(InsertPropertyPanel, DropDownClickHandler, ToolBox*, pToolBox)
{
if (pToolBox != NULL)
{
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
{
Reference<awt::XWindow> xWindow = xController->createPopupWindow();
if (xWindow.is() )
xWindow->setFocus();
}
}
return 1;
}
IMPL_LINK(InsertPropertyPanel, ClickHandler, ToolBox*, pToolBox)
{
if (pToolBox == NULL)
return 0;
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
xController->click();
return 1;
}
IMPL_LINK(InsertPropertyPanel, DoubleClickHandler, ToolBox*, pToolBox)
{
if (pToolBox == NULL)
return 0;
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
xController->doubleClick();
return 1;
}
IMPL_LINK(InsertPropertyPanel, SelectHandler, ToolBox*, pToolBox)
{
if (pToolBox == NULL)
return 0;
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
xController->execute((sal_Int16)pToolBox->GetModifier());
return 1;
}
IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent) IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent)
{ {
// We will be getting a lot of window events (well, basically all // We will be getting a lot of window events (well, basically all
...@@ -205,7 +111,9 @@ IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent) ...@@ -205,7 +111,9 @@ IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent)
if (pEvent->GetId() != VCLEVENT_TOOLBOX_SELECT) if (pEvent->GetId() != VCLEVENT_TOOLBOX_SELECT)
return 1; return 1;
ToolBox* pToolBox = dynamic_cast<ToolBox*>(dynamic_cast<VclWindowEvent*>(pEvent)->GetWindow()); Window* pWindow = dynamic_cast<VclWindowEvent*>(pEvent)->GetWindow();
Window* pParent = pWindow->GetParent();
ToolBox* pToolBox = dynamic_cast<ToolBox*>(pWindow);
if (pToolBox == NULL) if (pToolBox == NULL)
return 1; return 1;
...@@ -222,201 +130,29 @@ IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent) ...@@ -222,201 +130,29 @@ IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent)
if (nId == 0) if (nId == 0)
return 1; return 1;
// Get toolbar controller. SidebarToolBox* pSidebarToolBox = dynamic_cast<SidebarToolBox*>(mpStandardShapesToolBox.get());
const sal_uInt16 nItemId (GetItemIdForSubToolbarName(aURL.Path)); if (pSidebarToolBox == NULL)
Reference<frame::XSubToolbarController> xController (GetControllerForItemId(nItemId), UNO_QUERY); return 1;
sal_uInt16 nItemId (pSidebarToolBox->GetItemIdForSubToolbarName(aURL.Path));
if (nItemId == 0)
{
pSidebarToolBox = dynamic_cast<SidebarToolBox*>(mpCustomShapesToolBox.get());
if (pSidebarToolBox == NULL)
return 1;
nItemId = pSidebarToolBox->GetItemIdForSubToolbarName(aURL.Path);
if (nItemId == 0)
return 1;
}
Reference<frame::XSubToolbarController> xController (pSidebarToolBox->GetControllerForItemId(nItemId), UNO_QUERY);
if ( ! xController.is()) if ( ! xController.is())
return 1; return 1;
const OUString sCommand (pToolBox->GetItemCommand(nId)); const OUString sCommand (pToolBox->GetItemCommand(nId));
ControllerContainer::iterator iController (maControllers.find(nItemId));
if (iController != maControllers.end())
iController->second.msCurrentCommand = sCommand;
xController->functionSelected(sCommand); xController->functionSelected(sCommand);
const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
const bool bIsHighContrastActive (sfx2::sidebar::Theme::IsHighContrastMode());
Image aImage (framework::GetImageFromURL(mxFrame, sCommand, bBigImages, bIsHighContrastActive));
pToolBox->SetItemImage(iController->first, aImage);
return 1;
}
IMPL_LINK(InsertPropertyPanel, Activate, ToolBox*, EMPTYARG)
{
return 1;
}
IMPL_LINK(InsertPropertyPanel, Deactivate, ToolBox*, EMPTYARG)
{
return 1; return 1;
} }
void InsertPropertyPanel::CreateController (
const sal_uInt16 nItemId)
{
ToolBox* pToolBox = GetToolBoxForItemId(nItemId);
if (pToolBox != NULL)
{
ItemDescriptor aDescriptor;
const OUString sCommandName (pToolBox->GetItemCommand(nItemId));
// Create a controller for the new item.
aDescriptor.mxController.set(
static_cast<XWeak*>(::framework::CreateToolBoxController(
mxFrame,
pToolBox,
nItemId,
sCommandName)),
UNO_QUERY);
if ( ! aDescriptor.mxController.is())
aDescriptor.mxController.set(
static_cast<XWeak*>(new svt::GenericToolboxController(
::comphelper::getProcessServiceFactory(),
mxFrame,
pToolBox,
nItemId,
sCommandName)),
UNO_QUERY);
if ( ! aDescriptor.mxController.is())
return;
// Get dispatch object for the command.
aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(sCommandName);
aDescriptor.msCurrentCommand = sCommandName;
aDescriptor.mxDispatch = sfx2::sidebar::Tools::GetDispatch(mxFrame, aDescriptor.maURL);
if ( ! aDescriptor.mxDispatch.is())
return;
// Initialize the controller with eg a service factory.
Reference<lang::XInitialization> xInitialization (aDescriptor.mxController, UNO_QUERY);
if (xInitialization.is())
{
beans::PropertyValue aPropValue;
std::vector<Any> aPropertyVector;
aPropValue.Name = A2S("Frame");
aPropValue.Value <<= mxFrame;
aPropertyVector.push_back(makeAny(aPropValue));
aPropValue.Name = A2S("ServiceManager");
aPropValue.Value <<= ::comphelper::getProcessServiceFactory();
aPropertyVector.push_back(makeAny(aPropValue));
aPropValue.Name = A2S("CommandURL");
aPropValue.Value <<= sCommandName;
aPropertyVector.push_back(makeAny(aPropValue));
Sequence<Any> aArgs (comphelper::containerToSequence(aPropertyVector));
xInitialization->initialize(aArgs);
}
Reference<util::XUpdatable> xUpdatable (aDescriptor.mxController, UNO_QUERY);
if (xUpdatable.is())
xUpdatable->update();
// Add label.
const OUString sLabel (sfx2::sidebar::CommandInfoProvider::Instance().GetLabelForCommand(
sCommandName,
mxFrame));
pToolBox->SetQuickHelpText(nItemId, sLabel);
// Add item to toolbox.
pToolBox->EnableItem(nItemId);
maControllers.insert(::std::make_pair(nItemId, aDescriptor));
}
}
ToolBox* InsertPropertyPanel::GetToolBoxForItemId (const sal_uInt16 nItemId) const
{
switch(nItemId)
{
case TBI_STANDARD_LINE:
case TBI_STANDARD_ARROW:
case TBI_STANDARD_RECTANGLE:
case TBI_STANDARD_ELLIPSE:
case TBI_STANDARD_TEXT:
case TBI_STANDARD_LINES:
case TBI_STANDARD_CONNECTORS:
case TBI_STANDARD_ARROWS:
return mpStandardShapesToolBox.get();
case TBI_CUSTOM_BASICS:
case TBI_CUSTOM_SYMBOLS:
case TBI_CUSTOM_ARROWS:
case TBI_CUSTOM_FLOWCHARTS:
case TBI_CUSTOM_CALLOUTS:
case TBI_CUSTOM_STARS:
return mpCustomShapesToolBox.get();
default:
return NULL;
}
}
Reference<frame::XToolbarController> InsertPropertyPanel::GetControllerForItemId (const sal_uInt16 nItemId) const
{
ControllerContainer::const_iterator iController (maControllers.find(nItemId));
if (iController != maControllers.end())
return iController->second.mxController;
else
return NULL;
}
sal_uInt16 InsertPropertyPanel::GetItemIdForSubToolbarName (const OUString& rsSubToolbarName) const
{
for (ControllerContainer::const_iterator iController(maControllers.begin()), iEnd(maControllers.end());
iController!=iEnd;
++iController)
{
Reference<frame::XSubToolbarController> xSubToolbarController (iController->second.mxController, UNO_QUERY);
if (xSubToolbarController.is())
if (xSubToolbarController->getSubToolbarName().equals(rsSubToolbarName))
return iController->first;
}
return NULL;
}
void InsertPropertyPanel::UpdateIcons (void)
{
const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
const bool bIsHighContrastActive (sfx2::sidebar::Theme::IsHighContrastMode());
for (ControllerContainer::iterator iController(maControllers.begin()), iEnd(maControllers.end());
iController!=iEnd;
++iController)
{
const ::rtl::OUString sCommandURL (iController->second.msCurrentCommand);
Image aImage (framework::GetImageFromURL(mxFrame, sCommandURL, bBigImages, bIsHighContrastActive));
ToolBox* pToolBox = GetToolBoxForItemId(iController->first);
if (pToolBox != NULL)
pToolBox->SetItemImage(iController->first, aImage);
}
}
} } // end of namespace svx::sidebar } } // end of namespace svx::sidebar
...@@ -53,41 +53,9 @@ private: ...@@ -53,41 +53,9 @@ private:
::boost::scoped_ptr<ToolBox> mpStandardShapesToolBox; ::boost::scoped_ptr<ToolBox> mpStandardShapesToolBox;
::boost::scoped_ptr<Window> mpCustomShapesBackground; ::boost::scoped_ptr<Window> mpCustomShapesBackground;
::boost::scoped_ptr<ToolBox> mpCustomShapesToolBox; ::boost::scoped_ptr<ToolBox> mpCustomShapesToolBox;
class ItemDescriptor
{
public:
cssu::Reference<css::frame::XToolbarController> mxController;
css::util::URL maURL;
rtl::OUString msCurrentCommand;
cssu::Reference<css::frame::XDispatch> mxDispatch;
};
typedef ::std::map<sal_uInt16, ItemDescriptor> ControllerContainer;
ControllerContainer maControllers;
const cssu::Reference<css::frame::XFrame> mxFrame; const cssu::Reference<css::frame::XFrame> mxFrame;
/** Add listeners to toolbox and update its size to match its
content.
*/
void SetupToolBox (ToolBox& rToolBox);
cssu::Reference<css::frame::XToolbarController> GetControllerForItemId (
const sal_uInt16 nItemId) const;
ToolBox* GetToolBoxForItemId (const sal_uInt16 nItemId) const;
sal_uInt16 GetItemIdForSubToolbarName (
const ::rtl::OUString& rsCOmmandName) const;
/** Create toolbox controller for one item.
*/
void CreateController (
const sal_uInt16 nItemId);
void UpdateIcons (void);
DECL_LINK(DropDownClickHandler, ToolBox*);
DECL_LINK(ClickHandler, ToolBox*);
DECL_LINK(DoubleClickHandler, ToolBox*);
DECL_LINK(SelectHandler, ToolBox*);
DECL_LINK(WindowEventListener, VclSimpleEvent*); DECL_LINK(WindowEventListener, VclSimpleEvent*);
DECL_LINK(Activate, ToolBox*);
DECL_LINK(Deactivate, ToolBox*);
}; };
......
...@@ -44,7 +44,9 @@ ...@@ -44,7 +44,9 @@
#include <sfx2/viewsh.hxx> #include <sfx2/viewsh.hxx>
#include <sfx2/sidebar/ResourceDefinitions.hrc> #include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/sidebar/ControlFactory.hxx>
#include <sfx2/sidebar/ControllerFactory.hxx>
#include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/SidebarToolBox.hxx>
#include "sfx2/imagemgr.hxx" #include "sfx2/imagemgr.hxx"
#include <svtools/ctrltool.hxx> #include <svtools/ctrltool.hxx>
#include <svtools/unitconv.hxx> #include <svtools/unitconv.hxx>
...@@ -92,36 +94,6 @@ namespace ...@@ -92,36 +94,6 @@ namespace
} }
} // end of anonymous namespace } // end of anonymous namespace
PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent)
{
const ResId aResId(SVX_RES(STR_AUTOMATICE));
return new ColorControl(
pParent,
mpBindings,
SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
SVX_RES(VS_FONT_COLOR),
::boost::bind(GetAutomaticColor),
::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2),
pParent,
&aResId);
}
PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent)
{
const ResId aResId(SVX_RES(STR_AUTOMATICE));
return new ColorControl(
pParent,
mpBindings,
SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
SVX_RES(VS_FONT_COLOR),
::boost::bind(GetAutomaticColor),
::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2),
pParent,
&aResId);
}
long TextPropertyPanel::GetSelFontSize() long TextPropertyPanel::GetSelFontSize()
{ {
long nH = 240; long nH = 240;
...@@ -135,7 +107,8 @@ long TextPropertyPanel::GetSelFontSize() ...@@ -135,7 +107,8 @@ long TextPropertyPanel::GetSelFontSize()
TextPropertyPanel* TextPropertyPanel::Create ( TextPropertyPanel* TextPropertyPanel::Create (
Window* pParent, Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame, const cssu::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings) SfxBindings* pBindings,
const ::sfx2::sidebar::EnumContext& rContext)
{ {
if (pParent == NULL) if (pParent == NULL)
throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0); throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0);
...@@ -147,7 +120,8 @@ TextPropertyPanel* TextPropertyPanel::Create ( ...@@ -147,7 +120,8 @@ TextPropertyPanel* TextPropertyPanel::Create (
return new TextPropertyPanel( return new TextPropertyPanel(
pParent, pParent,
rxFrame, rxFrame,
pBindings); pBindings,
rContext);
} }
...@@ -159,7 +133,8 @@ TextPropertyPanel* TextPropertyPanel::Create ( ...@@ -159,7 +133,8 @@ TextPropertyPanel* TextPropertyPanel::Create (
TextPropertyPanel::TextPropertyPanel ( TextPropertyPanel::TextPropertyPanel (
Window* pParent, Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame, const cssu::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings) SfxBindings* pBindings,
const ::sfx2::sidebar::EnumContext& rContext)
: Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)), : Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))), mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
maFontSizeBox (this, SVX_RES(MB_SBFONT_FONTSIZE)), maFontSizeBox (this, SVX_RES(MB_SBFONT_FONTSIZE)),
...@@ -186,11 +161,15 @@ TextPropertyPanel::TextPropertyPanel ( ...@@ -186,11 +161,15 @@ TextPropertyPanel::TextPropertyPanel (
mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)), mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
mpToolBoxFontColor(ControlFactory::CreateToolBox( mpToolBoxFontColor(ControlFactory::CreateToolBox(
mpToolBoxFontColorBackground.get(), mpToolBoxFontColorBackground.get(),
SVX_RES(TB_FONTCOLOR))), rContext.GetApplication_DI() == sfx2::sidebar::EnumContext::Application_WriterVariants
? SVX_RES(TB_FONTCOLOR_SW)
: SVX_RES(TB_FONTCOLOR),
rxFrame)),
mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)), mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
mpToolBoxHighlight(ControlFactory::CreateToolBox( mpToolBoxHighlight(ControlFactory::CreateToolBox(
mpToolBoxHighlightBackground.get(), mpToolBoxHighlightBackground.get(),
SVX_RES(TB_HIGHLIGHT))), SVX_RES(TB_HIGHLIGHT),
rxFrame)),
mpFontColorUpdater(), mpFontColorUpdater(),
mpHighlightUpdater(), mpHighlightUpdater(),
...@@ -201,12 +180,10 @@ TextPropertyPanel::TextPropertyPanel ( ...@@ -201,12 +180,10 @@ TextPropertyPanel::TextPropertyPanel (
maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this, A2S("Underline"), rxFrame), maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this, A2S("Underline"), rxFrame),
maStrikeControl (SID_ATTR_CHAR_STRIKEOUT, *pBindings, *this, A2S("Strikeout"), rxFrame), maStrikeControl (SID_ATTR_CHAR_STRIKEOUT, *pBindings, *this, A2S("Strikeout"), rxFrame),
maShadowControl (SID_ATTR_CHAR_SHADOWED, *pBindings, *this, A2S("Shadowed"), rxFrame), maShadowControl (SID_ATTR_CHAR_SHADOWED, *pBindings, *this, A2S("Shadowed"), rxFrame),
maFontColorControl (SID_ATTR_CHAR_COLOR, *pBindings, *this, A2S("Color"), rxFrame),
maScriptControlSw (SID_ATTR_CHAR_ESCAPEMENT, *pBindings, *this, A2S("Escapement"), rxFrame), maScriptControlSw (SID_ATTR_CHAR_ESCAPEMENT, *pBindings, *this, A2S("Escapement"), rxFrame),
maSuperScriptControl(SID_SET_SUPER_SCRIPT, *pBindings, *this, A2S("SuperScript"), rxFrame), maSuperScriptControl(SID_SET_SUPER_SCRIPT, *pBindings, *this, A2S("SuperScript"), rxFrame),
maSubScriptControl (SID_SET_SUB_SCRIPT, *pBindings, *this, A2S("SubScript"), rxFrame), maSubScriptControl (SID_SET_SUB_SCRIPT, *pBindings, *this, A2S("SubScript"), rxFrame),
maSpacingControl (SID_ATTR_CHAR_KERNING, *pBindings, *this, A2S("Spacing"), rxFrame), maSpacingControl (SID_ATTR_CHAR_KERNING, *pBindings, *this, A2S("Spacing"), rxFrame),
maHighlightControl (SID_ATTR_BRUSH_CHAR, *pBindings, *this, A2S("CharacterBackgroundPattern"),rxFrame),
maSDFontGrow (SID_GROW_FONT_SIZE, *pBindings, *this, A2S("Grow"), rxFrame), maSDFontGrow (SID_GROW_FONT_SIZE, *pBindings, *this, A2S("Grow"), rxFrame),
maSDFontShrink (SID_SHRINK_FONT_SIZE, *pBindings, *this, A2S("Shrink"), rxFrame), maSDFontShrink (SID_SHRINK_FONT_SIZE, *pBindings, *this, A2S("Shrink"), rxFrame),
...@@ -215,13 +192,12 @@ TextPropertyPanel::TextPropertyPanel ( ...@@ -215,13 +192,12 @@ TextPropertyPanel::TextPropertyPanel (
mbFocusOnFontSizeCtrl(false), mbFocusOnFontSizeCtrl(false),
maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)), maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)), maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
mxFrame(rxFrame), mxFrame(rxFrame),
maContext(), maContext(),
mpBindings(pBindings) mpBindings(pBindings)
{ {
Initialize(); Initialize();
FreeResource(); FreeResource();
} }
...@@ -361,10 +337,8 @@ void TextPropertyPanel::Initialize (void) ...@@ -361,10 +337,8 @@ void TextPropertyPanel::Initialize (void)
SetupToolboxItems(); SetupToolboxItems();
InitToolBoxIncDec(); InitToolBoxIncDec();
InitToolBoxFont(); InitToolBoxFont();
InitToolBoxFontColor();
InitToolBoxScript(); InitToolBoxScript();
InitToolBoxSpacing(); InitToolBoxSpacing();
InitToolBoxHighlight();
#ifdef HAS_IA2 #ifdef HAS_IA2
mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox); mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
...@@ -389,27 +363,13 @@ void TextPropertyPanel::Initialize (void) ...@@ -389,27 +363,13 @@ void TextPropertyPanel::Initialize (void)
mbPostureAvailable = true; mbPostureAvailable = true;
mbWeightAvailable = true; mbWeightAvailable = true;
meUnderline = UNDERLINE_NONE; meUnderline = UNDERLINE_NONE;
meUnderlineColor = COL_AUTO; // meUnderlineColor = COL_AUTO;
maColor = COL_BLACK;
mbColorAvailable = true;
maBackColor = COL_AUTO;
mbBackColorAvailable = true;
meEscape = SVX_ESCAPEMENT_OFF; meEscape = SVX_ESCAPEMENT_OFF;
mbSuper = false; mbSuper = false;
mbSub = false; mbSub = false;
mbKernAvailable = true; mbKernAvailable = true;
mbKernLBAvailable = true; mbKernLBAvailable = true;
mlKerning = 0; mlKerning = 0;
mpFontColorUpdater.reset(new ToolboxButtonColorUpdater(
SID_ATTR_CHAR_COLOR,
TBI_FONTCOLOR,
mpToolBoxFontColor.get(),
TBX_UPDATER_MODE_CHAR_COLOR_NEW));
mpHighlightUpdater.reset(new ToolboxButtonColorUpdater(
SID_ATTR_BRUSH_CHAR,
TBI_HIGHLIGHT,
mpToolBoxHighlight.get(),
TBX_UPDATER_MODE_CHAR_COLOR_NEW));
//set handler //set handler
mpFontNameBox->SetBindings(mpBindings); mpFontNameBox->SetBindings(mpBindings);
...@@ -463,17 +423,6 @@ void TextPropertyPanel::InitToolBoxIncDec() ...@@ -463,17 +423,6 @@ void TextPropertyPanel::InitToolBoxIncDec()
void TextPropertyPanel::InitToolBoxFontColor()
{
Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() );
mpToolBoxFontColor->SetOutputSizePixel( aTbxSize );
mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY );
Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl);
mpToolBoxFontColor->SetDropdownClickHdl ( aLink );
mpToolBoxFontColor->SetSelectHdl ( aLink );
}
void TextPropertyPanel::InitToolBoxScript() void TextPropertyPanel::InitToolBoxScript()
{ {
Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() ); Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() );
...@@ -498,16 +447,6 @@ void TextPropertyPanel::InitToolBoxSpacing() ...@@ -498,16 +447,6 @@ void TextPropertyPanel::InitToolBoxSpacing()
mpToolBoxSpacing->SetDropdownClickHdl ( aLink ); mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
mpToolBoxSpacing->SetSelectHdl( aLink ); mpToolBoxSpacing->SetSelectHdl( aLink );
} }
void TextPropertyPanel::InitToolBoxHighlight()
{
Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() );
mpToolBoxHighlight->SetOutputSizePixel( aTbxSize );
mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY );
Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl);
mpToolBoxHighlight->SetDropdownClickHdl ( aLink );
mpToolBoxHighlight->SetSelectHdl( aLink );
}
...@@ -523,7 +462,6 @@ void TextPropertyPanel::SetupToolboxItems (void) ...@@ -523,7 +462,6 @@ void TextPropertyPanel::SetupToolboxItems (void)
maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT); maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT);
maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED); maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED);
maFontColorControl.SetupToolBoxItem(*mpToolBoxFontColor, TBI_FONTCOLOR);
//for sw //for sw
maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW); maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW);
maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW); maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW);
...@@ -531,7 +469,6 @@ void TextPropertyPanel::SetupToolboxItems (void) ...@@ -531,7 +469,6 @@ void TextPropertyPanel::SetupToolboxItems (void)
maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER); maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER);
maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB); maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB);
maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING); maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING);
maHighlightControl.SetupToolBoxItem(*mpToolBoxHighlight, TBI_HIGHLIGHT);
} }
...@@ -795,22 +732,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox) ...@@ -795,22 +732,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
{
const sal_uInt16 nId = pToolBox->GetCurItemId();
if(nId == TBI_FONTCOLOR)
{
pToolBox->SetItemDown( nId, true );
maFontColorPopup.Show(*pToolBox);
maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable);
}
return 0;
}
IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox) IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
{ {
const sal_uInt16 nId = pToolBox->GetCurItemId(); const sal_uInt16 nId = pToolBox->GetCurItemId();
...@@ -876,21 +797,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox) ...@@ -876,21 +797,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
{
const sal_uInt16 nId = pToolBox->GetCurItemId();
if(nId == TBI_HIGHLIGHT)
{
pToolBox->SetItemDown( nId, true );
maBrushColorPopup.Show(*pToolBox);
maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
}
return 0;
}
IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox) IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
{ {
const sal_uInt16 nId = pToolBox->GetCurItemId(); const sal_uInt16 nId = pToolBox->GetCurItemId();
...@@ -1084,44 +990,6 @@ void TextPropertyPanel::NotifyItemUpdate ( ...@@ -1084,44 +990,6 @@ void TextPropertyPanel::NotifyItemUpdate (
: STATE_NOCHECK); : STATE_NOCHECK);
break; break;
case SID_ATTR_CHAR_COLOR:
if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
{
const SvxColorItem* pItem = (const SvxColorItem*)pState;
maColor = pItem->GetValue();
mbColorAvailable = true;
if (mpFontColorUpdater)
mpFontColorUpdater->Update(maColor);
}
else
{
mbColorAvailable = false;
maColor.SetColor(COL_AUTO);
if (mpFontColorUpdater)
mpFontColorUpdater->Update(maColor);
}
mpToolBoxFontColor->EnableItem(TBI_FONTCOLOR, bIsEnabled);
break;
case SID_ATTR_BRUSH_CHAR:
if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem))
{
const SvxBrushItem* pItem = (const SvxBrushItem*)pState;
maBackColor = pItem->GetColor();
mbBackColorAvailable = true;
if (mpHighlightUpdater)
mpHighlightUpdater->Update(maBackColor);
}
else
{
mbBackColorAvailable = false;
maBackColor.SetColor(COL_AUTO);
if (mpHighlightUpdater)
mpHighlightUpdater->Update(maBackColor);
}
mpToolBoxHighlight->EnableItem(TBI_HIGHLIGHT, bIsEnabled);
break;
case SID_ATTR_CHAR_ESCAPEMENT: case SID_ATTR_CHAR_ESCAPEMENT:
{ {
bool bIsItemEnabled (true); bool bIsItemEnabled (true);
...@@ -1295,9 +1163,6 @@ void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId) ...@@ -1295,9 +1163,6 @@ void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
case SID_ATTR_CHAR_SHADOWED: case SID_ATTR_CHAR_SHADOWED:
maShadowControl.RequestUpdate(); maShadowControl.RequestUpdate();
break; break;
case SID_ATTR_CHAR_COLOR:
maFontColorControl.RequestUpdate();
break;
case SID_ATTR_CHAR_ESCAPEMENT: case SID_ATTR_CHAR_ESCAPEMENT:
maScriptControlSw.RequestUpdate(); maScriptControlSw.RequestUpdate();
break; break;
...@@ -1310,9 +1175,6 @@ void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId) ...@@ -1310,9 +1175,6 @@ void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
case SID_ATTR_CHAR_KERNING: case SID_ATTR_CHAR_KERNING:
maSpacingControl.RequestUpdate(); maSpacingControl.RequestUpdate();
break; break;
case SID_ATTR_BRUSH_CHAR:
maHighlightControl.RequestUpdate();
break;
case SID_GROW_FONT_SIZE: case SID_GROW_FONT_SIZE:
maSDFontGrow.RequestUpdate(); maSDFontGrow.RequestUpdate();
break; break;
...@@ -1326,24 +1188,6 @@ void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId) ...@@ -1326,24 +1188,6 @@ void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
void TextPropertyPanel::SetFontColor (
const String& /* rsColorName */,
const Color aColor)
{
SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
maColor = aColor;
}
void TextPropertyPanel::SetBrushColor (
const String& /* rsColorName */,
const Color aColor)
{
SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR);
mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L);
maBackColor = aColor;
}
Color& TextPropertyPanel::GetUnderlineColor() Color& TextPropertyPanel::GetUnderlineColor()
{ {
return meUnderlineColor; return meUnderlineColor;
......
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
#define TB_FONT 4 #define TB_FONT 4
#define TB_INCREASE_DECREASE 5 #define TB_INCREASE_DECREASE 5
#define TB_FONTCOLOR 6 #define TB_FONTCOLOR 6
#define TB_SCRIPT_SW 7 #define TB_FONTCOLOR_SW 7
#define TB_HIGHLIGHT 8 #define TB_HIGHLIGHT 8
#define TB_SPACING 9 #define TB_SPACING 9
#define TB_SCRIPT 10 #define TB_SCRIPT 10
#define TB_SCRIPT_SW 11
#define TBI_FONTCOLOR 50 #define TBI_FONTCOLOR 50
#define TBI_BOLD 51 #define TBI_BOLD 51
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <sfx2/sidebar/SidebarPanelBase.hxx> #include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sidebar/ControllerItem.hxx> #include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/EnumContext.hxx>
#include <svtools/ctrlbox.hxx> #include <svtools/ctrlbox.hxx>
#include <svx/tbxcolorupdate.hxx> #include <svx/tbxcolorupdate.hxx>
...@@ -33,6 +34,7 @@ ...@@ -33,6 +34,7 @@
#include <editeng/fhgtitem.hxx> #include <editeng/fhgtitem.hxx>
#include <com/sun/star/ui/XSidebar.hpp> #include <com/sun/star/ui/XSidebar.hpp>
#include <com/sun/star/frame/XToolbarController.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include "TextCharacterSpacingPopup.hxx" #include "TextCharacterSpacingPopup.hxx"
...@@ -58,7 +60,8 @@ public: ...@@ -58,7 +60,8 @@ public:
static TextPropertyPanel* Create ( static TextPropertyPanel* Create (
Window* pParent, Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame, const cssu::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings); SfxBindings* pBindings,
const ::sfx2::sidebar::EnumContext& rContext);
virtual void DataChanged (const DataChangedEvent& rEvent); virtual void DataChanged (const DataChangedEvent& rEvent);
...@@ -67,8 +70,6 @@ public: ...@@ -67,8 +70,6 @@ public:
void SetSpacing(long nKern); void SetSpacing(long nKern);
void EndSpacingPopupMode (void); void EndSpacingPopupMode (void);
void EndUnderlinePopupMode (void); void EndUnderlinePopupMode (void);
void SetFontColor (const String& rsColorName,const Color aColor);
void SetBrushColor (const String& rsColorName,const Color aColor);
void SetUnderline(FontUnderline eUnderline); void SetUnderline(FontUnderline eUnderline);
Color& GetUnderlineColor(); Color& GetUnderlineColor();
void SetDefaultUnderline(FontUnderline eUnderline); void SetDefaultUnderline(FontUnderline eUnderline);
...@@ -113,12 +114,10 @@ private: ...@@ -113,12 +114,10 @@ private:
::sfx2::sidebar::ControllerItem maUnderlineControl; ::sfx2::sidebar::ControllerItem maUnderlineControl;
::sfx2::sidebar::ControllerItem maStrikeControl; ::sfx2::sidebar::ControllerItem maStrikeControl;
::sfx2::sidebar::ControllerItem maShadowControl; ::sfx2::sidebar::ControllerItem maShadowControl;
::sfx2::sidebar::ControllerItem maFontColorControl;
::sfx2::sidebar::ControllerItem maScriptControlSw; ::sfx2::sidebar::ControllerItem maScriptControlSw;
::sfx2::sidebar::ControllerItem maSuperScriptControl; ::sfx2::sidebar::ControllerItem maSuperScriptControl;
::sfx2::sidebar::ControllerItem maSubScriptControl; ::sfx2::sidebar::ControllerItem maSubScriptControl;
::sfx2::sidebar::ControllerItem maSpacingControl; ::sfx2::sidebar::ControllerItem maSpacingControl;
::sfx2::sidebar::ControllerItem maHighlightControl;
::sfx2::sidebar::ControllerItem maSDFontGrow; ::sfx2::sidebar::ControllerItem maSDFontGrow;
::sfx2::sidebar::ControllerItem maSDFontShrink; ::sfx2::sidebar::ControllerItem maSDFontShrink;
...@@ -130,10 +129,6 @@ private: ...@@ -130,10 +129,6 @@ private:
FontStrikeout meStrike; FontStrikeout meStrike;
bool mbWeightAvailable; bool mbWeightAvailable;
bool mbPostureAvailable; bool mbPostureAvailable;
Color maColor;
bool mbColorAvailable;
Color maBackColor;
bool mbBackColorAvailable;
SvxEscapement meEscape; //for sw SvxEscapement meEscape; //for sw
bool mbSuper; bool mbSuper;
bool mbSub; bool mbSub;
...@@ -147,8 +142,6 @@ private: ...@@ -147,8 +142,6 @@ private:
bool mbFocusOnFontSizeCtrl; bool mbFocusOnFontSizeCtrl;
TextCharacterSpacingPopup maCharSpacePopup; TextCharacterSpacingPopup maCharSpacePopup;
TextUnderlinePopup maUnderlinePopup; TextUnderlinePopup maUnderlinePopup;
ColorPopup maFontColorPopup;
ColorPopup maBrushColorPopup;
cssu::Reference<css::frame::XFrame> mxFrame; cssu::Reference<css::frame::XFrame> mxFrame;
::sfx2::sidebar::EnumContext maContext; ::sfx2::sidebar::EnumContext maContext;
...@@ -157,26 +150,21 @@ private: ...@@ -157,26 +150,21 @@ private:
TextPropertyPanel ( TextPropertyPanel (
Window* pParent, Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame, const cssu::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings); SfxBindings* pBindings,
const ::sfx2::sidebar::EnumContext& rContext);
virtual ~TextPropertyPanel (void); virtual ~TextPropertyPanel (void);
PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent); PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
PopupControl* CreateFontColorPopupControl (PopupContainer* pParent);
PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent);
PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent); PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
DECL_LINK(SpacingClickHdl, ToolBox*); DECL_LINK(SpacingClickHdl, ToolBox*);
DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker
DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* ); DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
void Initialize (void); void Initialize (void);
void SetupToolboxItems (void); void SetupToolboxItems (void);
void InitToolBoxFont(); void InitToolBoxFont();
void InitToolBoxIncDec(); void InitToolBoxIncDec();
void InitToolBoxFontColor();
void InitToolBoxScript(); void InitToolBoxScript();
void InitToolBoxHighlight();
void InitToolBoxSpacing(); void InitToolBoxSpacing();
DECL_LINK(FontSelHdl, FontNameBox *); DECL_LINK(FontSelHdl, FontNameBox *);
......
...@@ -153,7 +153,6 @@ Control RID_SIDEBAR_TEXT_PANEL ...@@ -153,7 +153,6 @@ Control RID_SIDEBAR_TEXT_PANEL
Pos = MAP_APPFONT (X3, THIRD_LINE_Y) ; Pos = MAP_APPFONT (X3, THIRD_LINE_Y) ;
Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ; Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
TabStop = TRUE ; TabStop = TRUE ;
Text = "Font Color" ;
ItemList = ItemList =
{ {
ToolBoxItem ToolBoxItem
...@@ -165,6 +164,24 @@ Control RID_SIDEBAR_TEXT_PANEL ...@@ -165,6 +164,24 @@ Control RID_SIDEBAR_TEXT_PANEL
}; };
}; };
}; };
ToolBox TB_FONTCOLOR_SW
{
HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR;
SVLook = TRUE ;
Pos = MAP_APPFONT (X3, THIRD_LINE_Y) ;
Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
TabStop = TRUE ;
ItemList =
{
ToolBoxItem
{
Identifier = TBI_FONTCOLOR ;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR;
DropDown = TRUE ;
Command = ".uno:FontColor";
};
};
};
ToolBox TB_HIGHLIGHT ToolBox TB_HIGHLIGHT
{ {
...@@ -181,7 +198,7 @@ Control RID_SIDEBAR_TEXT_PANEL ...@@ -181,7 +198,7 @@ Control RID_SIDEBAR_TEXT_PANEL
Identifier = TBI_HIGHLIGHT ; Identifier = TBI_HIGHLIGHT ;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR;
DropDown = TRUE ; DropDown = TRUE ;
Command = ".uno:CharacterBackgroundPattern"; Command = ".uno:BackColor";
}; };
}; };
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment