merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / inc / request.hxx
blob1d553abb5cebc8b916add2dd5876a23c421b8602
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: request.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef CONFIGMGR_BACKEND_REQUEST_HXX_
32 #define CONFIGMGR_BACKEND_REQUEST_HXX_
34 #include "requestoptions.hxx"
35 #include "requesttypes.hxx"
36 #include "configpath.hxx"
38 namespace configmgr
40 // ---------------------------------------------------------------------------
41 namespace backend
43 // ---------------------------------------------------------------------------
45 class NodeRequest
47 configuration::AbsolutePath m_aNodePath;
48 RequestOptions m_aOptions;
49 public:
50 NodeRequest(configuration::AbsolutePath const& _aNodePath, RequestOptions const & _aOptions)
51 : m_aNodePath(_aNodePath)
52 , m_aOptions(_aOptions)
56 configuration::AbsolutePath const & getPath() const { return m_aNodePath; }
57 RequestOptions const & getOptions() const { return m_aOptions; }
59 // ---------------------------------------------------------------------------
61 class ComponentRequest
63 rtl::OUString m_aComponentName;
64 RequestOptions m_aOptions;
65 bool m_bForcedReload;
66 public:
67 ComponentRequest(rtl::OUString const& _aComponentName, RequestOptions const & _aOptions)
68 : m_aComponentName(_aComponentName)
69 , m_aOptions(_aOptions)
70 , m_bForcedReload(false)
74 rtl::OUString const & getComponentName() const { return m_aComponentName; }
75 RequestOptions const & getOptions() const { return m_aOptions; }
77 bool isForcingReload() const { return m_bForcedReload; }
78 void forceReload(bool _bForce = true) { m_bForcedReload = _bForce; }
80 // ---------------------------------------------------------------------------
82 class TemplateRequest
84 rtl::OUString m_aComponentName;
85 rtl::OUString m_aTemplateName;
87 public:
88 static
89 TemplateRequest forComponent(rtl::OUString const & _aComponentName)
91 return TemplateRequest( rtl::OUString(), _aComponentName);
94 explicit
95 TemplateRequest(rtl::OUString const & _aTemplateName, rtl::OUString const & _aComponentName)
96 : m_aComponentName(_aComponentName)
97 , m_aTemplateName(_aTemplateName)
100 bool isComponentRequest() const { return m_aTemplateName.getLength() == 0; }
101 rtl::OUString getTemplateName() const { return m_aTemplateName; }
102 rtl::OUString getComponentName() const { return m_aComponentName; }
106 // ---------------------------------------------------------------------------
108 class UpdateRequest
110 ConstUpdateInstance m_aUpdate;
111 RequestOptions m_aOptions;
112 rtl::OUString m_aRQID;
113 public:
114 explicit
115 UpdateRequest( UpdateInstance const & _aUpdate,
116 RequestOptions const & _aOptions)
117 : m_aUpdate(_aUpdate)
118 , m_aOptions(_aOptions)
121 explicit
122 UpdateRequest( ConstUpdateInstance const & _aUpdate,
123 RequestOptions const & _aOptions)
124 : m_aUpdate(_aUpdate)
125 , m_aOptions(_aOptions)
128 explicit
129 UpdateRequest( ConstUpdateInstance::Data _aUpdateData,
130 configuration::AbsolutePath const & _aRootpath,
131 RequestOptions const & _aOptions)
132 : m_aUpdate(_aUpdateData, _aRootpath)
133 , m_aOptions(_aOptions)
136 bool isSyncRequired() const { return !m_aOptions.isAsyncEnabled(); }
138 RequestOptions const & getOptions() const { return m_aOptions; }
139 configuration::AbsolutePath const & getUpdateRoot() const { return m_aUpdate.root(); }
141 ConstUpdateInstance const & getUpdate() const { return m_aUpdate; }
142 ConstUpdateInstance::Data getUpdateData() const { return m_aUpdate.data(); }
144 void setRequestId(rtl::OUString const & _aRQID) { m_aRQID = _aRQID; }
145 rtl::OUString getRequestId() const { return m_aRQID; }
148 inline ComponentRequest getComponentRequest(UpdateRequest const & _aUR)
149 { return ComponentRequest(_aUR.getUpdateRoot().getModuleName(), _aUR.getOptions()); }
150 // ---------------------------------------------------------------------------
151 } // namespace
152 // ---------------------------------------------------------------------------
153 } // namespace
155 #endif