1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMERGER_HXX
21 #define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMERGER_HXX
23 #include <uielement/comboboxtoolbarcontroller.hxx>
24 #include <uielement/imagebuttontoolbarcontroller.hxx>
25 #include <uielement/togglebuttontoolbarcontroller.hxx>
26 #include <uielement/buttontoolbarcontroller.hxx>
27 #include <uielement/spinfieldtoolbarcontroller.hxx>
28 #include <uielement/edittoolbarcontroller.hxx>
29 #include <uielement/dropdownboxtoolbarcontroller.hxx>
30 #include <uielement/commandinfo.hxx>
32 #include <com/sun/star/beans/PropertyValue.hpp>
34 #include <svtools/toolboxcontroller.hxx>
36 #include <rtl/ustring.hxx>
37 #include <vcl/toolbox.hxx>
46 OUString aControlType
;
49 struct AddonToolbarItem
53 OUString aImageIdentifier
;
56 OUString aControlType
;
60 typedef ::std::vector
< AddonToolbarItem
> AddonToolbarItemContainer
;
62 struct ReferenceToolbarPathInfo
64 VclPtr
<ToolBox
> pToolbar
;
72 static bool IsCorrectContext( const OUString
& aContext
, const OUString
& aModuleIdentifier
);
74 static bool ConvertSeqSeqToVector( const css::uno::Sequence
< css::uno::Sequence
< css::beans::PropertyValue
> >& rSequence
,
75 AddonToolbarItemContainer
& rContainer
);
77 static void ConvertSequenceToValues( const css::uno::Sequence
< css::beans::PropertyValue
>& rSequence
,
78 OUString
& rCommandURL
,
80 OUString
& rImageIdentifier
,
83 OUString
& rControlType
,
86 static ReferenceToolbarPathInfo
FindReferencePoint( ToolBox
* pToolbar
,
87 const OUString
& rReferencePoint
);
89 static bool ProcessMergeOperation( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& xFrame
,
93 CommandToInfoMap
& rCommandMap
,
94 const OUString
& rModuleIdentifier
,
95 const OUString
& rMergeCommand
,
96 const OUString
& rMergeCommandParameter
,
97 const AddonToolbarItemContainer
& rItems
);
99 static bool ProcessMergeFallback( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& xFrame
,
103 CommandToInfoMap
& rCommandMap
,
104 const OUString
& rModuleIdentifier
,
105 const OUString
& rMergeCommand
,
106 const OUString
& rMergeFallback
,
107 const AddonToolbarItemContainer
& rItems
);
109 static bool MergeItems( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& xFrame
,
112 sal_uInt16 nModIndex
,
114 CommandToInfoMap
& rCommandMap
,
115 const OUString
& rModuleIdentifier
,
116 const AddonToolbarItemContainer
& rAddonToolbarItems
);
118 static bool ReplaceItem( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& xFrame
,
122 CommandToInfoMap
& rCommandMap
,
123 const OUString
& rModuleIdentifier
,
124 const AddonToolbarItemContainer
& rAddonToolbarItems
);
126 static bool RemoveItems( ToolBox
* pToolbar
,
128 const OUString
& rMergeCommandParameter
);
130 static ::cppu::OWeakObject
* CreateController(
131 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> & rxContext
,
132 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
> & xFrame
,
134 const OUString
& rCommandURL
,
137 const OUString
& rControlType
);
139 static void CreateToolbarItem( ToolBox
* pToolbox
,
140 CommandToInfoMap
& rCommandMap
,
143 const AddonToolbarItem
& rAddonToolbarItem
);
146 ToolBarMerger( const ToolBarMerger
& ) SAL_DELETED_FUNCTION
;
147 ToolBarMerger
& operator=( const ToolBarMerger
& ) SAL_DELETED_FUNCTION
;
150 } // namespace framework
152 #endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMERGER_HXX
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */