1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: translatechanges.hxx,v $
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_API_TRANSLATECHANGES_HXX_
32 #define CONFIGMGR_API_TRANSLATECHANGES_HXX_
34 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
35 #include <com/sun/star/beans/XVetoableChangeListener.hpp>
36 #include <com/sun/star/beans/XPropertiesChangeListener.hpp>
37 #include <com/sun/star/container/XContainerListener.hpp>
38 #include <com/sun/star/util/XChangesListener.hpp>
39 #include "rtl/ref.hxx"
43 // ---------------------------------------------------------------------------------------------------
44 namespace css
= ::com::sun::star
;
45 namespace uno
= css::uno
;
46 namespace lang
= css::lang
;
47 namespace util
= css::util
;
48 namespace beans
= css::beans
;
49 namespace container
= css::container
;
50 // ---------------------------------------------------------------------------------------------------
52 namespace configuration
54 class NodeChangeInformation
;
56 class NodeChangeLocation
;
65 // ---------------------------------------------------------------------------------------------------
72 struct UnoChange
{ uno::Any newValue
, oldValue
; };
74 //interpreting NodeChanges
75 // resolve the relative path from a given base node to the changed node
76 bool resolveChangeLocation( configuration::RelativePath
& aPath
,
77 configuration::NodeChangeLocation
const& aChange
,
78 rtl::Reference
< configuration::Tree
> const& aBaseTree
,
79 configuration::NodeRef
const& aBaseNode
);
81 // change path and base settings to start from the given base tree (root)
82 bool rebaseChange( configuration::NodeChangeLocation
& aChange
,
83 rtl::Reference
< configuration::Tree
> const& _aBaseTreeRef
);
84 // change path and base settings to start from the given base node
85 bool rebaseChange( configuration::NodeChangeLocation
& aChange
,
86 rtl::Reference
< configuration::Tree
> const& _aBaseTreeRef
,
87 configuration::NodeRef
const& aBaseNode
);
88 // resolve non-uno elements to Uno Objects
89 bool resolveUnoObjects(UnoChange
& aUnoChange
,
90 configuration::NodeChangeData
const& aChange
,
92 // resolve non-uno elements to Uno Objects inplace
93 bool resolveToUno(configuration::NodeChangeData
& aChange
,
98 /// fill a change info from a NodeChangeInfo
99 void fillChange(util::ElementChange
& rChange
,
100 configuration::NodeChangeInformation
const& aInfo
,
101 rtl::Reference
< configuration::Tree
> const& aBaseTree
,
103 /// fill a change info from a NodeChangeInfo
104 void fillChange(util::ElementChange
& rChange
,
105 configuration::NodeChangeInformation
const& aInfo
,
106 rtl::Reference
< configuration::Tree
> const& aBaseTree
,
107 configuration::NodeRef
const& aBaseNode
,
109 /// fill a change info from a NodeChangeInfo (base,path and uno objects are assumed to be resolved already)
110 void fillChangeFromResolved(util::ElementChange
& rChange
, configuration::NodeChangeInformation
const& aInfo
);
112 /// fill a event from a NodeChangeInfo (uno objects are assumed to be resolved already)
113 bool fillEventDataFromResolved(container::ContainerEvent
& rEvent
, configuration::NodeChangeInformation
const& aInfo
);
114 /// fill a event from a NodeChangeInfo(uno objects are assumed to be resolved already) - returns false if this isn't a property change
115 bool fillEventDataFromResolved(beans::PropertyChangeEvent
& rEvent
, configuration::NodeChangeInformation
const& aInfo
, bool bMore
);
117 // ---------------------------------------------------------------------------------------------------
120 #endif // CONFIGMGR_API_TRANSLATECHANGES_HXX_