[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 38 commits - desktop/source framework/inc framework/Library_fwk.mk framework/Library_fwl.mk framework/source framework/util include/framework include/sfx2 include/svtools include/toolkit include/vcl offapi/com offapi/UnoApi_offapi.mk officecfg/registry reportdesign/source sc/source sd/source sfx2/source svtools/source svx/source sw/source toolkit/source vcl/source
Stephan Bergmann
sbergman at redhat.com
Wed May 22 03:35:04 PDT 2013
desktop/source/app/app.cxx | 10
framework/Library_fwk.mk | 7
framework/Library_fwl.mk | 3
framework/inc/classes/resource.hrc | 4
framework/inc/services.h | 5
framework/inc/uielement/genericstatusbarcontroller.hxx | 57 +
framework/inc/uielement/langselectionstatusbarcontroller.hxx | 22
framework/inc/uielement/logoimagestatusbarcontroller.hxx | 82 --
framework/inc/uielement/logotextstatusbarcontroller.hxx | 82 --
framework/inc/uielement/menubarmanager.hxx | 15
framework/inc/uielement/simpletextstatusbarcontroller.hxx | 84 --
framework/inc/uielement/statusbaritem.hxx | 79 ++
framework/inc/uielement/statusbarmanager.hxx | 9
framework/inc/uielement/statusbarmerger.hxx | 81 ++
framework/inc/uielement/toolbarmanager.hxx | 4
framework/inc/uifactory/factoryconfiguration.hxx | 1
framework/inc/uifactory/popupmenucontrollerfactory.hxx | 50 -
framework/inc/uifactory/statusbarcontrollerfactory.hxx | 44 -
framework/inc/uifactory/toolbarcontrollerfactory.hxx | 73 --
framework/inc/uifactory/uicontrollerfactory.hxx | 101 +++
framework/source/classes/resource.src | 11
framework/source/fwe/classes/addonsoptions.cxx | 236 +++++++-
framework/source/layoutmanager/layoutmanager.cxx | 3
framework/source/register/registerservices.cxx | 5
framework/source/register/registertemp.cxx | 6
framework/source/uielement/addonstoolbarmanager.cxx | 65 +-
framework/source/uielement/genericstatusbarcontroller.cxx | 163 +++++
framework/source/uielement/generictoolbarcontroller.cxx | 2
framework/source/uielement/langselectionstatusbarcontroller.cxx | 176 +-----
framework/source/uielement/logoimagestatusbarcontroller.cxx | 167 -----
framework/source/uielement/logotextstatusbarcontroller.cxx | 170 -----
framework/source/uielement/menubarmanager.cxx | 97 +--
framework/source/uielement/menubarwrapper.cxx | 2
framework/source/uielement/popupmenucontroller.cxx | 6
framework/source/uielement/simpletextstatusbarcontroller.cxx | 186 ------
framework/source/uielement/statusbaritem.cxx | 257 ++++++++
framework/source/uielement/statusbarmanager.cxx | 290 ++++++----
framework/source/uielement/statusbarmerger.cxx | 258 ++++++++
framework/source/uielement/toolbarmanager.cxx | 66 +-
framework/source/uielement/toolbarmerger.cxx | 50 -
framework/source/uifactory/factoryconfiguration.cxx | 1
framework/source/uifactory/popupmenucontrollerfactory.cxx | 73 --
framework/source/uifactory/statusbarcontrollerfactory.cxx | 71 --
framework/source/uifactory/toolbarcontrollerfactory.cxx | 242 --------
framework/source/uifactory/uicontrollerfactory.cxx | 269 +++++++++
framework/util/fwk.component | 2
framework/util/fwl.component | 9
include/framework/addonsoptions.hxx | 22
include/sfx2/sidebar/ControlFactory.hxx | 29 -
include/sfx2/sidebar/ControllerFactory.hxx | 16
include/sfx2/sidebar/SidebarToolBox.hxx | 13
include/sfx2/sidebar/Tools.hxx | 3
include/sfx2/stbitem.hxx | 8
include/svtools/statusbarcontroller.hxx | 15
include/toolkit/awt/vclxgraphics.hxx | 80 +-
include/vcl/status.hxx | 15
offapi/UnoApi_offapi.mk | 9
offapi/com/sun/star/awt/ImageDrawMode.idl | 55 +
offapi/com/sun/star/awt/XGraphics.idl | 44 -
offapi/com/sun/star/awt/XGraphics2.idl | 79 ++
offapi/com/sun/star/frame/PopupMenuControllerFactory.idl | 10
offapi/com/sun/star/frame/StatusbarController.idl | 72 --
offapi/com/sun/star/frame/StatusbarControllerFactory.idl | 37 -
offapi/com/sun/star/frame/ToolBarControllerFactory.idl | 41 -
offapi/com/sun/star/frame/ToolbarControllerFactory.idl | 38 +
offapi/com/sun/star/frame/XStatusbarController.idl | 82 ++
offapi/com/sun/star/frame/XToolbarControllerFactory.idl | 65 --
offapi/com/sun/star/frame/XUIControllerFactory.idl | 72 ++
offapi/com/sun/star/ui/XStatusbarItem.idl | 111 +++
officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 22
officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu | 2
officecfg/registry/schema/org/openoffice/Office/Addons.xcs | 107 +++
reportdesign/source/ui/inc/statusbarcontroller.hxx | 15
reportdesign/source/ui/misc/statusbarcontroller.cxx | 64 +-
sc/source/ui/navipi/navipi.cxx | 10
sc/source/ui/sidebar/CellBorderStyleControl.cxx | 3
sc/source/ui/sidebar/CellLineStyleValueSet.cxx | 2
sd/source/ui/dlg/navigatr.cxx | 17
sd/source/ui/sidebar/LayoutMenu.cxx | 1
sd/source/ui/view/drviews1.cxx | 3
sd/source/ui/view/drviews2.cxx | 2
sd/source/ui/view/drviewsa.cxx | 2
sfx2/source/sidebar/ControlFactory.cxx | 5
sfx2/source/sidebar/ControllerFactory.cxx | 132 +++-
sfx2/source/sidebar/Deck.cxx | 5
sfx2/source/sidebar/DeckDescriptor.cxx | 6
sfx2/source/sidebar/DeckLayouter.cxx | 6
sfx2/source/sidebar/FocusManager.cxx | 1
sfx2/source/sidebar/Panel.cxx | 13
sfx2/source/sidebar/Panel.hxx | 3
sfx2/source/sidebar/PanelDescriptor.cxx | 6
sfx2/source/sidebar/PanelTitleBar.cxx | 72 +-
sfx2/source/sidebar/PanelTitleBar.hxx | 8
sfx2/source/sidebar/ResourceManager.cxx | 37 -
sfx2/source/sidebar/ResourceManager.hxx | 3
sfx2/source/sidebar/SidebarController.cxx | 107 +--
sfx2/source/sidebar/SidebarController.hxx | 7
sfx2/source/sidebar/SidebarDockingWindow.cxx | 2
sfx2/source/sidebar/SidebarToolBox.cxx | 122 +++-
sfx2/source/sidebar/TabBar.cxx | 26
sfx2/source/sidebar/TabBar.hxx | 13
sfx2/source/sidebar/TitleBar.cxx | 2
sfx2/source/sidebar/TitleBar.hxx | 4
sfx2/source/sidebar/ToolBoxBackground.cxx | 13
sfx2/source/sidebar/ToolBoxBackground.hxx | 4
sfx2/source/sidebar/Tools.cxx | 25
sfx2/source/statbar/stbitem.cxx | 7
svtools/source/uno/statusbarcontroller.cxx | 73 +-
svtools/source/uno/toolboxcontroller.cxx | 2
svx/source/sidebar/insert/InsertPropertyPanel.hxx | 2
svx/source/sidebar/nbdtmg.cxx | 14
sw/source/ui/sidebar/PageSizeControl.cxx | 4
toolkit/source/awt/vclxgraphics.cxx | 173 ++++-
vcl/source/window/status.cxx | 175 ++++++
114 files changed, 3450 insertions(+), 2484 deletions(-)
New commits:
commit 15ffe4f935e133c17a242cc8c758fd9d9d1fb172
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed May 22 09:17:06 2013 +0200
Use implicit default constructors
...instead of explicit ones without arguments. The former internally call
css.lang.XMultiComponentFactory.createInstanceWithContext while the latter call
css.lang.createInstanceWithArgumentsAndContext, which in turn uses css.lang.XInitialization.initialize,
which could fail with a less forgiving factory than cppu::OSingleFactoryHelper
(cppuhelper/source/factory.cxx) if the service implementation does not support XInitialization.
Change-Id: Iff3b2ceacdd3d4e165004b841e5bbf9dbe0b98a5
(cherry picked from commit 66e39940d763586060c4bcc8c3cd213495c40b79)
diff --git a/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl b/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl
index d873e3d..f6c55b0 100644
--- a/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl
+++ b/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl
@@ -34,12 +34,7 @@ module com { module sun { module star { module frame {
@since OOo 2.0
*/
-service PopupMenuControllerFactory : XUIControllerFactory
-{
- /** service constructor
- */
- create();
-};
+service PopupMenuControllerFactory : XUIControllerFactory;
}; }; }; };
diff --git a/offapi/com/sun/star/frame/StatusbarControllerFactory.idl b/offapi/com/sun/star/frame/StatusbarControllerFactory.idl
index 7572c6c..ffffabf 100644
--- a/offapi/com/sun/star/frame/StatusbarControllerFactory.idl
+++ b/offapi/com/sun/star/frame/StatusbarControllerFactory.idl
@@ -35,12 +35,7 @@ module com { module sun { module star { module frame {
@since OOo 2.0
*/
-service StatusbarControllerFactory : XUIControllerFactory
-{
- /** service constructor
- */
- create();
-};
+service StatusbarControllerFactory : XUIControllerFactory;
}; }; }; };
diff --git a/offapi/com/sun/star/frame/ToolbarControllerFactory.idl b/offapi/com/sun/star/frame/ToolbarControllerFactory.idl
index 220046e..69b1314 100644
--- a/offapi/com/sun/star/frame/ToolbarControllerFactory.idl
+++ b/offapi/com/sun/star/frame/ToolbarControllerFactory.idl
@@ -31,12 +31,7 @@ module com { module sun { module star { module frame {
@since OOo 2.0
*/
-service ToolbarControllerFactory : XUIControllerFactory
-{
- /** service constructor
- */
- create();
-};
+service ToolbarControllerFactory : XUIControllerFactory;
}; }; }; };
commit a19dc6db736ce90e6718b214ad55798e8a549647
Author: Andre Fischer <af at apache.org>
Date: Tue May 21 09:46:08 2013 +0000
Resolves: #i122336# Show docked tab bar after closing undocked sidebar
(cherry picked from commit d8b17867f3c58d5623cca129d6459bae0eb11729)
Change-Id: I5579c8f12cad696da94674c4f1a52bb2bed68cb5
(cherry picked from commit 88707ef9e8477784d0f5f9d679c5de4020b4ea40)
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 3b6a61d..fe18b32 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -92,8 +92,8 @@ sal_Bool SidebarDockingWindow::Close (void)
{
// Do not close the floating window.
// Dock it and close just the deck instead.
- mpSidebarController->RequestCloseDeck();
SetFloatingMode(sal_False);
+ mpSidebarController->RequestCloseDeck();
mpSidebarController->NotifyResize();
return sal_False;
}
commit ab83a1ba84502ccda07777824db07084c87a21ff
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Tue May 21 14:36:18 2013 +0000
Resolves: #i122261# Calc Navigator - assure non-overlapping layout
(cherry picked from commit e7fa6ef1cbae2354078ec185c987e16e004e8a5d)
Conflicts:
sc/source/ui/navipi/navipi.cxx
Change-Id: I91147e2c4f5647e719eb86d0b4b342ea0d9770a7
(cherry picked from commit 94a3dc9e47afc40be21838889a326489b133c2df)
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 5c5d758..21f2178 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -46,6 +46,8 @@
#include "navsett.hxx"
#include "markdata.hxx"
+#include <algorithm>
+
// Timeout, um Notizen zu suchen
#define SC_CONTENT_TIMEOUT 1000
@@ -662,9 +664,11 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Win
aTitleBase = GetText();
- long nListboxYPos =
- std::max( aTbxCmd.GetPosPixel().Y() + aTbxCmd.GetSizePixel().Height(),
- aEdRow.GetPosPixel().Y() + aEdRow.GetSizePixel().Height() ) + 4;
+ const long nListboxYPos =
+ ::std::max(
+ (aTbxCmd.GetPosPixel().Y() + aTbxCmd.GetSizePixel().Height()),
+ (aEdRow.GetPosPixel().Y() + aEdRow.GetSizePixel().Height()) )
+ + 4;
aLbEntries.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y);
nBorderOffset = aLbEntries.GetPosPixel().X();
commit 313503adef671090f2735364c59c6bd16d0e20b0
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Tue May 21 13:31:56 2013 +0000
Resolves: #i122260# Calc Navigator - assure that tool box is...
at least as wide as the tree list box to avoid 'bad' layout when the Navigator
is resized.
(cherry picked from commit 1aead9f230e3953f6049e1700d912d6c14c62e7f)
Change-Id: Ie9aae42c42312777847fdb3261aa74ca7beaccbb
(cherry picked from commit 9ffcc8516ceb5c3b9e522bae6542a9d0e606663e)
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index 88262d7..37ca47b 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -95,7 +95,8 @@ SdNavigatorWin::SdNavigatorWin(
maToolbox.SetItemBits( TBI_DRAGTYPE, maToolbox.GetItemBits( TBI_DRAGTYPE ) | TIB_DROPDOWNONLY );
// Shape filter drop down menu.
- maToolbox.SetItemBits(TBI_SHAPE_FILTER,
+ maToolbox.SetItemBits(
+ TBI_SHAPE_FILTER,
maToolbox.GetItemBits(TBI_SHAPE_FILTER) | TIB_DROPDOWNONLY);
// TreeListBox
@@ -114,8 +115,18 @@ SdNavigatorWin::SdNavigatorWin(
nListboxYPos = maTlbObjects.GetPosPixel().Y() + maTlbObjects.GetSizePixel().Height() + 4;
maLbDocs.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+ // assure that tool box is at least as wide as the tree list box
+ {
+ const Size aTlbSize( maTlbObjects.GetOutputSizePixel() );
+ if ( aTlbSize.Width() > aTbxSize.Width() )
+ {
+ maToolbox.setPosSizePixel( 0, 0, aTlbSize.Width(), 0, WINDOW_POSSIZE_WIDTH );
+ aTbxSize = maToolbox.GetOutputSizePixel();
+ }
+ }
+
// set min outputsize after all sizes are known
- long nFullHeight = nListboxYPos + maLbDocs.GetSizePixel().Height() + 4;
+ const long nFullHeight = nListboxYPos + maLbDocs.GetSizePixel().Height() + 4;
maSize = GetOutputSizePixel();
if( maSize.Height() < nFullHeight )
{
@@ -123,7 +134,7 @@ SdNavigatorWin::SdNavigatorWin(
SetOutputSizePixel( maSize );
}
maMinSize = maSize;
- long nMinWidth = 2*maToolbox.GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox
+ const long nMinWidth = 2*maToolbox.GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox
if( nMinWidth > maMinSize.Width() )
maMinSize.Width() = nMinWidth;
maMinSize.Height() -= 40;
commit 42f61713d1bc841d9638b14b591c7ecc73e5ef51
Author: Andre Fischer <af at apache.org>
Date: Tue May 21 13:29:49 2013 +0000
Resolves: #i122057# Fixed layouting of legacy sidebar panels
(cherry picked from commit ff4875ae18c417a74621559bd2d2e9ad05929a82)
Change-Id: I6c97144981fbebc591fe595274c2f01055dd1979
(cherry picked from commit 57af6389b5e6cf9656edb96e987509ce84b45721)
diff --git a/sfx2/source/sidebar/DeckDescriptor.cxx b/sfx2/source/sidebar/DeckDescriptor.cxx
index be0c77d..01602ef 100644
--- a/sfx2/source/sidebar/DeckDescriptor.cxx
+++ b/sfx2/source/sidebar/DeckDescriptor.cxx
@@ -25,9 +25,12 @@ DeckDescriptor::DeckDescriptor (void)
msId(),
msIconURL(),
msHighContrastIconURL(),
+ msTitleBarIconURL(),
+ msHighContrastTitleBarIconURL(),
msHelpURL(),
msHelpText(),
maContextList(),
+ mbIsEnabled(true),
mnOrderIndex(10000) // Default value as defined in Sidebar.xcs
{
}
@@ -40,9 +43,12 @@ DeckDescriptor::DeckDescriptor (const DeckDescriptor& rOther)
msId(rOther.msId),
msIconURL(rOther.msIconURL),
msHighContrastIconURL(rOther.msHighContrastIconURL),
+ msTitleBarIconURL(rOther.msTitleBarIconURL),
+ msHighContrastTitleBarIconURL(rOther.msHighContrastTitleBarIconURL),
msHelpURL(rOther.msHelpURL),
msHelpText(rOther.msHelpText),
maContextList(rOther.maContextList),
+ mbIsEnabled(rOther.mbIsEnabled),
mnOrderIndex(rOther.mnOrderIndex)
{
}
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index 8d7cb89..ade08bb 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -318,7 +318,7 @@ void DeckLayouter::GetRequestedSizes (
if (xPanel.is())
aLayoutSize = xPanel->getHeightForWidth(rContentBox.GetWidth());
else
- aLayoutSize = ui::LayoutSize(MinimalPanelHeight, 0, -1);
+ aLayoutSize = ui::LayoutSize(MinimalPanelHeight, -1, 0);
}
}
iItem->maLayoutSize = aLayoutSize;
diff --git a/sfx2/source/sidebar/PanelDescriptor.cxx b/sfx2/source/sidebar/PanelDescriptor.cxx
index 31e3b9e..fa80402 100644
--- a/sfx2/source/sidebar/PanelDescriptor.cxx
+++ b/sfx2/source/sidebar/PanelDescriptor.cxx
@@ -26,10 +26,13 @@ PanelDescriptor::PanelDescriptor (void)
mbIsTitleBarOptional(false),
msId(),
msDeckId(),
+ msTitleBarIconURL(),
+ msHighContrastTitleBarIconURL(),
msHelpURL(),
maContextList(),
msImplementationURL(),
mnOrderIndex(10000), // Default value as defined in Sidebar.xcs
+ mbShowForReadOnlyDocuments(false),
mbWantsCanvas(false)
{
}
@@ -42,10 +45,13 @@ PanelDescriptor::PanelDescriptor (const PanelDescriptor& rOther)
mbIsTitleBarOptional(rOther.mbIsTitleBarOptional),
msId(rOther.msId),
msDeckId(rOther.msDeckId),
+ msTitleBarIconURL(rOther.msTitleBarIconURL),
+ msHighContrastTitleBarIconURL(rOther.msHighContrastTitleBarIconURL),
msHelpURL(rOther.msHelpURL),
maContextList(rOther.maContextList),
msImplementationURL(rOther.msImplementationURL),
mnOrderIndex(rOther.mnOrderIndex),
+ mbShowForReadOnlyDocuments(rOther.mbShowForReadOnlyDocuments),
mbWantsCanvas(rOther.mbWantsCanvas)
{
}
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index 2821293..96395eb 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -535,20 +535,27 @@ void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame)
rDeckDescriptor.msId = rsNodeName;
rDeckDescriptor.msIconURL = ::comphelper::getString(aChildNode.getNodeValue("ImageURL"));
rDeckDescriptor.msHighContrastIconURL = rDeckDescriptor.msIconURL;
+ rDeckDescriptor.msTitleBarIconURL = OUString();
+ rDeckDescriptor.msHighContrastTitleBarIconURL = OUString();
rDeckDescriptor.msHelpURL = ::comphelper::getString(aChildNode.getNodeValue("HelpURL"));
rDeckDescriptor.msHelpText = rDeckDescriptor.msTitle;
- rDeckDescriptor.maContextList.AddContextDescription(Context(sModuleName, A2S("any")), true, OUString());
rDeckDescriptor.mbIsEnabled = true;
+ rDeckDescriptor.mnOrderIndex = 100000 + nReadIndex;
+ rDeckDescriptor.maContextList.AddContextDescription(Context(sModuleName, A2S("any")), true, OUString());
PanelDescriptor& rPanelDescriptor (maPanels[nPanelWriteIndex++]);
rPanelDescriptor.msTitle = ::comphelper::getString(aChildNode.getNodeValue("UIName"));
rPanelDescriptor.mbIsTitleBarOptional = true;
rPanelDescriptor.msId = rsNodeName;
rPanelDescriptor.msDeckId = rsNodeName;
+ rPanelDescriptor.msTitleBarIconURL = OUString();
+ rPanelDescriptor.msHighContrastTitleBarIconURL = OUString();
rPanelDescriptor.msHelpURL = ::comphelper::getString(aChildNode.getNodeValue("HelpURL"));
- rPanelDescriptor.maContextList.AddContextDescription(Context(sModuleName, A2S("any")), true, OUString());
rPanelDescriptor.msImplementationURL = rsNodeName;
+ rPanelDescriptor.mnOrderIndex = 100000 + nReadIndex;
rPanelDescriptor.mbShowForReadOnlyDocuments = false;
+ rPanelDescriptor.mbWantsCanvas = false;
+ rPanelDescriptor.maContextList.AddContextDescription(Context(sModuleName, A2S("any")), true, OUString());
}
// When there where invalid nodes then we have to adapt the size
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index e1e0042..43b7194 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -201,6 +201,8 @@ void SAL_CALL SidebarController::disposing (void)
Theme::GetPropertySet()->removePropertyChangeListener(
A2S(""),
static_cast<css::beans::XPropertyChangeListener*>(this));
+
+ maContextChangeUpdate.CancelRequest();
}
commit 9277f40f231b6d14a181be5c61a02c9053f136fa
Author: Andre Fischer <af at apache.org>
Date: Tue May 21 09:22:27 2013 +0000
Resolves: #i122291# Showing the right set of layouts for handout mode
Fixed painting selection in layout panel
(cherry picked from commit b89784c822670593cb253bcc0d260b93c9936e1c)
Change-Id: I73d53bdcdec25753c8adb0f011f05868f82d35a5
(cherry picked from commit b8520e02d2b1b18ece5dbc6dbac12b9481643fdd)
diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx
index 9aa5955..ef6ae63 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -809,6 +809,7 @@ void LayoutMenu::UpdateSelection (void)
break;
// Find the entry of the menu for to the layout.
+ SetNoSelection();
sal_uInt16 nItemCount (GetItemCount());
for (sal_uInt16 nId=1; nId<=nItemCount; nId++)
{
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 552f61b..876eab3 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -461,6 +461,9 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
if (meEditMode == EM_PAGE)
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawPage));
+ else if (mePageKind == PK_HANDOUT)
+
+ SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_HandoutPage));
else
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_MasterPage));
}
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 86c20dd..2287258 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -139,6 +139,8 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas
if (mpFrameView->GetViewShEditMode(mePageKind) == EM_PAGE)
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawPage));
+ else if (mePageKind == PK_HANDOUT)
+ SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_HandoutPage));
else
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_MasterPage));
commit a75ce7e18b4d6d2098b213d14dd7687a554d728d
Author: Andre Fischer <af at apache.org>
Date: Tue May 21 08:49:40 2013 +0000
Resolves: #i122352# Do not allow selection of disabled decks via menu
(cherry picked from commit b27563ac5988d7ce407b045466e952114f54e07c)
Change-Id: Id36b8fd12d0fce8f8717e5dd21538d1871a005b0
(cherry picked from commit d456545fb1215eda69f6970d4207b2b062384877)
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 7cc315e..e1e0042 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -102,7 +102,7 @@ SidebarController::SidebarController (
mpParentWindow,
rxFrame,
::boost::bind(&SidebarController::OpenThenSwitchToDeck, this, _1),
- ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2,_3))),
+ ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2))),
mxFrame(rxFrame),
maCurrentContext(OUString(), OUString()),
maRequestedContext(),
@@ -794,10 +794,9 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
void SidebarController::ShowPopupMenu (
const Rectangle& rButtonBox,
- const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
- const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const
+ const ::std::vector<TabBar::DeckMenuData>& rMenuData) const
{
- ::boost::shared_ptr<PopupMenu> pMenu = CreatePopupMenu(rDeckSelectionData, rDeckShowData);
+ ::boost::shared_ptr<PopupMenu> pMenu = CreatePopupMenu(rMenuData);
pMenu->SetSelectHdl(LINK(this, SidebarController, OnMenuItemSelected));
// pass toolbox button rect so the menu can stay open on button up
@@ -829,9 +828,9 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co
::boost::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu (
- const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
- const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const
+ const ::std::vector<TabBar::DeckMenuData>& rMenuData) const
{
+ // Create the top level popup menu.
::boost::shared_ptr<PopupMenu> pMenu (new PopupMenu());
FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
if (pMenuWindow != NULL)
@@ -839,21 +838,36 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co
pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE);
}
+ // Create sub menu for customization (hiding of deck tabs.)
+ PopupMenu* pCustomizationMenu = new PopupMenu();
+
SidebarResource aLocalResource;
// Add one entry for every tool panel element to individually make
// them visible or hide them.
+ sal_Int32 nIndex (0);
+ for(::std::vector<TabBar::DeckMenuData>::const_iterator
+ iItem(rMenuData.begin()),
+ iEnd(rMenuData.end());
+ iItem!=iEnd;
+ ++iItem,++nIndex)
{
- sal_Int32 nIndex (MID_FIRST_PANEL);
- for(::std::vector<TabBar::DeckMenuData>::const_iterator
- iItem(rDeckSelectionData.begin()),
- iEnd(rDeckSelectionData.end());
- iItem!=iEnd;
- ++iItem)
+ const sal_Int32 nMenuIndex (nIndex+MID_FIRST_PANEL);
+ pMenu->InsertItem(nMenuIndex, iItem->msDisplayName, MIB_RADIOCHECK);
+ pMenu->CheckItem(nMenuIndex, iItem->mbIsCurrentDeck ? sal_True : sal_False);
+ pMenu->EnableItem(nMenuIndex, (iItem->mbIsEnabled&&iItem->mbIsActive) ? sal_True : sal_False);
+
+ const sal_Int32 nSubMenuIndex (nIndex+MID_FIRST_HIDE);
+ if (iItem->mbIsCurrentDeck)
+ {
+ // Don't allow the currently visible deck to be disabled.
+ pCustomizationMenu->InsertItem(nSubMenuIndex, iItem->msDisplayName, MIB_RADIOCHECK);
+ pCustomizationMenu->CheckItem(nSubMenuIndex, sal_True);
+ }
+ else
{
- pMenu->InsertItem(nIndex, iItem->get<0>(), MIB_RADIOCHECK);
- pMenu->CheckItem(nIndex, iItem->get<2>());
- ++nIndex;
+ pCustomizationMenu->InsertItem(nSubMenuIndex, iItem->msDisplayName, MIB_CHECKABLE);
+ pCustomizationMenu->CheckItem(nSubMenuIndex, iItem->mbIsActive ? sal_True : sal_False);
}
}
@@ -865,22 +879,6 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co
else
pMenu->InsertItem(MID_UNLOCK_TASK_PANEL, String(SfxResId(STR_SFX_UNDOCK)));
- // Add sub menu for customization (hiding of deck tabs.)
- PopupMenu* pCustomizationMenu = new PopupMenu();
- {
- sal_Int32 nIndex (MID_FIRST_HIDE);
- for(::std::vector<TabBar::DeckMenuData>::const_iterator
- iItem(rDeckShowData.begin()),
- iEnd(rDeckShowData.end());
- iItem!=iEnd;
- ++iItem)
- {
- pCustomizationMenu->InsertItem(nIndex, iItem->get<0>(), MIB_CHECKABLE);
- pCustomizationMenu->CheckItem(nIndex, iItem->get<2>());
- ++nIndex;
- }
- }
-
pCustomizationMenu->InsertSeparator();
pCustomizationMenu->InsertItem(MID_RESTORE_DEFAULT, String(SfxResId(STRING_RESTORE)));
@@ -926,7 +924,8 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, pMenu)
if (nIndex >= MID_FIRST_PANEL && nIndex<MID_FIRST_HIDE)
SwitchToDeck(mpTabBar->GetDeckIdForIndex(nIndex - MID_FIRST_PANEL));
else if (nIndex >=MID_FIRST_HIDE)
- mpTabBar->ToggleHideFlag(nIndex-MID_FIRST_HIDE);
+ if (pMenu->GetItemBits(nIndex) == MIB_CHECKABLE)
+ mpTabBar->ToggleHideFlag(nIndex-MID_FIRST_HIDE);
}
catch (RuntimeException&)
{
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index dc62f7a..7eeab7f 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -178,12 +178,10 @@ private:
const Context& rContext);
void ShowPopupMenu (
const Rectangle& rButtonBox,
- const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
- const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
+ const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
void ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const;
::boost::shared_ptr<PopupMenu> CreatePopupMenu (
- const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
- const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
+ const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
DECL_LINK(OnMenuItemSelected, Menu*);
void BroadcastPropertyChange (void);
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 11f8e2e..21beb0f 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -363,8 +363,7 @@ void TabBar::UpdateFocusManager (FocusManager& rFocusManager)
IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
{
- ::std::vector<DeckMenuData> aSelectionData;
- ::std::vector<DeckMenuData> aShowData;
+ ::std::vector<DeckMenuData> aMenuData;
for(ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
iItem!=iEnd;
@@ -373,18 +372,14 @@ IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
if (pDeckDescriptor != NULL)
{
- if ( ! iItem->mbIsHidden)
- aSelectionData.push_back(
- DeckMenuData(
- pDeckDescriptor->msTitle,
- pDeckDescriptor->msId,
- iItem->mpButton->IsChecked()));
-
- aShowData.push_back(
- DeckMenuData(
- pDeckDescriptor->msTitle,
- pDeckDescriptor->msId,
- !iItem->mbIsHidden));
+ DeckMenuData aData;
+ aData.msDisplayName = pDeckDescriptor->msTitle;
+ aData.msDeckId = pDeckDescriptor->msId;
+ aData.mbIsCurrentDeck = iItem->mpButton->IsChecked();
+ aData.mbIsActive = !iItem->mbIsHidden;
+ aData.mbIsEnabled = iItem->mpButton->IsEnabled();
+
+ aMenuData.push_back(aData);
}
}
@@ -392,8 +387,7 @@ IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
Rectangle(
mpMenuButton->GetPosPixel(),
mpMenuButton->GetSizePixel()),
- aSelectionData,
- aShowData);
+ aMenuData);
return 0;
}
diff --git a/sfx2/source/sidebar/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx
index a9479cb..7cecc42 100644
--- a/sfx2/source/sidebar/TabBar.hxx
+++ b/sfx2/source/sidebar/TabBar.hxx
@@ -52,11 +52,18 @@ public:
- isCurrentDeck for the deck selection data
- isEnabled for the show/hide menu
*/
- typedef ::boost::tuple<rtl::OUString,rtl::OUString,bool> DeckMenuData;
+ class DeckMenuData
+ {
+ public:
+ ::rtl::OUString msDisplayName;
+ ::rtl::OUString msDeckId;
+ bool mbIsCurrentDeck;
+ bool mbIsActive;
+ bool mbIsEnabled;
+ };
typedef ::boost::function<void(
const Rectangle&,
- const ::std::vector<DeckMenuData>& rDeckSelectionData,
- const ::std::vector<DeckMenuData>& rDeckShowData)> PopupMenuProvider;
+ const ::std::vector<DeckMenuData>& rMenuData)> PopupMenuProvider;
TabBar (
Window* pParentWindow,
const cssu::Reference<css::frame::XFrame>& rxFrame,
commit 86af8eb71b362271bef2592a7e988631caa90224
Author: Andre Fischer <af at apache.org>
Date: Fri May 17 12:23:50 2013 +0000
Resolves; #i122219# Show 'Cell Appearance' and 'Number Format' panels...
when editing cells.(cherry picked from commit 09d043596e8283dd6ced26d1e4ff0da530252df0)
Change-Id: I2fe0f9655efa24fb99b566f5c515b0fd1f651f6b
(cherry picked from commit 9a32ed36709cb03a8b5d3bcff0276bc31c934848)
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index a92643a..cd69c01 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -724,6 +724,7 @@
<value oor:separator=";">
Calc, Auditing, visible ;
Calc, Cell, visible ;
+ Calc, EditCell, visible ;
Calc, default, visible ;
Calc, Pivot, visible ;
</value>
@@ -753,6 +754,7 @@
<value oor:separator=";">
Calc, Auditing, hidden ;
Calc, Cell, hidden ;
+ Calc, EditCell, hidden ;
Calc, default, hidden ;
Calc, Pivot, hidden ;
</value>
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 0fed648..9a16ad5 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -294,8 +294,6 @@ const SharedPanelContainer& Deck::GetPanels (void) const
void Deck::RequestLayout (void)
{
- // PrintWindowTree();
-
DeckLayouter::LayoutDeck(
GetContentArea(),
maPanels,
@@ -304,8 +302,6 @@ void Deck::RequestLayout (void)
*mpScrollContainer,
*mpFiller,
*mpVerticalScrollBar);
-
- Invalidate();
}
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index af0a547..7cc315e 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -518,20 +518,6 @@ void SidebarController::SwitchToDeck (
}
}
- if (mpCurrentDeck
- && ArePanelSetsEqual(mpCurrentDeck->GetPanels(), aPanelContextDescriptors))
- {
- // Requested set of panels is identical to the current set of
- // panels => Nothing to do.
- return;
- }
-
- // When the document is read-only, check if there are any panels that can still be displayed.
- if (mbIsDocumentReadOnly)
- {
- }
-
-
// Provide a configuration and Deck object.
if ( ! mpCurrentDeck)
{
commit 6bd7bfc156c6fda69b629cb31d28a7b0ed2298da
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Fri May 17 11:35:46 2013 +0000
Resolves: #i122310# page property panel, page size control
display page size as Width x Height
(cherry picked from commit b83fb522809c9b54427f60200164f878ae7f4658)
Conflicts:
sw/source/ui/sidebar/PageSizeControl.cxx
Change-Id: I150eb045366ee1a712f2a7fc992d5ac76b7e19d7
(cherry picked from commit 2d00e944315ddbf25b1e566082ecbf576ea0dab6)
diff --git a/sw/source/ui/sidebar/PageSizeControl.cxx b/sw/source/ui/sidebar/PageSizeControl.cxx
index 1f6cfd8..ca77f91 100644
--- a/sw/source/ui/sidebar/PageSizeControl.cxx
+++ b/sw/source/ui/sidebar/PageSizeControl.cxx
@@ -111,9 +111,9 @@ PageSizeControl::PageSizeControl(
maWidthHeightField.IsUseThousandSep(),
maWidthHeightField.IsShowTrailingZeros() );
- ItemText2 = HeightStr;
+ ItemText2 = WidthStr;
ItemText2 += OUString(" x ");
- ItemText2 += WidthStr;
+ ItemText2 += HeightStr;
ItemText2 += OUString(" ");
ItemText2 += aMetricStr;
commit 851ecc635c25aecb623a54c8b22583ce3e6adb26
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 21 17:03:14 2013 +0100
avoid static OUStrings here
Change-Id: Idd53eeaccc7d99b35ce16e30ee6d531e0cf6c34c
(cherry picked from commit 63fca6b8040f08f815378cd933e7cb66eee40346)
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 4447bed..af0a547 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -66,7 +66,7 @@ using ::rtl::OUString;
namespace
{
- const static OUString gsReadOnlyCommandName (A2S(".uno:EditDoc"));
+ const static char gsReadOnlyCommandName[] = ".uno:EditDoc";
const static sal_Int32 gnMaximumSidebarWidth (400);
const static sal_Int32 gnWidthCloseThreshold (70);
const static sal_Int32 gnWidthOpenThreshold (40);
@@ -88,7 +88,7 @@ namespace {
/** When in doubt, show this deck.
*/
- static const ::rtl::OUString gsDefaultDeckId(A2S("PropertyDeck"));
+ static const char gsDefaultDeckId[] = "PropertyDeck";
}
commit cbd8e0fef6968244861b76a3aff212bc39746aa2
Author: Andre Fischer <af at apache.org>
Date: Fri May 17 11:13:52 2013 +0000
Resolvs: #i122082# React to changes read-only <-> read-write more reliably
(cherry picked from commit a30912ea805a74f2ef47e10511d6e85ed4600b73)
Change-Id: I735ea32a498413f663efaf0e22051ab4d2d92ef5
(cherry picked from commit adb2d846e0912918708f2242997665dae5ed7478)
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index d831cee..4447bed 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -85,6 +85,10 @@ namespace {
MID_FIRST_PANEL,
MID_FIRST_HIDE = 1000
};
+
+ /** When in doubt, show this deck.
+ */
+ static const ::rtl::OUString gsDefaultDeckId(A2S("PropertyDeck"));
}
@@ -102,7 +106,7 @@ SidebarController::SidebarController (
mxFrame(rxFrame),
maCurrentContext(OUString(), OUString()),
maRequestedContext(),
- msCurrentDeckId(A2S("PropertyDeck")),
+ msCurrentDeckId(gsDefaultDeckId),
msCurrentDeckTitle(),
maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this)),
maContextChangeUpdate(::boost::bind(&SidebarController::UpdateConfigurations, this)),
@@ -252,7 +256,10 @@ void SAL_CALL SidebarController::statusChanged (const css::frame::FeatureStateEv
mbIsDocumentReadOnly = !bIsReadWrite;
// Force the current deck to update its panel list.
- SwitchToDeck(msCurrentDeckId);
+ if ( ! mbIsDocumentReadOnly)
+ msCurrentDeckId = gsDefaultDeckId;
+ maCurrentContext = Context();
+ maContextChangeUpdate.RequestCall();
}
}
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index df288bf..dc62f7a 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -159,6 +159,7 @@ private:
/** Make maRequestedContext the current context.
*/
void UpdateConfigurations (void);
+
bool ArePanelSetsEqual (
const SharedPanelContainer& rCurrentPanels,
const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels);
commit 7c531c48b78d4d03082ea5a9f054d69b91a8758a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 21 16:56:49 2013 +0100
restore missing XUIControllerRegistration from list
Change-Id: I733a6e94e28c08779303d8b720602c71791b5bd6
(cherry picked from commit 8a8fee316a565c050ef1a8531ded130ff9959bfd)
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 8845d9f..4e03c19 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2625,7 +2625,8 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\
XToolbarController \
XToolbarControllerListener \
XTransientDocumentsDocumentContentFactory \
- XUIControllerFactory \
+ XUIControllerFactory \
+ XUIControllerRegistration \
XUntitledNumbers \
XUrlList \
XWindowArranger \
commit 9499841b4cb41cc062feabd7a91e6a9a46886135
Author: Andre Fischer <af at apache.org>
Date: Fri May 17 11:58:45 2013 +0000
Related: #i122315# Include the Tools.hxx header always
(cherry picked from commit e65bf3376ec742e2d5e69cad097d17f77fb19a73)
Change-Id: I5ba72f2e30e4e3a306fafc45dfc2c38997f07f0f
(cherry picked from commit b7d74cba368a682b275adcd5d533ad067d636016)
diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index bf94ff4..738593a 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -24,14 +24,12 @@
#include "Panel.hxx"
#include "sfx2/sidebar/Theme.hxx"
#include "sfx2/sidebar/ControllerFactory.hxx"
+#include "sfx2/sidebar/Tools.hxx"
#include <tools/svborder.hxx>
#include <vcl/gradient.hxx>
#include <vcl/image.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#ifdef DEBUG
-#include "sfx2/sidebar/Tools.hxx"
-#endif
using namespace css;
using namespace cssu;
commit 485a5ff16ab355a6e51050539d94b5ceedde6021
Author: Andre Fischer <af at apache.org>
Date: Fri May 17 09:44:46 2013 +0000
Resolves: #i122315# Disable 'More Options' buttons when...
their commands are disabled
(cherry picked from commit 10e1831ad2e9597c5197bafb6e03b098f8e81454)
Conflicts:
sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
sfx2/source/sidebar/SidebarToolBox.cxx
sfx2/source/sidebar/TitleBar.cxx
Change-Id: Iff83e024bd58ce4a6f27a8cde66b287d3bf710a3
(cherry picked from commit 76ca8f7f178f5e9698d23ac0b1212922f2ddf39b)
diff --git a/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx
index bb96a9e..b22bbc8 100644
--- a/include/sfx2/sidebar/SidebarToolBox.hxx
+++ b/include/sfx2/sidebar/SidebarToolBox.hxx
@@ -48,6 +48,8 @@ public:
Window* pParentWindow,
const ResId& rResId,
const cssu::Reference<css::frame::XFrame>& rxFrame);
+ SidebarToolBox (
+ Window* pParentWindow);
virtual ~SidebarToolBox (void);
void SetBorderWindow (const Window* pBorderWindow);
@@ -67,6 +69,11 @@ public:
sal_uInt16 GetItemIdForSubToolbarName (
const ::rtl::OUString& rsCOmmandName) const;
+ void SetController (
+ const sal_uInt16 nItemId,
+ const cssu::Reference<css::frame::XToolbarController>& rxController,
+ const ::rtl::OUString& rsCommandName);
+
private:
bool mbParentIsBorder;
Image maItemSeparator;
@@ -79,6 +86,7 @@ private:
};
typedef ::std::map<sal_uInt16, ItemDescriptor> ControllerContainer;
ControllerContainer maControllers;
+ bool mbAreHandlersRegistered;
DECL_LINK(DropDownClickHandler, ToolBox*);
DECL_LINK(ClickHandler, ToolBox*);
@@ -93,6 +101,7 @@ private:
const sal_Int32 nItemWidth = 0);
void UpdateIcons (
const cssu::Reference<css::frame::XFrame>& rxFrame);
+ void RegisterHandlers (void);
};
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 6534ec7..0fed648 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -21,6 +21,7 @@
#include "DeckLayouter.hxx"
#include "DrawHelper.hxx"
#include "DeckTitleBar.hxx"
+#include "PanelTitleBar.hxx"
#include "Paint.hxx"
#include "Panel.hxx"
#include "ToolBoxBackground.hxx"
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index b04f83b..8d7cb89 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -19,7 +19,7 @@
#include "DeckLayouter.hxx"
#include "sfx2/sidebar/Theme.hxx"
#include "Panel.hxx"
-#include "TitleBar.hxx"
+#include "PanelTitleBar.hxx"
#include "Deck.hxx"
#include <vcl/window.hxx>
@@ -212,7 +212,7 @@ sal_Int32 DeckLayouter::PlacePanels (
nY += nDeckSeparatorHeight;
// Place the title bar.
- TitleBar* pTitleBar = rPanel.GetTitleBar();
+ PanelTitleBar* pTitleBar = rPanel.GetTitleBar();
if (pTitleBar != NULL)
{
if (iItem->mbShowTitleBar)
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index 6ed64a5..51d4c5e 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -19,6 +19,7 @@
#include "FocusManager.hxx"
#include "Panel.hxx"
#include "DeckTitleBar.hxx"
+#include "PanelTitleBar.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include "TitleBar.hxx"
#include <vcl/button.hxx>
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index 0840c4c..3b81121 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -82,17 +82,6 @@ Panel::~Panel (void)
-void Panel::SetShowMenuFunctor( const ::boost::function<void(void)>& rShowMenuFunctor )
-{
- if ( mpTitleBar.get() )
- {
- mpTitleBar->SetMenuAction( rShowMenuFunctor );
- }
-}
-
-
-
-
void Panel::Dispose (void)
{
mxPanelComponent = NULL;
@@ -123,7 +112,7 @@ void Panel::Dispose (void)
-TitleBar* Panel::GetTitleBar (void) const
+PanelTitleBar* Panel::GetTitleBar (void) const
{
return mpTitleBar.get();
}
diff --git a/sfx2/source/sidebar/Panel.hxx b/sfx2/source/sidebar/Panel.hxx
index 27c771a..cbf1781 100644
--- a/sfx2/source/sidebar/Panel.hxx
+++ b/sfx2/source/sidebar/Panel.hxx
@@ -53,8 +53,7 @@ public:
void Dispose (void);
- void SetShowMenuFunctor( const ::boost::function<void(void)>& rShowMenuFunctor );
- TitleBar* GetTitleBar (void) const;
+ PanelTitleBar* GetTitleBar (void) const;
bool IsTitleBarOptional (void) const;
void SetUIElement (const cssu::Reference<css::ui::XUIElement>& rxElement);
cssu::Reference<css::ui::XSidebarPanel> GetPanelComponent (void) const;
diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index 3446aca..bf94ff4 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -23,15 +23,18 @@
#include "Paint.hxx"
#include "Panel.hxx"
#include "sfx2/sidebar/Theme.hxx"
-
+#include "sfx2/sidebar/ControllerFactory.hxx"
#include <tools/svborder.hxx>
#include <vcl/gradient.hxx>
#include <vcl/image.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#ifdef DEBUG
#include "sfx2/sidebar/Tools.hxx"
#endif
+using namespace css;
+using namespace cssu;
namespace sfx2 { namespace sidebar {
@@ -48,7 +51,8 @@ PanelTitleBar::PanelTitleBar (
mbIsLeftButtonDown(false),
mpPanel(pPanel),
mnMenuItemIndex(1),
- maMenuAction()
+ mxFrame(),
+ msMoreOptionsCommand()
{
OSL_ASSERT(mpPanel != NULL);
@@ -73,23 +77,38 @@ PanelTitleBar::~PanelTitleBar (void)
-void PanelTitleBar::SetMenuAction ( const ::boost::function<void(void)>& rMenuAction )
+void PanelTitleBar::SetMoreOptionsCommand (
+ const ::rtl::OUString& rsCommandName,
+ const ::cssu::Reference<css::frame::XFrame>& rxFrame)
{
- if ( !maMenuAction && rMenuAction )
- {
- maToolBox.InsertItem(
- mnMenuItemIndex,
- Theme::GetImage(Theme::Image_PanelMenu));
- maToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT);
- maToolBox.SetQuickHelpText(
- mnMenuItemIndex,
- String(SfxResId(SFX_STR_SIDEBAR_MORE_OPTIONS)));
- }
- else if ( maMenuAction && !rMenuAction )
+ if ( ! rsCommandName.equals(msMoreOptionsCommand))
{
- maToolBox.RemoveItem( maToolBox.GetItemPos( mnMenuItemIndex ) );
+ if (msMoreOptionsCommand.getLength() > 0)
+ maToolBox.RemoveItem(maToolBox.GetItemPos(mnMenuItemIndex));
+
+ msMoreOptionsCommand = rsCommandName;
+ mxFrame = rxFrame;
+
+ if (msMoreOptionsCommand.getLength() > 0)
+ {
+ maToolBox.InsertItem(
+ mnMenuItemIndex,
+ Theme::GetImage(Theme::Image_PanelMenu));
+ Reference<frame::XToolbarController> xController (
+ ControllerFactory::CreateToolBoxController(
+ &maToolBox,
+ mnMenuItemIndex,
+ msMoreOptionsCommand,
+ rxFrame,
+ VCLUnoHelper::GetInterface(&maToolBox),
+ 0));
+ maToolBox.SetController(mnMenuItemIndex, xController, msMoreOptionsCommand);
+ maToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT);
+ maToolBox.SetQuickHelpText(
+ mnMenuItemIndex,
+ String(SfxResId(SFX_STR_SIDEBAR_MORE_OPTIONS)));
+ }
}
- maMenuAction = rMenuAction;
}
@@ -153,8 +172,21 @@ Color PanelTitleBar::GetTextColor (void)
void PanelTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
{
if (nItemIndex == mnMenuItemIndex)
- if (maMenuAction)
- maMenuAction();
+ if (msMoreOptionsCommand.getLength() > 0)
+ {
+ try
+ {
+ const util::URL aURL (Tools::GetURL(msMoreOptionsCommand));
+ Reference<frame::XDispatch> xDispatch (Tools::GetDispatch(mxFrame, aURL));
+ if (xDispatch.is())
+ xDispatch->dispatch(aURL, Sequence<beans::PropertyValue>());
+ }
+ catch(Exception& rException)
+ {
+ OSL_TRACE("caught exception: %s",
+ OUStringToOString(rException.Message, RTL_TEXTENCODING_ASCII_US).getStr());
+ }
+ }
}
diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/sfx2/source/sidebar/PanelTitleBar.hxx
index dff82a9..f47f86e 100644
--- a/sfx2/source/sidebar/PanelTitleBar.hxx
+++ b/sfx2/source/sidebar/PanelTitleBar.hxx
@@ -20,6 +20,7 @@
#include "TitleBar.hxx"
+#include <com/sun/star/frame/XFrame.hpp>
#include <boost/function.hpp>
@@ -37,7 +38,9 @@ public:
Panel* pPanel );
virtual ~PanelTitleBar (void);
- void SetMenuAction ( const ::boost::function<void(void)>& rMenuAction );
+ void SetMoreOptionsCommand (
+ const ::rtl::OUString& rsCommandName,
+ const ::cssu::Reference<css::frame::XFrame>& rxFrame);
virtual void DataChanged (const DataChangedEvent& rEvent);
virtual void MouseButtonDown (const MouseEvent& rMouseEvent);
@@ -54,7 +57,8 @@ private:
bool mbIsLeftButtonDown;
Panel* mpPanel;
const sal_uInt16 mnMenuItemIndex;
- ::boost::function<void(void)> maMenuAction;
+ cssu::Reference<css::frame::XFrame> mxFrame;
+ ::rtl::OUString msMoreOptionsCommand;
};
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 5f1b6ac..d831cee 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -19,6 +19,7 @@
#include "Deck.hxx"
#include "DeckTitleBar.hxx"
#include "Panel.hxx"
+#include "PanelTitleBar.hxx"
#include "SidebarPanel.hxx"
#include "SidebarResource.hxx"
#include "TabBar.hxx"
@@ -578,11 +579,15 @@ void SidebarController::SwitchToDeck (
}
if (aNewPanels[nWriteIndex] != NULL)
{
- // Depending on the context we have to apply the show menu functor.
- aNewPanels[nWriteIndex]->SetShowMenuFunctor(
- rPanelContexDescriptor.msMenuCommand.getLength()>0
- ? ::boost::bind(&SidebarController::ShowDetailMenu,this,rPanelContexDescriptor.msMenuCommand)
- : ::boost::function<void(void)>() );
+ // Depending on the context we have to change the command
+ // for the "more options" dialog.
+ PanelTitleBar* pTitleBar = aNewPanels[nWriteIndex]->GetTitleBar();
+ if (pTitleBar != NULL)
+ {
+ pTitleBar->SetMoreOptionsCommand(
+ rPanelContexDescriptor.msMenuCommand,
+ mxFrame);
+ }
++nWriteIndex;
}
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index d4aa7b6..291b82f 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -43,7 +43,9 @@ SidebarToolBox::SidebarToolBox (
const cssu::Reference<css::frame::XFrame>& rxFrame)
: ToolBox(pParentWindow, rResId),
mbParentIsBorder(false),
- maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator))
+ maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)),
+ maControllers(),
+ mbAreHandlersRegistered(false)
{
SetBackground(Wallpaper());
SetPaintTransparent(true);
@@ -65,12 +67,7 @@ SidebarToolBox::SidebarToolBox (
SetSizePixel(CalcWindowSizePixel());
- SetDropdownClickHdl(LINK(this, SidebarToolBox, DropDownClickHandler));
- SetClickHdl(LINK(this, SidebarToolBox, ClickHandler));
- SetDoubleClickHdl(LINK(this, SidebarToolBox, DoubleClickHandler));
- SetSelectHdl(LINK(this, SidebarToolBox, SelectHandler));
- SetActivateHdl(LINK(this, SidebarToolBox, ActivateToolBox));
- SetDeactivateHdl(LINK(this, SidebarToolBox, DeactivateToolBox));
+ RegisterHandlers();
}
#ifdef DEBUG
@@ -81,6 +78,24 @@ SidebarToolBox::SidebarToolBox (
+SidebarToolBox::SidebarToolBox (Window* pParentWindow)
+ : ToolBox(pParentWindow, 0),
+ mbParentIsBorder(false),
+ maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)),
+ maControllers(),
+ mbAreHandlersRegistered(false)
+{
+ SetBackground(Wallpaper());
+ SetPaintTransparent(true);
+
+#ifdef DEBUG
+ SetText(A2S("SidebarToolBox"));
+#endif
+}
+
+
+
+
SidebarToolBox::~SidebarToolBox (void)
{
ControllerContainer aControllers;
@@ -94,13 +109,15 @@ SidebarToolBox::~SidebarToolBox (void)
xComponent->dispose();
}
- SetDropdownClickHdl(Link());
- SetClickHdl(Link());
- SetDoubleClickHdl(Link());
- SetSelectHdl(Link());
- SetActivateHdl(Link());
- SetDeactivateHdl(Link());
-
+ if (mbAreHandlersRegistered)
+ {
+ SetDropdownClickHdl(Link());
+ SetClickHdl(Link());
+ SetDoubleClickHdl(Link());
+ SetSelectHdl(Link());
+ SetActivateHdl(Link());
+ SetDeactivateHdl(Link());
+ }
}
@@ -261,6 +278,37 @@ Reference<frame::XToolbarController> SidebarToolBox::GetControllerForItemId (con
+void SidebarToolBox::SetController(
+ const sal_uInt16 nItemId,
+ const cssu::Reference<css::frame::XToolbarController>& rxController,
+ const ::rtl::OUString& rsCommandName)
+{
+ ItemDescriptor aDescriptor;
+ aDescriptor.mxController = rxController;
+ aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(rsCommandName);
+ aDescriptor.msCurrentCommand = rsCommandName;
+
+ ControllerContainer::iterator iController (maControllers.find(nItemId));
+ if (iController != maControllers.end())
+ {
+ Reference<lang::XComponent> xComponent (iController->second.mxController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+
+ iController->second = aDescriptor;
+ }
+ else
+ {
+ maControllers[nItemId] = aDescriptor;
+ }
+
+ if (rxController.is())
+ RegisterHandlers();
+}
+
+
+
+
void SidebarToolBox::UpdateIcons (const Reference<frame::XFrame>& rxFrame)
{
for (ControllerContainer::iterator iController(maControllers.begin()), iEnd(maControllers.end());
@@ -296,6 +344,24 @@ sal_uInt16 SidebarToolBox::GetItemIdForSubToolbarName (const OUString& rsSubTool
+
+void SidebarToolBox::RegisterHandlers (void)
+{
+ if ( ! mbAreHandlersRegistered)
+ {
+ mbAreHandlersRegistered = true;
+ SetDropdownClickHdl(LINK(this, SidebarToolBox, DropDownClickHandler));
+ SetClickHdl(LINK(this, SidebarToolBox, ClickHandler));
+ SetDoubleClickHdl(LINK(this, SidebarToolBox, DoubleClickHandler));
+ SetSelectHdl(LINK(this, SidebarToolBox, SelectHandler));
+ SetActivateHdl(LINK(this, SidebarToolBox, ActivateToolBox));
+ SetDeactivateHdl(LINK(this, SidebarToolBox, DeactivateToolBox));
+ }
+}
+
+
+
+
IMPL_LINK(SidebarToolBox, DropDownClickHandler, ToolBox*, pToolBox)
{
if (pToolBox != NULL)
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index 2240006..bab9631 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -117,7 +117,7 @@ void TitleBar::setPosSizePixel (
// Place the toolbox.
const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth());
- maToolBox.setPosSizePixel(nWidth-nToolBoxWidth,0,nToolBoxWidth,nHeight);
+ maToolBox.setPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE);
maToolBox.Show();
}
diff --git a/sfx2/source/sidebar/TitleBar.hxx b/sfx2/source/sidebar/TitleBar.hxx
index c16cfbc..229d3b7 100644
--- a/sfx2/source/sidebar/TitleBar.hxx
+++ b/sfx2/source/sidebar/TitleBar.hxx
@@ -21,7 +21,7 @@
#include "Paint.hxx"
#include <vcl/window.hxx>
-#include <vcl/toolbox.hxx>
+#include "sfx2/sidebar/SidebarToolBox.hxx"
namespace sfx2 { namespace sidebar {
@@ -52,7 +52,7 @@ public:
const ToolBox& GetToolBox (void) const;
protected:
- ToolBox maToolBox;
+ SidebarToolBox maToolBox;
virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0;
virtual void PaintDecoration (const Rectangle& rTitleBarBox) = 0;
commit 52181e48798a9fdee6788f723d4ed0478ed40683
Author: Andre Fischer <af at apache.org>
Date: Thu May 16 11:43:55 2013 +0000
Resolves: #i121960# Improve creation of toolbox/toolbar controllers
(cherry picked from commit 3608a33d8362cbc44a2eb7203b7d1bffe481c7ab)
Conflicts:
sfx2/inc/sfx2/sidebar/ControlFactory.hxx
sfx2/inc/sfx2/sidebar/ControllerFactory.hxx
sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
sfx2/inc/sfx2/sidebar/Tools.hxx
sfx2/source/sidebar/ToolBoxBackground.cxx
Change-Id: I833a33bbc58ebe46bd28c6d97a4d76329f1f0186
(cherry picked from commit edaca7c6e1d1ade6bf6cdae753028ee62297f0b1)
diff --git a/include/sfx2/sidebar/ControlFactory.hxx b/include/sfx2/sidebar/ControlFactory.hxx
index 3b286e9..b4d329a 100644
--- a/include/sfx2/sidebar/ControlFactory.hxx
+++ b/include/sfx2/sidebar/ControlFactory.hxx
@@ -28,26 +28,49 @@ namespace sfx2 { namespace sidebar {
class ToolBoxBackground;
+/** Factory for controls used in sidebar panels.
+ The reason to use this factory instead of creating the controls
+ directly is that this way the sidebar has a little more control
+ over look and feel of its controls.
+*/
class SFX2_DLLPUBLIC ControlFactory
{
public:
+ /** Create the menu button for the task bar.
+ */
static CheckBox* CreateMenuButton (Window* pParentWindow);
+
static ImageRadioButton* CreateTabItem (Window* pParentWindow);
- /** Create a tool box that does *not* handle its items.
+ /** Create a tool box that does *not* handle its items. The
+ caller has to register callbacks to process, among others,
+ click and selection events.
*/
static SidebarToolBox* CreateToolBox (
Window* pParentWindow,
const ResId& rResId);
- /** Create a tool box that *does* handle its items.
+ /** Create a tool box that *does* handle its items. All event
+ processing is done by toolbox controllers.
*/
static SidebarToolBox* CreateToolBox (
Window* pParentWindow,
const ResId& rResId,
const ::com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rxFrame);
- static Window* CreateToolBoxBackground (Window* pParentWindow);
+ /** Create a window that acts as background of a tool box.
+ In general it is slightly larger than the tool box.
+ @param pParentWindow
+ The parent window of the new background control.
+ @param bShowBorder
+ When <TRUE/> then the background control is made slightly
+ larger then its tool box child, once that is created.
+ Otherwise the background control will not be visible.
+ */
+ static Window* CreateToolBoxBackground (
+ Window* pParentWindow,
+ const bool bShowBorder = true);
+
static ImageRadioButton* CreateCustomImageRadionButton(
Window* pParentWindow,
const ResId& rResId );
diff --git a/include/sfx2/sidebar/ControllerFactory.hxx b/include/sfx2/sidebar/ControllerFactory.hxx
index 030b050..fa341f1 100644
--- a/include/sfx2/sidebar/ControllerFactory.hxx
+++ b/include/sfx2/sidebar/ControllerFactory.hxx
@@ -19,8 +19,9 @@
#define SFX_SIDEBAR_CONTROLLER_FACTORY_HXX
#include "sfx2/dllapi.h"
-#include <com/sun/star/frame/XToolbarController.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XToolbarController.hpp>
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
@@ -29,7 +30,7 @@ class ToolBox;
namespace sfx2 { namespace sidebar {
-/** Convenience class for easy creation of toolbox controllers.
+/** Convenience class for the easy creation of toolbox controllers.
*/
class SFX2_DLLPUBLIC ControllerFactory
{
@@ -38,7 +39,16 @@ public:
ToolBox* pToolBox,
const sal_uInt16 nItemId,
const ::rtl::OUString& rsCommandName,
- const cssu::Reference<css::frame::XFrame>& rxFrame);
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ const cssu::Reference<css::awt::XWindow>& rxParentWindow,
+ const sal_Int32 nItemWidth);
+
+private:
+ static cssu::Reference<css::frame::XToolbarController> CreateToolBarController(
+ ToolBox* pToolBox,
+ const ::rtl::OUString& rsCommandName,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ const sal_Int32 nWidth);
};
diff --git a/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx
index 4d5625c..bb96a9e 100644
--- a/include/sfx2/sidebar/SidebarToolBox.hxx
+++ b/include/sfx2/sidebar/SidebarToolBox.hxx
@@ -76,7 +76,6 @@ private:
cssu::Reference<css::frame::XToolbarController> mxController;
css::util::URL maURL;
rtl::OUString msCurrentCommand;
- cssu::Reference<css::frame::XDispatch> mxDispatch;
};
typedef ::std::map<sal_uInt16, ItemDescriptor> ControllerContainer;
ControllerContainer maControllers;
@@ -90,7 +89,8 @@ private:
void CreateController (
const sal_uInt16 nItemId,
- const cssu::Reference<css::frame::XFrame>& rxFrame);
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ const sal_Int32 nItemWidth = 0);
void UpdateIcons (
const cssu::Reference<css::frame::XFrame>& rxFrame);
};
diff --git a/include/sfx2/sidebar/Tools.hxx b/include/sfx2/sidebar/Tools.hxx
index 769cd04..db72103 100644
--- a/include/sfx2/sidebar/Tools.hxx
+++ b/include/sfx2/sidebar/Tools.hxx
@@ -60,6 +60,9 @@ public:
static cssu::Reference<css::frame::XDispatch> GetDispatch (
const cssu::Reference<css::frame::XFrame>& rxFrame,
const css::util::URL& rURL);
+
+ static ::rtl::OUString GetModuleName (
+ const cssu::Reference<css::frame::XFrame>& rxFrame);
};
diff --git a/sfx2/source/sidebar/ControlFactory.cxx b/sfx2/source/sidebar/ControlFactory.cxx
index 1a6f9a5..3c0c02a 100644
--- a/sfx2/source/sidebar/ControlFactory.cxx
+++ b/sfx2/source/sidebar/ControlFactory.cxx
@@ -76,9 +76,10 @@ SidebarToolBox* ControlFactory::CreateToolBox (
Window* ControlFactory::CreateToolBoxBackground (
- Window* pParentWindow)
+ Window* pParentWindow,
+ const bool bShowBorder)
{
- ToolBoxBackground* pBorderWindow = new ToolBoxBackground(pParentWindow);
+ ToolBoxBackground* pBorderWindow = new ToolBoxBackground(pParentWindow, bShowBorder);
pBorderWindow->Show();
return pBorderWindow;
}
diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx
index 7ce9eb8..cc5fe34 100644
--- a/sfx2/source/sidebar/ControllerFactory.cxx
+++ b/sfx2/source/sidebar/ControllerFactory.cxx
@@ -22,10 +22,12 @@
#include <com/sun/star/frame/XToolbarController.hpp>
#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
#include <framework/sfxhelperfunctions.hxx>
#include <svtools/generictoolboxcontroller.hxx>
#include <comphelper/processfactory.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
using namespace css;
@@ -39,17 +41,30 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
ToolBox* pToolBox,
const sal_uInt16 nItemId,
const OUString& rsCommandName,
- const Reference<frame::XFrame>& rxFrame)
+ const Reference<frame::XFrame>& rxFrame,
+ const Reference<awt::XWindow>& rxParentWindow,
+ const sal_Int32 nWidth)
{
+ Reference<frame::XToolbarController> xController (
+ CreateToolBarController(
+ pToolBox,
+ rsCommandName,
+ rxFrame,
+ nWidth));
+
// Create a controller for the new item.
- Reference<frame::XToolbarController> xController(
- static_cast<XWeak*>(::framework::CreateToolBoxController(
- rxFrame,
- pToolBox,
- nItemId,
- rsCommandName)),
+ if ( ! xController.is())
+ {
+ xController.set(
+ static_cast<XWeak*>(::framework::CreateToolBoxController(
+ rxFrame,
+ pToolBox,
+ nItemId,
+ rsCommandName)),
UNO_QUERY);
+ }
if ( ! xController.is())
+ {
xController.set(
static_cast<XWeak*>(new svt::GenericToolboxController(
::comphelper::getProcessComponentContext(),
@@ -58,6 +73,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
nItemId,
rsCommandName)),
UNO_QUERY);
+ }
// Initialize the controller with eg a service factory.
Reference<lang::XInitialization> xInitialization (xController, UNO_QUERY);
@@ -82,22 +98,104 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
xInitialization->initialize(aArgs);
}
- Reference<util::XUpdatable> xUpdatable (xController, UNO_QUERY);
- if (xUpdatable.is())
- xUpdatable->update();
-
- // Add label.
if (xController.is())
{
- const OUString sLabel (sfx2::sidebar::CommandInfoProvider::Instance().GetLabelForCommand(
- rsCommandName,
- rxFrame));
- pToolBox->SetQuickHelpText(nItemId, sLabel);
- pToolBox->EnableItem(nItemId);
+ if (rxParentWindow.is())
+ {
+ Reference<awt::XWindow> xItemWindow (xController->createItemWindow(rxParentWindow));
+ Window* pItemWindow = VCLUnoHelper::GetWindow(xItemWindow);
+ if (pItemWindow != NULL)
+ {
+ WindowType nType = pItemWindow->GetType();
+ if (nType == WINDOW_LISTBOX || nType == WINDOW_MULTILISTBOX || nType == WINDOW_COMBOBOX)
+ pItemWindow->SetAccessibleName(pToolBox->GetItemText(nItemId));
+ if (nWidth > 0)
+ pItemWindow->SetSizePixel(Size(nWidth, pItemWindow->GetSizePixel().Height()));
+ pToolBox->SetItemWindow(nItemId, pItemWindow);
+ }
+ }
+
+ Reference<util::XUpdatable> xUpdatable (xController, UNO_QUERY);
+ if (xUpdatable.is())
+ xUpdatable->update();
+
+ // Add label.
+ if (xController.is())
+ {
+ const OUString sLabel (sfx2::sidebar::CommandInfoProvider::Instance().GetLabelForCommand(
+ rsCommandName,
+ rxFrame));
+ pToolBox->SetQuickHelpText(nItemId, sLabel);
+ pToolBox->EnableItem(nItemId);
+ }
}
return xController;
}
+
+
+Reference<frame::XToolbarController> ControllerFactory::CreateToolBarController(
+ ToolBox* pToolBox,
+ const OUString& rsCommandName,
+ const Reference<frame::XFrame>& rxFrame,
+ const sal_Int32 nWidth)
+{
+ try
+ {
+ Reference<frame::XUIControllerFactory> xFactory (
+ comphelper::getProcessServiceFactory()->createInstance(A2S("com.sun.star.frame.ToolbarControllerFactory")),
+ UNO_QUERY);
+ OUString sModuleName (Tools::GetModuleName(rxFrame));
+
+ if (xFactory.is() && xFactory->hasController(rsCommandName, sModuleName))
+ {
+ beans::PropertyValue aPropValue;
+ std::vector<Any> aPropertyVector;
+
+ aPropValue.Name = A2S("ModuleIdentifier");
+ aPropValue.Value <<= sModuleName;
+ aPropertyVector.push_back( makeAny( aPropValue ));
+
+ aPropValue.Name = A2S("Frame");
+ aPropValue.Value <<= rxFrame;
+ aPropertyVector.push_back( makeAny( aPropValue ));
+
+ aPropValue.Name = A2S("ServiceManager");
+ aPropValue.Value <<= comphelper::getProcessServiceFactory();
+ aPropertyVector.push_back( makeAny( aPropValue ));
+
+ aPropValue.Name = A2S("ParentWindow");
+ aPropValue.Value <<= VCLUnoHelper::GetInterface(pToolBox);
+ aPropertyVector.push_back( makeAny( aPropValue ));
+
+ if (nWidth > 0)
+ {
+ aPropValue.Name = A2S("Width");
+ aPropValue.Value <<= nWidth;
+ aPropertyVector.push_back( makeAny( aPropValue ));
+ }
+
+ Reference<beans::XPropertySet> xFactoryProperties (comphelper::getProcessServiceFactory(), UNO_QUERY);
+ Reference<XComponentContext > xComponentContext;
+ if (xFactoryProperties.is())
+ xFactoryProperties->getPropertyValue(A2S("DefaultContext")) >>= xComponentContext;
+
+ Sequence<Any> aArgs (comphelper::containerToSequence(aPropertyVector));
+ return Reference<frame::XToolbarController>(
+ xFactory->createInstanceWithArgumentsAndContext(
+ rsCommandName,
+ aArgs,
+ xComponentContext),
+ UNO_QUERY);
+ }
+ }
+ catch (Exception& rException)
+ {
+ // Ignore exception.
+ }
+ return NULL;
+}
+
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index eaf4bea..2821293 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -495,7 +495,7 @@ void ResourceManager::ReadContextList (
void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame)
{
// Get module name for given frame.
- ::rtl::OUString sModuleName (GetModuleName(rxFrame));
+ ::rtl::OUString sModuleName (Tools::GetModuleName(rxFrame));
if (sModuleName.getLength() == 0)
return;
if (maProcessedApplications.find(sModuleName) != maProcessedApplications.end())
@@ -586,30 +586,6 @@ void ResourceManager::StorePanelExpansionState (
-::rtl::OUString ResourceManager::GetModuleName (
- const cssu::Reference<css::frame::XFrame>& rxFrame)
-{
- if ( ! rxFrame.is() || ! rxFrame->getController().is())
- return OUString();
-
- try
- {
- const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory());
- const Reference<frame::XModuleManager> xModuleManager (
- aContext.createComponent("com.sun.star.frame.ModuleManager"),
- UNO_QUERY_THROW);
- return xModuleManager->identify(rxFrame);
- }
- catch (const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return OUString();
-}
-
-
-
-
::utl::OConfigurationTreeRoot ResourceManager::GetLegacyAddonRootNode (
const ::rtl::OUString& rsModuleName) const
{
diff --git a/sfx2/source/sidebar/ResourceManager.hxx b/sfx2/source/sidebar/ResourceManager.hxx
index e1b6e68..8d617d9 100644
--- a/sfx2/source/sidebar/ResourceManager.hxx
+++ b/sfx2/source/sidebar/ResourceManager.hxx
@@ -98,9 +98,6 @@ public:
const bool bExpansionState,
const Context& rContext);
- static ::rtl::OUString GetModuleName (
- const cssu::Reference<css::frame::XFrame>& rxFrame);
-
private:
ResourceManager (void);
~ResourceManager (void);
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index 0fcf64e..d4aa7b6 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -23,6 +23,7 @@
#include "sfx2/sidebar/Tools.hxx"
#include <vcl/gradient.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <svtools/miscopt.hxx>
#include <framework/imageproducer.hxx>
#include <com/sun/star/frame/XSubToolbarController.hpp>
@@ -51,8 +52,15 @@ SidebarToolBox::SidebarToolBox (
if (rxFrame.is())
{
const sal_uInt16 nItemCount (GetItemCount());
- for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex)
- CreateController(GetItemId(nItemIndex), rxFrame);
+ if (nItemCount == 1)
+ {
+ // When there is only one item then make that as wide as
+ // the tool box.
+ CreateController(GetItemId(0), rxFrame, GetSizePixel().Width());
+ }
+ else
+ for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex)
+ CreateController(GetItemId(nItemIndex), rxFrame, 0);
UpdateIcons(rxFrame);
SetSizePixel(CalcWindowSizePixel());
@@ -215,7 +223,8 @@ long SidebarToolBox::Notify (NotifyEvent& rEvent)
void SidebarToolBox::CreateController (
const sal_uInt16 nItemId,
- const cssu::Reference<css::frame::XFrame>& rxFrame)
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ const sal_Int32 nItemWidth)
{
ItemDescriptor aDescriptor;
@@ -225,13 +234,16 @@ void SidebarToolBox::CreateController (
this,
nItemId,
sCommandName,
- rxFrame);
- aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(sCommandName);
- aDescriptor.msCurrentCommand = sCommandName;
- aDescriptor.mxDispatch = sfx2::sidebar::Tools::GetDispatch(rxFrame, aDescriptor.maURL);
+ rxFrame,
+ VCLUnoHelper::GetInterface(this),
+ nItemWidth);
+ if (aDescriptor.mxController.is())
+ {
+ aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(sCommandName);
+ aDescriptor.msCurrentCommand = sCommandName;
- if (aDescriptor.mxController.is() && aDescriptor.mxDispatch.is())
maControllers.insert(::std::make_pair(nItemId, aDescriptor));
+ }
}
diff --git a/sfx2/source/sidebar/ToolBoxBackground.cxx b/sfx2/source/sidebar/ToolBoxBackground.cxx
index a5105c9..23c6af3 100644
--- a/sfx2/source/sidebar/ToolBoxBackground.cxx
+++ b/sfx2/source/sidebar/ToolBoxBackground.cxx
@@ -28,10 +28,19 @@
namespace sfx2 { namespace sidebar {
-ToolBoxBackground::ToolBoxBackground (Window* pParentWindow)
+ToolBoxBackground::ToolBoxBackground (
+ Window* pParentWindow,
+ const bool bShowBorder)
: Window(pParentWindow, WB_DIALOGCONTROL),
- maPadding(Tools::RectangleToSvBorder(Theme::GetRectangle(Theme::Rect_ToolBoxPadding)))
+ maPadding(bShowBorder
+ ? Tools::RectangleToSvBorder(Theme::GetRectangle(Theme::Rect_ToolBoxPadding))
+ : SvBorder())
{
+ if (bShowBorder)
+ SetBackground(Theme::GetPaint(Theme::Paint_ToolBoxBackground).GetWallpaper());
+ else
+ SetBackground(Wallpaper());
+
#ifdef DEBUG
SetText(A2S("ToolBoxBackground"));
#endif
diff --git a/sfx2/source/sidebar/ToolBoxBackground.hxx b/sfx2/source/sidebar/ToolBoxBackground.hxx
index f1d1bdc..375e6d9 100644
--- a/sfx2/source/sidebar/ToolBoxBackground.hxx
+++ b/sfx2/source/sidebar/ToolBoxBackground.hxx
@@ -32,7 +32,9 @@ class ToolBoxBackground
: public Window
{
public:
- ToolBoxBackground (Window* pParentWindow);
+ ToolBoxBackground (
+ Window* pParentWindow,
+ const bool bShowBorder);
virtual ~ToolBoxBackground (void);
/** Call this method once to
diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx
index 8815458..62c244c 100644
--- a/sfx2/source/sidebar/Tools.cxx
+++ b/sfx2/source/sidebar/Tools.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
#include <cstring>
@@ -179,4 +180,28 @@ Reference<frame::XDispatch> Tools::GetDispatch (
}
+
+
+::rtl::OUString Tools::GetModuleName (
+ const cssu::Reference<css::frame::XFrame>& rxFrame)
+{
+ if ( ! rxFrame.is() || ! rxFrame->getController().is())
+ return ::rtl::OUString();
+
+ try
+ {
+ const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory());
+ const Reference<frame::XModuleManager> xModuleManager (
+ aContext.createComponent("com.sun.star.frame.ModuleManager"),
+ UNO_QUERY_THROW);
+ return xModuleManager->identify(rxFrame);
+ }
+ catch (const Exception&)
+ {
+ // Ignored.
+ }
+ return ::rtl::OUString();
+}
+
+
} } // end of namespace sfx2::sidebar
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.hxx b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
index 6f50d93..bd58a3a 100644
--- a/svx/source/sidebar/insert/InsertPropertyPanel.hxx
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
@@ -35,6 +35,8 @@ class ToolBox;
namespace svx { namespace sidebar {
+/** This panel provides buttons for inserting shapes into a document.
+*/
class InsertPropertyPanel
: public Control
{
commit 1fb5a19fa3c80b4a33d8ccffad2127ebc1c17542
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 21 16:35:47 2013 +0100
add missing files
Change-Id: I94dc9b99d243adf21f0439911899354781467da4
(cherry picked from commit aad035bd70b29253e9206de48259a9f0943bbc41)
diff --git a/framework/inc/uifactory/uicontrollerfactory.hxx b/framework/inc/uifactory/uicontrollerfactory.hxx
new file mode 100644
index 0000000..df3f70a
--- /dev/null
+++ b/framework/inc/uifactory/uicontrollerfactory.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 __FRAMEWORK_UICONTROLLERFACTORY_HXX_
+#define __FRAMEWORK_UICONTROLLERFACTORY_HXX_
+
+#include <threadhelp/threadhelpbase.hxx>
+#include <macros/generic.hxx>
+#include <macros/xinterface.hxx>
+#include <macros/xtypeprovider.hxx>
+#include <macros/xserviceinfo.hxx>
+#include <stdtypes.h>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+namespace framework
+{
+
+class ConfigurationAccess_ControllerFactory;
+class UIControllerFactory : protected ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2<
+ com::sun::star::lang::XServiceInfo,
+ com::sun::star::frame::XUIControllerFactory >
+{
+ public:
+ virtual ~UIControllerFactory();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ // XMultiComponentFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const OUString& aServiceSpecifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XUIControllerRegistration
+ virtual sal_Bool SAL_CALL hasController( const OUString& aCommandURL, const OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL registerController( const OUString& aCommandURL, const OUString& aModuleName, const OUString& aControllerImplementationName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deregisterController( const OUString& aCommandURL, const OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ UIControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager, const rtl::OUString &rUINode );
+ sal_Bool m_bConfigRead;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ConfigurationAccess_ControllerFactory* m_pConfigAccess;
+};
+
+class PopupMenuControllerFactory : public UIControllerFactory
+{
+ public:
+ PopupMenuControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+
+ // XInterface, XTypeProvider, XServiceInfo
+ DECLARE_XSERVICEINFO
+};
+
+class ToolbarControllerFactory : public UIControllerFactory
+{
+ public:
+ ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+
+ // XInterface, XTypeProvider, XServiceInfo
+ DECLARE_XSERVICEINFO
+};
+
+class StatusbarControllerFactory : public UIControllerFactory
+{
+ public:
+ StatusbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+
+ // XInterface, XTypeProvider, XServiceInfo
+ DECLARE_XSERVICEINFO
+};
+
+}
+
+#endif // __FRAMEWORK_UICONTROLLERFACTORY_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uifactory/uicontrollerfactory.cxx b/framework/source/uifactory/uicontrollerfactory.cxx
new file mode 100644
index 0000000..e72a3a8
--- /dev/null
+++ b/framework/source/uifactory/uicontrollerfactory.cxx
@@ -0,0 +1,269 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 <uifactory/uicontrollerfactory.hxx>
+#include <uifactory/factoryconfiguration.hxx>
+#include <threadhelp/resetableguard.hxx>
+#include "services.h"
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+
+#include <rtl/ustrbuf.hxx>
+#include <cppuhelper/weak.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace ::com::sun::star::frame;
+
+namespace framework
+{
+
+UIControllerFactory::UIControllerFactory(
+ const Reference< XMultiServiceFactory >& xServiceManager,
+ const rtl::OUString &rConfigurationNode )
+ : ThreadHelpBase()
+ , m_bConfigRead( sal_False )
+ , m_xServiceManager( xServiceManager )
+ , m_pConfigAccess()
+{
+ rtl::OUStringBuffer aBuffer;
+ aBuffer.appendAscii(
+ RTL_CONSTASCII_STRINGPARAM(
+ "/org.openoffice.Office.UI.Controller/Registered/" ) );
+ aBuffer.append( rConfigurationNode );
+ m_pConfigAccess = new ConfigurationAccess_ControllerFactory(
+ comphelper::getComponentContext(m_xServiceManager), aBuffer.makeStringAndClear() );
+ m_pConfigAccess->acquire();
+}
+
+UIControllerFactory::~UIControllerFactory()
+{
+ ResetableGuard aLock( m_aLock );
+
+ // reduce reference count
+ m_pConfigAccess->release();
+}
+
+// XMultiComponentFactory
+Reference< XInterface > SAL_CALL UIControllerFactory::createInstanceWithContext(
+ const OUString& aServiceSpecifier,
+ const Reference< XComponentContext >& )
+throw (Exception, RuntimeException)
+{
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ if ( !m_bConfigRead )
+ {
+ m_bConfigRead = sal_True;
+ m_pConfigAccess->readConfigurationData();
+ }
+
+ OUString aServiceName = m_pConfigAccess->getServiceFromCommandModule( aServiceSpecifier, OUString() );
+ if ( !aServiceName.isEmpty() )
+ return m_xServiceManager->createInstance( aServiceName );
+ else
+ return Reference< XInterface >();
+ // SAFE
+}
+
+Reference< XInterface > SAL_CALL UIControllerFactory::createInstanceWithArgumentsAndContext(
+ const OUString& ServiceSpecifier,
+ const Sequence< Any >& Arguments,
+ const Reference< XComponentContext >& )
+throw (Exception, RuntimeException)
+{
+ const OUString aPropModuleName( "ModuleIdentifier" );
+ const OUString aPropValueName( "Value" );
+
+ OUString aPropName;
+ PropertyValue aPropValue;
+
+ // Retrieve the optional module name form the Arguments sequence. It is used as a part of
+ // the hash map key to support different controller implementation for the same URL but different
+ // module!!
+ for ( int i = 0; i < Arguments.getLength(); i++ )
+ {
+ if (( Arguments[i] >>= aPropValue ) && ( aPropValue.Name.equals( aPropModuleName )))
+ {
+ aPropValue.Value >>= aPropName;
+ break;
+ }
+ }
+
+ Sequence< Any > aNewArgs( Arguments );
+
+ sal_Int32 nAppendIndex = aNewArgs.getLength();
+ bool bHasValue = m_pConfigAccess->hasValue();
+ aNewArgs.realloc( aNewArgs.getLength() + (bHasValue ? 2 : 1) );
+
+ // Append the command URL to the Arguments sequence so that one controller can be
+ // used for more than one command URL.
+ aPropValue.Name = OUString( "CommandURL" );
+ aPropValue.Value <<= ServiceSpecifier;
+ aNewArgs[nAppendIndex] <<= aPropValue;
+
+ if ( bHasValue )
+ {
+ // Append the optional value argument. It's an empty string if no additional info
+ // is provided to the controller.
+ OUString aValue = m_pConfigAccess->getValueFromCommandModule( ServiceSpecifier, aPropName );
+ aPropValue.Name = aPropValueName;
+ aPropValue.Value <<= aValue;
+ aNewArgs[nAppendIndex+1] <<= aPropValue;
+ }
+
+ {
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ if ( !m_bConfigRead )
+ {
+ m_bConfigRead = sal_True;
+ m_pConfigAccess->readConfigurationData();
+ }
+
+ OUString aServiceName = m_pConfigAccess->getServiceFromCommandModule( ServiceSpecifier, aPropName );
+ Reference< XMultiServiceFactory > xServiceManager( m_xServiceManager );
+
+ aLock.unlock();
+ // SAFE
+
+ if ( !aServiceName.isEmpty() )
+ return xServiceManager->createInstanceWithArguments( aServiceName, aNewArgs );
+ else
+ return Reference< XInterface >();
+ }
+}
+
+Sequence< OUString > SAL_CALL UIControllerFactory::getAvailableServiceNames()
+throw (RuntimeException)
+{
+ return Sequence< OUString >();
+}
+
+// XUIControllerRegistration
+sal_Bool SAL_CALL UIControllerFactory::hasController(
+ const OUString& aCommandURL,
+ const OUString& aModuleName )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aLock( m_aLock );
+
+ if ( !m_bConfigRead )
+ {
+ m_bConfigRead = sal_True;
+ m_pConfigAccess->readConfigurationData();
+ }
+
+ return ( !m_pConfigAccess->getServiceFromCommandModule( aCommandURL, aModuleName ).isEmpty() );
+}
+
+void SAL_CALL UIControllerFactory::registerController(
+ const OUString& aCommandURL,
+ const OUString& aModuleName,
+ const OUString& aControllerImplementationName )
+throw (RuntimeException)
+{
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ if ( !m_bConfigRead )
+ {
+ m_bConfigRead = sal_True;
+ m_pConfigAccess->readConfigurationData();
+ }
+
+ m_pConfigAccess->addServiceToCommandModule( aCommandURL, aModuleName, aControllerImplementationName );
+ // SAFE
+}
+
+void SAL_CALL UIControllerFactory::deregisterController(
+ const OUString& aCommandURL,
+ const OUString& aModuleName )
+throw (RuntimeException)
+{
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ if ( !m_bConfigRead )
+ {
+ m_bConfigRead = sal_True;
+ m_pConfigAccess->readConfigurationData();
+ }
+
+ m_pConfigAccess->removeServiceFromCommandModule( aCommandURL, aModuleName );
+ // SAFE
+}
+
+
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( PopupMenuControllerFactory ,
+ ::cppu::OWeakObject ,
+ SERVICENAME_POPUPMENUCONTROLLERFACTORY ,
+ IMPLEMENTATIONNAME_POPUPMENUCONTROLLERFACTORY
+ )
+
+DEFINE_INIT_SERVICE ( PopupMenuControllerFactory, {} )
+
+PopupMenuControllerFactory::PopupMenuControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) :
+ UIControllerFactory(
+ xServiceManager,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PopupMenu" )) )
+{
+}
+
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( ToolbarControllerFactory ,
+ ::cppu::OWeakObject ,
+ SERVICENAME_TOOLBARCONTROLLERFACTORY ,
+ IMPLEMENTATIONNAME_TOOLBARCONTROLLERFACTORY
+ )
+
+DEFINE_INIT_SERVICE ( ToolbarControllerFactory, {} )
+
+ToolbarControllerFactory::ToolbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) :
+ UIControllerFactory(
+ xServiceManager,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ToolBar" )))
+{
+}
+
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( StatusbarControllerFactory ,
+ ::cppu::OWeakObject ,
+ SERVICENAME_STATUSBARCONTROLLERFACTORY ,
+ IMPLEMENTATIONNAME_STATUSBARCONTROLLERFACTORY
+ )
+
+DEFINE_INIT_SERVICE ( StatusbarControllerFactory, {} )
+
+StatusbarControllerFactory::StatusbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) :
+ UIControllerFactory(
+ xServiceManager,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusBar" )) )
+{
+}
+
+} // namespace framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 8b6d5901d8476e8a3ff72c8d50d53f961849111a
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Fri Apr 26 21:55:57 2013 +0000
UI Controller Factory fixes
- "ModuleName" --> "ModuleIdentifier": the IDL definition for
css::frame::PopupMenuControllerFactory and
css::frame::StatusbarControllerFactory tells to use a property named
"ModuleIdentifier", but in the code it is named "ModuleName"
- Undocumented css::frame::ToolbarControllerFactory
- Fix service name of ToolbarControllerFactory (ToolbarControllerFactory
instead of ToolBarControllerFactory)
- Convert the three service factories to new style, and use these
new-style services in the source code
- Implement multiple inheritance: added new css::frame::XUIControllerFactory
- Added a (true) base class and implemented the three factories in a
single file
(cherry picked from commit acc7fed28f54f836b0923180431a0c180f91e98c)
Conflicts:
framework/inc/pch/precompiled_framework.hxx
framework/inc/uielement/toolbarmanager.hxx
framework/inc/uifactory/popupmenucontrollerfactory.hxx
framework/inc/uifactory/statusbarcontrollerfactory.hxx
framework/inc/uifactory/uicontrollerfactory.hxx
framework/source/uielement/addonstoolbarmanager.cxx
framework/source/uielement/menubarmanager.cxx
framework/source/uielement/popupmenucontroller.cxx
framework/source/uielement/statusbarmanager.cxx
framework/source/uielement/toolbarmanager.cxx
framework/source/uifactory/popupmenucontrollerfactory.cxx
framework/source/uifactory/statusbarcontrollerfactory.cxx
framework/source/uifactory/uicontrollerfactory.cxx
framework/source/unotypes/fwk.xml
offapi/com/sun/star/frame/PopupMenuControllerFactory.idl
offapi/com/sun/star/frame/StatusbarControllerFactory.idl
offapi/com/sun/star/frame/makefile.mk
svtools/source/uno/toolboxcontroller.cxx
Change-Id: Ia8580539badf650a84bc6e57a6b832071e011f0a
(cherry picked from commit 8b050d1e91a6623fb2770421e564a74d6259d816)
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 0b05fab..195776f 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -69,6 +69,8 @@
#include <com/sun/star/ui/UIElementFactoryManager.hpp>
#include <com/sun/star/ui/WindowStateConfiguration.hpp>
#include <com/sun/star/frame/XUIControllerRegistration.hpp>
+#include <com/sun/star/frame/ToolbarControllerFactory.hpp>
+#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <toolkit/unohlp.hxx>
#include <comphelper/configuration.hxx>
@@ -2214,21 +2216,17 @@ void Desktop::PreloadConfigurationData()
// preload popup menu controller factories. As all controllers are in the same
// configuration file they also get preloaded!
- Reference< ::com::sun::star::frame::XUIControllerRegistration > xPopupMenuControllerFactory(
- rFactory->createInstance(
- rtl::OUString( "com.sun.star.frame.PopupMenuControllerFactory" )),
- UNO_QUERY );
- if ( xPopupMenuControllerFactory.is() )
+
+ Reference< css::frame::XUIControllerRegistration > xPopupMenuControllerFactory =
+ css::frame::PopupMenuControllerFactory::create( xContext );
+ try
+ {
+ xPopupMenuControllerFactory->hasController(
+ OUString( ".uno:CharFontName" ),
+ OUString() );
+ }
+ catch ( const ::com::sun::star::uno::Exception& )
{
- try
- {
- xPopupMenuControllerFactory->hasController(
- rtl::OUString( ".uno:CharFontName" ),
- OUString() );
- }
- catch ( const ::com::sun::star::uno::Exception& )
- {
- }
}
// preload filter configuration
diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk
index 2a53057..bc9b711 100644
--- a/framework/Library_fwk.mk
+++ b/framework/Library_fwk.mk
@@ -160,10 +160,8 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/uifactory/addonstoolboxfactory \
framework/source/uifactory/factoryconfiguration \
framework/source/uifactory/menubarfactory \
- framework/source/uifactory/popupmenucontrollerfactory \
- framework/source/uifactory/statusbarcontrollerfactory \
framework/source/uifactory/statusbarfactory \
- framework/source/uifactory/toolbarcontrollerfactory \
+ framework/source/uifactory/uicontrollerfactory \
framework/source/uifactory/toolboxfactory \
framework/source/uifactory/uielementfactorymanager \
framework/source/uifactory/windowcontentfactorymanager \
diff --git a/framework/inc/services.h b/framework/inc/services.h
index d57af35..16a9443 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -46,7 +46,7 @@ namespace framework{
#define SERVICENAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration")
#define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration")
#define SERVICENAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.ui.ToolBarFactory" )
-#define SERVICENAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.ToolBarControllerFactory" )
+#define SERVICENAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.ToolbarControllerFactory" )
#define SERVICENAME_LICENSE SERVICENAME_JOB
#define SERVICENAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.ui.StatusBarFactory" )
#define SERVICENAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.StatusbarControllerFactory" )
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx
index 1e9e386..50e27d66 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -41,7 +41,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/frame/XUIControllerRegistration.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
#include <com/sun/star/ui/XUIConfigurationListener.hpp>
#include <com/sun/star/ui/XImageManager.hpp>
#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
@@ -235,7 +235,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
Menu* m_pVCLMenu;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xPopupMenuControllerRegistration;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerFactory > m_xPopupMenuControllerFactory;
::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider;
diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx
index 26cc183..c855b12 100644
--- a/framework/inc/uielement/statusbarmanager.hxx
+++ b/framework/inc/uielement/statusbarmanager.hxx
@@ -29,7 +29,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XStatusListener.hpp>
#include <com/sun/star/frame/XStatusbarController.hpp>
-#include <com/sun/star/frame/XUIControllerRegistration.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
#include <com/sun/star/ui/XUIConfiguration.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -118,7 +118,7 @@ class StatusBarManager : public ::com::sun::star::frame::XFrameActionListener
StatusBarControllerMap m_aControllerMap;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xStatusbarControllerRegistration;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerFactory > m_xStatusbarControllerFactory;
};
}
diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx
index 3e05868..1b26588 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -34,7 +34,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
-#include <com/sun/star/frame/XUIControllerRegistration.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
#include <com/sun/star/ui/XImageManager.hpp>
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
#include <com/sun/star/frame/XSubToolbarController.hpp>
@@ -202,7 +202,7 @@ class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener
ToolBarControllerMap m_aControllerMap;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xToolbarControllerRegistration;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerFactory > m_xToolbarControllerFactory;
::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xModuleImageManager;
::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xDocImageManager;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xImageOrientationListener;
diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx
index 82a9943..eacb8da 100644
--- a/framework/inc/uifactory/factoryconfiguration.hxx
+++ b/framework/inc/uifactory/factoryconfiguration.hxx
@@ -31,7 +31,6 @@
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/frame/XUIControllerRegistration.hpp>
#include <cppuhelper/implbase1.hxx>
#include <rtl/ustring.hxx>
diff --git a/framework/inc/uifactory/popupmenucontrollerfactory.hxx b/framework/inc/uifactory/popupmenucontrollerfactory.hxx
deleted file mode 100644
index 749bd51..0000000
--- a/framework/inc/uifactory/popupmenucontrollerfactory.hxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list