Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
d70aa23c
Kaydet (Commit)
d70aa23c
authored
Ock 25, 2012
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add configuration wrappers for groups, too (to add listeners etc.).
üst
866df124
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
4 deletions
+93
-4
cppheader.xsl
officecfg/registry/cppheader.xsl
+20
-4
configuration.hxx
unotools/inc/unotools/configuration.hxx
+48
-0
configuration.cxx
unotools/source/config/configuration.cxx
+25
-0
No files found.
officecfg/registry/cppheader.xsl
Dosyayı görüntüle @
d70aa23c
...
@@ -141,9 +141,18 @@
...
@@ -141,9 +141,18 @@
<xsl:template
match=
"group"
>
<xsl:template
match=
"group"
>
<xsl:param
name=
"path"
/>
<xsl:param
name=
"path"
/>
<xsl:if
test=
".//prop or .//set"
>
<xsl:if
test=
".//prop or .//set"
>
<xsl:text>
namespace
</xsl:text>
<xsl:variable
name=
"name"
select=
"translate(@oor:name, '-.', '__')"
/>
<xsl:value-of
select=
"translate(@oor:name, '-.', '__')"
/>
<xsl:text>
struct
</xsl:text>
<xsl:text>
{


</xsl:text>
<xsl:value-of
select=
"$name"
/>
<xsl:text>
: public unotools::ConfigurationGroup
<
</xsl:text>
<xsl:value-of
select=
"$name"
/>
<xsl:text>
>
{


</xsl:text>
<xsl:text>
static rtl::OUString path() { return rtl::OUString(
<!--
-->
RTL_CONSTASCII_USTRINGPARAM("
</xsl:text>
<xsl:value-of
select=
"$path"
/>
<xsl:text>
/
</xsl:text>
<xsl:value-of
select=
"@oor:name"
/>
<xsl:text>
")); }


</xsl:text>
<xsl:text>


</xsl:text>
<xsl:text>


</xsl:text>
<xsl:apply-templates
select=
"group|set|prop"
>
<xsl:apply-templates
select=
"group|set|prop"
>
<xsl:with-param
name=
"path"
>
<xsl:with-param
name=
"path"
>
...
@@ -152,7 +161,14 @@
...
@@ -152,7 +161,14 @@
<xsl:value-of
select=
"@oor:name"
/>
<xsl:value-of
select=
"@oor:name"
/>
</xsl:with-param>
</xsl:with-param>
</xsl:apply-templates>
</xsl:apply-templates>
<xsl:text>
}


</xsl:text>
<xsl:text>
private:


</xsl:text>
<xsl:text>
</xsl:text>
<xsl:value-of
select=
"$name"
/>
<xsl:text>
(); // not defined


</xsl:text>
<xsl:text>
~
</xsl:text>
<xsl:value-of
select=
"$name"
/>
<xsl:text>
(); // not defined


</xsl:text>
<xsl:text>
};


</xsl:text>
<xsl:text>


</xsl:text>
<xsl:text>


</xsl:text>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:template>
...
...
unotools/inc/unotools/configuration.hxx
Dosyayı görüntüle @
d70aa23c
...
@@ -43,6 +43,7 @@ namespace com { namespace sun { namespace star {
...
@@ -43,6 +43,7 @@ namespace com { namespace sun { namespace star {
namespace
configuration
{
class
XReadWriteAccess
;
}
namespace
configuration
{
class
XReadWriteAccess
;
}
namespace
container
{
namespace
container
{
class
XHierarchicalNameAccess
;
class
XHierarchicalNameAccess
;
class
XHierarchicalNameReplace
;
class
XNameAccess
;
class
XNameAccess
;
class
XNameContainer
;
class
XNameContainer
;
}
}
...
@@ -80,6 +81,10 @@ private:
...
@@ -80,6 +81,10 @@ private:
rtl
::
OUString
const
&
path
,
com
::
sun
::
star
::
uno
::
Any
const
&
value
)
rtl
::
OUString
const
&
path
,
com
::
sun
::
star
::
uno
::
Any
const
&
value
)
const
;
const
;
SAL_DLLPRIVATE
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
container
::
XHierarchicalNameReplace
>
getGroup
(
rtl
::
OUString
const
&
path
)
const
;
SAL_DLLPRIVATE
SAL_DLLPRIVATE
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
container
::
XNameContainer
>
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
container
::
XNameContainer
>
getSet
(
rtl
::
OUString
const
&
path
)
const
;
getSet
(
rtl
::
OUString
const
&
path
)
const
;
...
@@ -120,6 +125,16 @@ public:
...
@@ -120,6 +125,16 @@ public:
rtl
::
OUString
const
&
path
,
com
::
sun
::
star
::
uno
::
Any
const
&
value
)
rtl
::
OUString
const
&
path
,
com
::
sun
::
star
::
uno
::
Any
const
&
value
)
const
;
const
;
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
container
::
XHierarchicalNameAccess
>
getGroupReadOnly
(
rtl
::
OUString
const
&
path
)
const
;
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
container
::
XHierarchicalNameReplace
>
getGroupReadWrite
(
boost
::
shared_ptr
<
ConfigurationChanges
>
const
&
batch
,
rtl
::
OUString
const
&
path
)
const
;
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
container
::
XNameAccess
>
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
container
::
XNameAccess
>
getSetReadOnly
(
rtl
::
OUString
const
&
path
)
const
;
getSetReadOnly
(
rtl
::
OUString
const
&
path
)
const
;
...
@@ -230,6 +245,39 @@ private:
...
@@ -230,6 +245,39 @@ private:
~
ConfigurationLocalizedProperty
();
// not defined
~
ConfigurationLocalizedProperty
();
// not defined
};
};
/// A type-safe wrapper around a configuration group.
///
/// Automatically generated headers for the various configuration groups derive
/// from this template and make available its member functions to access each
/// given configuration group.
template
<
typename
T
>
struct
ConfigurationGroup
:
private
boost
::
noncopyable
{
/// Get read-only access to the given configuration group.
static
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
container
::
XHierarchicalNameAccess
>
get
(
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
uno
::
XComponentContext
>
const
&
context
)
{
return
detail
::
ConfigurationWrapper
::
get
(
context
).
getGroupReadOnly
(
T
::
path
());
}
/// Get read/write access to the given configuration group, storing any
/// modifications via the given changes batch.
static
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
container
::
XHierarchicalNameReplace
>
get
(
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
uno
::
XComponentContext
>
const
&
context
,
boost
::
shared_ptr
<
ConfigurationChanges
>
const
&
batch
)
{
return
detail
::
ConfigurationWrapper
::
get
(
context
).
getGroupReadWrite
(
batch
,
T
::
path
());
}
private
:
ConfigurationGroup
();
// not defined
~
ConfigurationGroup
();
// not defined
};
/// A type-safe wrapper around a configuration set.
/// A type-safe wrapper around a configuration set.
///
///
/// Automatically generated headers for the various configuration sets derive
/// Automatically generated headers for the various configuration sets derive
...
...
unotools/source/config/configuration.cxx
Dosyayı görüntüle @
d70aa23c
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include "com/sun/star/configuration/XReadWriteAccess.hpp"
#include "com/sun/star/configuration/XReadWriteAccess.hpp"
#include "com/sun/star/configuration/theDefaultProvider.hpp"
#include "com/sun/star/configuration/theDefaultProvider.hpp"
#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
#include "com/sun/star/container/XHierarchicalNameReplace.hpp"
#include "com/sun/star/container/XNameAccess.hpp"
#include "com/sun/star/container/XNameAccess.hpp"
#include "com/sun/star/container/XNameContainer.hpp"
#include "com/sun/star/container/XNameContainer.hpp"
#include "com/sun/star/lang/Locale.hpp"
#include "com/sun/star/lang/Locale.hpp"
...
@@ -90,6 +91,13 @@ void unotools::ConfigurationChanges::setPropertyValue(
...
@@ -90,6 +91,13 @@ void unotools::ConfigurationChanges::setPropertyValue(
access_
->
replaceByHierarchicalName
(
path
,
value
);
access_
->
replaceByHierarchicalName
(
path
,
value
);
}
}
css
::
uno
::
Reference
<
css
::
container
::
XHierarchicalNameReplace
>
unotools
::
ConfigurationChanges
::
getGroup
(
rtl
::
OUString
const
&
path
)
const
{
return
css
::
uno
::
Reference
<
css
::
container
::
XHierarchicalNameReplace
>
(
access_
->
getByHierarchicalName
(
path
),
css
::
uno
::
UNO_QUERY_THROW
);
}
css
::
uno
::
Reference
<
css
::
container
::
XNameContainer
>
css
::
uno
::
Reference
<
css
::
container
::
XNameContainer
>
unotools
::
ConfigurationChanges
::
getSet
(
rtl
::
OUString
const
&
path
)
const
unotools
::
ConfigurationChanges
::
getSet
(
rtl
::
OUString
const
&
path
)
const
{
{
...
@@ -139,6 +147,23 @@ void unotools::detail::ConfigurationWrapper::setLocalizedPropertyValue(
...
@@ -139,6 +147,23 @@ void unotools::detail::ConfigurationWrapper::setLocalizedPropertyValue(
batch
->
setPropertyValue
(
extendLocalizedPath
(
path
),
value
);
batch
->
setPropertyValue
(
extendLocalizedPath
(
path
),
value
);
}
}
css
::
uno
::
Reference
<
css
::
container
::
XHierarchicalNameAccess
>
unotools
::
detail
::
ConfigurationWrapper
::
getGroupReadOnly
(
rtl
::
OUString
const
&
path
)
const
{
return
css
::
uno
::
Reference
<
css
::
container
::
XHierarchicalNameAccess
>
(
access_
->
getByHierarchicalName
(
path
),
css
::
uno
::
UNO_QUERY_THROW
);
}
css
::
uno
::
Reference
<
css
::
container
::
XHierarchicalNameReplace
>
unotools
::
detail
::
ConfigurationWrapper
::
getGroupReadWrite
(
boost
::
shared_ptr
<
ConfigurationChanges
>
const
&
batch
,
rtl
::
OUString
const
&
path
)
const
{
assert
(
batch
.
get
()
!=
0
);
return
batch
->
getGroup
(
path
);
}
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
unotools
::
detail
::
ConfigurationWrapper
::
getSetReadOnly
(
unotools
::
detail
::
ConfigurationWrapper
::
getSetReadOnly
(
rtl
::
OUString
const
&
path
)
const
rtl
::
OUString
const
&
path
)
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment