Kaydet (Commit) a9626f14 authored tarafından Andre Fischer's avatar Andre Fischer Kaydeden (comit) Michael Meeks

Resolves: #i122302# Use tool bar controls for color controls...

in text property panel

(cherry picked from commit 3b252796)

Conflicts:
	sfx2/Package_inc.mk
	sfx2/inc/sfx2/sidebar/ControlFactory.hxx
	sfx2/inc/sfx2/sidebar/ControllerFactory.hxx
	sfx2/inc/sfx2/sidebar/EnumContext.hxx
	sfx2/source/sidebar/SidebarToolBox.cxx
	svx/source/sidebar/insert/InsertPropertyPanel.cxx
	svx/source/sidebar/insert/InsertPropertyPanel.hxx
	svx/source/sidebar/text/TextPropertyPanel.cxx

Change-Id: Ifa1947c9e9bfdc3635dbb5b0c7a79f8ead613a90
üst 6e6f8cb2
......@@ -19,21 +19,34 @@
#define SFX_SIDEBAR_CONTROL_FACTORY_HXX
#include <sfx2/dllapi.h>
#include <sfx2/sidebar/SidebarToolBox.hxx>
#include <vcl/button.hxx>
#include <com/sun/star/frame/XFrame.hpp>
class ToolBox;
namespace sfx2 { namespace sidebar {
class ToolBoxBackground;
class SFX2_DLLPUBLIC ControlFactory
{
public:
static CheckBox* CreateMenuButton (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 ImageRadioButton* CreateCustomImageRadionButton(
Window* pParentWindow,
......
......@@ -15,36 +15,30 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef SFX_SIDEBAR_TOOLBOX_HXX
#define SFX_SIDEBAR_TOOLBOX_HXX
#ifndef SFX_SIDEBAR_CONTROLLER_FACTORY_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;
class ToolBox;
namespace sfx2 { namespace sidebar {
class SidebarToolBox
: public ToolBox
/** Convenience class for easy creation of toolbox controllers.
*/
class SFX2_DLLPUBLIC ControllerFactory
{
public:
SidebarToolBox (Window* pParentWindow, const ResId& rResId);
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);
private:
bool mbParentIsBorder;
Image maItemSeparator;
static cssu::Reference<css::frame::XToolbarController> CreateToolBoxController(
ToolBox* pToolBox,
const sal_uInt16 nItemId,
const ::rtl::OUString& rsCommandName,
const cssu::Reference<css::frame::XFrame>& rxFrame);
};
......
......@@ -125,6 +125,9 @@ public:
sal_Int32 GetCombinedContext_DI(void) const;
const ::rtl::OUString& GetApplicationName (void) const;
Application GetApplication (void) const;
Application GetApplication_DI (void) const;
const ::rtl::OUString& GetContextName (void) const;
bool operator == (const EnumContext aOther);
......
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#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
......@@ -239,6 +239,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/sidebar/ContextChangeBroadcaster \
sfx2/source/sidebar/ContextList \
sfx2/source/sidebar/ControlFactory \
sfx2/source/sidebar/ControllerFactory \
sfx2/source/sidebar/ControllerItem \
sfx2/source/sidebar/CustomImageRadioButton \
sfx2/source/sidebar/Deck \
......
......@@ -19,7 +19,7 @@
#include "MenuButton.hxx"
#include "TabItem.hxx"
#include "SidebarToolBox.hxx"
#include "sfx2/sidebar/SidebarToolBox.hxx"
#include "ToolBoxBackground.hxx"
#include "CustomImageRadioButton.hxx"
#include <vcl/toolbox.hxx>
......@@ -44,11 +44,27 @@ ImageRadioButton* ControlFactory::CreateTabItem (Window* pParentWindow)
ToolBox* ControlFactory::CreateToolBox (
SidebarToolBox* ControlFactory::CreateToolBox (
Window* pParentWindow,
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->Invalidate();
......
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#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
......@@ -82,23 +82,39 @@ sal_Int32 EnumContext::GetCombinedContext (void) const
sal_Int32 EnumContext::GetCombinedContext_DI (void) const
{
switch (meApplication)
{
case Application_Draw:
case Application_Impress:
return CombinedEnumContext(Application_DrawImpress, meContext);
case Application_Writer:
case Application_WriterGlobal:
case Application_WriterWeb:
case Application_WriterXML:
case Application_WriterForm:
case Application_WriterReport:
return CombinedEnumContext(Application_WriterVariants, meContext);
default:
return CombinedEnumContext(meApplication, meContext);
}
return CombinedEnumContext(GetApplication_DI(), meContext);
}
EnumContext::Application EnumContext::GetApplication_DI (void) const
{
switch (meApplication)
{
case Application_Draw:
case Application_Impress:
return Application_DrawImpress;
case Application_Writer:
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;
}
......
......@@ -572,7 +572,8 @@ void SidebarController::SwitchToDeck (
aNewPanels[nWriteIndex] = CreatePanel(
rPanelContexDescriptor.msId,
mpCurrentDeck->GetPanelParentWindow(),
rPanelContexDescriptor.mbIsInitiallyVisible);
rPanelContexDescriptor.mbIsInitiallyVisible,
rContext);
bHasPanelSetChanged = true;
}
if (aNewPanels[nWriteIndex] != NULL)
......@@ -641,7 +642,8 @@ bool SidebarController::ArePanelSetsEqual (
SharedPanel SidebarController::CreatePanel (
const OUString& rsPanelId,
::Window* pParentWindow,
const bool bIsInitiallyExpanded)
const bool bIsInitiallyExpanded,
const Context& rContext)
{
const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
if (pPanelDescriptor == NULL)
......@@ -659,7 +661,8 @@ SharedPanel SidebarController::CreatePanel (
Reference<ui::XUIElement> xUIElement (CreateUIElement(
pPanel->GetComponentInterface(),
pPanelDescriptor->msImplementationURL,
pPanelDescriptor->mbWantsCanvas));
pPanelDescriptor->mbWantsCanvas,
rContext));
if (xUIElement.is())
{
// Initialize the panel and add it to the active deck.
......@@ -679,7 +682,8 @@ SharedPanel SidebarController::CreatePanel (
Reference<ui::XUIElement> SidebarController::CreateUIElement (
const Reference<awt::XWindowPeer>& rxWindow,
const ::rtl::OUString& rsImplementationURL,
const bool bWantsCanvas)
const bool bWantsCanvas,
const Context& rContext)
{
try
{
......@@ -702,6 +706,8 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement (
Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas());
aCreationArguments.put("Canvas", makeAny(xCanvas));
}
aCreationArguments.put("ApplicationName", makeAny(rContext.msApplication));
aCreationArguments.put("ContextName", makeAny(rContext.msContext));
Reference<ui::XUIElement> xUIElement(
xUIElementFactory->createUIElement(
......
......@@ -165,11 +165,13 @@ private:
cssu::Reference<css::ui::XUIElement> CreateUIElement (
const cssu::Reference<css::awt::XWindowPeer>& rxWindow,
const ::rtl::OUString& rsImplementationURL,
const bool bWantsCanvas);
const bool bWantsCanvas,
const Context& rContext);
SharedPanel CreatePanel (
const ::rtl::OUString& rsPanelId,
::Window* pParentWindow,
const bool bIsInitiallyExpanded);
const bool bIsInitiallyExpanded,
const Context& rContext);
void SwitchToDeck (
const DeckDescriptor& rDeckDescriptor,
const Context& rContext);
......
......@@ -15,16 +15,22 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "SidebarToolBox.hxx"
#include "sfx2/sidebar/SidebarToolBox.hxx"
#include "ToolBoxBackground.hxx"
#include "sfx2/sidebar/ControllerFactory.hxx"
#include "sfx2/sidebar/Theme.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include <vcl/gradient.hxx>
#include <svtools/miscopt.hxx>
#include <framework/imageproducer.hxx>
#include <com/sun/star/frame/XSubToolbarController.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using ::rtl::OUString;
namespace sfx2 { namespace sidebar {
......@@ -32,13 +38,32 @@ namespace sfx2 { namespace sidebar {
SidebarToolBox::SidebarToolBox (
Window* pParentWindow,
const ResId& rResId)
const ResId& rResId,
const cssu::Reference<css::frame::XFrame>& rxFrame)
: ToolBox(pParentWindow, rResId),
mbParentIsBorder(false),
maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator))
{
SetBackground(Wallpaper());
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
SetText(A2S("SidebarToolBox"));
#endif
......@@ -49,6 +74,24 @@ SidebarToolBox::SidebarToolBox (
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());
}
......@@ -167,4 +210,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
......@@ -132,10 +132,6 @@ IMPL_LINK(ToolBoxBackground, WindowEventHandler, VclWindowEvent*, pEvent)
Hide();
break;
case SFX_HINT_DYING:
doLazyDelete();
break;
default:
break;
}
......
......@@ -114,6 +114,9 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
::sfx2::sidebar::EnumContext aContext (
aArguments.getOrDefault("ApplicationName", OUString()),
aArguments.getOrDefault("ContextName", OUString()));
::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==NULL)
......@@ -135,7 +138,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
if (DoesResourceEndWith("/TextPropertyPanel"))
{
pControl = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings);
pControl = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings, aContext);
}
else if (DoesResourceEndWith("/ParaPropertyPanel"))
{
......
......@@ -49,41 +49,9 @@ private:
::boost::scoped_ptr<ToolBox> mpStandardShapesToolBox;
::boost::scoped_ptr<Window> mpCustomShapesBackground;
::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;
/** 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(ActivateToolBox, ToolBox*);
DECL_LINK(DeactivateToolBox, ToolBox*);
};
......
......@@ -30,11 +30,11 @@
#define TB_FONT 4
#define TB_INCREASE_DECREASE 5
#define TB_FONTCOLOR 6
#define TB_SCRIPT_SW 7
#define TB_FONTCOLOR_SW 7
#define TB_HIGHLIGHT 8
#define TB_SPACING 9
#define TB_SCRIPT 10
#define TB_SCRIPT_SW 11
#define TBI_FONTCOLOR 50
#define TBI_BOLD 51
......
......@@ -22,6 +22,7 @@
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/EnumContext.hxx>
#include <svtools/ctrlbox.hxx>
#include <svx/tbxcolorupdate.hxx>
......@@ -29,6 +30,7 @@
#include <editeng/fhgtitem.hxx>
#include <com/sun/star/ui/XSidebar.hpp>
#include <com/sun/star/frame/XToolbarController.hpp>
#include <boost/scoped_ptr.hpp>
#include "TextCharacterSpacingPopup.hxx"
......@@ -54,7 +56,8 @@ public:
static TextPropertyPanel* Create (
Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
SfxBindings* pBindings,
const ::sfx2::sidebar::EnumContext& rContext);
virtual void DataChanged (const DataChangedEvent& rEvent);
......@@ -63,8 +66,6 @@ public:
void SetSpacing(long nKern);
void EndSpacingPopupMode (void);
void EndUnderlinePopupMode (void);
void SetFontColor (const String& rsColorName,const Color aColor);
void SetBrushColor (const String& rsColorName,const Color aColor);
void SetUnderline(FontUnderline eUnderline);
Color& GetUnderlineColor();
void SetDefaultUnderline(FontUnderline eUnderline);
......@@ -109,12 +110,10 @@ private:
::sfx2::sidebar::ControllerItem maUnderlineControl;
::sfx2::sidebar::ControllerItem maStrikeControl;
::sfx2::sidebar::ControllerItem maShadowControl;
::sfx2::sidebar::ControllerItem maFontColorControl;
::sfx2::sidebar::ControllerItem maScriptControlSw;
::sfx2::sidebar::ControllerItem maSuperScriptControl;
::sfx2::sidebar::ControllerItem maSubScriptControl;
::sfx2::sidebar::ControllerItem maSpacingControl;
::sfx2::sidebar::ControllerItem maHighlightControl;
::sfx2::sidebar::ControllerItem maSDFontGrow;
::sfx2::sidebar::ControllerItem maSDFontShrink;
......@@ -126,10 +125,6 @@ private:
FontStrikeout meStrike;
bool mbWeightAvailable;
bool mbPostureAvailable;
Color maColor;
bool mbColorAvailable;
Color maBackColor;
bool mbBackColorAvailable;
SvxEscapement meEscape; //for sw
bool mbSuper;
bool mbSub;
......@@ -143,8 +138,6 @@ private:
bool mbFocusOnFontSizeCtrl;
TextCharacterSpacingPopup maCharSpacePopup;
TextUnderlinePopup maUnderlinePopup;
ColorPopup maFontColorPopup;
ColorPopup maBrushColorPopup;
cssu::Reference<css::frame::XFrame> mxFrame;
::sfx2::sidebar::EnumContext maContext;
......@@ -153,26 +146,21 @@ private:
TextPropertyPanel (
Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
SfxBindings* pBindings,
const ::sfx2::sidebar::EnumContext& rContext);
virtual ~TextPropertyPanel (void);
PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
PopupControl* CreateFontColorPopupControl (PopupContainer* pParent);
PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent);
PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
DECL_LINK(SpacingClickHdl, ToolBox*);
DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker
DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
void Initialize (void);
void SetupToolboxItems (void);
void InitToolBoxFont();
void InitToolBoxIncDec();
void InitToolBoxFontColor();
void InitToolBoxScript();
void InitToolBoxHighlight();
void InitToolBoxSpacing();
DECL_LINK(FontSelHdl, FontNameBox *);
......
......@@ -149,7 +149,6 @@ Control RID_SIDEBAR_TEXT_PANEL
Pos = MAP_APPFONT (X3, THIRD_LINE_Y) ;
Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
TabStop = TRUE ;
Text = "Font Color" ;
ItemList =
{
ToolBoxItem
......@@ -161,6 +160,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
{
......@@ -177,7 +194,7 @@ Control RID_SIDEBAR_TEXT_PANEL
Identifier = TBI_HIGHLIGHT ;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR;
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