summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2013-05-03 13:01:13 +0000
committerMichael Meeks <michael.meeks@suse.com>2013-05-20 11:33:28 +0100
commit1571b476038c46777edd3df610c83dc761f22cf9 (patch)
tree55070a75e4c33217a8033541b54f9085d1df0a15
parentc6f163600e308ae7c4f5ea3f6962a23cb067185f (diff)
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
-rw-r--r--include/sfx2/sidebar/CommandInfoProvider.hxx (renamed from sfx2/source/sidebar/CommandInfoProvider.hxx)4
-rw-r--r--include/sfx2/sidebar/ResourceDefinitions.hrc42
-rw-r--r--include/sfx2/sidebar/Tools.hxx (renamed from sfx2/source/sidebar/Tools.hxx)11
-rw-r--r--include/svx/dialogs.hrc4
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu23
-rw-r--r--sd/source/ui/view/drviewsa.cxx2
-rw-r--r--sfx2/source/sidebar/CommandInfoProvider.cxx2
-rw-r--r--sfx2/source/sidebar/ControllerItem.cxx2
-rw-r--r--sfx2/source/sidebar/CustomImageRadioButton.cxx2
-rw-r--r--sfx2/source/sidebar/Deck.cxx2
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.cxx2
-rw-r--r--sfx2/source/sidebar/FocusManager.cxx2
-rw-r--r--sfx2/source/sidebar/MenuButton.cxx2
-rw-r--r--sfx2/source/sidebar/Paint.cxx2
-rw-r--r--sfx2/source/sidebar/Panel.cxx2
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.cxx2
-rw-r--r--sfx2/source/sidebar/ResourceManager.cxx2
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx39
-rw-r--r--sfx2/source/sidebar/SidebarController.hxx2
-rw-r--r--sfx2/source/sidebar/SidebarToolBox.cxx2
-rw-r--r--sfx2/source/sidebar/TabBar.cxx2
-rw-r--r--sfx2/source/sidebar/TabItem.cxx2
-rw-r--r--sfx2/source/sidebar/Theme.cxx2
-rw-r--r--sfx2/source/sidebar/ToolBoxBackground.cxx2
-rw-r--r--sfx2/source/sidebar/Tools.cxx34
-rw-r--r--svx/AllLangResTarget_svx.mk1
-rw-r--r--svx/Library_svx.mk3
-rw-r--r--svx/inc/helpid.hrc3
-rw-r--r--svx/source/sidebar/PanelFactory.cxx5
-rw-r--r--svx/source/sidebar/insert/InsertPropertyPanel.cxx410
-rw-r--r--svx/source/sidebar/insert/InsertPropertyPanel.hrc38
-rw-r--r--svx/source/sidebar/insert/InsertPropertyPanel.hxx92
-rw-r--r--svx/source/sidebar/insert/InsertPropertyPanel.src142
-rw-r--r--svx/source/sidebar/insert/SimpleToolBoxController.cxx79
-rw-r--r--svx/source/sidebar/insert/SimpleToolBoxController.hxx50
35 files changed, 938 insertions, 78 deletions
diff --git a/sfx2/source/sidebar/CommandInfoProvider.hxx b/include/sfx2/sidebar/CommandInfoProvider.hxx
index 8278111858d2..ba3db4be69ff 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 b45e398dedf1..279e1103ef82 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
index 70bc7f995d0c..769cd04d10f4 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 4cfa8c5fc1ce..9950f2c73b2a 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 de9cadd8dea7..b0c669e35441 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 cad4da25a7e8..a74716543dd4 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 dc254db718d0..a924a24efba2 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 979dd8a3547b..521a2953cea1 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 adc0eed9cc97..1d50101f8bbc 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 a1f32ebed59b..91929f8a1fa0 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 008da73ba1ea..0370ef85dadd 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 b5c2ec552333..f213a8c58504 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 5b28220b8637..0a5180e918b8 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 20f9bb938113..3f02fb8399b9 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 19b0588265e0..b5bfcf2bc481 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 28f819bf3954..0175741d0daf 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 26d6e4d8f0ef..683856257d5f 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 7a6ef5e20192..6f4c95e56ddc 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 0aa088306ca5..ec93b062c0b8 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 6a404dfec2c6..6992afb453e3 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 feebb14ec223..bde7039436ae 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 8bc0fd9fdb74..a7a1eec4e1ed 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 81d951731f74..a23421575859 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 1336c03478ed..42aebbe773d8 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 27956cd6670d..881545864ae9 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 82140786bc9d..9bc8b0bb0419 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 6279f09f6992..b4b4051b0c18 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 9db45b80de72..ddfb233047cf 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 cb02d670394e..7b75844cc16e 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 000000000000..fc40f92cac3d
--- /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 000000000000..55425e2537a6
--- /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 000000000000..a84bf1d96972
--- /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 000000000000..5219eeded69e
--- /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 000000000000..5eba6dad8c6f
--- /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 000000000000..b10bda728fb6
--- /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