Resolves: #i121960# Extend the sidebar::ControllerItem to check Disabled state
Converted TextPropertyPanel to use this new functionality.
(cherry picked from commit 5e32abe48b0833e4e370507a1e74fbb1ba98b5e3)
Conflicts:
officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
sfx2/inc/sfx2/sidebar/ControllerItem.hxx
sfx2/source/sidebar/ControllerItem.cxx
sfx2/source/sidebar/FocusManager.cxx
sfx2/source/sidebar/SidebarChildWindow.cxx
svx/Library_svx.mk
svx/source/sidebar/text/TextPropertyPanel.cxx
svx/source/sidebar/text/TextPropertyPanel.hrc
svx/source/sidebar/text/TextPropertyPanel.hxx
svx/source/sidebar/text/TextPropertyPanel.src
svx/source/sidebar/text/TextUnderlineControl.hxx
Change-Id: I3a25bb0a02e6165ceeb6dbd9e6ecd3e94051f594
diff --git a/icon-themes/galaxy/cmd/lc_characterbackgroundpattern.png b/icon-themes/galaxy/cmd/lc_characterbackgroundpattern.png
new file mode 100644
index 0000000..c0aa720
--- /dev/null
+++ b/icon-themes/galaxy/cmd/lc_characterbackgroundpattern.png
Binary files differ
diff --git a/icon-themes/galaxy/cmd/lc_spacing.png b/icon-themes/galaxy/cmd/lc_spacing.png
new file mode 100644
index 0000000..0d6a719
--- /dev/null
+++ b/icon-themes/galaxy/cmd/lc_spacing.png
Binary files differ
diff --git a/icon-themes/galaxy/cmd/sc_characterbackgroundpattern.png b/icon-themes/galaxy/cmd/sc_characterbackgroundpattern.png
new file mode 100644
index 0000000..667d6cc
--- /dev/null
+++ b/icon-themes/galaxy/cmd/sc_characterbackgroundpattern.png
Binary files differ
diff --git a/icon-themes/galaxy/cmd/sc_spacing.png b/icon-themes/galaxy/cmd/sc_spacing.png
new file mode 100644
index 0000000..03396da
--- /dev/null
+++ b/icon-themes/galaxy/cmd/sc_spacing.png
Binary files differ
diff --git a/icon-themes/galaxy/cmd/sch_characterbackgroundpattern.png b/icon-themes/galaxy/cmd/sch_characterbackgroundpattern.png
new file mode 100644
index 0000000..aaa81bd
--- /dev/null
+++ b/icon-themes/galaxy/cmd/sch_characterbackgroundpattern.png
Binary files differ
diff --git a/icon-themes/galaxy/cmd/sch_spacing.png b/icon-themes/galaxy/cmd/sch_spacing.png
new file mode 100644
index 0000000..4cd96408
--- /dev/null
+++ b/icon-themes/galaxy/cmd/sch_spacing.png
Binary files differ
diff --git a/icon-themes/hicontrast/cmd/lc_characterbackgroundpattern.png b/icon-themes/hicontrast/cmd/lc_characterbackgroundpattern.png
new file mode 100644
index 0000000..aa23c69
--- /dev/null
+++ b/icon-themes/hicontrast/cmd/lc_characterbackgroundpattern.png
Binary files differ
diff --git a/icon-themes/hicontrast/cmd/lc_spacing.png b/icon-themes/hicontrast/cmd/lc_spacing.png
new file mode 100644
index 0000000..7664bbc
--- /dev/null
+++ b/icon-themes/hicontrast/cmd/lc_spacing.png
Binary files differ
diff --git a/include/sfx2/sidebar/ControllerItem.hxx b/include/sfx2/sidebar/ControllerItem.hxx
index 3e7cd83..e79d797 100644
--- a/include/sfx2/sidebar/ControllerItem.hxx
+++ b/include/sfx2/sidebar/ControllerItem.hxx
@@ -20,11 +20,33 @@
#include <sfx2/ctrlitem.hxx>
#include <cppuhelper/compbase1.hxx>
#include <cppuhelper/basemutex.hxx>
#include <unotools/cmdoptions.hxx>
#include <vcl/image.hxx>
#include <com/sun/star/frame/XFrame.hpp>
#include <boost/function.hpp>
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
class SfxViewFrame;
class ToolBox;
namespace sfx2 { namespace sidebar {
/** The sfx2::sidebar::ControllerItem is a wrapper around the
SfxControllerItem that becomes necessary to allow objects (think
sidebar panels) to receive state changes without having one
SfxControllerItem per supported item as base class (which is not
possible in C++ anyway).
It also gives access to the label and icon of a slot/command.
*/
class SFX2_DLLPUBLIC ControllerItem
: public SfxControllerItem
{
@@ -35,19 +57,79 @@ public:
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState) = 0;
const SfxPoolItem* pState,
const bool bIsEnabled) = 0;
virtual ~ItemUpdateReceiverInterface();
};
/** This is the preferred constructor that allows the created
controller item to return non-empty values for GetLable() and
GetIcon() calls.
*/
ControllerItem (
const sal_uInt16 nSlotId,
SfxBindings &rBindings,
ItemUpdateReceiverInterface& rItemUpdateReceiver,
const ::rtl::OUString& rsCommandName,
const cssu::Reference<css::frame::XFrame>& rxFrame);
/** This is the simpler constructor variant that still exists for
compatibility resons. Note that GetLabel() and GetIcon() will
return empty strings/images.
*/
ControllerItem (
const sal_uInt16 nId,
SfxBindings &rBindings,
ItemUpdateReceiverInterface& rItemUpdateReceiver);
virtual ~ControllerItem();
/** Returns </TRUE> when the slot/command has not been disabled.
Changes of this state are notified via the
ItemUpdateReceiverInterface::NotifyContextChang() method.
*/
bool IsEnabled (void) const;
/** Force the controller item to call its NotifyItemUpdate
callback with up-to-date data.
*/
void RequestUpdate (void);
/** Return the label for the command. It contains the keyboard
accelerator when one exists.
*/
::rtl::OUString GetLabel (void) const;
/** Return the icon for the command.
*/
Image GetIcon (void) const;
/** Convenience method for setting all relevant properties for the
slot/command represented by the called object at the given tool
box.
*/
void SetupToolBoxItem (ToolBox& rToolBox, const sal_uInt16 nIndex);
/** Do not call. Used by local class only. Should be a member of
a local and hidden interface.
*/
void NotifyFrameContextChange (void);
/** Do not call. Used by local class only. Should be a member of
a local and hidden interface.
*/
void ResetFrame (void);
protected:
virtual void StateChanged (sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState);
private:
ItemUpdateReceiverInterface& mrItemUpdateReceiver;
cssu::Reference<css::frame::XFrame> mxFrame;
cssu::Reference<css::lang::XComponent> mxFrameActionListener;
const ::rtl::OUString msCommandName;
void SetupCommandURL (const sal_Char* sCommandName);
};
} } // end of namespace sfx2::sidebar
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 517d601..7b01925 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -1340,6 +1340,14 @@
<value>1</value>
</prop>
</node>
<node oor:name=".uno:CharacterBackgroundPattern" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Highlight Color</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
</node>
<node oor:name=".uno:CharFontName" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Font Name</value>
@@ -3072,6 +3080,14 @@
<value>1</value>
</prop>
</node>
<node oor:name=".uno:Spacing" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Character Spacing</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
</node>
<node oor:name=".uno:SpellDialog" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Spelling...</value>
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 3fb7bb2..0ba2436 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -382,8 +382,11 @@ void AlignmentPropertyPanel::HandleContextChange(
void AlignmentPropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
const SfxPoolItem* pState,
const bool bIsEnabled)
{
(void)bIsEnabled;
switch(nSID)
{
case SID_H_ALIGNCELL:
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index 07d3e06..a5a0a58 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -53,7 +53,8 @@ public:
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState);
const SfxPoolItem* pState,
const bool bIsEnabled);
SfxBindings* GetBindings();
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index fe48df6..2ee40a9 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -446,8 +446,11 @@ void CellAppearancePropertyPanel::HandleContextChange(
void CellAppearancePropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
const SfxPoolItem* pState,
const bool bIsEnabled)
{
(void)bIsEnabled;
switch(nSID)
{
case SID_BACKGROUND_COLOR:
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
index 184cd95..00b747e 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
@@ -61,7 +61,8 @@ public:
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState);
const SfxPoolItem* pState,
const bool bIsEnabled);
SfxBindings* GetBindings();
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index 2f5a805..9a7e2cb 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -262,8 +262,11 @@ void NumberFormatPropertyPanel::HandleContextChange(
void NumberFormatPropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
const SfxPoolItem* pState,
const bool bIsEnabled)
{
(void)bIsEnabled;
switch(nSID)
{
case SID_NUMBER_TYPE_FORMAT:
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
index 98102f4..cf7087c 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
@@ -50,7 +50,8 @@ public:
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState);
const SfxPoolItem* pState,
const bool bIsEnabled);
SfxBindings* GetBindings();
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index e32300c..40d4283 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -234,6 +234,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/sidebar/SidebarPanelBase \
sfx2/source/sidebar/SidebarToolBox \
sfx2/source/sidebar/AsynchronousCall \
sfx2/source/sidebar/CommandInfoProvider \
sfx2/source/sidebar/Context \
sfx2/source/sidebar/ContextChangeBroadcaster \
sfx2/source/sidebar/ContextList \
diff --git a/sfx2/source/sidebar/CommandInfoProvider.cxx b/sfx2/source/sidebar/CommandInfoProvider.cxx
new file mode 100644
index 0000000..dc254db
--- /dev/null
+++ b/sfx2/source/sidebar/CommandInfoProvider.cxx
@@ -0,0 +1,354 @@
/*
* 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 "CommandInfoProvider.hxx"
#include <comphelper/processfactory.hxx>
#include <svtools/acceleratorexecute.hxx>
#include <cppuhelper/compbase1.hxx>
#include <cppuhelper/basemutex.hxx>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
using namespace css;
using namespace cssu;
using ::rtl::OUString;
#define A2S(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
namespace
{
typedef ::cppu::WeakComponentImplHelper1 <
css::lang::XEventListener
> FrameListenerInterfaceBase;
class FrameListener
: public ::cppu::BaseMutex,
public FrameListenerInterfaceBase
{
public:
FrameListener (sfx2::sidebar::CommandInfoProvider& rInfoProvider, const Reference<frame::XFrame>& rxFrame)
: FrameListenerInterfaceBase(m_aMutex),
mrInfoProvider(rInfoProvider),
mxFrame(rxFrame)
{
if (mxFrame.is())
mxFrame->addEventListener(this);
}
virtual ~FrameListener (void)
{
}
virtual void SAL_CALL disposing (void)
{
if (mxFrame.is())
mxFrame->removeEventListener(this);
}
virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
throw (cssu::RuntimeException)
{
(void)rEvent;
mrInfoProvider.SetFrame(NULL);
mxFrame = NULL;
}
private:
sfx2::sidebar::CommandInfoProvider& mrInfoProvider;
Reference<frame::XFrame> mxFrame;
};
}
namespace sfx2 { namespace sidebar {
CommandInfoProvider& CommandInfoProvider::Instance (void)
{
static CommandInfoProvider aProvider;
return aProvider;
}
CommandInfoProvider::CommandInfoProvider (void)
: mxServiceFactory(comphelper::getProcessServiceFactory()),
mxCachedDataFrame(),
mxCachedDocumentAcceleratorConfiguration(),
mxCachedModuleAcceleratorConfiguration(),
mxCachedGlobalAcceleratorConfiguration(),
msCachedModuleIdentifier(),
mxFrameListener()
{
}
CommandInfoProvider::~CommandInfoProvider (void)
{
if (mxFrameListener.is())
{
mxFrameListener->dispose();
mxFrameListener = NULL;
}
}
OUString CommandInfoProvider::GetLabelForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
SetFrame(rxFrame);
const OUString sLabel (GetCommandLabel(rsCommandName));
const OUString sShortCut (GetCommandShortcut(rsCommandName));
if (sShortCut.getLength() > 0)
return sLabel + A2S(" (") + sShortCut + A2S(")");
else
return sLabel;
}
void CommandInfoProvider::SetFrame (const Reference<frame::XFrame>& rxFrame)
{
if (rxFrame != mxCachedDataFrame)
{
// Detach from the old frame.
if (mxFrameListener.is())
{
mxFrameListener->dispose();
mxFrameListener = NULL;
}
// Release objects that are tied to the old frame.
mxCachedDocumentAcceleratorConfiguration = NULL;
mxCachedModuleAcceleratorConfiguration = NULL;
msCachedModuleIdentifier = OUString();
mxCachedDataFrame = rxFrame;
// Connect to the new frame.
if (rxFrame.is())
mxFrameListener = new FrameListener(*this, rxFrame);
}
}
Reference<ui::XAcceleratorConfiguration> CommandInfoProvider::GetDocumentAcceleratorConfiguration (void)
{
if ( ! mxCachedDocumentAcceleratorConfiguration.is())
{
// Get the accelerator configuration for the document.
if (mxCachedDataFrame.is())
{
Reference<frame::XController> xController = mxCachedDataFrame->getController();
if (xController.is())
{
Reference<frame::XModel> xModel (xController->getModel());
if (xModel.is())
{
Reference<ui::XUIConfigurationManagerSupplier> xSupplier (xModel, UNO_QUERY);
if (xSupplier.is())
{
Reference<ui::XUIConfigurationManager> xConfigurationManager(
xSupplier->getUIConfigurationManager(),
UNO_QUERY);
if (xConfigurationManager.is())
{
mxCachedDocumentAcceleratorConfiguration = Reference<ui::XAcceleratorConfiguration>(
xConfigurationManager->getShortCutManager(),
UNO_QUERY);
}
}
}
}
}
}
return mxCachedDocumentAcceleratorConfiguration;
}
Reference<ui::XAcceleratorConfiguration> CommandInfoProvider::GetModuleAcceleratorConfiguration (void)
{
if ( ! mxCachedModuleAcceleratorConfiguration.is())
{
try
{
Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier (
mxServiceFactory->createInstance(A2S("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")),
UNO_QUERY);
Reference<ui::XUIConfigurationManager> xManager (
xSupplier->getUIConfigurationManager(GetModuleIdentifier()));
if (xManager.is())
{
mxCachedModuleAcceleratorConfiguration = Reference<ui::XAcceleratorConfiguration>(
xManager->getShortCutManager(),
UNO_QUERY);
}
}
catch (Exception&)
{
}
}
return mxCachedModuleAcceleratorConfiguration;
}
Reference<ui::XAcceleratorConfiguration> CommandInfoProvider::GetGlobalAcceleratorConfiguration (void)
{
// Get the global accelerator configuration.
if ( ! mxCachedGlobalAcceleratorConfiguration.is())
{
mxCachedGlobalAcceleratorConfiguration = Reference<ui::XAcceleratorConfiguration>(
mxServiceFactory->createInstance(A2S("com.sun.star.ui.GlobalAcceleratorConfiguration")),
UNO_QUERY);
}
return mxCachedGlobalAcceleratorConfiguration;
}
OUString CommandInfoProvider::GetModuleIdentifier (void)
{
if (msCachedModuleIdentifier.getLength() == 0)
{
Reference<frame::XModuleManager> xModuleManager (
mxServiceFactory->createInstance(A2S("com.sun.star.frame.ModuleManager")),
UNO_QUERY);
if (xModuleManager.is())
msCachedModuleIdentifier = xModuleManager->identify(mxCachedDataFrame);
}
return msCachedModuleIdentifier;
}
OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName)
{
OUString sShortcut;
sShortcut = RetrieveShortcutsFromConfiguration(GetDocumentAcceleratorConfiguration(), rsCommandName);
if (sShortcut.getLength() > 0)
return sShortcut;
sShortcut = RetrieveShortcutsFromConfiguration(GetModuleAcceleratorConfiguration(), rsCommandName);
if (sShortcut.getLength() > 0)
return sShortcut;
sShortcut = RetrieveShortcutsFromConfiguration(GetGlobalAcceleratorConfiguration(), rsCommandName);
if (sShortcut.getLength() > 0)
return sShortcut;
return OUString();
}
OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
const Reference<ui::XAcceleratorConfiguration>& rxConfiguration,
const OUString& rsCommandName)
{
if (rxConfiguration.is())
{
try
{
Sequence<OUString> aCommands(1);
aCommands[0] = rsCommandName;
Sequence<Any> aKeyCodes (rxConfiguration->getPreferredKeyEventsForCommandList(aCommands));
if (aCommands.getLength() == 1)
{
css::awt::KeyEvent aKeyEvent;
if (aKeyCodes[0] >>= aKeyEvent)
{
return svt::AcceleratorExecute::st_AWTKey2VCLKey(aKeyEvent).GetName();
}
}
}
catch (lang::IllegalArgumentException&)
{
}
}
return OUString();
}
Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties (const OUString& rsCommandName)
{
Sequence<beans::PropertyValue> aProperties;
try
{
const OUString sModuleIdentifier (GetModuleIdentifier());
if (sModuleIdentifier.getLength() > 0)
{
Reference<container::XNameAccess> xNameAccess (
mxServiceFactory->createInstance(
OUString::createFromAscii("com.sun.star.frame.UICommandDescription")),
UNO_QUERY);
Reference<container::XNameAccess> xUICommandLabels;
if (xNameAccess.is())
if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels)
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
}
}
catch (Exception&)
{
}
return aProperties;
}
OUString CommandInfoProvider::GetCommandLabel (const OUString& rsCommandName)
{
const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName));
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
{
if (aProperties[nIndex].Name.equalsAscii("Name"))
{
OUString sLabel;
aProperties[nIndex].Value >>= sLabel;
return sLabel;
}
}
return OUString();
}
} } // end of namespace sfx2/framework
diff --git a/sfx2/source/sidebar/CommandInfoProvider.hxx b/sfx2/source/sidebar/CommandInfoProvider.hxx
new file mode 100644
index 0000000..8278111
--- /dev/null
+++ b/sfx2/source/sidebar/CommandInfoProvider.hxx
@@ -0,0 +1,92 @@
/*
* 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 SIDEBAR_COMMAND_INFO_PROVIDER_HXX
#define SIDEBAR_COMMAND_INFO_PROVIDER_HXX
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
namespace sfx2 { namespace sidebar {
/** Provide information about UNO commands like tooltip text with
keyboard accelerator.
*/
class CommandInfoProvider
{
public:
/** Return the singleton instance.
It caches some objects for the last XFrame object given to
GetLabelForCommand. These objects are release and created new
when that method is called with a different XFrame from the
last call.
Lifetime control should work but could be more elegant.
*/
static CommandInfoProvider& Instance (void);
/** Return a label for the given command.
@param rsCommandName
The command name is expected to start with .uno:
@param rxFrame
The frame is used to identify the module and document.
@return
The returned label contains the keyboard accelerator, if
one is defined.
*/
::rtl::OUString GetLabelForCommand (
const ::rtl::OUString& rsCommandName,
const cssu::Reference<css::frame::XFrame>& rxFrame);
/** Do not call. Should be part of a local and hidden interface.
*/
void SetFrame (const cssu::Reference<css::frame::XFrame>& rxFrame);
private:
cssu::Reference<css::lang::XMultiServiceFactory> mxServiceFactory;
cssu::Reference<css::frame::XFrame> mxCachedDataFrame;
cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedDocumentAcceleratorConfiguration;
cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedModuleAcceleratorConfiguration;
cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedGlobalAcceleratorConfiguration;
::rtl::OUString msCachedModuleIdentifier;
cssu::Reference<css::lang::XComponent> mxFrameListener;
CommandInfoProvider (void);
~CommandInfoProvider (void);
cssu::Reference<css::ui::XAcceleratorConfiguration> GetDocumentAcceleratorConfiguration (void);
cssu::Reference<css::ui::XAcceleratorConfiguration> GetModuleAcceleratorConfiguration (void);
cssu::Reference<css::ui::XAcceleratorConfiguration> GetGlobalAcceleratorConfiguration(void);
::rtl::OUString GetModuleIdentifier (void);
::rtl::OUString GetCommandShortcut (const ::rtl::OUString& rCommandName);
cssu::Sequence<css::beans::PropertyValue> GetCommandProperties (
const ::rtl::OUString& rsCommandName);
::rtl::OUString GetCommandLabel (const ::rtl::OUString& rsCommandName);
rtl::OUString RetrieveShortcutsFromConfiguration(
const cssu::Reference<css::ui::XAcceleratorConfiguration>& rxConfiguration,
const rtl::OUString& rsCommandName);
};
} } // end of namespace sfx2/framework
#endif
diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx
index e002412..979dd8a 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -17,14 +17,102 @@
*/
#include "sidebar/ControllerItem.hxx"
#include <sfx2/msgpool.hxx>
#include <sfx2/viewsh.hxx>
#include "sfx2/imagemgr.hxx"
#include "sfx2/bindings.hxx"
#include <unotools/cmdoptions.hxx>
#include "CommandInfoProvider.hxx"
#include <vcl/svapp.hxx>
#include <vcl/toolbox.hxx>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XFrameActionListener.hpp>
using namespace css;
using namespace cssu;
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
namespace
{
typedef ::cppu::WeakComponentImplHelper1 <
css::frame::XFrameActionListener
> FrameActionListenerInterfaceBase;
class FrameActionListener
: public ::cppu::BaseMutex,
public FrameActionListenerInterfaceBase
{
public:
FrameActionListener (
sfx2::sidebar::ControllerItem& rControllerItem,
const Reference<frame::XFrame>& rxFrame)
: FrameActionListenerInterfaceBase(m_aMutex),
mrControllerItem(rControllerItem),
mxFrame(rxFrame)
{
if (mxFrame.is())
mxFrame->addFrameActionListener(this);
}
virtual ~FrameActionListener (void)
{
}
virtual void SAL_CALL disposing (void)
{
if (mxFrame.is())
mxFrame->removeFrameActionListener(this);
}
virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
throw (cssu::RuntimeException)
{
(void)rEvent;
mrControllerItem.ResetFrame();
mxFrame = NULL;
}
virtual void SAL_CALL frameAction (const css::frame::FrameActionEvent& rEvent)
throw (cssu::RuntimeException)
{
if (rEvent.Action == frame::FrameAction_CONTEXT_CHANGED)
mrControllerItem.NotifyFrameContextChange();
}
private:
sfx2::sidebar::ControllerItem& mrControllerItem;
Reference<frame::XFrame> mxFrame;
};
}
namespace sfx2 { namespace sidebar {
ControllerItem::ControllerItem (
const sal_uInt16 nInId,
const sal_uInt16 nSlotId,
SfxBindings &rBindings,
ItemUpdateReceiverInterface& rItemUpdateReceiver)
: SfxControllerItem(nInId, rBindings),
mrItemUpdateReceiver(rItemUpdateReceiver)
: SfxControllerItem(nSlotId, rBindings),
mrItemUpdateReceiver(rItemUpdateReceiver),
mxFrame(),
mxFrameActionListener(),
msCommandName()
{
}
ControllerItem::ControllerItem (
const sal_uInt16 nSlotId,
SfxBindings &rBindings,
ItemUpdateReceiverInterface& rItemUpdateReceiver,
const ::rtl::OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
: SfxControllerItem(nSlotId, rBindings),
mrItemUpdateReceiver(rItemUpdateReceiver),
mxFrame(rxFrame),
mxFrameActionListener(new FrameActionListener(*this, mxFrame)),
msCommandName(rsCommandName)
{
}
@@ -33,6 +121,8 @@ ControllerItem::ControllerItem (
ControllerItem::~ControllerItem (void)
{
if (mxFrameActionListener.is())
mxFrameActionListener->dispose();
}
@@ -43,12 +133,91 @@ void ControllerItem::StateChanged (
SfxItemState eState,
const SfxPoolItem* pState)
{
mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState);
mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState, IsEnabled());
}
bool ControllerItem::IsEnabled (void) const
{
if ( ! SvtCommandOptions().HasEntries(SvtCommandOptions::CMDOPTION_DISABLED))
{
// There are no disabled commands.
return true;
}
else if (msCommandName.getLength() == 0)
{
// We were not given a command name at construction and can
// not check the state now. Assume the best and return true.
return true;
}
else if (SvtCommandOptions().Lookup(SvtCommandOptions::CMDOPTION_DISABLED, msCommandName))
{
// The command is part of a list of disabled commands.
return false;
}
else
return true;
}
void ControllerItem::RequestUpdate (void)
{
SfxPoolItem* pState = NULL;
const SfxItemState eState (GetBindings().QueryState(GetId(), pState));
mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState, IsEnabled());
}
void ControllerItem::NotifyFrameContextChange (void)
{
RequestUpdate();
}
void ControllerItem::ResetFrame (void)
{
mxFrame = NULL;
}
::rtl::OUString ControllerItem::GetLabel (void) const
{
return CommandInfoProvider::Instance().GetLabelForCommand(
A2S(".uno:")+msCommandName,
mxFrame);
}
Image ControllerItem::GetIcon (void) const
{
return GetImage(mxFrame, A2S(".uno:")+msCommandName, sal_False);
}
ControllerItem::ItemUpdateReceiverInterface::~ItemUpdateReceiverInterface()
{
}
void ControllerItem::SetupToolBoxItem (ToolBox& rToolBox, const sal_uInt16 nIndex)
{
rToolBox.SetQuickHelpText(nIndex, GetLabel());
rToolBox.SetItemImage(nIndex, GetIcon());
}
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 2fdf0a2..f02b37c 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -30,23 +30,25 @@ SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR);
SidebarChildWindow::SidebarChildWindow (
Window* pSidebarParent,
Window* pParentWindow,
sal_uInt16 nId,
SfxBindings* pBindings,
SfxChildWinInfo* pInfo )
: SfxChildWindow(pSidebarParent, nId)
SfxChildWinInfo* pInfo)
: SfxChildWindow(pParentWindow, nId)
{
this->pWindow = new SidebarDockingWindow(
pBindings,
*this,
pSidebarParent,
pParentWindow,
WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
eChildAlignment = SFX_ALIGN_RIGHT;
this->pWindow->SetHelpId(HID_SIDEBAR_WINDOW);
this->pWindow->SetOutputSizePixel(Size(300, 450));
dynamic_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo);
SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pParentWindow);
if (pDockingParent != NULL)
pDockingParent->Initialize(pInfo);
SetHideNotDelete(sal_True);
this->pWindow->Show();
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index 420bb63..6279f09 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_Library_use_libraries,svx,\
cppu \
drawinglayer \
editeng \
fwk \
i18nlangtag \
sal \
sfx \
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx
index 0e746aa..ee8d0cc 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -735,8 +735,11 @@ void AreaPropertyPanel::ImpUpdateTransparencies()
void AreaPropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
const SfxPoolItem* pState,
const bool bIsEnabled)
{
(void)bIsEnabled;
XFillStyle eXFS;
SfxObjectShell* pSh = SfxObjectShell::Current();
bool bFillTransparenceChanged(false);
@@ -1042,6 +1045,7 @@ void AreaPropertyPanel::NotifyItemUpdate(
SfxBindings* AreaPropertyPanel::GetBindings()
{
return mpBindings;
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx
index 69617a0..4f8da6f 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.hxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx
@@ -65,7 +65,8 @@ public:
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState);
const SfxPoolItem* pState,
const bool bIsEnabled);
SfxBindings* GetBindings();
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
index 1e5103d..f55a408 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
@@ -272,8 +272,11 @@ void GraphicPropertyPanel::DataChanged(
void GraphicPropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
const SfxPoolItem* pState,
const bool bIsEnabled)
{
(void)bIsEnabled;
switch( nSID )
{
case SID_ATTR_GRAF_LUMINANCE:
@@ -439,6 +442,9 @@ void GraphicPropertyPanel::NotifyItemUpdate(
}
}
//////////////////////////////////////////////////////////////////////////////
SfxBindings* GraphicPropertyPanel::GetBindings()
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
index c5bd01c..d5e0c09 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
@@ -48,7 +48,8 @@ public:
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState);
const SfxPoolItem* pState,
const bool bIsEnabled);
SfxBindings* GetBindings();
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx
index d58ad83..4f39c5b 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -383,8 +383,11 @@ void LinePropertyPanel::DataChanged(
void LinePropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
const SfxPoolItem* pState,
const bool bIsEnabled)
{
(void)bIsEnabled;
switch(nSID)
{
case SID_ATTR_LINE_COLOR:
@@ -684,6 +687,7 @@ void LinePropertyPanel::NotifyItemUpdate(
SfxBindings* LinePropertyPanel::GetBindings()
{
return mpBindings;
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx
index 327c18e..ba77e5a 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.hxx
@@ -76,7 +76,8 @@ public:
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState);
const SfxPoolItem* pState,
const bool bIsEnabled);
SfxBindings* GetBindings();
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index 76dd922..c6b8809 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -1022,8 +1022,14 @@ IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl)
}
//==================================for Paragraph State change=====================
void ParaPropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
void ParaPropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState,
const bool bIsEnabled)
{
(void)bIsEnabled;
if( nSID == SID_ATTR_METRIC )
{
m_eMetricUnit = GetCurrentUnit(eState,pState);
@@ -1073,6 +1079,9 @@ void ParaPropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, SfxItemState eState,
}
}
void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
{
if( eState >= SFX_ITEM_AVAILABLE )
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
index 7d6677d..6a5aaa9 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
@@ -76,7 +76,8 @@ public:
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState);
const SfxPoolItem* pState,
const bool bIsEnabled);
void ShowMenu (void);
sal_uInt16 GetBulletTypeIndex(){ return mnBulletTypeIndex; }
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 03253735..ff95a4d 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -627,8 +627,11 @@ IMPL_LINK( PosSizePropertyPanel, FlipHdl, ToolBox*, pBox )
void PosSizePropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
const SfxPoolItem* pState,
const bool bIsEnabled)
{
(void)bIsEnabled;
mpFtAngle->Enable();
mpMtrAngle->Enable();
mpDial->Enable();
@@ -950,6 +953,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
SfxBindings* PosSizePropertyPanel::GetBindings()
{
return mpBindings;
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
index bbdff17..7beb082 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
@@ -61,7 +61,8 @@ public:
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState);
const SfxPoolItem* pState,
const bool bIsEnabled);
SfxBindings* GetBindings();
void ShowMenu (void);
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index 59fdfdc..96371ce 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -27,10 +27,14 @@
#include <sfx2/sidebar/Theme.hxx>
namespace svx { namespace sidebar {
TextCharacterSpacingControl::TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel)
TextCharacterSpacingControl::TextCharacterSpacingControl (
Window* pParent,
svx::sidebar::TextPropertyPanel& rPanel,
SfxBindings* pBindings)
: PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_SPACING))
, mrTextPropertyPanel(rPanel)
, mpBindings(NULL)
, mpBindings(pBindings)
, maVSSpacing (ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES(VS_SPACING))
, maLastCus (this, SVX_RES(FT_LASTCUSTOM))
//, maBorder (this, SVX_RES(CT_BORDER))
@@ -59,7 +63,6 @@ TextCharacterSpacingControl::TextCharacterSpacingControl(Window* pParent, svx::s
{
initial();
FreeResource();
mpBindings = mrTextPropertyPanel.GetBindings();
Link aLink = LINK(this, TextCharacterSpacingControl, KerningSelectHdl);
maLBKerning.SetSelectHdl(aLink);
aLink =LINK(this, TextCharacterSpacingControl, KerningModifyHdl);
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
index 89c0703..2e0aef9 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
@@ -37,11 +37,15 @@ namespace svx { namespace sidebar {
#define SIDEBAR_SPACE_NORMAL 0
#define SIDEBAR_SPACE_EXPAND 1
#define SIDEBAR_SPACE_CONDENSED 2
class TextCharacterSpacingControl:public svx::sidebar::PopupControl
{
public:
TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel);
~TextCharacterSpacingControl();
TextCharacterSpacingControl (
Window* pParent,
svx::sidebar::TextPropertyPanel& rPanel,
SfxBindings* pBindings);
virtual ~TextCharacterSpacingControl();
void ToGetFocus();
void Rearrange(bool bLBAvailable,bool bAvailable, long nKerning);
//virtual void Paint(const Rectangle& rect);
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index 79b2488..044bfa9 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -54,7 +54,6 @@
#include <svx/sidebar/ColorControl.hxx>
#include <svx/sidebar/PopupContainer.hxx>
#include <boost/bind.hpp>
using namespace css;
@@ -77,12 +76,12 @@ namespace svx { namespace sidebar {
//end
PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
{
return new TextCharacterSpacingControl(pParent, *this);
return new TextCharacterSpacingControl(pParent, *this, mpBindings);
}
PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
{
return new TextUnderlineControl(pParent, *this);
return new TextUnderlineControl(pParent, *this, mpBindings);
}
namespace
@@ -199,35 +198,21 @@ TextPropertyPanel::TextPropertyPanel (
mpFontColorUpdater(),
mpHighlightUpdater(),
maFontNameControl (SID_ATTR_CHAR_FONT, *pBindings, *this),
maFontSizeControl (SID_ATTR_CHAR_FONTHEIGHT, *pBindings, *this),
maWeightControl (SID_ATTR_CHAR_WEIGHT, *pBindings, *this),
maItalicControl (SID_ATTR_CHAR_POSTURE, *pBindings, *this),
maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this),
maStrikeControl (SID_ATTR_CHAR_STRIKEOUT, *pBindings, *this),
maShadowControl (SID_ATTR_CHAR_SHADOWED, *pBindings, *this),
maFontColorControl (SID_ATTR_CHAR_COLOR, *pBindings, *this),
maScriptControlSw (SID_ATTR_CHAR_ESCAPEMENT, *pBindings, *this), //for sw
maSuperScriptControl (SID_SET_SUPER_SCRIPT, *pBindings, *this),
maSubScriptControl (SID_SET_SUB_SCRIPT, *pBindings, *this),
maSpacingControl (SID_ATTR_CHAR_KERNING, *pBindings, *this),
maHighlightControl (SID_ATTR_BRUSH_CHAR, *pBindings, *this),
maSDFontGrow (SID_GROW_FONT_SIZE, *pBindings, *this),
maSDFontShrink (SID_SHRINK_FONT_SIZE, *pBindings, *this),
maImgIncrease (SVX_RES( IMG_INCREASE)),
maImgDecrease (SVX_RES( IMG_DECREASE)),
maImgBold (SVX_RES( IMG_BOLD )),
maImgItalic (SVX_RES( IMG_ITALIC )),
maImgUnderline (SVX_RES( IMG_UNDERLINE )),
maImgStrike (SVX_RES( IMG_STRIKEOUT )),
maImgShadow (SVX_RES( IMG_SHADOWED )),
maImgFontColor (SVX_RES( IMG_FONTCOLOR)),
maImgSupScript (SVX_RES( IMG_SUPSCRIPT)),
maImgSubScript (SVX_RES( IMG_SUBSCRIPT)),
maImgHighlight (SVX_RES( IMG_HIGHLIGHT)),
maImgNormalIcon (SVX_RES( IMG_SPACING_D)),
maFontNameControl (SID_ATTR_CHAR_FONT, *pBindings, *this, A2S("CharFontName"), rxFrame),
maFontSizeControl (SID_ATTR_CHAR_FONTHEIGHT, *pBindings, *this, A2S("FontHeight"), rxFrame),
maWeightControl (SID_ATTR_CHAR_WEIGHT, *pBindings, *this, A2S("Bold"), rxFrame),
maItalicControl (SID_ATTR_CHAR_POSTURE, *pBindings, *this, A2S("Italic"), rxFrame),
maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this, A2S("Underline"), rxFrame),
maStrikeControl (SID_ATTR_CHAR_STRIKEOUT, *pBindings, *this, A2S("Strikeout"), 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),
maSuperScriptControl(SID_SET_SUPER_SCRIPT, *pBindings, *this, A2S("SuperScript"), rxFrame),
maSubScriptControl (SID_SET_SUB_SCRIPT, *pBindings, *this, A2S("SubScript"), 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),
maSDFontShrink (SID_SHRINK_FONT_SIZE, *pBindings, *this, A2S("Shrink"), rxFrame),
mpFontList (NULL),
mbMustDelete (false),
@@ -238,7 +223,6 @@ TextPropertyPanel::TextPropertyPanel (
maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
mxFrame(rxFrame),
maContext(),
mpBindings(pBindings),
@@ -278,12 +262,6 @@ TextPropertyPanel::~TextPropertyPanel (void)
Image TextPropertyPanel::GetIcon (const ::rtl::OUString& rsURL)
{
return GetImage(mxFrame, rsURL, sal_False);
}
void TextPropertyPanel::SetSpacing(long nKern)
{
mlKerning = nKern;
@@ -382,17 +360,14 @@ void TextPropertyPanel::HandleContextChange (
}
}
SfxBindings* TextPropertyPanel::GetBindings()
{
return mpBindings;
}
void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
{
(void)rEvent;
SetupIcons();
SetupToolboxItems();
}
@@ -410,7 +385,7 @@ void TextPropertyPanel::Initialize (void)
else
{
mpFontList = new FontList( Application::GetDefaultDevice() );
mbMustDelete = 1;
mbMustDelete = true;
}
mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
@@ -419,7 +394,7 @@ void TextPropertyPanel::Initialize (void)
maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
//toolbox
SetupIcons();
SetupToolboxItems();
InitToolBoxIncDec();
InitToolBoxFont();
InitToolBoxFontColor();
@@ -513,9 +488,6 @@ void TextPropertyPanel::EndUnderlinePopupMode (void)
void TextPropertyPanel::InitToolBoxFont()
{
mpToolBoxFont->SetQuickHelpText(TBI_BOLD,String(SVX_RES(STR_QH_BOLD))); //Add
mpToolBoxFont->SetQuickHelpText(TBI_ITALIC,String(SVX_RES(STR_QH_ITALIC))); //Add
mpToolBoxFont->SetQuickHelpText(TBI_UNDERLINE,String(SVX_RES(STR_QH_UNDERLINE))); //Add
mpToolBoxFont->SetBackground(Wallpaper());
mpToolBoxFont->SetPaintTransparent(true);
@@ -592,48 +564,26 @@ void TextPropertyPanel::InitToolBoxHighlight()
void TextPropertyPanel::SetupIcons (void)
void TextPropertyPanel::SetupToolboxItems (void)
{
if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
{
mpToolBoxIncDec->SetItemImage(TBI_INCREASE, maImgIncrease);
mpToolBoxIncDec->SetItemImage(TBI_DECREASE, maImgDecrease);
mpToolBoxFont->SetItemImage(TBI_BOLD, maImgBold);
mpToolBoxFont->SetItemImage(TBI_ITALIC, maImgItalic);
mpToolBoxFont->SetItemImage(TBI_UNDERLINE, maImgUnderline);
mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, maImgStrike);
mpToolBoxFont->SetItemImage(TBI_SHADOWED, maImgShadow);
maSDFontGrow.SetupToolBoxItem(*mpToolBoxIncDec, TBI_INCREASE);
maSDFontShrink.SetupToolBoxItem(*mpToolBoxIncDec, TBI_DECREASE);
mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, maImgFontColor);
//for sw
mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, maImgSupScript);
mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, maImgSubScript);
//for sc and sd
mpToolBoxScript->SetItemImage(TBI_SUPER, maImgSupScript);
mpToolBoxScript->SetItemImage(TBI_SUB, maImgSubScript);
mpToolBoxSpacing->SetItemImage(TBI_SPACING, maImgNormalIcon);
mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, maImgHighlight);
}
else
{
mpToolBoxIncDec->SetItemImage(TBI_INCREASE, GetIcon(A2S(".uno:Grow")));
mpToolBoxIncDec->SetItemImage(TBI_DECREASE, GetIcon(A2S(".uno:Shrink")));
mpToolBoxFont->SetItemImage(TBI_BOLD, GetIcon(A2S(".uno:Bold")));
mpToolBoxFont->SetItemImage(TBI_ITALIC, GetIcon(A2S(".uno:Italic")));
mpToolBoxFont->SetItemImage(TBI_UNDERLINE, GetIcon(A2S(".uno:Underline")));
mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, GetIcon(A2S(".uno:Strikeout")));
mpToolBoxFont->SetItemImage(TBI_SHADOWED, GetIcon(A2S(".uno:Shadowed")));
maWeightControl.SetupToolBoxItem(*mpToolBoxFont, TBI_BOLD);
maItalicControl.SetupToolBoxItem(*mpToolBoxFont, TBI_ITALIC);
maUnderlineControl.SetupToolBoxItem(*mpToolBoxFont, TBI_UNDERLINE);
maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT);
maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED);
mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, GetIcon(A2S(".uno:FontColor")));
//for sw
mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, GetIcon(A2S(".uno:SuperScript")));
mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, GetIcon(A2S(".uno:SubScript")));
//for sc and sd
mpToolBoxScript->SetItemImage(TBI_SUPER, GetIcon(A2S(".uno:SuperScript")));
mpToolBoxScript->SetItemImage(TBI_SUB, GetIcon(A2S(".uno:SubScript")));
mpToolBoxSpacing->SetItemImage(TBI_SPACING, GetIcon(A2S(".uno:FontworkCharacterSpacingFloater")));
mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, GetIcon(A2S(".uno:BackColor")));
}
maFontColorControl.SetupToolBoxItem(*mpToolBoxFontColor, TBI_FONTCOLOR);
//for sw
maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW);
maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW);
//for sc and sd
maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER);
maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB);
maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING);
maHighlightControl.SetupToolBoxItem(*mpToolBoxHighlight, TBI_HIGHLIGHT);
}
@@ -700,78 +650,71 @@ IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
{
const sal_uInt16 nId = pToolBox->GetCurItemId();
//Bold
if(nId == TBI_BOLD)
switch (nId)
{
EndTracking();
if(meWeight != WEIGHT_BOLD)
meWeight = WEIGHT_BOLD;
else
meWeight = WEIGHT_NORMAL;
SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
UpdateFontBold();
}
//Italic
else if(nId == TBI_ITALIC)
{
EndTracking();
if(meItalic != ITALIC_NORMAL)
meItalic = ITALIC_NORMAL;
else
meItalic = ITALIC_NONE;
SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
UpdateFontItalic();
}
//underline
else if(nId == TBI_UNDERLINE)
{
EndTracking();
//add , keep underline's color
if(meUnderline == UNDERLINE_NONE)
case TBI_BOLD:
{
//AF: meUnderline = GetDefaultUnderline();
meUnderline = UNDERLINE_SINGLE;
//<<modify
//SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
//modify end>>
aLineItem.SetColor(meUnderlineColor);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
EndTracking();
if(meWeight != WEIGHT_BOLD)
meWeight = WEIGHT_BOLD;
else
meWeight = WEIGHT_NORMAL;
SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
UpdateItem(SID_ATTR_CHAR_WEIGHT);
break;
}
else
case TBI_ITALIC:
{
meUnderline = UNDERLINE_NONE;
//<<modify
//SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
//modify end>>
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
EndTracking();
if(meItalic != ITALIC_NORMAL)
meItalic = ITALIC_NORMAL;
else
meItalic = ITALIC_NONE;
SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
UpdateItem(SID_ATTR_CHAR_POSTURE);
break;
}
UpdateFontUnderline();
//add end
}
//strike out
else if(nId == TBI_STRIKEOUT)
{
EndTracking();
if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
meStrike = STRIKEOUT_NONE;
else
meStrike = STRIKEOUT_SINGLE;
SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
UpdateFontStrikeOut();
}
//shadowed
else if(nId == TBI_SHADOWED)
{
EndTracking();
mbShadow = !mbShadow;
SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
UpdateFontShadowed();
case TBI_UNDERLINE:
{
EndTracking();
if(meUnderline == UNDERLINE_NONE)
{
meUnderline = UNDERLINE_SINGLE;
SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
aLineItem.SetColor(meUnderlineColor);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
}
else
{
meUnderline = UNDERLINE_NONE;
SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
}
UpdateItem(SID_ATTR_CHAR_UNDERLINE);
}
case TBI_STRIKEOUT:
{
EndTracking();
if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
meStrike = STRIKEOUT_NONE;
else
meStrike = STRIKEOUT_SINGLE;
SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
UpdateItem(SID_ATTR_CHAR_STRIKEOUT);
break;
}
case TBI_SHADOWED:
{
EndTracking();
mbShadow = !mbShadow;
SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
UpdateItem(SID_ATTR_CHAR_SHADOWED);
break;
}
}
return 0;
}
@@ -784,22 +727,15 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
const sal_uInt16 nId = pToolBox->GetCurItemId();
// font size +/- enhancement in sd
switch (maContext.GetCombinedContext())
switch (maContext.GetCombinedContext_DI())
{
case CombinedEnumContext(Application_Draw, Context_DrawText):
case CombinedEnumContext(Application_Draw, Context_Text):
case CombinedEnumContext(Application_Draw, Context_Table):
case CombinedEnumContext(Application_Draw, Context_OutlineText):
case CombinedEnumContext(Application_Draw, Context_Draw):
case CombinedEnumContext(Application_Draw, Context_TextObject):
case CombinedEnumContext(Application_Draw, Context_Graphic):
case CombinedEnumContext(Application_Impress, Context_DrawText):
case CombinedEnumContext(Application_Impress, Context_Text):
case CombinedEnumContext(Application_Impress, Context_Table):
case CombinedEnumContext(Application_Impress, Context_OutlineText):
case CombinedEnumContext(Application_Impress, Context_Draw):
case CombinedEnumContext(Application_Impress, Context_TextObject):
case CombinedEnumContext(Application_Impress, Context_Graphic):
case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
case CombinedEnumContext(Application_DrawImpress, Context_Text):
case CombinedEnumContext(Application_DrawImpress, Context_Table):
case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
case CombinedEnumContext(Application_DrawImpress, Context_Draw):
case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
if(nId == TBI_INCREASE)
{
EndTracking();
@@ -846,24 +782,7 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
//add , update ASAP
maFontSizeBox.SetValue( nSize );
if(nSize >= 960)
{
mpToolBoxIncDec->EnableItem(TBI_INCREASE,false);
mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
}
else if(nSize <= 60)
{
mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
mpToolBoxIncDec->EnableItem(TBI_DECREASE,false);
}
else
{
mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
}
//add end
}
else if(nId == TBI_DECREASE)
{
@@ -900,26 +819,11 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
//add
maFontSizeBox.SetValue( nSize );
if(nSize >= 960)
{
mpToolBoxIncDec->EnableItem(TBI_INCREASE,false);
mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
}
else if(nSize <= 60)
{
mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
mpToolBoxIncDec->EnableItem(TBI_DECREASE,false);
}
else
{
mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
}
//add end
}
}
UpdateItem(SID_ATTR_CHAR_FONTHEIGHT);
return 0;
}
@@ -993,7 +897,7 @@ IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
}
}
UpdateFontScript();
UpdateItem(SID_ATTR_CHAR_ESCAPEMENT);
return 0;
}
@@ -1009,6 +913,7 @@ IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
mbSuper = !mbSuper;
SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper);
mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
UpdateItem(SID_SET_SUPER_SCRIPT);
}
else if(TBI_SUB == nId)
{
@@ -1016,8 +921,8 @@ IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
mbSub = !mbSub;
SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub );
mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
UpdateItem(SID_SET_SUB_SCRIPT);
}
UpdateFontScript();
return 0;
}
@@ -1066,21 +971,19 @@ IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
void TextPropertyPanel::NotifyItemUpdate (
const sal_uInt16 nSID,
const SfxItemState eState,
const SfxPoolItem* pState)
const SfxPoolItem* pState,
const bool bIsEnabled)
{
switch(nSID)
{
case SID_ATTR_CHAR_FONT:
{
bool bIsControlEnabled (bIsEnabled);
if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
{
mpFontNameBox->Enable();
const SvxFontItem* pFontItem = (const SvxFontItem*)pState;
mpFontNameBox->SetText( pFontItem->GetFamilyName() );
}
@@ -1088,12 +991,14 @@ void TextPropertyPanel::NotifyItemUpdate (
{
mpFontNameBox->SetText( String() );
if (SFX_ITEM_DISABLED == eState)
{
mpFontNameBox->Disable();
}
bIsControlEnabled = false;
}
mpFontNameBox->Enable(bIsControlEnabled);
break;
}
case SID_ATTR_CHAR_FONTHEIGHT:
{
bool bIsControlEnabled (bIsEnabled);
if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
{
mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem*
@@ -1101,51 +1006,17 @@ void TextPropertyPanel::NotifyItemUpdate (
long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 );
mpToolBoxIncDec->Enable();
// font size +/- enhancement in sd
switch(maContext.GetCombinedContext())
{
case CombinedEnumContext(Application_Draw, Context_DrawText):
case CombinedEnumContext(Application_Draw, Context_Text):
case CombinedEnumContext(Application_Draw, Context_Table):
case CombinedEnumContext(Application_Draw, Context_OutlineText):
case CombinedEnumContext(Application_Draw, Context_Draw):
case CombinedEnumContext(Application_Draw, Context_TextObject):
case CombinedEnumContext(Application_Draw, Context_Graphic):
case CombinedEnumContext(Application_Impress, Context_DrawText):
case CombinedEnumContext(Application_Impress, Context_Text):
case CombinedEnumContext(Application_Impress, Context_Table):
case CombinedEnumContext(Application_Impress, Context_OutlineText):
case CombinedEnumContext(Application_Impress, Context_Draw):
case CombinedEnumContext(Application_Impress, Context_TextObject):
case CombinedEnumContext(Application_Impress, Context_Graphic):
break;
default:
if(iValue > 60 && iValue < 960 )
{
mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
}
else if (iValue <= 60)
{
mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
mpToolBoxIncDec->EnableItem(TBI_DECREASE,false);
}
else if (iValue >= 960)
{
mpToolBoxIncDec->EnableItem(TBI_INCREASE,false);
mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
}
}
mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK);
mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK);
if( mbFocusOnFontSizeCtrl )
return;
maFontSizeBox.Enable( );
maFontSizeBox.SetValue( iValue );
maFontSizeBox.LoseFocus();
UpdateItem(SID_SHRINK_FONT_SIZE);
UpdateItem(SID_GROW_FONT_SIZE);
}
else
{
@@ -1154,118 +1025,106 @@ void TextPropertyPanel::NotifyItemUpdate (
//increase decrease diabled when multi-seletion have different font size
// font size +/- enhancement in sd
switch(maContext.GetCombinedContext())
switch(maContext.GetCombinedContext_DI())
{
case CombinedEnumContext(Application_Draw, Context_DrawText):
case CombinedEnumContext(Application_Draw, Context_Text):
case CombinedEnumContext(Application_Draw, Context_Table):
case CombinedEnumContext(Application_Draw, Context_OutlineText):
case CombinedEnumContext(Application_Draw, Context_Draw):
case CombinedEnumContext(Application_Draw, Context_TextObject):
case CombinedEnumContext(Application_Draw, Context_Graphic):
case CombinedEnumContext(Application_Impress, Context_DrawText):
case CombinedEnumContext(Application_Impress, Context_Text):
case CombinedEnumContext(Application_Impress, Context_Table):
case CombinedEnumContext(Application_Impress, Context_OutlineText):
case CombinedEnumContext(Application_Impress, Context_Draw):
case CombinedEnumContext(Application_Impress, Context_TextObject):
case CombinedEnumContext(Application_Impress, Context_Graphic):
case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
case CombinedEnumContext(Application_DrawImpress, Context_Text):
case CombinedEnumContext(Application_DrawImpress, Context_Table):
case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
case CombinedEnumContext(Application_DrawImpress, Context_Draw):
case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
break;
default:
mpToolBoxIncDec->Disable();
}
if ( eState <= SFX_ITEM_READONLY )
{
maFontSizeBox.Disable( );
}
bIsControlEnabled = false;
}
maFontSizeBox.Enable(bIsControlEnabled);
break;
}
case SID_ATTR_CHAR_WEIGHT:
mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE);
if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem))
{
const SvxWeightItem* pItem = (const SvxWeightItem*)pState;
meWeight = (FontWeight)pItem->GetValue();
TextStyleChanged();
}
else
{
meWeight = WEIGHT_NORMAL;
TextStyleChanged();
}
mpToolBoxFont->EnableItem(TBI_BOLD, mbWeightAvailable && bIsEnabled);
mpToolBoxFont->SetItemState(TBI_BOLD, meWeight==WEIGHT_BOLD ? STATE_CHECK : STATE_NOCHECK);
break;
case SID_ATTR_CHAR_POSTURE:
mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE);
if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem))
{
const SvxPostureItem* pItem = (const SvxPostureItem*)pState;
meItalic = (FontItalic)pItem->GetValue();
TextStyleChanged();
}
else
{
meItalic = ITALIC_NONE;
TextStyleChanged();
}
mpToolBoxFont->EnableItem(TBI_ITALIC, mbPostureAvailable && bIsEnabled);
mpToolBoxFont->SetItemState(TBI_ITALIC, meItalic==ITALIC_NORMAL ? STATE_CHECK : STATE_NOCHECK);
break;
case SID_ATTR_CHAR_UNDERLINE:
if( eState >= SFX_ITEM_DEFAULT) //SvxUnderlineItem
if( eState >= SFX_ITEM_DEFAULT)
{
//<<delete
//if(pState->ISA(SvxTextLineItem))
//{
// const SvxTextLineItem* pItem = (const SvxTextLineItem*)pState;
// meUnderline = (FontUnderline)pItem->GetValue();
// //add , need to record the underline's color, if not the color will turn to auto
// meUnderlineColor = pItem->GetColor();
// //add end
//}
//else
//delete end>>
if(pState->ISA(SvxUnderlineItem))
{
const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
meUnderline = (FontUnderline)pItem->GetValue();
//add
meUnderlineColor = pItem->GetColor();
//add end
}
TextStyleChanged();
}
else
{
meUnderline = UNDERLINE_NONE;
TextStyleChanged();
}
mpToolBoxFont->EnableItem(TBI_UNDERLINE, bIsEnabled);
mpToolBoxFont->SetItemState(TBI_UNDERLINE, meUnderline==UNDERLINE_NONE ? STATE_NOCHECK : STATE_CHECK);
break;
case SID_ATTR_CHAR_SHADOWED:
if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem))
{
const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState;
mbShadow = pItem->GetValue();
TextStyleChanged();
}
else
{
mbShadow = false;
TextStyleChanged();
}
mpToolBoxFont->EnableItem(TBI_SHADOWED, bIsEnabled);
mpToolBoxFont->SetItemState(TBI_SHADOWED, mbShadow ? STATE_CHECK : STATE_NOCHECK);
break;
case SID_ATTR_CHAR_STRIKEOUT:
if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem))
{
const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState;
meStrike = (FontStrikeout)pItem->GetValue();
TextStyleChanged();
}
else
{
meStrike = STRIKEOUT_NONE;
TextStyleChanged();
}
mpToolBoxFont->EnableItem(TBI_STRIKEOUT, bIsEnabled);
mpToolBoxFont->SetItemState(TBI_STRIKEOUT,
meStrike!=STRIKEOUT_NONE && meStrike!=STRIKEOUT_DONTKNOW
? STATE_CHECK
: STATE_NOCHECK);
break;
case SID_ATTR_CHAR_COLOR:
if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
{
@@ -1282,7 +1141,9 @@ void TextPropertyPanel::NotifyItemUpdate (
if (mpFontColorUpdater)
mpFontColorUpdater->Update(maColor);
}
mpToolBoxFontColor->EnableItem(TBI_FONTCOLOR, bIsEnabled);
break;
case SID_ATTR_BRUSH_CHAR:
if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem))
{
@@ -1299,64 +1160,85 @@ void TextPropertyPanel::NotifyItemUpdate (
if (mpHighlightUpdater)
mpHighlightUpdater->Update(maBackColor);
}
mpToolBoxHighlight->EnableItem(TBI_HIGHLIGHT, bIsEnabled);
break;
case SID_ATTR_CHAR_ESCAPEMENT:
if( eState == SFX_ITEM_AVAILABLE)
{
bool bIsItemEnabled (true);
if (eState == SFX_ITEM_AVAILABLE)
{
if( pState->ISA(SvxEscapementItem))
if (pState->ISA(SvxEscapementItem))
{
const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState;
short nEsc = pItem->GetEsc();
if(nEsc == 0)
{
meEscape = SVX_ESCAPEMENT_OFF;
mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
}
else if(nEsc > 0)
{
meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
}
else
{
meEscape = SVX_ESCAPEMENT_SUBSCRIPT;
mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK);
}
}
else
{
meEscape = SVX_ESCAPEMENT_OFF;
mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
}
TextStyleChanged();
}
else if(eState == SFX_ITEM_DISABLED)
else if (eState == SFX_ITEM_DISABLED)
{
mpToolBoxScriptSw->EnableItem(TBI_SUPER,false);
mpToolBoxScriptSw->EnableItem(TBI_SUB,false);
bIsItemEnabled = false;
}
else
{
meEscape = SVX_ESCAPEMENT_OFF;
TextStyleChanged();
}
mpToolBoxScriptSw->EnableItem(TBI_SUPER, bIsItemEnabled && bIsEnabled);
mpToolBoxScriptSw->EnableItem(TBI_SUB, bIsItemEnabled && bIsEnabled);
break;
}
case SID_SET_SUB_SCRIPT:
if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
{
const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
mbSub = pItem->GetValue();
TextStyleChanged();
}
else
{
mbSub = false;
TextStyleChanged();
}
mpToolBoxScript->EnableItem(TBI_SUB, bIsEnabled);
mpToolBoxScript->SetItemState(TBI_SUB, mbSub ? STATE_CHECK : STATE_NOCHECK);
break;
case SID_SET_SUPER_SCRIPT:
if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
{
const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
mbSuper = pItem->GetValue();
TextStyleChanged();
}
else
{
mbSuper = false;
TextStyleChanged();
}
mpToolBoxScript->EnableItem(TBI_SUPER, bIsEnabled);
mpToolBoxScript->SetItemState(TBI_SUPER, mbSuper ? STATE_CHECK : STATE_NOCHECK);
break;
case SID_ATTR_CHAR_KERNING:
if ( SFX_ITEM_AVAILABLE == eState )
{
@@ -1386,162 +1268,94 @@ void TextPropertyPanel::NotifyItemUpdate (
mbKernAvailable = false;
mlKerning = 0;
}
mpToolBoxSpacing->EnableItem(TBI_SPACING, bIsEnabled);
break;
// font size +/- enhancement in sd
case SID_SHRINK_FONT_SIZE:
case SID_GROW_FONT_SIZE:
switch(maContext.GetCombinedContext())
{
case CombinedEnumContext(Application_Draw, Context_DrawText):
case CombinedEnumContext(Application_Draw, Context_Text):
case CombinedEnumContext(Application_Draw, Context_Table):
case CombinedEnumContext(Application_Draw, Context_OutlineText):
case CombinedEnumContext(Application_Draw, Context_Draw):
case CombinedEnumContext(Application_Draw, Context_TextObject):
case CombinedEnumContext(Application_Draw, Context_Graphic):
case CombinedEnumContext(Application_Impress, Context_DrawText):
case CombinedEnumContext(Application_Impress, Context_Text):
case CombinedEnumContext(Application_Impress, Context_Table):
case CombinedEnumContext(Application_Impress, Context_OutlineText):
case CombinedEnumContext(Application_Impress, Context_Draw):
case CombinedEnumContext(Application_Impress, Context_TextObject):
case CombinedEnumContext(Application_Impress, Context_Graphic):
if(eState == SFX_ITEM_DISABLED)
{
mpToolBoxIncDec->Disable();
}
else
{
mpToolBoxIncDec->Enable();
}
break;
}
switch(maContext.GetCombinedContext_DI())
{
case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
case CombinedEnumContext(Application_DrawImpress, Context_Text):
case CombinedEnumContext(Application_DrawImpress, Context_Table):
case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
case CombinedEnumContext(Application_DrawImpress, Context_Draw):
case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
if(eState == SFX_ITEM_DISABLED)
mpToolBoxIncDec->Disable();
else
mpToolBoxIncDec->Enable();
break;
}
const sal_Int32 nSize (maFontSizeBox.GetValue());
if (nSID == SID_GROW_FONT_SIZE)
mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nSize<960);
else
mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nSize>60);
break;
}
}
void TextPropertyPanel::TextStyleChanged()
void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
{
if( !mbWeightAvailable )
mpToolBoxFont->EnableItem(TBI_BOLD,false);
else
mpToolBoxFont->EnableItem(TBI_BOLD,true);
if(!mbPostureAvailable )
mpToolBoxFont->EnableItem(TBI_ITALIC,false);
else
mpToolBoxFont->EnableItem(TBI_ITALIC,true);
UpdateFontBold();
UpdateFontItalic();
UpdateFontUnderline();
UpdateFontStrikeOut();
UpdateFontShadowed();
UpdateFontScript();
switch (nSlotId)
{
case SID_ATTR_CHAR_FONT:
maFontNameControl.RequestUpdate();
break;
case SID_ATTR_CHAR_FONTHEIGHT:
maFontSizeControl.RequestUpdate();
break;
case SID_ATTR_CHAR_WEIGHT:
maWeightControl.RequestUpdate();
break;
case SID_ATTR_CHAR_POSTURE:
maItalicControl.RequestUpdate();
break;
case SID_ATTR_CHAR_UNDERLINE:
maUnderlineControl.RequestUpdate();
break;
case SID_ATTR_CHAR_STRIKEOUT:
maStrikeControl.RequestUpdate();
break;
case SID_ATTR_CHAR_SHADOWED:
maShadowControl.RequestUpdate();
break;
case SID_ATTR_CHAR_COLOR:
maFontColorControl.RequestUpdate();
break;
case SID_ATTR_CHAR_ESCAPEMENT:
maScriptControlSw.RequestUpdate();
break;
case SID_SET_SUPER_SCRIPT:
maSuperScriptControl.RequestUpdate();
break;
case SID_SET_SUB_SCRIPT:
maSubScriptControl.RequestUpdate();
break;
case SID_ATTR_CHAR_KERNING:
maSpacingControl.RequestUpdate();
break;
case SID_ATTR_BRUSH_CHAR:
maHighlightControl.RequestUpdate();
break;
case SID_GROW_FONT_SIZE:
maSDFontGrow.RequestUpdate();
break;
case SID_SHRINK_FONT_SIZE:
maSDFontShrink.RequestUpdate();
break;
}
}
void TextPropertyPanel::UpdateFontBold()
{
if( meWeight == WEIGHT_BOLD )
{
mpToolBoxFont->SetItemState(TBI_BOLD, STATE_CHECK);
}
else
{
mpToolBoxFont->SetItemState(TBI_BOLD, STATE_NOCHECK);
}
}
void TextPropertyPanel::UpdateFontItalic()
{
if(meItalic == ITALIC_NORMAL)
{
mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_CHECK);
}
else
{
mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_NOCHECK);
}
}
void TextPropertyPanel::UpdateFontUnderline()
{
if(meUnderline == UNDERLINE_NONE)
{
mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_NOCHECK);
}
else
{
mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_CHECK);
}
}
void TextPropertyPanel::UpdateFontStrikeOut()
{
if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
{
mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_CHECK);
}
else
{
mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_NOCHECK);
}
}
void TextPropertyPanel::UpdateFontShadowed()
{
if(mbShadow)
{
mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_CHECK);
}
else
{
mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_NOCHECK);
}
}
void TextPropertyPanel::UpdateFontScript()
{
//script for sw
mpToolBoxScriptSw->EnableItem(TBI_SUPER,true);
mpToolBoxScriptSw->EnableItem(TBI_SUB,true);
if(meEscape == SVX_ESCAPEMENT_SUPERSCRIPT)
{
mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
}
else if(meEscape == SVX_ESCAPEMENT_SUBSCRIPT)
{
mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK);
}
else
{
mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
}
//script for sc sd
mpToolBoxScript->EnableItem(TBI_SUPER,true);
mpToolBoxScript->EnableItem(TBI_SUB,true);
if(mbSuper)
{
mpToolBoxScript->SetItemState(TBI_SUPER, STATE_CHECK);
mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK);
}
else if(mbSub)
{
mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK);
mpToolBoxScript->SetItemState(TBI_SUB, STATE_CHECK);
}
else
{
mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK);
mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK);
}
}
void TextPropertyPanel::SetFontColor (
const String& /*rsColorName*/,
@@ -1571,4 +1385,6 @@ void TextPropertyPanel::SetUnderline(FontUnderline eUnderline)
meUnderline = eUnderline;
}
} } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hrc b/svx/source/sidebar/text/TextPropertyPanel.hrc
index bfa0c821..146d51c 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hrc
+++ b/svx/source/sidebar/text/TextPropertyPanel.hrc
@@ -36,19 +36,6 @@
#define TB_SCRIPT 10
#define IMG_INCREASE 11
#define IMG_DECREASE 13
#define IMG_BOLD 15
#define IMG_ITALIC 17
#define IMG_UNDERLINE 19
#define IMG_STRIKEOUT 21
#define IMG_SHADOWED 23
#define IMG_FONTCOLOR 25
#define IMG_SUPSCRIPT 27
#define IMG_SUBSCRIPT 29
//#define IMG_SPACING 31
#define IMG_HIGHLIGHT 33
#define TBI_FONTCOLOR 50
#define TBI_BOLD 51
#define TBI_ITALIC 52
@@ -149,9 +136,6 @@
#define STR_CUSTOM_C_TIP 72
#define STR_CUSTOM_E_TIP 73
#define STR_PT 74
#define STR_QH_BOLD 75
#define STR_QH_ITALIC 76
#define STR_QH_UNDERLINE 77
//help ids
#define HID_COMBO_FONT_NAME "SVX_HID_COMBO_FONT_NAME"
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx
index b842e4f..4666918 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -59,7 +59,6 @@ public:
const cssu::Reference<css::ui::XSidebar>& rxSidebar);
virtual void DataChanged (const DataChangedEvent& rEvent);
SfxBindings* GetBindings();
::sfx2::sidebar::ControllerItem& GetSpaceController();
long GetSelFontSize();
void SetSpacing(long nKern);
@@ -81,10 +80,14 @@ public:
virtual void HandleContextChange (
const ::sfx2::sidebar::EnumContext aContext);
// ControllerItem::ItemUpdateReceiverInterface
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState);
const SfxPoolItem* pState,
const bool bIsEnabled);
private:
//ui controls
@@ -124,21 +127,6 @@ private:
::sfx2::sidebar::ControllerItem maSDFontGrow;
::sfx2::sidebar::ControllerItem maSDFontShrink;
//Images
Image maImgIncrease;
Image maImgDecrease;
Image maImgBold;
Image maImgItalic;
Image maImgUnderline;
Image maImgStrike;
Image maImgShadow;
Image maImgFontColor;
Image maImgSupScript;
Image maImgSubScript;
Image maImgHighlight;
Image maImgNormalIcon;
FontWeight meWeight;
FontItalic meItalic;
FontUnderline meUnderline;
@@ -191,7 +179,7 @@ private:
DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
void Initialize (void);
void SetupIcons (void);
void SetupToolboxItems (void);
void InitToolBoxFont();
void InitToolBoxIncDec();
void InitToolBoxFontColor();
@@ -199,13 +187,6 @@ private:
void InitToolBoxHighlight();
void InitToolBoxSpacing();
void UpdateFontBold();
void UpdateFontItalic();
void UpdateFontUnderline();
void UpdateFontStrikeOut();
void UpdateFontShadowed();
void UpdateFontScript();
DECL_LINK(FontSelHdl, FontNameBox *);
DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
DECL_LINK(FontSizeSelHdl, FontSizeBox *);
@@ -216,11 +197,7 @@ private:
DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
void TextStyleChanged();
Image GetIcon (const ::rtl::OUString& rsURL);
void UpdateItem (const sal_uInt16 nSlotId);
};
} } // end of namespace ::svx::sidebar
diff --git a/svx/source/sidebar/text/TextPropertyPanel.src b/svx/source/sidebar/text/TextPropertyPanel.src
index 633750f..3197bbc 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.src
+++ b/svx/source/sidebar/text/TextPropertyPanel.src
@@ -68,7 +68,6 @@ Control RID_SIDEBAR_TEXT_PANEL
Pos = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2, SECTIONPAGE_MARGIN_VERTICAL_TOP) ;
Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ;
TabStop = TRUE ;
// HelpID = HID_TB_INCREASE_DECREASE;
HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE;
Text = "Font Size Adjusting" ;
ItemList =
@@ -76,15 +75,11 @@ Control RID_SIDEBAR_TEXT_PANEL
ToolBoxItem
{
Identifier = TBI_INCREASE;
Text [ en-US ] = "Increase Font Size" ;
// HelpID = HID_TBI_INCREASE;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_INCREASE;
};
ToolBoxItem
{
Identifier = TBI_DECREASE;
Text [ en-US ] = "Decrease Font Size" ;
// HelpID = HID_TBI_DECREASE;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_DECREASE;
};
};
@@ -95,7 +90,6 @@ Control RID_SIDEBAR_TEXT_PANEL
Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 1) ;
Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 4 + TOOLBOX_ITEM_DD_WIDTH, TOOLBOX_ITEM_HEIGHT ) ;
TabStop = TRUE ;
// HelpID = HID_TB_FONT;
HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT;
Text = "Font Effects" ;
ItemList =
@@ -103,59 +97,34 @@ Control RID_SIDEBAR_TEXT_PANEL
ToolBoxItem
{
Identifier = TBI_BOLD;
Text [ en-US ] = "Bold" ;
// HelpID = HID_TBI_FONT_BOLD;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_BOLD;
};
ToolBoxItem
{
Identifier = TBI_ITALIC;
Text [ en-US ] = "Italic" ;
// HelpID = HID_TBI_FONT_ITALIC;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_ITALIC;
};
ToolBoxItem
{
Identifier = TBI_UNDERLINE;
DropDown = TRUE ;
Text [ en-US ] = "Underline" ;
// HelpID = HID_TBI_FONT_UNDERLINE;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE;
};
ToolBoxItem
{
Identifier = TBI_STRIKEOUT;
Text [ en-US ] = "Strikethrough" ;
// HelpID = HID_TBI_FONT_STRIKEOUT;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT;
};
ToolBoxItem
{
Identifier = TBI_SHADOWED;
Text [ en-US ] = "Shadow" ;
// HelpID = HID_TBI_FONT_SHADOWED;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED;
};
};
};
String STR_QH_BOLD
{
Text [ en-US ] = "Bold (Ctrl+B)";
};
String STR_QH_ITALIC
{
Text [ en-US ] = "Italic (Ctrl+I)";
};
String STR_QH_UNDERLINE
{
Text [ en-US ] = "Underline (Ctrl+U)";
};
ToolBox TB_FONTCOLOR
{
// HelpID = HID_TB_COLOR;
HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR;
SVLook = TRUE ;
Pos = MAP_APPFONT (PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 1) ;
@@ -167,10 +136,8 @@ Control RID_SIDEBAR_TEXT_PANEL
ToolBoxItem
{
Identifier = TBI_FONTCOLOR ;
// HelpID = HID_TBI_COLOR;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR;
DropDown = TRUE ;
Text [ en-US ] = "Font Color" ;
};
};
};
@@ -181,7 +148,6 @@ Control RID_SIDEBAR_TEXT_PANEL
Pos = MAP_APPFONT (PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + (TOOLBOX_ITEM_HEIGHT + 2) + CONTROL_SPACING_VERTICAL * 2 + 1) ;
Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
TabStop = TRUE ;
// HelpID = HID_TB_HIGHLIGHT;
HelpID = HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR;
Text = "Highlight Color" ;
ItemList =
@@ -189,10 +155,8 @@ Control RID_SIDEBAR_TEXT_PANEL
ToolBoxItem
{
Identifier = TBI_HIGHLIGHT ;
// HelpID = HID_TBI_HIGHLIGHT;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR;
DropDown = TRUE ;
Text [ en-US ] = "Highlight Color" ;
};
};
};
@@ -203,7 +167,6 @@ Control RID_SIDEBAR_TEXT_PANEL
Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ;
Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ;
TabStop = TRUE ;
// HelpID = HID_TB_SCRIPT_SW;
HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW;
Text = "Font Position" ;
ItemList =
@@ -211,15 +174,11 @@ Control RID_SIDEBAR_TEXT_PANEL
ToolBoxItem
{
Identifier = TBI_SUPER_SW;
Text [ en-US ] = "Superscript" ;
// HelpID = HID_TBI_SCRIPT_SW_SUPER;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW;
};
ToolBoxItem
{
Identifier = TBI_SUB_SW;
Text [ en-US ] = "Subscript" ;
// HelpID = HID_TBI_SCRIPT_SW_SUB;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW;
};
};
@@ -230,7 +189,6 @@ Control RID_SIDEBAR_TEXT_PANEL
Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ;
Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ;
TabStop = TRUE ;
// HelpID = HID_TB_SCRIPT;
HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT;
Text = "Font Position" ;
ItemList =
@@ -238,15 +196,11 @@ Control RID_SIDEBAR_TEXT_PANEL
ToolBoxItem
{
Identifier = TBI_SUPER;
Text [ en-US ] = "Superscript" ;
// HelpID = HID_TBI_SCRIPT_SUPER;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER;
};
ToolBoxItem
{
Identifier = TBI_SUB;
Text [ en-US ] = "Subscript" ;
// HelpID = HID_TBI_SCRIPT_SUB;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB;
};
};
@@ -266,67 +220,10 @@ Control RID_SIDEBAR_TEXT_PANEL
{
Identifier = TBI_SPACING;
DropDown = TRUE ;
Text [ en-US ] = "Character Spacing" ;
HelpID = HID_TBI_SPACING;
};
};
};
Image IMG_INCREASE
{
ImageBitmap = Bitmap{File = "symphony/enlarge font.png";};
// MaskColor = IMAGE_MASK_COLOR;
};
Image IMG_DECREASE
{
ImageBitmap = Bitmap{File = "symphony/decrease font.png";};
};
Image IMG_BOLD
{
ImageBitmap = Bitmap{File = "symphony/sc_bold.png";};//sc_bold.bmp
};
Image IMG_ITALIC
{
ImageBitmap = Bitmap{File = "symphony/sc_italic.png";};//sc_italic.bmp
};
Image IMG_UNDERLINE
{
ImageBitmap = Bitmap{File = "symphony/sc_underline.png";};//sc_underline.png
};
Image IMG_STRIKEOUT
{
ImageBitmap = Bitmap{File = "symphony/sc_strikeout.png";};//sc_strikeout.png
};
Image IMG_SHADOWED
{
ImageBitmap = Bitmap{File = "symphony/sc_shadowed.png";};//sc_shadowed.png
};
Image IMG_FONTCOLOR
{
ImageBitmap = Bitmap{File = "symphony/sc_color.png";};
};
Image IMG_SUPSCRIPT
{
ImageBitmap = Bitmap{File = "symphony/sc_superscript.png";};
};
Image IMG_SUBSCRIPT
{
ImageBitmap = Bitmap{File = "symphony/sc_subscript.png";};
};
// Image IMG_SPACING
// {
// ImageBitmap = Bitmap{File = "symphony/icon_normal.png";};
// };
Image IMG_HIGHLIGHT
{
ImageBitmap = Bitmap{File = "symphony/Highlight.png";};//sc_backcolor
};
//small icon for spacing
Image IMG_SPACING_D
{
ImageBitmap = Bitmap{File = "symphony/icon_normal.png";};
};
};
Control RID_POPUPPANEL_TEXTPAGE_UNDERLINE
@@ -338,7 +235,6 @@ Control RID_POPUPPANEL_TEXTPAGE_UNDERLINE
Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_UNDERLINE_WIDTH, 13+ VS_UNDERLINE_HEIGHT + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE);
Control VS_UNDERLINE
{
// HelpID = HID_UNDERLINE_VS ;
HelpID = HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS;
Hide = TRUE ;
Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y );
@@ -440,12 +336,6 @@ Control RID_POPUPPANEL_TEXTPAGE_UNDERLINE
ImageBitmap = Bitmap{File = "symphony/selected-line10.bmp";};
};
// //more button bmps
// Bitmap BMP_UNDERLINE_MORE
// {
// File = "symphony/morebutton.bmp";
// };
//tips
String STR_SINGLE
{
@@ -539,12 +429,6 @@ Control RID_POPUPPANEL_TEXTPAGE_SPACING
Text [ en-US ] = "Custom:" ;
};
//custom area
// Control CT_BORDER
// {
// Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X + 1 , OFFSET_Y + POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + TEXT_HEIGHT) ;
// Size = MAP_APPFONT (CUSTOM_WIDTH , CUSTOM_HEIGHT ) ;// TOOLBOX_42_42_ITEM_DD_WIDTH * 2 + TB_SPACE * 2 - 5 + TEXT_WIDTH - 2
// DialogControl = TRUE;
// };
FixedText FT_SPACING
{
Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE);
diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx
index 17e0c4b..7d92179 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.cxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.cxx
@@ -29,10 +29,13 @@
namespace svx { namespace sidebar {
TextUnderlineControl::TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel)
TextUnderlineControl::TextUnderlineControl (
Window* pParent,
svx::sidebar::TextPropertyPanel& rPanel,
SfxBindings* pBindings)
: svx::sidebar::PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_UNDERLINE))
, mrTextPropertyPanel(rPanel)
, mpBindings(NULL)
, mpBindings(pBindings)
, maVSUnderline( this, SVX_RES(VS_UNDERLINE))
, maPBOptions (this, SVX_RES(PB_OPTIONS) )
@@ -61,7 +64,6 @@ TextUnderlineControl::TextUnderlineControl(Window* pParent, svx::sidebar::TextPr
{
initial();
FreeResource();
mpBindings = mrTextPropertyPanel.GetBindings();
}
void TextUnderlineControl::initial()
diff --git a/svx/source/sidebar/text/TextUnderlineControl.hxx b/svx/source/sidebar/text/TextUnderlineControl.hxx
index 82bb9be..a57ee00 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.hxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.hxx
@@ -15,6 +15,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_
#define _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_
@@ -34,7 +35,10 @@ namespace svx{ namespace sidebar {
class TextUnderlineControl:public svx::sidebar::PopupControl
{
public:
TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel);
TextUnderlineControl (
Window* pParent,
svx::sidebar::TextPropertyPanel& rPanel,
SfxBindings* pBindings);
void GetFocus();
void Rearrange(FontUnderline eLine);
ValueSet& GetValueSet();
diff --git a/sw/source/ui/sidebar/PagePropertyPanel.cxx b/sw/source/ui/sidebar/PagePropertyPanel.cxx
index b731114..864742d 100644
--- a/sw/source/ui/sidebar/PagePropertyPanel.cxx
+++ b/sw/source/ui/sidebar/PagePropertyPanel.cxx
@@ -490,8 +490,11 @@ void PagePropertyPanel::ClosePageColumnPopup()
void PagePropertyPanel::NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState)
const SfxPoolItem* pState,
const bool bIsEnabled)
{
(void)bIsEnabled;
switch( nSId )
{
case SID_ATTR_PAGE_COLUMN:
diff --git a/sw/source/ui/sidebar/PagePropertyPanel.hxx b/sw/source/ui/sidebar/PagePropertyPanel.hxx
index 311f0ee..267c99e 100644
--- a/sw/source/ui/sidebar/PagePropertyPanel.hxx
+++ b/sw/source/ui/sidebar/PagePropertyPanel.hxx
@@ -61,7 +61,8 @@ namespace sw { namespace sidebar {
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState );
const SfxPoolItem* pState,
const bool bIsEnabled);
SfxBindings* GetBindings() const
{
diff --git a/sw/source/ui/sidebar/WrapPropertyPanel.cxx b/sw/source/ui/sidebar/WrapPropertyPanel.cxx
index d3d9a83..c185d95 100644
--- a/sw/source/ui/sidebar/WrapPropertyPanel.cxx
+++ b/sw/source/ui/sidebar/WrapPropertyPanel.cxx
@@ -181,8 +181,11 @@ IMPL_LINK(WrapPropertyPanel, WrapTypeHdl, void *, EMPTYARG)
void WrapPropertyPanel::NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState )
const SfxPoolItem* pState,
const bool bIsEnabled)
{
(void)bIsEnabled;
if ( eState == SFX_ITEM_AVAILABLE &&
pState->ISA(SfxBoolItem) )
{
diff --git a/sw/source/ui/sidebar/WrapPropertyPanel.hxx b/sw/source/ui/sidebar/WrapPropertyPanel.hxx
index fb30dda..415e880 100644
--- a/sw/source/ui/sidebar/WrapPropertyPanel.hxx
+++ b/sw/source/ui/sidebar/WrapPropertyPanel.hxx
@@ -43,7 +43,8 @@ namespace sw { namespace sidebar {
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
const SfxPoolItem* pState );
const SfxPoolItem* pState,
const bool bIsEnabled);
private:
WrapPropertyPanel(