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 23 24 #ifndef __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_ 25 #define __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_ 26 27 //_______________________________________________ 28 // interface includes 29 #include <com/sun/star/frame/XFrame.hpp> 30 31 //_______________________________________________ 32 // other includes 33 #include <framework/fwedllapi.h> 34 35 //_______________________________________________ 36 // namespace 37 38 namespace framework{ 39 40 //_______________________________________________ 41 // exported const 42 43 //_______________________________________________ 44 // exported definitions 45 46 /** analyze and split the current available frame list of a given frames supplier 47 into different parts. 48 49 These analyzed informations can be used e.g. to decide if it's neccessary 50 to switch into the backing mode, close the current active frame only or 51 exit the whole application explicitly or implicitly. 52 */ 53 class FWE_DLLPUBLIC FrameListAnalyzer 54 { 55 //_______________________________________ 56 // types 57 58 public: 59 60 /** These enums can be combined as flags to enable/disable 61 special search algorithm during analyze phase. 62 see impl_analyze() for further informations. 63 But note: To be useable as flags, these enums 64 must be values of range [2^n]! */ 65 enum EDetect 66 { 67 E_MODEL = 1, 68 E_HELP = 2, 69 E_BACKINGCOMPONENT = 4, 70 E_HIDDEN = 8, 71 E_ALL = 15, 72 E_ZOMBIE = 32768 // use it for special test scenarios only!!! 73 }; 74 75 //_______________________________________ 76 // member 77 78 public: 79 80 /** provides access to the frame container, which should be analyzed. */ 81 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& m_xSupplier; 82 83 /** hold the reference frame, which is used e.g. to detect other frames with the same model. */ 84 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xReferenceFrame; 85 86 /** enable/disable some special analyzing steps. 87 see impl_analyze() for further informations. */ 88 sal_uInt32 m_eDetectMode; 89 90 /** contains all frames, which uses the same model like the reference frame. 91 Will be filled only if m_eDetectMode has set the flag E_MODEL. 92 The reference frame is never part of this list! */ 93 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lModelFrames; 94 95 /** contains all frames, which does not contain the same model like the reference frame. 96 Filling of it can't be supressed by m_eDetectMode. 97 The reference frame is never part of this list! 98 All frames inside this list are visible ones. */ 99 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherVisibleFrames; 100 101 /** contains all frames, which does not contain the same model like the reference frame. 102 Filling of it can't be supressed by m_eDetectMode. 103 The reference frame is never part of this list! 104 All frames inside this list are hidden ones. */ 105 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherHiddenFrames; 106 107 /** points to the help frame. 108 Will be set only, if any other frame (means different from the reference frame) 109 contains the help component. If the reference frame itself includes the help module 110 it's not set ... but another member m_bIsHelp is used to safe this information. 111 See following example code: 112 113 <listing> 114 if (m_xReferenceFrame == help) 115 { 116 m_xHelp = NULL; 117 m_bIsHelp = sal_True; 118 } 119 else 120 if (xOtherFrame == help) 121 { 122 m_xHelp = xOtherFrame; 123 m_bIsHelp = sal_False; 124 } 125 </listing> 126 127 Analyzing of the help frame ignores the visible state of any frame. 128 But note: a hidden help frame indicates a wrong state! 129 */ 130 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xHelp; 131 132 /** points to the frame, which contains the backing component. 133 Will be set only, if any other frame (means different from the reference frame) 134 contains the backing component. If the reference frame itself includes the 135 backing component it's not set ... but another member m_bIsBackingComponent 136 will used to safe this information. 137 See following example code: 138 139 <listing> 140 if (m_xReferenceFrame == backing) 141 { 142 m_xBackingComponent = NULL; 143 m_bIsBackingComponent = sal_True; 144 } 145 else 146 if (xOtherFrame == backing) 147 { 148 m_xBackingComponent = xOtherFrame; 149 m_bIsBackingComponent = sal_False ; 150 } 151 </listing> 152 153 Analyzing of the help frame ignores the visible state of any frame. 154 But note: a hidden backing mode frame indicates a wrong state! 155 */ 156 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xBackingComponent; 157 158 /** is set to true only, if the reference frame is a hidden one. 159 This value is undefined if m_eDetectMode doesn't have set the flag E_HIDDEN! */ 160 sal_Bool m_bReferenceIsHidden; 161 162 /** is set to true only, if the reference frame contains the help component. 163 In this case the member m_xHelp is set to NULL everytimes. 164 This value is undefined if m_eDetectMode doesn't have set the flag E_HELP! */ 165 sal_Bool m_bReferenceIsHelp; 166 167 /** is set to true only, if the reference frame contains the backing component. 168 In this case the member m_xBackingComponent is set to NULL everytimes. 169 This value is undefined if m_eDetectMode doesn't have set the flag E_BACKINGCOMPONENT! */ 170 sal_Bool m_bReferenceIsBacking; 171 172 //_______________________________________ 173 // interface 174 175 public: 176 177 /** starts analyze phase and fille all members with valid informations. 178 179 @param xSupplier 180 Must be a valid reference to a frames supplier, which provies 181 access to the frame list for analyzing. 182 183 @param xReferenceFrame 184 This frame must(!) exist inside the analyzed frame list and 185 is used for some comparing functions. Further some member states 186 depends from the current state of this frame. 187 188 @param eDetectMode 189 It represent a flag field, which can enable/disable special 190 analyze steps. Note: Some member values will be undefined, if 191 an analyze step will be disabled. 192 */ 193 FrameListAnalyzer( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& xSupplier , 194 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xReferenceFrame , 195 sal_uInt32 eDetectMode ); 196 virtual ~FrameListAnalyzer(); 197 198 //_______________________________________ 199 // helper 200 201 private: 202 203 void impl_analyze(); 204 205 206 }; // class FrameListAnalyzer 207 208 } // namespace framework 209 210 #endif // #ifndef __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_ 211