Resolves: #i122218# Add new sidebar panel...
for inserting shapes into Draw documents
(cherry picked from commit 5e09229d726cbc288719c7466b277a4eb5bb244b)
Conflicts:
sd/source/ui/view/drviewsa.cxx
sfx2/Package_inc.mk
svx/inc/svx/dialogs.hrc
Related: #i122218# Added missing files to sfx2/inc/sfx2/sidebar
(cherry picked from commit 99572ff12af758a256703884811c7915c79f27ec)
Conflicts:
sfx2/inc/sfx2/sidebar/ResourceDefinitions.hrc
Related: #i122218# Added more missing files
(cherry picked from commit cdc8cb702630938c673255638aecbd2dd5c53ed7)
fix up to build
Change-Id: I098976d787e6a91d36aac98a5917f48b50872087
9c6f4d957924e177922e26606173d1b238b8006e
ceb9b720c08fb1db5b418c618e280b9b68eda2cf
01712631eacbd3e58e2cd04d1903bbcb0ecb9301
diff --git a/sfx2/source/sidebar/CommandInfoProvider.hxx b/include/sfx2/sidebar/CommandInfoProvider.hxx
similarity index 97%
rename from sfx2/source/sidebar/CommandInfoProvider.hxx
rename to include/sfx2/sidebar/CommandInfoProvider.hxx
index 8278111..ba3db4b 100644
--- a/sfx2/source/sidebar/CommandInfoProvider.hxx
+++ b/include/sfx2/sidebar/CommandInfoProvider.hxx
@@ -18,6 +18,8 @@
#ifndef SIDEBAR_COMMAND_INFO_PROVIDER_HXX
#define SIDEBAR_COMMAND_INFO_PROVIDER_HXX
#include "sfx2/dllapi.h"
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
@@ -31,7 +33,7 @@ namespace sfx2 { namespace sidebar {
/** Provide information about UNO commands like tooltip text with
keyboard accelerator.
*/
class CommandInfoProvider
class SFX2_DLLPUBLIC CommandInfoProvider
{
public:
/** Return the singleton instance.
diff --git a/include/sfx2/sidebar/ResourceDefinitions.hrc b/include/sfx2/sidebar/ResourceDefinitions.hrc
index b45e398..279e110 100644
--- a/include/sfx2/sidebar/ResourceDefinitions.hrc
+++ b/include/sfx2/sidebar/ResourceDefinitions.hrc
@@ -1,26 +1,22 @@
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _SFX_PROPERTYPANEL_HRC
#define _SFX_PROPERTYPANEL_HRC
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _SFX_SIDEBAR_RESOURCE_DEFINITIONS_HRC
#define _SFX_SIDEBAR_RESOURCE_DEFINITIONS_HRC
#include <sfx2/sfx.hrc>
diff --git a/sfx2/source/sidebar/Tools.hxx b/include/sfx2/sidebar/Tools.hxx
similarity index 83%
rename from sfx2/source/sidebar/Tools.hxx
rename to include/sfx2/sidebar/Tools.hxx
index 70bc7f9..769cd04 100644
--- a/sfx2/source/sidebar/Tools.hxx
+++ b/include/sfx2/sidebar/Tools.hxx
@@ -22,8 +22,12 @@
#include <vcl/gradient.hxx>
#include <tools/svborder.hxx>
#include "sfx2/dllapi.h"
#include <com/sun/star/awt/Gradient.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/util/URL.hpp>
#define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
@@ -35,7 +39,7 @@ namespace cssu = ::com::sun::star::uno;
namespace sfx2 { namespace sidebar {
class Tools
class SFX2_DLLPUBLIC Tools
{
public:
static Image GetImage (
@@ -51,6 +55,11 @@ public:
static Gradient AwtToVclGradient (const css::awt::Gradient aGradient);
static SvBorder RectangleToSvBorder (const Rectangle aBox);
static css::util::URL GetURL (const ::rtl::OUString& rsCommand);
static cssu::Reference<css::frame::XDispatch> GetDispatch (
const cssu::Reference<css::frame::XFrame>& rxFrame,
const css::util::URL& rURL);
};
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index 4cfa8c5..9950f2c 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -26,7 +26,7 @@
// Resource-Id's ------------------------------------------------------------
// !!! IMPORTANT: consider and update FIRSTFREE when introducing new RIDs !!! (not for RIDs for Strings - they have there own)
#define RID_SVX_FIRSTFREE 333
#define RID_SVX_FIRSTFREE 334
// some strings also used in CUI
#define RID_SVXERRCTX (RID_SVX_START + 351)
@@ -272,6 +272,8 @@
#define RID_POPUPPANEL_PARAPAGE_NUMBERING (RID_SVX_START + 331)
#define RID_POPUPPANEL_PARAPAGE_BACK_COLOR (RID_SVX_START + 332)
#define RID_SIDEBAR_INSERT_PANEL (RID_SVX_START + 333)
// !!! IMPORTANT: consider and update RID_SVX_FIRSTFREE when introducing new RIDs !!! (see above)
// Strings ------------------------------------------------------------------
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index de9cadd..b0c669e 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -963,6 +963,29 @@
</prop>
</node>
<node oor:name="InsertPropertyPanel" oor:op="replace">
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en-US">Insert Shapes</value>
</prop>
<prop oor:name="Id" oor:type="xs:string">
<value>InsertPropertyPanel</value>
</prop>
<prop oor:name="DeckId" oor:type="xs:string">
<value>PropertyDeck</value>
</prop>
<prop oor:name="ContextList">
<value oor:separator=";">
Draw, any, visible ;
</value>
</prop>
<prop oor:name="ImplementationURL" oor:type="xs:string">
<value>private:resource/toolpanel/SvxPanelFactory/InsertPropertyPanel</value>
</prop>
<prop oor:name="OrderIndex" oor:type="xs:int">
<value>50</value>
</prop>
</node>
</node>
</node>
</oor:component-data>
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index cad4da2..a747165 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -137,6 +137,8 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas
mpSelectionChangeHandler->Connect();
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawPage));
doShow();
}
diff --git a/sfx2/source/sidebar/CommandInfoProvider.cxx b/sfx2/source/sidebar/CommandInfoProvider.cxx
index dc254db..a924a24 100644
--- a/sfx2/source/sidebar/CommandInfoProvider.cxx
+++ b/sfx2/source/sidebar/CommandInfoProvider.cxx
@@ -16,7 +16,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "CommandInfoProvider.hxx"
#include "sfx2/sidebar/CommandInfoProvider.hxx"
#include <comphelper/processfactory.hxx>
#include <svtools/acceleratorexecute.hxx>
diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx
index 979dd8a..521a295 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -22,7 +22,7 @@
#include "sfx2/imagemgr.hxx"
#include "sfx2/bindings.hxx"
#include <unotools/cmdoptions.hxx>
#include "CommandInfoProvider.hxx"
#include "sfx2/sidebar/CommandInfoProvider.hxx"
#include <vcl/svapp.hxx>
#include <vcl/toolbox.hxx>
diff --git a/sfx2/source/sidebar/CustomImageRadioButton.cxx b/sfx2/source/sidebar/CustomImageRadioButton.cxx
index adc0eed..1d50101 100644
--- a/sfx2/source/sidebar/CustomImageRadioButton.cxx
+++ b/sfx2/source/sidebar/CustomImageRadioButton.cxx
@@ -19,7 +19,7 @@
#include "DrawHelper.hxx"
#include "Paint.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index a1f32eb..91929f8 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -24,7 +24,7 @@
#include "Paint.hxx"
#include "Panel.hxx"
#include "ToolBoxBackground.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include "sfx2/sidebar/Theme.hxx"
#include <vcl/dockwin.hxx>
diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx
index 008da73..0370ef8 100644
--- a/sfx2/source/sidebar/DeckTitleBar.cxx
+++ b/sfx2/source/sidebar/DeckTitleBar.cxx
@@ -22,7 +22,7 @@
#include <vcl/image.hxx>
#ifdef DEBUG
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#endif
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index b5c2ec5..f213a8c 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -18,7 +18,7 @@
#include "FocusManager.hxx"
#include "Panel.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include "TitleBar.hxx"
#include <vcl/button.hxx>
#include <vcl/toolbox.hxx>
diff --git a/sfx2/source/sidebar/MenuButton.cxx b/sfx2/source/sidebar/MenuButton.cxx
index 5b28220..0a5180e 100644
--- a/sfx2/source/sidebar/MenuButton.cxx
+++ b/sfx2/source/sidebar/MenuButton.cxx
@@ -20,7 +20,7 @@
#include "DrawHelper.hxx"
#include "Paint.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include "sfx2/sidebar/Theme.hxx"
using namespace ::com::sun::star;
diff --git a/sfx2/source/sidebar/Paint.cxx b/sfx2/source/sidebar/Paint.cxx
index 20f9bb9..3f02fb8 100644
--- a/sfx2/source/sidebar/Paint.cxx
+++ b/sfx2/source/sidebar/Paint.cxx
@@ -16,7 +16,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "Paint.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include <com/sun/star/awt/Gradient.hpp>
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index 19b0588..b5bfcf2 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -23,7 +23,7 @@
#include "Paint.hxx"
#ifdef DEBUG
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include "Deck.hxx"
#endif
diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index 28f819b..0175741 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -27,7 +27,7 @@
#include <vcl/image.hxx>
#ifdef DEBUG
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#endif
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index 26d6e4d..6838562 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -17,7 +17,7 @@
*/
#include "ResourceManager.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include <unotools/confignode.hxx>
#include <comphelper/componentcontext.hxx>
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 7a6ef5e..6f4c95e 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -24,9 +24,9 @@
#include "TabBar.hxx"
#include "sfx2/sidebar/Theme.hxx"
#include "sfx2/sidebar/SidebarChildWindow.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include "SidebarDockingWindow.hxx"
#include "Context.hxx"
#include "Tools.hxx"
#include "sfxresid.hxx"
#include "sfx2/sfxsids.hrc"
@@ -138,8 +138,8 @@ SidebarController::SidebarController (
// Get the dispatch object as preparation to listen for changes of
// the read-only state.
const util::URL aURL (GetURL(gsReadOnlyCommandName));
mxReadOnlyModeDispatch = GetDispatch(aURL);
const util::URL aURL (Tools::GetURL(gsReadOnlyCommandName));
mxReadOnlyModeDispatch = Tools::GetDispatch(mxFrame, aURL);
if (mxReadOnlyModeDispatch.is())
mxReadOnlyModeDispatch->addStatusListener(this, aURL);
@@ -168,7 +168,7 @@ void SAL_CALL SidebarController::disposing (void)
static_cast<css::ui::XContextChangeEventListener*>(this));
if (mxReadOnlyModeDispatch.is())
mxReadOnlyModeDispatch->removeStatusListener(this, GetURL(gsReadOnlyCommandName));
mxReadOnlyModeDispatch->removeStatusListener(this, Tools::GetURL(gsReadOnlyCommandName));
if (mpSplitWindow != NULL)
{
mpSplitWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
@@ -803,8 +803,8 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co
{
try
{
const util::URL aURL (GetURL(rsMenuCommand));
Reference<frame::XDispatch> xDispatch (GetDispatch(aURL));
const util::URL aURL (Tools::GetURL(rsMenuCommand));
Reference<frame::XDispatch> xDispatch (Tools::GetDispatch(mxFrame, aURL));
if (xDispatch.is())
xDispatch->dispatch(aURL, Sequence<beans::PropertyValue>());
}
@@ -818,33 +818,6 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co
util::URL SidebarController::GetURL (const ::rtl::OUString& rsCommand) const
{
util::URL aURL;
aURL.Complete = rsCommand;
const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
const Reference<util::XURLTransformer> xParser (
aComponentContext.createComponent("com.sun.star.util.URLTransformer"),
UNO_QUERY_THROW);
xParser->parseStrict(aURL);
return aURL;
}
Reference<frame::XDispatch> SidebarController::GetDispatch (const util::URL& rURL) const
{
Reference<frame::XDispatchProvider> xProvider (mxFrame, UNO_QUERY_THROW);
Reference<frame::XDispatch> xDispatch (xProvider->queryDispatch(rURL, OUString(), 0));
return xDispatch;
}
::boost::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu (
const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 0aa0883..ec93b06 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -177,8 +177,6 @@ private:
const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
void ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const;
css::util::URL GetURL (const ::rtl::OUString& rsCommand) const;
cssu::Reference<css::frame::XDispatch> GetDispatch (const css::util::URL& rURL) const;
::boost::shared_ptr<PopupMenu> CreatePopupMenu (
const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index 6a404df..6992afb 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -18,7 +18,7 @@
#include "SidebarToolBox.hxx"
#include "ToolBoxBackground.hxx"
#include "sfx2/sidebar/Theme.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include <vcl/gradient.hxx>
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index feebb14..bde7039 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -22,7 +22,7 @@
#include "DeckDescriptor.hxx"
#include "Paint.hxx"
#include "sfx2/sidebar/Theme.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include "FocusManager.hxx"
#include <vcl/gradient.hxx>
diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx
index 8bc0fd9..a7a1eec 100644
--- a/sfx2/source/sidebar/TabItem.cxx
+++ b/sfx2/source/sidebar/TabItem.cxx
@@ -20,7 +20,7 @@
#include "DrawHelper.hxx"
#include "Paint.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include "sfx2/sidebar/Theme.hxx"
diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx
index 81d9517..a234215 100644
--- a/sfx2/source/sidebar/Theme.cxx
+++ b/sfx2/source/sidebar/Theme.cxx
@@ -18,7 +18,7 @@
#include "sfx2/sidebar/Theme.hxx"
#include "Paint.hxx"
#include "SidebarResource.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include <tools/svborder.hxx>
#include <tools/rc.hxx>
diff --git a/sfx2/source/sidebar/ToolBoxBackground.cxx b/sfx2/source/sidebar/ToolBoxBackground.cxx
index 1336c03..42aebbe 100644
--- a/sfx2/source/sidebar/ToolBoxBackground.cxx
+++ b/sfx2/source/sidebar/ToolBoxBackground.cxx
@@ -18,7 +18,7 @@
#include "ToolBoxBackground.hxx"
#include "Paint.hxx"
#include "DrawHelper.hxx"
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include "sfx2/sidebar/Theme.hxx"
#include <vcl/toolbox.hxx>
diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx
index 27956cd..8815458 100644
--- a/sfx2/source/sidebar/Tools.cxx
+++ b/sfx2/source/sidebar/Tools.cxx
@@ -16,7 +16,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "Tools.hxx"
#include "sfx2/sidebar/Tools.hxx"
#include "sfx2/sidebar/Theme.hxx"
@@ -26,7 +26,9 @@
#include <comphelper/namedvaluecollection.hxx>
#include <vcl/gradient.hxx>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <cstring>
@@ -147,4 +149,34 @@ SvBorder Tools::RectangleToSvBorder (const Rectangle aBox)
aBox.Bottom());
}
util::URL Tools::GetURL (const ::rtl::OUString& rsCommand)
{
util::URL aURL;
aURL.Complete = rsCommand;
const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
const Reference<util::XURLTransformer> xParser (
aComponentContext.createComponent("com.sun.star.util.URLTransformer"),
UNO_QUERY_THROW);
xParser->parseStrict(aURL);
return aURL;
}
Reference<frame::XDispatch> Tools::GetDispatch (
const cssu::Reference<css::frame::XFrame>& rxFrame,
const util::URL& rURL)
{
Reference<frame::XDispatchProvider> xProvider (rxFrame, UNO_QUERY_THROW);
Reference<frame::XDispatch> xDispatch (xProvider->queryDispatch(rURL, ::rtl::OUString(), 0));
return xDispatch;
}
} } // end of namespace sfx2::sidebar
diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk
index 8214078..9bc8b0b 100644
--- a/svx/AllLangResTarget_svx.mk
+++ b/svx/AllLangResTarget_svx.mk
@@ -78,6 +78,7 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\
svx/source/sidebar/possize/PosSizePropertyPanel.src \
svx/source/sidebar/text/TextPropertyPanel.src \
svx/source/sidebar/paragraph/ParaPropertyPanel.src \
svx/source/sidebar/insert/InsertPropertyPanel.src \
svx/source/stbctrls/stbctrls.src \
svx/source/svdraw/svdstr.src \
svx/source/table/table.src \
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index 6279f09..b4b4051 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_Library_use_libraries,svx,\
cppu \
drawinglayer \
editeng \
fwe \
fwk \
i18nlangtag \
sal \
@@ -200,6 +201,8 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/sidebar/tools/PopupContainer \
svx/source/sidebar/tools/Popup \
svx/source/sidebar/tools/ValueSetWithTextControl \
svx/source/sidebar/insert/InsertPropertyPanel \
svx/source/sidebar/insert/SimpleToolBoxController \
svx/source/stbctrls/pszctrl \
svx/source/stbctrls/insctrl \
svx/source/stbctrls/selctrl \
diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
index 9db45b8..ddfb233 100644
--- a/svx/inc/helpid.hrc
+++ b/svx/inc/helpid.hrc
@@ -272,6 +272,9 @@
#define HID_PROPERTYPANEL_POSIZE_SECTION "SVX_HID_PROPERTYPANEL_POSIZE_SECTION"
#define HID_PROPERTYPANEL_GRAPHIC_SECTION "SVX_HID_PROPERTYPANEL_GRAPHIC_SECTION"
// Insert panel
#define HID_SIDEBAR_INSERT_PANEL "HID_SIDEBAR_INSERT_PANEL"
#define HID_SIDEBAR_INSERT_TOOLBOX "HID_SIDEBAR_INSERT_TOOLBOX"
#define HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET "SVX_HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET"
#define HID_PPROPERTYPANEL_PARA_TBI_NUM "SVX_HID_PPROPERTYPANEL_PARA_TBI_NUM"
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx
index cb02d67..7b75844 100644
--- a/svx/source/sidebar/PanelFactory.cxx
+++ b/svx/source/sidebar/PanelFactory.cxx
@@ -23,6 +23,7 @@
#include "graphic/GraphicPropertyPanel.hxx"
#include "line/LinePropertyPanel.hxx"
#include "possize/PosSizePropertyPanel.hxx"
#include "insert/InsertPropertyPanel.hxx"
#include "GalleryControl.hxx"
#include "debug/ColorPanel.hxx"
#include "debug/ContextPanel.hxx"
@@ -156,6 +157,10 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
{
pControl = PosSizePropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar);
}
else if (DoesResourceEndWith("/InsertPropertyPanel"))
{
pControl = new InsertPropertyPanel(pParentWindow, xFrame);
}
else if (DoesResourceEndWith("/GalleryPanel"))
{
pControl = new GalleryControl(pBindings, pParentWindow);
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.cxx b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
new file mode 100644
index 0000000..fc40f92
--- /dev/null
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
@@ -0,0 +1,410 @@
/*
* 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 "InsertPropertyPanel.hxx"
#include "InsertPropertyPanel.hrc"
#include "SimpleToolBoxController.hxx"
#include "sfx2/sidebar/CommandInfoProvider.hxx"
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/Tools.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
#include <svx/dialmgr.hxx>
#include <svtools/miscopt.hxx>
#include <vcl/toolbox.hxx>
#include <sfx2/tbxctrl.hxx>
#include <framework/sfxhelperfunctions.hxx>
#include <framework/imageproducer.hxx>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/compbase1.hxx>
#include <cppuhelper/basemutex.hxx>
#include <com/sun/star/frame/XStatusListener.hpp>
using namespace css;
using namespace cssu;
using ::rtl::OUString;
namespace svx { namespace sidebar {
InsertPropertyPanel::InsertPropertyPanel (
Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame)
: Control(pParent, SVX_RES(RID_SIDEBAR_INSERT_PANEL)),
mpStandardShapesBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
mpStandardShapesToolBox(sfx2::sidebar::ControlFactory::CreateToolBox(
mpStandardShapesBackground.get(),
SVX_RES(TB_INSERT_STANDARD))),
mpCustomShapesBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
mpCustomShapesToolBox(sfx2::sidebar::ControlFactory::CreateToolBox(
mpCustomShapesBackground.get(),
SVX_RES(TB_INSERT_CUSTOM))),
maControllers(),
mxFrame(rxFrame)
{
SetupToolBox(*mpStandardShapesToolBox);
SetupToolBox(*mpCustomShapesToolBox);
FreeResource();
UpdateIcons();
mpStandardShapesToolBox->Show();
mpCustomShapesToolBox->Show();
// Listen to all tool box selection events.
Window* pTopWindow = pParent;
while (pTopWindow->GetParent() != NULL)
pTopWindow = pTopWindow->GetParent();
pTopWindow->AddChildEventListener(LINK(this, InsertPropertyPanel, WindowEventListener));
}
InsertPropertyPanel::~InsertPropertyPanel (void)
{
ControllerContainer aControllers;
aControllers.swap(maControllers);
for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
iController!=iEnd;
++iController)
{
Reference<lang::XComponent> xComponent (iController->second.mxController, UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
}
// Remove window child listener.
Window* pTopWindow = this;
while (pTopWindow->GetParent() != NULL)
pTopWindow = pTopWindow->GetParent();
pTopWindow->RemoveChildEventListener(LINK(this, InsertPropertyPanel, WindowEventListener));
mpStandardShapesToolBox.reset();
mpCustomShapesToolBox.reset();
mpStandardShapesBackground.reset();
mpCustomShapesBackground.reset();
}
void InsertPropertyPanel::SetupToolBox (ToolBox& rToolBox)
{
const sal_uInt16 nItemCount (rToolBox.GetItemCount());
for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex)
CreateController(rToolBox.GetItemId(nItemIndex));
rToolBox.SetDropdownClickHdl(LINK(this, InsertPropertyPanel, DropDownClickHandler));
rToolBox.SetClickHdl(LINK(this, InsertPropertyPanel, ClickHandler));
rToolBox.SetDoubleClickHdl(LINK(this, InsertPropertyPanel, DoubleClickHandler));
rToolBox.SetSelectHdl(LINK(this, InsertPropertyPanel, SelectHandler));
rToolBox.SetActivateHdl(LINK(this, InsertPropertyPanel, ActivateToolBox));
rToolBox.SetDeactivateHdl(LINK(this, InsertPropertyPanel, DeactivateToolBox));
rToolBox.SetSizePixel(rToolBox.CalcWindowSizePixel());
}
IMPL_LINK(InsertPropertyPanel, DropDownClickHandler, ToolBox*, pToolBox)
{
if (pToolBox != NULL)
{
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
{
Reference<awt::XWindow> xWindow = xController->createPopupWindow();
if (xWindow.is() )
xWindow->setFocus();
}
}
return 1;
}
IMPL_LINK(InsertPropertyPanel, ClickHandler, ToolBox*, pToolBox)
{
if (pToolBox == NULL)
return 0;
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
xController->click();
return 1;
}
IMPL_LINK(InsertPropertyPanel, DoubleClickHandler, ToolBox*, pToolBox)
{
if (pToolBox == NULL)
return 0;
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
xController->doubleClick();
return 1;
}
IMPL_LINK(InsertPropertyPanel, SelectHandler, ToolBox*, pToolBox)
{
if (pToolBox == NULL)
return 0;
Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
if (xController.is())
xController->execute((sal_Int16)pToolBox->GetModifier());
return 1;
}
IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent)
{
// We will be getting a lot of window events (well, basically all
// of them), so reject early everything that is not connected to
// toolbox selection.
if (pEvent == NULL)
return 1;
if ( ! pEvent->ISA(VclWindowEvent))
return 1;
if (pEvent->GetId() != VCLEVENT_TOOLBOX_SELECT)
return 1;
ToolBox* pToolBox = dynamic_cast<ToolBox*>(dynamic_cast<VclWindowEvent*>(pEvent)->GetWindow());
if (pToolBox == NULL)
return 1;
// Extract name of (sub)toolbar from help id.
OUString sToolbarName (rtl::OStringToOUString(pToolBox->GetHelpId(), RTL_TEXTENCODING_UTF8));
if (sToolbarName.getLength() == 0)
return 1;
const util::URL aURL (sfx2::sidebar::Tools::GetURL(sToolbarName));
if (aURL.Path.getLength() == 0)
return 1;
// Get item id.
sal_uInt16 nId = pToolBox->GetCurItemId();
if (nId == 0)
return 1;
// Get toolbar controller.
const sal_uInt16 nItemId (GetItemIdForSubToolbarName(aURL.Path));
Reference<frame::XSubToolbarController> xController (GetControllerForItemId(nItemId), UNO_QUERY);
if ( ! xController.is())
return 1;
const OUString sCommand (pToolBox->GetItemCommand(nId));
ControllerContainer::iterator iController (maControllers.find(nItemId));
if (iController != maControllers.end())
iController->second.msCurrentCommand = sCommand;
xController->functionSelected(sCommand);
const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
Image aImage (framework::GetImageFromURL(mxFrame, sCommand, bBigImages));
pToolBox->SetItemImage(iController->first, aImage);
return 1;
}
IMPL_LINK(InsertPropertyPanel, ActivateToolBox, ToolBox*, EMPTYARG)
{
return 1;
}
IMPL_LINK(InsertPropertyPanel, DeactivateToolBox, ToolBox*, EMPTYARG)
{
return 1;
}
void InsertPropertyPanel::CreateController (
const sal_uInt16 nItemId)
{
ToolBox* pToolBox = GetToolBoxForItemId(nItemId);
if (pToolBox != NULL)
{
ItemDescriptor aDescriptor;
const OUString sCommandName (pToolBox->GetItemCommand(nItemId));
// Create a controller for the new item.
aDescriptor.mxController.set(
static_cast<XWeak*>(::framework::CreateToolBoxController(
mxFrame,
pToolBox,
nItemId,
sCommandName)),
UNO_QUERY);
if ( ! aDescriptor.mxController.is())
aDescriptor.mxController.set(
static_cast<XWeak*>(new SimpleToolBoxController(mxFrame, *pToolBox, nItemId, sCommandName)),
UNO_QUERY);
if ( ! aDescriptor.mxController.is())
return;
// Get dispatch object for the command.
aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(sCommandName);
aDescriptor.msCurrentCommand = sCommandName;
aDescriptor.mxDispatch = sfx2::sidebar::Tools::GetDispatch(mxFrame, aDescriptor.maURL);
if ( ! aDescriptor.mxDispatch.is())
return;
// Initialize the controller with eg a service factory.
Reference<lang::XInitialization> xInitialization (aDescriptor.mxController, UNO_QUERY);
if (xInitialization.is())
{
beans::PropertyValue aPropValue;
std::vector<Any> aPropertyVector;
aPropValue.Name = A2S("Frame");
aPropValue.Value <<= mxFrame;
aPropertyVector.push_back(makeAny(aPropValue));
aPropValue.Name = A2S("ServiceManager");
aPropValue.Value <<= ::comphelper::getProcessServiceFactory();
aPropertyVector.push_back(makeAny(aPropValue));
aPropValue.Name = A2S("CommandURL");
aPropValue.Value <<= sCommandName;
aPropertyVector.push_back(makeAny(aPropValue));
Sequence<Any> aArgs (comphelper::containerToSequence(aPropertyVector));
xInitialization->initialize(aArgs);
}
Reference<util::XUpdatable> xUpdatable (aDescriptor.mxController, UNO_QUERY);
if (xUpdatable.is())
xUpdatable->update();
// Add label.
const OUString sLabel (sfx2::sidebar::CommandInfoProvider::Instance().GetLabelForCommand(
sCommandName,
mxFrame));
pToolBox->SetQuickHelpText(nItemId, sLabel);
// Add item to toolbox.
pToolBox->EnableItem(nItemId);
maControllers.insert(::std::make_pair(nItemId, aDescriptor));
}
}
ToolBox* InsertPropertyPanel::GetToolBoxForItemId (const sal_uInt16 nItemId) const
{
switch(nItemId)
{
case TBI_STANDARD_LINE:
case TBI_STANDARD_ARROW:
case TBI_STANDARD_RECTANGLE:
case TBI_STANDARD_ELLIPSE:
case TBI_STANDARD_TEXT:
case TBI_STANDARD_LINES:
case TBI_STANDARD_CONNECTORS:
case TBI_STANDARD_ARROWS:
return mpStandardShapesToolBox.get();
case TBI_CUSTOM_BASICS:
case TBI_CUSTOM_SYMBOLS:
case TBI_CUSTOM_ARROWS:
case TBI_CUSTOM_FLOWCHARTS:
case TBI_CUSTOM_CALLOUTS:
case TBI_CUSTOM_STARS:
return mpCustomShapesToolBox.get();
default:
return NULL;
}
}
Reference<frame::XToolbarController> InsertPropertyPanel::GetControllerForItemId (const sal_uInt16 nItemId) const
{
ControllerContainer::const_iterator iController (maControllers.find(nItemId));
if (iController != maControllers.end())
return iController->second.mxController;
else
return NULL;
}
sal_uInt16 InsertPropertyPanel::GetItemIdForSubToolbarName (const OUString& rsSubToolbarName) const
{
for (ControllerContainer::const_iterator iController(maControllers.begin()), iEnd(maControllers.end());
iController!=iEnd;
++iController)
{
Reference<frame::XSubToolbarController> xSubToolbarController (iController->second.mxController, UNO_QUERY);
if (xSubToolbarController.is())
if (xSubToolbarController->getSubToolbarName().equals(rsSubToolbarName))
return iController->first;
}
return 0;
}
void InsertPropertyPanel::UpdateIcons (void)
{
const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
for (ControllerContainer::iterator iController(maControllers.begin()), iEnd(maControllers.end());
iController!=iEnd;
++iController)
{
const ::rtl::OUString sCommandURL (iController->second.msCurrentCommand);
Image aImage (framework::GetImageFromURL(mxFrame, sCommandURL, bBigImages));
ToolBox* pToolBox = GetToolBoxForItemId(iController->first);
if (pToolBox != NULL)
pToolBox->SetItemImage(iController->first, aImage);
}
}
} } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.hrc b/svx/source/sidebar/insert/InsertPropertyPanel.hrc
new file mode 100644
index 0000000..55425e2
--- /dev/null
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.hrc
@@ -0,0 +1,38 @@
/*
* 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 "svx/dialogs.hrc"
#define TB_INSERT_STANDARD 1
#define TB_INSERT_CUSTOM 2
#define TBI_STANDARD_LINE 10
#define TBI_STANDARD_ARROW 11
#define TBI_STANDARD_RECTANGLE 12
#define TBI_STANDARD_ELLIPSE 13
#define TBI_STANDARD_TEXT 14
#define TBI_STANDARD_LINES 15
#define TBI_STANDARD_CONNECTORS 16
#define TBI_STANDARD_ARROWS 17
#define TBI_CUSTOM_BASICS 20
#define TBI_CUSTOM_SYMBOLS 21
#define TBI_CUSTOM_ARROWS 22
#define TBI_CUSTOM_FLOWCHARTS 23
#define TBI_CUSTOM_CALLOUTS 24
#define TBI_CUSTOM_STARS 25
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.hxx b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
new file mode 100644
index 0000000..a84bf1d
--- /dev/null
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
@@ -0,0 +1,92 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef SVX_SIDEBAR_INSERT_PROPERTY_PAGE_HXX
#define SVX_SIDEBAR_INSERT_PROPERTY_PAGE_HXX
#include <boost/scoped_ptr.hpp>
#include <vcl/ctrl.hxx>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XToolbarController.hpp>
#include <map>
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
class ToolBox;
namespace svx { namespace sidebar {
class InsertPropertyPanel
: public Control
{
public:
InsertPropertyPanel (
Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame);
virtual ~InsertPropertyPanel (void);
private:
::boost::scoped_ptr<Window> mpStandardShapesBackground;
::boost::scoped_ptr<ToolBox> mpStandardShapesToolBox;
::boost::scoped_ptr<Window> mpCustomShapesBackground;
::boost::scoped_ptr<ToolBox> mpCustomShapesToolBox;
class ItemDescriptor
{
public:
cssu::Reference<css::frame::XToolbarController> mxController;
css::util::URL maURL;
rtl::OUString msCurrentCommand;
cssu::Reference<css::frame::XDispatch> mxDispatch;
};
typedef ::std::map<sal_uInt16, ItemDescriptor> ControllerContainer;
ControllerContainer maControllers;
const cssu::Reference<css::frame::XFrame> mxFrame;
/** Add listeners to toolbox and update its size to match its
content.
*/
void SetupToolBox (ToolBox& rToolBox);
cssu::Reference<css::frame::XToolbarController> GetControllerForItemId (
const sal_uInt16 nItemId) const;
ToolBox* GetToolBoxForItemId (const sal_uInt16 nItemId) const;
sal_uInt16 GetItemIdForSubToolbarName (
const ::rtl::OUString& rsCOmmandName) const;
/** Create toolbox controller for one item.
*/
void CreateController (
const sal_uInt16 nItemId);
void UpdateIcons (void);
DECL_LINK(DropDownClickHandler, ToolBox*);
DECL_LINK(ClickHandler, ToolBox*);
DECL_LINK(DoubleClickHandler, ToolBox*);
DECL_LINK(SelectHandler, ToolBox*);
DECL_LINK(WindowEventListener, VclSimpleEvent*);
DECL_LINK(ActivateToolBox, ToolBox*);
DECL_LINK(DeactivateToolBox, ToolBox*);
};
} } // end of namespace ::svx::sidebar
#endif
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.src b/svx/source/sidebar/insert/InsertPropertyPanel.src
new file mode 100644
index 0000000..5219eed
--- /dev/null
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.src
@@ -0,0 +1,142 @@
/*
* 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 "InsertPropertyPanel.hrc"
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include "helpid.hrc"
#define FIRST_LINE_Y SECTIONPAGE_MARGIN_VERTICAL_TOP
#define SECOND_LINE_Y FIRST_LINE_Y + TOOLBOX_ITEM_HEIGHT + CONTROL_SPACING_VERTICAL + 1
Control RID_SIDEBAR_INSERT_PANEL
{
OutputSize = TRUE;
DialogControl = TRUE;
Border = FALSE;
Size = MAP_APPFONT(
PROPERTYPAGE_WIDTH,
SECTIONPAGE_MARGIN_VERTICAL_TOP
+ TOOLBOX_ITEM_HEIGHT * 2
+ CONTROL_SPACING_VERTICAL
+ SECTIONPAGE_MARGIN_VERTICAL_BOT);
HelpID = HID_SIDEBAR_INSERT_PANEL;
Text = "Insert";
ToolBox TB_INSERT_STANDARD
{
SVLook = TRUE ;
Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, FIRST_LINE_Y);
Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 6 + TOOLBOX_ITEM_DD_WIDTH, TOOLBOX_ITEM_HEIGHT) ;
TabStop = TRUE ;
HelpID = HID_SIDEBAR_INSERT_TOOLBOX;
Text = "Insert Shapes";
ItemList =
{
ToolBoxItem
{
Identifier = TBI_STANDARD_LINE;
Command = ".uno:Line";
};
ToolBoxItem
{
Identifier = TBI_STANDARD_ARROW;
Command = ".uno:LineArrowEnd";
};
ToolBoxItem
{
Identifier = TBI_STANDARD_RECTANGLE;
Command = ".uno:Rect";
};
ToolBoxItem
{
Identifier = TBI_STANDARD_ELLIPSE;
Command = ".uno:Ellipse";
};
ToolBoxItem
{
Identifier = TBI_STANDARD_TEXT;
Command = ".uno:Text";
};
ToolBoxItem
{
Identifier = TBI_STANDARD_LINES;
Command = ".uno:LineToolbox";
};
ToolBoxItem
{
Identifier = TBI_STANDARD_CONNECTORS;
Command = ".uno:ConnectorToolbox";
};
ToolBoxItem
{
Identifier = TBI_STANDARD_ARROWS;
Command = ".uno:ArrowsToolbox";
DropDown = TRUE;
};
};
};
ToolBox TB_INSERT_CUSTOM
{
SVLook = TRUE ;
Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECOND_LINE_Y);
Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH * 6, TOOLBOX_ITEM_HEIGHT) ;
TabStop = TRUE ;
HelpID = HID_SIDEBAR_INSERT_TOOLBOX;
Text = "Insert";
ItemList =
{
ToolBoxItem
{
Identifier = TBI_CUSTOM_BASICS;
Command = ".uno:BasicShapes";
DropDown = TRUE;
};
ToolBoxItem
{
Identifier = TBI_CUSTOM_SYMBOLS;
Command = ".uno:SymbolShapes";
DropDown = TRUE;
};
ToolBoxItem
{
Identifier = TBI_CUSTOM_ARROWS;
Command = ".uno:ArrowShapes";
DropDown = TRUE;
};
ToolBoxItem
{
Identifier = TBI_CUSTOM_FLOWCHARTS;
Command = ".uno:FlowChartShapes";
DropDown = TRUE;
};
ToolBoxItem
{
Identifier = TBI_CUSTOM_CALLOUTS;
Command = ".uno:CalloutShapes";
DropDown = TRUE;
};
ToolBoxItem
{
Identifier = TBI_CUSTOM_STARS;
Command = ".uno:StarShapes";
DropDown = TRUE;
};
};
};
};
diff --git a/svx/source/sidebar/insert/SimpleToolBoxController.cxx b/svx/source/sidebar/insert/SimpleToolBoxController.cxx
new file mode 100644
index 0000000..5eba6da
--- /dev/null
+++ b/svx/source/sidebar/insert/SimpleToolBoxController.cxx
@@ -0,0 +1,79 @@
/*
* 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 "SimpleToolBoxController.hxx"
#include <comphelper/processfactory.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
namespace svx { namespace sidebar {
SimpleToolBoxController::SimpleToolBoxController(
const cssu::Reference<css::frame::XFrame>& rxFrame,
ToolBox& rToolBox,
const sal_uInt16 nItemId,
const rtl::OUString& rsCommand)
: svt::ToolboxController(comphelper::getComponentContext(comphelper::getProcessServiceFactory()),
rxFrame, rsCommand),
mrToolbox(rToolBox),
mnItemId(nItemId)
{
}
SimpleToolBoxController::~SimpleToolBoxController (void)
{
}
void SAL_CALL SimpleToolBoxController::statusChanged (const css::frame::FeatureStateEvent& rEvent)
throw (cssu::RuntimeException)
{
SolarMutexGuard aSolarMutexGuard;
if (m_bDisposed)
return;
mrToolbox.EnableItem(mnItemId, rEvent.IsEnabled);
sal_uInt16 nItemBits = mrToolbox.GetItemBits(mnItemId);
nItemBits &= ~TIB_CHECKABLE;
TriState eState = STATE_NOCHECK;
sal_Bool bValue;
if (rEvent.State >>= bValue)
{
// Boolean, treat it as checked/unchecked
mrToolbox.CheckItem(mnItemId, bValue);
if ( bValue )
eState = STATE_CHECK;
nItemBits |= TIB_CHECKABLE;
}
mrToolbox.SetItemState(mnItemId, eState);
mrToolbox.SetItemBits(mnItemId, nItemBits);
}
} } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/insert/SimpleToolBoxController.hxx b/svx/source/sidebar/insert/SimpleToolBoxController.hxx
new file mode 100644
index 0000000..b10bda7
--- /dev/null
+++ b/svx/source/sidebar/insert/SimpleToolBoxController.hxx
@@ -0,0 +1,50 @@
/*
* 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 SVX_SIDEBAR_INSERT_SIMPLE_TOOLBOX_CONTROLLER_HXX
#define SVX_SIDEBAR_INSERT_SIMPLE_TOOLBOX_CONTROLLER_HXX
#include <svtools/toolboxcontroller.hxx>
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
namespace svx { namespace sidebar {
class SimpleToolBoxController : public svt::ToolboxController
{
public:
SimpleToolBoxController(
const cssu::Reference<css::frame::XFrame>& rxFrame,
ToolBox& rToolBox,
const sal_uInt16 nItTemId,
const rtl::OUString& rsComand);
virtual ~SimpleToolBoxController (void);
// XStatusListener
virtual void SAL_CALL statusChanged (const css::frame::FeatureStateEvent& rEvent)
throw (cssu::RuntimeException);
private:
ToolBox& mrToolbox;
const sal_uInt16 mnItemId;
};
} } // end of namespace svx::sidebar
#endif