build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / framework / framelistanalyzer.hxx
blobfe4798eafa56297adf6049217f974c33dcc51f0d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_FRAMELISTANALYZER_HXX
21 #define INCLUDED_FRAMEWORK_FRAMELISTANALYZER_HXX
23 #include <com/sun/star/frame/XFrame.hpp>
25 #include <framework/fwedllapi.h>
26 #include <vector>
28 namespace framework{
30 /** analyze and split the current available frame list of a given frames supplier
31 into different parts.
33 These analyzed information can be used e.g. to decide if it's necessary
34 to switch into the backing mode, close the current active frame only or
35 exit the whole application explicitly or implicitly.
37 class FWE_DLLPUBLIC FrameListAnalyzer final
40 // types
42 public:
44 /** These enums can be combined as flags to enable/disable
45 special search algorithm during analyze phase.
46 see impl_analyze() for further information.
47 But note: To be useable as flags, these enums
48 must be values of range [2^n]! */
49 enum EDetect
51 E_MODEL = 1,
52 E_HELP = 2,
53 E_BACKINGCOMPONENT = 4,
54 E_HIDDEN = 8,
55 E_ALL = 15,
56 E_ZOMBIE = 32768 // use it for special test scenarios only!!!
60 // member
62 public:
64 /** provides access to the frame container, which should be analyzed. */
65 const css::uno::Reference< css::frame::XFramesSupplier >& m_xSupplier;
67 /** hold the reference frame, which is used e.g. to detect other frames with the same model. */
68 const css::uno::Reference< css::frame::XFrame >& m_xReferenceFrame;
70 /** enable/disable some special analyzing steps.
71 see impl_analyze() for further information. */
72 sal_uInt32 m_eDetectMode;
74 /** contains all frames, which uses the same model like the reference frame.
75 Will be filled only if m_eDetectMode has set the flag E_MODEL.
76 The reference frame is never part of this list! */
77 std::vector< css::uno::Reference< css::frame::XFrame > > m_lModelFrames;
79 /** contains all frames, which does not contain the same model like the reference frame.
80 Filling of it can't be suppressed by m_eDetectMode.
81 The reference frame is never part of this list!
82 All frames inside this list are visible ones. */
83 std::vector< css::uno::Reference< css::frame::XFrame > > m_lOtherVisibleFrames;
85 /** contains all frames, which does not contain the same model like the reference frame.
86 Filling of it can't be suppressed by m_eDetectMode.
87 The reference frame is never part of this list!
88 All frames inside this list are hidden ones. */
89 std::vector< css::uno::Reference< css::frame::XFrame > > m_lOtherHiddenFrames;
91 /** points to the help frame.
92 Will be set only, if any other frame (means different from the reference frame)
93 contains the help component. If the reference frame itself includes the help module
94 it's not set ... but another member m_bIsHelp is used to safe this information.
95 See following example code:
97 <listing>
98 if (m_xReferenceFrame == help)
100 m_xHelp = NULL;
101 m_bIsHelp = sal_True;
103 else
104 if (xOtherFrame == help)
106 m_xHelp = xOtherFrame;
107 m_bIsHelp = sal_False;
109 </listing>
111 Analyzing of the help frame ignores the visible state of any frame.
112 But note: a hidden help frame indicates a wrong state!
114 css::uno::Reference< css::frame::XFrame > m_xHelp;
116 /** points to the frame, which contains the backing component.
117 Will be set only, if any other frame (means different from the reference frame)
118 contains the backing component. If the reference frame itself includes the
119 backing component it's not set ... but another member m_bIsBackingComponent
120 will used to safe this information.
121 See following example code:
123 <listing>
124 if (m_xReferenceFrame == backing)
126 m_xBackingComponent = NULL;
127 m_bIsBackingComponent = sal_True;
129 else
130 if (xOtherFrame == backing)
132 m_xBackingComponent = xOtherFrame;
133 m_bIsBackingComponent = sal_False ;
135 </listing>
137 Analyzing of the help frame ignores the visible state of any frame.
138 But note: a hidden backing mode frame indicates a wrong state!
140 css::uno::Reference< css::frame::XFrame > m_xBackingComponent;
142 /** is set to true only, if the reference frame is a hidden one.
143 This value is undefined if m_eDetectMode doesn't have set the flag E_HIDDEN! */
144 bool m_bReferenceIsHidden;
146 /** is set to true only, if the reference frame contains the help component.
147 In this case the member m_xHelp is set to NULL every time.
148 This value is undefined if m_eDetectMode doesn't have set the flag E_HELP! */
149 bool m_bReferenceIsHelp;
151 /** is set to true only, if the reference frame contains the backing component.
152 In this case the member m_xBackingComponent is set to NULL every time.
153 This value is undefined if m_eDetectMode doesn't have set the flag E_BACKINGCOMPONENT! */
154 bool m_bReferenceIsBacking;
157 // interface
159 public:
161 /** starts analyze phase and fill all members with valid information.
163 @param xSupplier
164 Must be a valid reference to a frames supplier, which provides
165 access to the frame list for analyzing.
167 @param xReferenceFrame
168 This frame must(!) exist inside the analyzed frame list and
169 is used for some comparing functions. Further some member states
170 depends from the current state of this frame.
172 @param eDetectMode
173 It represent a flag field, which can enable/disable special
174 analyze steps. Note: Some member values will be undefined, if
175 an analyze step will be disabled.
177 FrameListAnalyzer( const css::uno::Reference< css::frame::XFramesSupplier >& xSupplier ,
178 const css::uno::Reference< css::frame::XFrame >& xReferenceFrame ,
179 sal_uInt32 eDetectMode );
180 ~FrameListAnalyzer();
183 // helper
185 private:
187 void impl_analyze();
190 }; // class FrameListAnalyzer
192 } // namespace framework
194 #endif // INCLUDED_FRAMEWORK_FRAMELISTANALYZER_HXX
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */