[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 8 commits - default_images/res framework/source icu/icu4c-4_0_1-src.patch officecfg/registry sc/source sfx2/inc sfx2/Library_sfx.mk sfx2/source svx/Library_svx.mk svx/source sw/source uui/source vcl/inc vcl/source
Pavel JanÃk
paveljanik at apache.org
Fri Apr 19 16:33:22 PDT 2013
default_images/res/commandimagelist/lc_characterbackgroundpattern.png |binary
default_images/res/commandimagelist/lc_spacing.png |binary
default_images/res/commandimagelist/lch_characterbackgroundpattern.png |binary
default_images/res/commandimagelist/lch_spacing.png |binary
default_images/res/commandimagelist/sc_characterbackgroundpattern.png |binary
default_images/res/commandimagelist/sc_spacing.png |binary
default_images/res/commandimagelist/sch_characterbackgroundpattern.png |binary
default_images/res/commandimagelist/sch_spacing.png |binary
framework/source/classes/menumanager.cxx | 3
icu/icu4c-4_0_1-src.patch | 18
officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 16
officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs | 8
sc/source/ui/sidebar/AlignmentPropertyPanel.cxx | 5
sc/source/ui/sidebar/AlignmentPropertyPanel.hxx | 3
sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx | 5
sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx | 3
sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx | 5
sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx | 3
sfx2/Library_sfx.mk | 1
sfx2/inc/sfx2/sidebar/ControllerItem.hxx | 88 +
sfx2/source/sidebar/CommandInfoProvider.cxx | 359 ++++
sfx2/source/sidebar/CommandInfoProvider.hxx | 96 +
sfx2/source/sidebar/ControllerItem.cxx | 183 ++
sfx2/source/sidebar/Deck.cxx | 2
sfx2/source/sidebar/DeckLayouter.cxx | 3
sfx2/source/sidebar/FocusManager.cxx | 3
sfx2/source/sidebar/SidebarChildWindow.cxx | 12
sfx2/source/sidebar/SidebarController.cxx | 22
svx/Library_svx.mk | 1
svx/source/sidebar/area/AreaPropertyPanel.cxx | 6
svx/source/sidebar/area/AreaPropertyPanel.hxx | 3
svx/source/sidebar/graphic/GraphicPropertyPanel.cxx | 8
svx/source/sidebar/graphic/GraphicPropertyPanel.hxx | 3
svx/source/sidebar/line/LinePropertyPanel.cxx | 6
svx/source/sidebar/line/LinePropertyPanel.hxx | 3
svx/source/sidebar/paragraph/ParaPropertyPanel.cxx | 11
svx/source/sidebar/paragraph/ParaPropertyPanel.hxx | 3
svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 4
svx/source/sidebar/possize/PosSizePropertyPanel.hxx | 3
svx/source/sidebar/text/TextCharacterSpacingControl.cxx | 9
svx/source/sidebar/text/TextCharacterSpacingControl.hxx | 8
svx/source/sidebar/text/TextPropertyPanel.cxx | 727 +++-------
svx/source/sidebar/text/TextPropertyPanel.hrc | 28
svx/source/sidebar/text/TextPropertyPanel.hxx | 49
svx/source/sidebar/text/TextPropertyPanel.src | 169 --
svx/source/sidebar/text/TextUnderlineControl.cxx | 8
svx/source/sidebar/text/TextUnderlineControl.hxx | 6
sw/source/ui/sidebar/PagePropertyPanel.cxx | 5
sw/source/ui/sidebar/PagePropertyPanel.hxx | 3
sw/source/ui/sidebar/WrapPropertyPanel.cxx | 5
sw/source/ui/sidebar/WrapPropertyPanel.hxx | 3
uui/source/iahndl.hxx | 2
vcl/inc/fontcache.hxx | 6
vcl/inc/printergfx.hxx | 4
vcl/inc/unx/salgdi.h | 4
vcl/source/gdi/print3.cxx | 8
56 files changed, 1155 insertions(+), 778 deletions(-)
New commits:
commit 319bb8945e90f064d59813f2c9c64015bc993da6
Author: Pavel JanÃk <paveljanik at apache.org>
Date: Fri Apr 19 20:43:36 2013 +0000
WaE: unname unused argument to prevent compiler warning.
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index d26d2fe..8e8d920 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -634,7 +634,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState,
- const bool bIsEnabled)
+ const bool /* bIsEnabled */)
{
mpFtAngle->Enable();
mpMtrAngle->Enable();
commit e271ee33bd29cb8e5a7bbecdcdac71596ee2442f
Author: Jürgen Schmidt <jsc at apache.org>
Date: Fri Apr 19 16:35:12 2013 +0000
minor change in syntax to make localize happy
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
index ca821b7..28c1491 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
@@ -22,13 +22,7 @@
<!DOCTYPE oor:component-schema SYSTEM "../../../../../component-schema.dtd">
-<oor:component-schema
- xmlns:oor="http://openoffice.org/2001/registry"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- oor:name="Sidebar"
- oor:package="org.openoffice.Office.UI"
- xml:lang="en-US">
+<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="Sidebar" oor:package="org.openoffice.Office.UI" xml:lang="en-US">
<info>
<author>Andre Fischer</author>
<desc>Specification of decks and content panels of the sidebar.</desc>
commit 8d956f9ec332f818fbe49286ba8eec28179486f2
Author: Andre Fischer <af at apache.org>
Date: Fri Apr 19 14:27:16 2013 +0000
122104: Fixed selection of sidebar button.
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index df012dc..214cf1d 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -67,6 +67,7 @@ using namespace cssu;
using ::rtl::OUString;
+#undef VERBOSE
namespace sfx2 { namespace sidebar {
@@ -157,7 +158,6 @@ void SAL_CALL SidebarController::disposing (void)
if (mpCurrentDeck)
{
mpCurrentDeck->Dispose();
- OSL_TRACE("deleting deck window subtree");
mpCurrentDeck->PrintWindowTree();
mpCurrentDeck.reset();
}
@@ -264,7 +264,7 @@ void SidebarController::NotifyResize (void)
mnSavedSidebarWidth = nWidth;
RestrictWidth();
-#ifdef DEBUG
+#ifdef VERBOSE
if (mpCurrentDeck)
{
mpCurrentDeck->PrintWindowTree();
@@ -323,6 +323,10 @@ void SidebarController::UpdateConfigurations (const Context& rContext)
{
msCurrentDeckId = pDeckDescriptor->msId;
SwitchToDeck(*pDeckDescriptor, rContext);
+
+ // Tell the tab bar to highlight the button associated
+ // with the deck.
+ mpTabBar->HighlightDeck(msCurrentDeckId);
}
#ifdef DEBUG
@@ -447,7 +451,6 @@ void SidebarController::SwitchToDeck (
{
// Panel already exists in current deck. Reuse it.
aNewPanels[nWriteIndex] = *iPanel;
- OSL_TRACE(" reusing panel %s", S2A(rPanelContexDescriptor.msId));
}
else
{
@@ -456,7 +459,6 @@ void SidebarController::SwitchToDeck (
rPanelContexDescriptor.msId,
mpCurrentDeck->GetPanelParentWindow(),
rPanelContexDescriptor.msMenuCommand);
- OSL_TRACE(" creating panel %s", S2A(rPanelContexDescriptor.msId));
bHasPanelSetChanged = true;
}
if (aNewPanels[nWriteIndex] != NULL)
@@ -479,10 +481,6 @@ void SidebarController::SwitchToDeck (
mpCurrentDeck->SetPanels(aNewPanels);
mpCurrentDeck->Show();
- // Tell the tab bar to highlight the button associated with the
- // deck.
- mpTabBar->HighlightDeck(rDeckDescriptor.msId);
-
mpParentWindow->SetText(rDeckDescriptor.msTitle);
if (bHasPanelSetChanged)
@@ -501,7 +499,7 @@ bool SidebarController::ArePanelSetsEqual (
const SharedPanelContainer& rCurrentPanels,
const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels)
{
-#ifdef DEBUG
+#ifdef VERBOSE
OSL_TRACE("current panel list:");
for (SharedPanelContainer::const_iterator
iPanel(rCurrentPanels.begin()),
@@ -547,12 +545,6 @@ SharedPanel SidebarController::CreatePanel (
if (pPanelDescriptor == NULL)
return SharedPanel();
-#ifdef DEBUG
- // Prevent the panel not being created in the same memory of an old panel.
- ::boost::scoped_array<char> pUnused (new char[sizeof(Panel)]);
- OSL_TRACE("allocated memory at %x", pUnused.get());
-#endif
-
// Create the panel which is the parent window of the UIElement.
SharedPanel pPanel (new Panel(
*pPanelDescriptor,
commit aa472da82a35c9643319f0af69d856a38c1cca4d
Author: Herbert Dürr <hdu at apache.org>
Date: Fri Apr 19 12:19:38 2013 +0000
fix icu build breaker for compilers supporting user-defined literals
diff --git a/icu/icu4c-4_0_1-src.patch b/icu/icu4c-4_0_1-src.patch
index 121be81..803c7d3 100644
--- a/icu/icu4c-4_0_1-src.patch
+++ b/icu/icu4c-4_0_1-src.patch
@@ -287,6 +287,24 @@
}
--- misc/icu/source/tools/genuca/genuca.cpp 2009-01-15 08:46:02.000000000 +0100
+++ misc/build/icu/source/tools/genuca/genuca.cpp 2013-01-30 07:45:01.000000000 +0100
+@@ -395,7 +395,7 @@
+ copyright, status);
+
+ if(U_FAILURE(*status)) {
+- fprintf(stderr, "Error: unable to create %s"INVC_DATA_NAME", error %s\n", outputDir, u_errorName(*status));
++ fprintf(stderr, "Error: unable to create %s" INVC_DATA_NAME ", error %s\n", outputDir, u_errorName(*status));
+ return;
+ }
+
+@@ -757,7 +757,7 @@
+ copyright, status);
+
+ if(U_FAILURE(*status)) {
+- fprintf(stderr, "Error: unable to create %s"UCA_DATA_NAME", error %s\n", outputDir, u_errorName(*status));
++ fprintf(stderr, "Error: unable to create %s" UCA_DATA_NAME ", error %s\n", outputDir, u_errorName(*status));
+ return;
+ }
+
@@ -904,9 +904,9 @@
{0x20000, 0x2A6D6, UCOL_SPECIAL_FLAG | (CJK_IMPLICIT_TAG << 24) }, //6 CJK_IMPLICIT_TAG, /* 0x20000-0x2A6D6*/
{0x2F800, 0x2FA1D, UCOL_SPECIAL_FLAG | (CJK_IMPLICIT_TAG << 24) }, //7 CJK_IMPLICIT_TAG, /* 0x2F800-0x2FA1D*/
commit aad8d0b80c56b956ce674e713d4d09a077e20f68
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Fri Apr 19 10:41:08 2013 +0000
120529: abort print controller job, if no pages will be printed
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 0963fd8..a1296b7 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -656,7 +656,13 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl::
{
mbJobActive = sal_True;
i_pController->createProgressDialog();
- int nPages = i_pController->getFilteredPageCount();
+ const int nPages = i_pController->getFilteredPageCount();
+ // abort job, if no pages will be printed.
+ if ( nPages == 0 )
+ {
+ i_pController->abortJob();
+ bAborted = true;
+ }
for( int nOuterIteration = 0; nOuterIteration < nOuterRepeatCount && ! bAborted; nOuterIteration++ )
{
for( int nPage = 0; nPage < nPages && ! bAborted; nPage++ )
commit 1a169fa0ca55cd10b76205d09ecebc5717afdc77
Author: Herbert Dürr <hdu at apache.org>
Date: Fri Apr 19 08:52:00 2013 +0000
WaE: fix "call to pure virtual member function" warning
reported by clang. The strange casting seems to be a leftover
from times before the MenuManager::acquire() method was added.
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index fe62ccd..d33c5d3 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -147,7 +147,8 @@ MenuManager::MenuManager(
m_xFrame = rFrame;
m_bInitialized = sal_False;
m_bIsBookmarkMenu = sal_False;
- SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, (OWeakObject*)this )->acquire();
+
+ acquire();
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
m_bWasHiContrast = rSettings.GetHighContrastMode();
commit 5e32abe48b0833e4e370507a1e74fbb1ba98b5e3
Author: Andre Fischer <af at apache.org>
Date: Fri Apr 19 08:51:45 2013 +0000
121960: Extend the sidebar::ControllerItem to check Disabled state. Converted TextPropertyPanel to use this new functionality.
diff --git a/default_images/res/commandimagelist/lc_characterbackgroundpattern.png b/default_images/res/commandimagelist/lc_characterbackgroundpattern.png
new file mode 100644
index 0000000..c0aa720
Binary files /dev/null and b/default_images/res/commandimagelist/lc_characterbackgroundpattern.png differ
diff --git a/default_images/res/commandimagelist/lc_spacing.png b/default_images/res/commandimagelist/lc_spacing.png
new file mode 100644
index 0000000..0d6a719
Binary files /dev/null and b/default_images/res/commandimagelist/lc_spacing.png differ
diff --git a/default_images/res/commandimagelist/lch_characterbackgroundpattern.png b/default_images/res/commandimagelist/lch_characterbackgroundpattern.png
new file mode 100644
index 0000000..aa23c69
Binary files /dev/null and b/default_images/res/commandimagelist/lch_characterbackgroundpattern.png differ
diff --git a/default_images/res/commandimagelist/lch_spacing.png b/default_images/res/commandimagelist/lch_spacing.png
new file mode 100644
index 0000000..7664bbc
Binary files /dev/null and b/default_images/res/commandimagelist/lch_spacing.png differ
diff --git a/default_images/res/commandimagelist/sc_characterbackgroundpattern.png b/default_images/res/commandimagelist/sc_characterbackgroundpattern.png
new file mode 100644
index 0000000..667d6cc
Binary files /dev/null and b/default_images/res/commandimagelist/sc_characterbackgroundpattern.png differ
diff --git a/default_images/res/commandimagelist/sc_spacing.png b/default_images/res/commandimagelist/sc_spacing.png
new file mode 100644
index 0000000..03396da
Binary files /dev/null and b/default_images/res/commandimagelist/sc_spacing.png differ
diff --git a/default_images/res/commandimagelist/sch_characterbackgroundpattern.png b/default_images/res/commandimagelist/sch_characterbackgroundpattern.png
new file mode 100644
index 0000000..aaa81bd
Binary files /dev/null and b/default_images/res/commandimagelist/sch_characterbackgroundpattern.png differ
diff --git a/default_images/res/commandimagelist/sch_spacing.png b/default_images/res/commandimagelist/sch_spacing.png
new file mode 100644
index 0000000..4cd9640
Binary files /dev/null and b/default_images/res/commandimagelist/sch_spacing.png differ
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index b888d8f..ccdf149 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -1004,6 +1004,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>
@@ -4832,6 +4840,14 @@
<value>15</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 bec91e0..167a631 100755
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -386,8 +386,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 7f02847..3693d18 100755
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -57,7 +57,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 9bfe390..5e781d4 100755
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -461,8 +461,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 bb5bc32..08f30dd 100755
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.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/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index c714f04..d91655d 100755
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -267,8 +267,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 13ca80c..ab38587 100755
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
@@ -54,7 +54,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 145b933..9a14410 100755
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -219,6 +219,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/inc/sfx2/sidebar/ControllerItem.hxx b/sfx2/inc/sfx2/sidebar/ControllerItem.hxx
index c9bdbea..aaecd44 100644
--- a/sfx2/inc/sfx2/sidebar/ControllerItem.hxx
+++ b/sfx2/inc/sfx2/sidebar/ControllerItem.hxx
@@ -24,11 +24,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
{
@@ -39,18 +61,82 @@ public:
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
- const SfxPoolItem* pState) = 0;
+ const SfxPoolItem* pState,
+ const bool bIsEnabled) = 0;
};
+
+ /** 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 (void);
+ /** 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. Uses the system high contrast mode state.
+ */
+ Image GetIcon (void) const;
+
+ /** Return the icon for the command. Allows the user to override
+ the high contrast mode state.
+ */
+ Image GetIcon (const bool bIsHighContrastMode) 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/sfx2/source/sidebar/CommandInfoProvider.cxx b/sfx2/source/sidebar/CommandInfoProvider.cxx
new file mode 100644
index 0000000..0cb2591
--- /dev/null
+++ b/sfx2/source/sidebar/CommandInfoProvider.cxx
@@ -0,0 +1,359 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "precompiled_sfx2.hxx"
+
+#include "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..e2b0c1c
--- /dev/null
+++ b/sfx2/source/sidebar/CommandInfoProvider.hxx
@@ -0,0 +1,96 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef 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 f3e023c..43d1aa2 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -23,14 +23,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 nId,
+ const sal_uInt16 nSlotId,
SfxBindings &rBindings,
ItemUpdateReceiverInterface& rItemUpdateReceiver)
- : SfxControllerItem(nId, 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)
{
}
@@ -39,6 +127,8 @@ ControllerItem::ControllerItem (
ControllerItem::~ControllerItem (void)
{
+ if (mxFrameActionListener.is())
+ mxFrameActionListener->dispose();
}
@@ -49,10 +139,95 @@ 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 GetIcon(Application::GetSettings().GetStyleSettings().GetHighContrastMode());
+}
+
+
+
+
+Image ControllerItem::GetIcon (const bool bIsHighContrastMode) const
+{
+ return GetImage(mxFrame, A2S(".uno:")+msCommandName, sal_False, bIsHighContrastMode);
+
}
+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/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index e1fddbe..da27741 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -282,7 +282,7 @@ const char* GetWindowClassification (const Window* pWindow)
void Deck::PrintWindowSubTree (Window* pRoot, int nIndentation)
{
- static char* sIndentation = " ";
+ static const char* sIndentation = " ";
const Point aLocation (pRoot->GetPosPixel());
const Size aSize (pRoot->GetSizePixel());
const char* sClassification = GetWindowClassification(pRoot);
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index 9e5ec88..fed77b2 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -353,7 +353,6 @@ void DeckLayouter::DistributeHeights (
// (either its minimum or preferred height) and the container height.
sal_Int32 nTotalWeight (0);
sal_Int32 nNoMaximumCount (0);
- sal_Int32 nIndex (0);
IterateLayoutItems(iItem,rLayoutItems)
{
if (iItem->maLayoutSize.Maximum == 0)
@@ -376,7 +375,6 @@ void DeckLayouter::DistributeHeights (
return;
// First pass of height distribution.
- nIndex = 0;
IterateLayoutItems(iItem,rLayoutItems)
{
const sal_Int32 nBaseHeight (
@@ -410,7 +408,6 @@ void DeckLayouter::DistributeHeights (
// Handle rounding error.
sal_Int32 nAdditionalHeightForFirstPanel (nRemainingHeightToDistribute
- nNoMaximumCount*nAdditionalHeightPerPanel);
- nIndex = 0;
IterateLayoutItems(iItem,rLayoutItems)
{
if (iItem->maLayoutSize.Maximum < 0)
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index 906c50a..9508f6a 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -47,11 +47,12 @@ namespace
if (rPanel.HasFocus())
return PC_Content;
else if (rPanel.GetTitleBar() != NULL)
+ {
if (rPanel.GetTitleBar()->HasFocus())
return PC_TitleBar;
else if (rPanel.GetTitleBar()->GetToolBox().HasFocus())
return PC_ToolBox;
-
+ }
return PC_None;
}
}
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index f9f28ce..8397470 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -35,23 +35,25 @@ SFX_IMPL_DOCKINGWINDOW(SidebarChildWindow, SID_SIDEBAR);
SidebarChildWindow::SidebarChildWindow (
- Window* pParent,
+ Window* pParentWindow,
sal_uInt16 nId,
SfxBindings* pBindings,
- SfxChildWinInfo* pInfo )
- : SfxChildWindow(pParent, nId)
+ SfxChildWinInfo* pInfo)
+ : SfxChildWindow(pParentWindow, nId)
{
this->pWindow = new SidebarDockingWindow(
pBindings,
*this,
- pParent,
+ 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 5a01046..0146285 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -47,6 +47,7 @@ $(eval $(call gb_Library_add_linked_libs,svx,\
cppu \
drawinglayer \
editeng \
+ fwk \
i18nisolang1 \
icuuc \
sal \
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx
index 4b1472d..466fee8 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -747,8 +747,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);
@@ -1054,6 +1057,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 870705d..d959b31 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.hxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx
@@ -69,7 +69,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 1209ea6..c3788b0 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
@@ -276,8 +276,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:
@@ -443,6 +446,9 @@ void GraphicPropertyPanel::NotifyItemUpdate(
}
}
+
+
+
//////////////////////////////////////////////////////////////////////////////
SfxBindings* GraphicPropertyPanel::GetBindings()
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
index 26e6809..b45c16f 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
@@ -52,7 +52,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 6b73ada..40b6279 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -401,8 +401,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:
@@ -702,6 +705,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 0a75879..fe93d65 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.hxx
@@ -79,7 +79,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 1580ded..f8bc018 100755
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -1032,8 +1032,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);
@@ -1083,6 +1089,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 7317dbb..7debb7d 100755
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
@@ -80,7 +80,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 23df38c..d26d2fe 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -633,7 +633,8 @@ IMPL_LINK( PosSizePropertyPanel, FlipHdl, ToolBox*, pBox )
void PosSizePropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
- const SfxPoolItem* pState)
+ const SfxPoolItem* pState,
+ const bool bIsEnabled)
{
mpFtAngle->Enable();
mpMtrAngle->Enable();
@@ -956,6 +957,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 ca3f5ad..aa2c42a 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.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();
void ShowMenu (void);
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index a99ffdb..14e83f2 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -32,10 +32,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))
@@ -64,7 +68,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 df2f9eb..d64a037 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
@@ -40,11 +40,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 ba4c5fc..92cf44c 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -59,7 +59,6 @@
#include <svx/sidebar/ColorControl.hxx>
#include <svx/sidebar/PopupContainer.hxx>
-
#include <boost/bind.hpp>
using namespace css;
@@ -88,12 +87,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
@@ -209,55 +208,29 @@ 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)),
-
- maImgIncreaseHigh (SVX_RES( IMG_INCREASE_H )),
- maImgDecreaseHigh (SVX_RES( IMG_DECREASE_H )),
- maImgBoldHigh (SVX_RES( IMG_BOLD_H )),
- maImgItalicHigh (SVX_RES( IMG_ITALIC_H )),
- maImgUnderlineHigh (SVX_RES( IMG_UNDERLINE_H )),
- maImgStrikeHigh (SVX_RES( IMG_STRIKEOUT_H )),
- maImgShadowHigh (SVX_RES( IMG_SHADOWED_H )),
- maImgFontColorHigh (SVX_RES( IMG_FONTCOLOR_H)),
- maImgSupScriptHigh (SVX_RES( IMG_SUPSCRIPT_H)),
- maImgSubScriptHigh (SVX_RES( IMG_SUBSCRIPT_H)),
- maImgHighlightHigh (SVX_RES( IMG_HIGHLIGHT_H)),
+ 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),
mbFocusOnFontSizeCtrl(false),
- maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
- maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
- maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
- maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
+ maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
+ maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
+ maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
+ maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
mxFrame(rxFrame),
maContext(),
mpBindings(pBindings),
@@ -297,12 +270,6 @@ TextPropertyPanel::~TextPropertyPanel (void)
-Image TextPropertyPanel::GetIcon (const ::rtl::OUString& rsURL)
-{
- return GetImage(mxFrame, rsURL, sal_False, Theme::IsHighContrastMode());
-}
-
-
void TextPropertyPanel::SetSpacing(long nKern)
{
mlKerning = nKern;
@@ -401,17 +368,14 @@ void TextPropertyPanel::HandleContextChange (
}
}
-SfxBindings* TextPropertyPanel::GetBindings()
-{
- return mpBindings;
-}
+
void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
{
(void)rEvent;
- SetupIcons();
+ SetupToolboxItems();
}
@@ -429,7 +393,7 @@ void TextPropertyPanel::Initialize (void)
else
{
mpFontList = new FontList( Application::GetDefaultDevice() );
- mbMustDelete = 1;
+ mbMustDelete = true;
}
mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
@@ -438,7 +402,7 @@ void TextPropertyPanel::Initialize (void)
maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
//toolbox
- SetupIcons();
+ SetupToolboxItems();
InitToolBoxIncDec();
InitToolBoxFont();
InitToolBoxFontColor();
@@ -532,9 +496,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);
@@ -611,48 +572,26 @@ void TextPropertyPanel::InitToolBoxHighlight()
-void TextPropertyPanel::SetupIcons (void)
+void TextPropertyPanel::SetupToolboxItems (void)
{
- if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
- {
- mpToolBoxIncDec->SetItemImage(TBI_INCREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgIncreaseHigh : maImgIncrease);
- mpToolBoxIncDec->SetItemImage(TBI_DECREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgDecreaseHigh : maImgDecrease);
- mpToolBoxFont->SetItemImage(TBI_BOLD, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgBoldHigh : maImgBold);
- mpToolBoxFont->SetItemImage(TBI_ITALIC, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgItalicHigh : maImgItalic);
- mpToolBoxFont->SetItemImage(TBI_UNDERLINE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgUnderlineHigh : maImgUnderline);
- mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgStrikeHigh : maImgStrike);
- mpToolBoxFont->SetItemImage(TBI_SHADOWED, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgShadowHigh : maImgShadow);
-
- mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgFontColorHigh : maImgFontColor);
- //for sw
- mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript);
- mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript);
- //for sc and sd
- mpToolBoxScript->SetItemImage(TBI_SUPER, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript);
- mpToolBoxScript->SetItemImage(TBI_SUB, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript);
- mpToolBoxSpacing->SetItemImage(TBI_SPACING, maImgNormalIcon);
- mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgHighlightHigh : 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")));
-
- 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")));
- }
+ maSDFontGrow.SetupToolBoxItem(*mpToolBoxIncDec, TBI_INCREASE);
+ maSDFontShrink.SetupToolBoxItem(*mpToolBoxIncDec, TBI_DECREASE);
+
+ 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);
+
+ 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);
}
@@ -719,78 +658,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:
+ {
+ 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;
+ }
+ case TBI_UNDERLINE:
{
- 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(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;
}
- 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();
}
return 0;
}
@@ -803,22 +735,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();
@@ -865,24 +790,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)
{
@@ -919,26 +827,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;
}
@@ -1012,7 +905,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;
}
@@ -1028,6 +921,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)
{
@@ -1035,8 +929,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;
}
@@ -1085,21 +979,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() );
}
@@ -1107,12 +999,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*
@@ -1120,51 +1014,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
{
@@ -1173,118 +1033,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))
{
@@ -1301,7 +1149,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))
{
@@ -1318,64 +1168,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 )
{
@@ -1405,162 +1276,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()
-{
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list