1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef __FRAMEWORK_UIELEMENT_STATUSBARMERGER_HXX_
23 #define __FRAMEWORK_UIELEMENT_STATUSBARMERGER_HXX_
24 
25 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <rtl/ustring.hxx>
27 #include <uielement/statusbar.hxx>
28 
29 namespace framework
30 {
31 
32 struct AddonStatusbarItemData
33 {
34     rtl::OUString aLabel;
35     sal_uInt16    nItemBits;
36 };
37 
38 struct AddonStatusbarItem
39 {
40     rtl::OUString aCommandURL;
41     rtl::OUString aLabel;
42     rtl::OUString aContext;
43     sal_uInt16    nItemBits;
44     sal_Int16     nWidth;
45 };
46 
47 typedef ::std::vector< AddonStatusbarItem > AddonStatusbarItemContainer;
48 
49 class StatusbarMerger
50 {
51 public:
52     static bool IsCorrectContext( const ::rtl::OUString& aContext,
53                                   const ::rtl::OUString& aModuleIdentifier );
54 
55     static bool ConvertSeqSeqToVector( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > &rSequence,
56                                        AddonStatusbarItemContainer& rContainer );
57 
58     static sal_uInt16 FindReferencePos( StatusBar* pStatusbar,
59                                         const ::rtl::OUString& rReferencePoint );
60 
61     static bool ProcessMergeOperation( StatusBar* pStatusbar,
62                                        sal_uInt16 nPos,
63                                        sal_uInt16& rItemId,
64                                        const ::rtl::OUString& rModuleIdentifier,
65                                        const ::rtl::OUString& rMergeCommand,
66                                        const ::rtl::OUString& rMergeCommandParameter,
67                                        const AddonStatusbarItemContainer& rItems );
68 
69     static bool ProcessMergeFallback( StatusBar* pStatusbar,
70                                       sal_uInt16 nPos,
71                                       sal_uInt16& rItemId,
72                                       const ::rtl::OUString& rModuleIdentifier,
73                                       const ::rtl::OUString& rMergeCommand,
74                                       const ::rtl::OUString& rMergeFallback,
75                                       const AddonStatusbarItemContainer& rItems );
76 
77 private:
78     StatusbarMerger();
79     StatusbarMerger( const StatusbarMerger& );
80     StatusbarMerger& operator=( const StatusbarMerger& );
81 };
82 
83 }
84 
85 #endif
86