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
6c15ca4d
Kaydet (Commit)
6c15ca4d
authored
Ock 09, 2014
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fwk: Constructor feature for single-instance SubstitutePathVariables.
Change-Id: Ibd626f00bb844ae8ec1cab773093b8c94bf8d936
üst
2257efcd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
291 additions
and
315 deletions
+291
-315
substitutepathvars.hxx
framework/inc/services/substitutepathvars.hxx
+0
-285
registerservices.cxx
framework/source/register/registerservices.cxx
+0
-2
substitutepathvars.cxx
framework/source/services/substitutepathvars.cxx
+288
-27
fwk.component
framework/util/fwk.component
+2
-1
native-code.py
solenv/bin/native-code.py
+1
-0
No files found.
framework/inc/services/substitutepathvars.hxx
deleted
100644 → 0
Dosyayı görüntüle @
2257efcd
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_SUBSTITUTEPATHVARS_HXX
#define INCLUDED_FRAMEWORK_INC_SERVICES_SUBSTITUTEPATHVARS_HXX
/** Attention: stl headers must(!) be included at first. Otherwise it can make trouble
with solaris headers ...
*/
#include <vector>
#include <list>
#include <boost/unordered_map.hpp>
#include <threadhelp/threadhelpbase.hxx>
#include <macros/generic.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
#include <stdtypes.h>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/util/XStringSubstitution.hpp>
#include <cppuhelper/implbase2.hxx>
#include <rtl/ustring.hxx>
#include <unotools/configitem.hxx>
#include <tools/link.hxx>
#include <i18nlangtag/lang.h>
namespace
framework
{
// Must be zero value based
enum
EnvironmentType
{
ET_HOST
=
0
,
ET_YPDOMAIN
,
ET_DNSDOMAIN
,
ET_NTDOMAIN
,
ET_OS
,
ET_UNKNOWN
,
ET_COUNT
};
// Must be zero value based
enum
OperatingSystem
{
OS_WINDOWS
=
0
,
OS_UNIX
,
OS_SOLARIS
,
OS_LINUX
,
OS_UNKNOWN
,
OS_COUNT
};
struct
SubstituteRule
{
SubstituteRule
()
{}
SubstituteRule
(
const
OUString
&
aVarName
,
const
OUString
&
aValue
,
const
com
::
sun
::
star
::
uno
::
Any
&
aVal
,
EnvironmentType
aType
)
:
aSubstVariable
(
aVarName
),
aSubstValue
(
aValue
),
aEnvValue
(
aVal
),
aEnvType
(
aType
)
{}
OUString
aSubstVariable
;
OUString
aSubstValue
;
com
::
sun
::
star
::
uno
::
Any
aEnvValue
;
EnvironmentType
aEnvType
;
};
struct
SubstitutePathNotify
{
SubstitutePathNotify
()
{};
const
com
::
sun
::
star
::
uno
::
Sequence
<
OUString
>
aPropertyNames
;
};
class
SubstituteVariables
:
public
::
boost
::
unordered_map
<
OUString
,
SubstituteRule
,
OUStringHash
,
::
std
::
equal_to
<
OUString
>
>
{
public
:
inline
void
free
()
{
SubstituteVariables
().
swap
(
*
this
);
}
};
typedef
std
::
vector
<
SubstituteRule
>
SubstituteRuleVector
;
class
SubstitutePathVariables_Impl
:
public
utl
::
ConfigItem
{
public
:
SubstitutePathVariables_Impl
(
const
Link
&
aNotifyLink
);
virtual
~
SubstitutePathVariables_Impl
();
static
OperatingSystem
GetOperatingSystemFromString
(
const
OUString
&
);
static
EnvironmentType
GetEnvTypeFromString
(
const
OUString
&
);
void
GetSharePointsRules
(
SubstituteVariables
&
aSubstVarMap
);
/** is called from the ConfigManager before application ends or from the
PropertyChangeListener if the sub tree broadcasts changes. */
virtual
void
Notify
(
const
com
::
sun
::
star
::
uno
::
Sequence
<
OUString
>&
aPropertyNames
);
virtual
void
Commit
();
private
:
// Wrapper methods for low-level functions
OperatingSystem
GetOperatingSystem
();
const
OUString
&
GetYPDomainName
();
const
OUString
&
GetDNSDomainName
();
const
OUString
&
GetNTDomainName
();
const
OUString
&
GetHostName
();
bool
FilterRuleSet
(
const
SubstituteRuleVector
&
aRuleSet
,
SubstituteRule
&
aActiveRule
);
void
ReadSharePointsFromConfiguration
(
com
::
sun
::
star
::
uno
::
Sequence
<
OUString
>&
aSharePointsSeq
);
void
ReadSharePointRuleSetFromConfiguration
(
const
OUString
&
aSharePointName
,
const
OUString
&
aSharePointNodeName
,
SubstituteRuleVector
&
aRuleSet
);
// Stored values for domains and host
bool
m_bYPDomainRetrieved
;
OUString
m_aYPDomain
;
bool
m_bDNSDomainRetrieved
;
OUString
m_aDNSDomain
;
bool
m_bNTDomainRetrieved
;
OUString
m_aNTDomain
;
bool
m_bHostRetrieved
;
OUString
m_aHost
;
Link
m_aListenerNotify
;
const
OUString
m_aSharePointsNodeName
;
const
OUString
m_aDirPropertyName
;
const
OUString
m_aEnvPropertyName
;
const
OUString
m_aLevelSep
;
};
enum
PreDefVariable
{
PREDEFVAR_INST
,
PREDEFVAR_PROG
,
PREDEFVAR_USER
,
PREDEFVAR_WORK
,
PREDEFVAR_HOME
,
PREDEFVAR_TEMP
,
PREDEFVAR_PATH
,
PREDEFVAR_LANG
,
PREDEFVAR_LANGID
,
PREDEFVAR_VLANG
,
PREDEFVAR_INSTPATH
,
PREDEFVAR_PROGPATH
,
PREDEFVAR_USERPATH
,
PREDEFVAR_INSTURL
,
PREDEFVAR_PROGURL
,
PREDEFVAR_USERURL
,
PREDEFVAR_WORKDIRURL
,
// New variable of hierachy service (#i32656#)
PREDEFVAR_BASEINSTURL
,
PREDEFVAR_USERDATAURL
,
PREDEFVAR_BRANDBASEURL
,
PREDEFVAR_COUNT
};
struct
PredefinedPathVariables
{
// Predefined variables supported by substitute variables
LanguageType
m_eLanguageType
;
// Lanuage type of Office
OUString
m_FixedVar
[
PREDEFVAR_COUNT
];
// Variable value access by PreDefVariable
OUString
m_FixedVarNames
[
PREDEFVAR_COUNT
];
// Variable name access by PreDefVariable
};
struct
ReSubstFixedVarOrder
{
sal_Int32
nVarValueLength
;
PreDefVariable
eVariable
;
bool
operator
<
(
const
ReSubstFixedVarOrder
&
aFixedVarOrder
)
const
{
// Reverse operator< to have high to low ordering
return
(
nVarValueLength
>
aFixedVarOrder
.
nVarValueLength
);
}
};
struct
ReSubstUserVarOrder
{
sal_Int32
nVarValueLength
;
OUString
aVarName
;
bool
operator
<
(
const
ReSubstUserVarOrder
&
aUserVarOrder
)
const
{
// Reverse operator< to have high to low ordering
return
(
nVarValueLength
>
aUserVarOrder
.
nVarValueLength
);
}
};
typedef
std
::
list
<
ReSubstFixedVarOrder
>
ReSubstFixedVarOrderVector
;
typedef
std
::
list
<
ReSubstUserVarOrder
>
ReSubstUserVarOrderVector
;
class
SubstitutePathVariables
:
private
ThreadHelpBase
,
// Struct for right initalization of mutex member! Must be first of baseclasses.
public
::
cppu
::
WeakImplHelper2
<
::
com
::
sun
::
star
::
util
::
XStringSubstitution
,
css
::
lang
::
XServiceInfo
>
{
friend
class
SubstitutePathVariables_Impl
;
public
:
SubstitutePathVariables
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>&
xContext
);
virtual
~
SubstitutePathVariables
();
// XInterface, XTypeProvider, XServiceInfo
DECLARE_XSERVICEINFO
// XStringSubstitution
virtual
OUString
SAL_CALL
substituteVariables
(
const
OUString
&
aText
,
sal_Bool
bSubstRequired
)
throw
(
::
com
::
sun
::
star
::
container
::
NoSuchElementException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
OUString
SAL_CALL
reSubstituteVariables
(
const
OUString
&
aText
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
OUString
SAL_CALL
getSubstituteVariableValue
(
const
OUString
&
variable
)
throw
(
::
com
::
sun
::
star
::
container
::
NoSuchElementException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
protected
:
DECL_LINK
(
implts_ConfigurationNotify
,
void
*
);
void
SetPredefinedPathVariables
(
PredefinedPathVariables
&
);
OUString
ConvertOSLtoUCBURL
(
const
OUString
&
aOSLCompliantURL
)
const
;
// Special case (transient) values can change during runtime!
// Don't store them in the pre defined struct
OUString
GetWorkPath
()
const
;
OUString
GetWorkVariableValue
()
const
;
OUString
GetPathVariableValue
()
const
;
OUString
GetHomeVariableValue
()
const
;
// XStringSubstitution implementation methods
OUString
impl_substituteVariable
(
const
OUString
&
aText
,
bool
bSustRequired
)
throw
(
::
com
::
sun
::
star
::
container
::
NoSuchElementException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
OUString
impl_reSubstituteVariables
(
const
OUString
&
aText
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
OUString
impl_getSubstituteVariableValue
(
const
OUString
&
variable
)
throw
(
::
com
::
sun
::
star
::
container
::
NoSuchElementException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
private
:
class
VarNameToIndexMap
:
public
boost
::
unordered_map
<
OUString
,
PreDefVariable
,
OUStringHash
,
::
std
::
equal_to
<
OUString
>
>
{
inline
void
free
()
{
VarNameToIndexMap
().
swap
(
*
this
);
}
};
VarNameToIndexMap
m_aPreDefVarMap
;
// Mapping from pre-def variable names to enum for array access
SubstituteVariables
m_aSubstVarMap
;
// Active rule set map indexed by variable name!
PredefinedPathVariables
m_aPreDefVars
;
// All predefined variables
SubstitutePathVariables_Impl
m_aImpl
;
// Implementation class that access the configuration
ReSubstFixedVarOrderVector
m_aReSubstFixedVarOrder
;
// To speed up resubstitution fixed variables (order for lookup)
ReSubstUserVarOrderVector
m_aReSubstUserVarOrder
;
// To speed up resubstitution user variables
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
uno
::
XComponentContext
>
m_xContext
;
};
}
#endif // INCLUDED_FRAMEWORK_INC_SERVICES_SUBSTITUTEPATHVARS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
framework/source/register/registerservices.cxx
Dosyayı görüntüle @
6c15ca4d
...
...
@@ -42,7 +42,6 @@
#include <services/sessionlistener.hxx>
#include <services/taskcreatorsrv.hxx>
#include <services/substitutepathvars.hxx>
#include <services/ContextChangeEventMultiplexer.hxx>
COMPONENTGETFACTORY
(
fwk
,
...
...
@@ -55,7 +54,6 @@ COMPONENTGETFACTORY ( fwk,
IFFACTORY
(
::
framework
::
SessionListener
)
else
IFFACTORY
(
::
framework
::
SessionListener
)
else
IFFACTORY
(
::
framework
::
TaskCreatorService
)
else
IFFACTORY
(
::
framework
::
SubstitutePathVariables
)
else
IFFACTORY
(
::
framework
::
ContextChangeEventMultiplexer
)
)
...
...
framework/source/services/substitutepathvars.cxx
Dosyayı görüntüle @
6c15ca4d
...
...
@@ -19,13 +19,10 @@
#include <config_folders.h>
#include "services/substitutepathvars.hxx"
#include <threadhelp/resetableguard.hxx>
#include <helper/networkdomain.hxx>
#include "services.h"
#include <com/sun/star/beans/XPropertySet.hpp>
#include <cppuhelper/compbase2.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <unotools/configitem.hxx>
#include <unotools/localfilehelper.hxx>
#include <unotools/configmgr.hxx>
...
...
@@ -37,6 +34,7 @@
#include <osl/socket.hxx>
#include <osl/process.h>
#include <i18nlangtag/languagetag.hxx>
#include <tools/link.hxx>
#include <tools/urlobj.hxx>
#include <tools/resmgr.hxx>
#include <tools/wldcrd.hxx>
...
...
@@ -45,9 +43,12 @@
#include <officecfg/Office/Paths.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/util/XStringSubstitution.hpp>
#include <boost/unordered_map.hpp>
#include <string.h>
using
namespace
com
::
sun
::
star
::
uno
;
...
...
@@ -55,13 +56,259 @@ using namespace com::sun::star::beans;
using
namespace
com
::
sun
::
star
::
util
;
using
namespace
com
::
sun
::
star
::
lang
;
using
namespace
com
::
sun
::
star
::
container
;
using
namespace
framework
;
//_________________________________________________________________________________________________________________
// Namespace
//_________________________________________________________________________________________________________________
namespace
{
// Must be zero value based
enum
EnvironmentType
{
ET_HOST
=
0
,
ET_YPDOMAIN
,
ET_DNSDOMAIN
,
ET_NTDOMAIN
,
ET_OS
,
ET_UNKNOWN
,
ET_COUNT
};
namespace
framework
// Must be zero value based
enum
OperatingSystem
{
OS_WINDOWS
=
0
,
OS_UNIX
,
OS_SOLARIS
,
OS_LINUX
,
OS_UNKNOWN
,
OS_COUNT
};
struct
SubstituteRule
{
SubstituteRule
()
{}
SubstituteRule
(
const
OUString
&
aVarName
,
const
OUString
&
aValue
,
const
com
::
sun
::
star
::
uno
::
Any
&
aVal
,
EnvironmentType
aType
)
:
aSubstVariable
(
aVarName
),
aSubstValue
(
aValue
),
aEnvValue
(
aVal
),
aEnvType
(
aType
)
{}
OUString
aSubstVariable
;
OUString
aSubstValue
;
com
::
sun
::
star
::
uno
::
Any
aEnvValue
;
EnvironmentType
aEnvType
;
};
struct
SubstitutePathNotify
{
SubstitutePathNotify
()
{};
const
com
::
sun
::
star
::
uno
::
Sequence
<
OUString
>
aPropertyNames
;
};
class
SubstituteVariables
:
public
::
boost
::
unordered_map
<
OUString
,
SubstituteRule
,
OUStringHash
,
::
std
::
equal_to
<
OUString
>
>
{
public
:
inline
void
free
()
{
SubstituteVariables
().
swap
(
*
this
);
}
};
typedef
std
::
vector
<
SubstituteRule
>
SubstituteRuleVector
;
class
SubstitutePathVariables_Impl
:
public
utl
::
ConfigItem
{
public
:
SubstitutePathVariables_Impl
(
const
Link
&
aNotifyLink
);
virtual
~
SubstitutePathVariables_Impl
();
static
OperatingSystem
GetOperatingSystemFromString
(
const
OUString
&
);
static
EnvironmentType
GetEnvTypeFromString
(
const
OUString
&
);
void
GetSharePointsRules
(
SubstituteVariables
&
aSubstVarMap
);
/** is called from the ConfigManager before application ends or from the
PropertyChangeListener if the sub tree broadcasts changes. */
virtual
void
Notify
(
const
com
::
sun
::
star
::
uno
::
Sequence
<
OUString
>&
aPropertyNames
);
virtual
void
Commit
();
private
:
// Wrapper methods for low-level functions
OperatingSystem
GetOperatingSystem
();
const
OUString
&
GetYPDomainName
();
const
OUString
&
GetDNSDomainName
();
const
OUString
&
GetNTDomainName
();
const
OUString
&
GetHostName
();
bool
FilterRuleSet
(
const
SubstituteRuleVector
&
aRuleSet
,
SubstituteRule
&
aActiveRule
);
void
ReadSharePointsFromConfiguration
(
com
::
sun
::
star
::
uno
::
Sequence
<
OUString
>&
aSharePointsSeq
);
void
ReadSharePointRuleSetFromConfiguration
(
const
OUString
&
aSharePointName
,
const
OUString
&
aSharePointNodeName
,
SubstituteRuleVector
&
aRuleSet
);
// Stored values for domains and host
bool
m_bYPDomainRetrieved
;
OUString
m_aYPDomain
;
bool
m_bDNSDomainRetrieved
;
OUString
m_aDNSDomain
;
bool
m_bNTDomainRetrieved
;
OUString
m_aNTDomain
;
bool
m_bHostRetrieved
;
OUString
m_aHost
;
Link
m_aListenerNotify
;
const
OUString
m_aSharePointsNodeName
;
const
OUString
m_aDirPropertyName
;
const
OUString
m_aEnvPropertyName
;
const
OUString
m_aLevelSep
;
};
enum
PreDefVariable
{
PREDEFVAR_INST
,
PREDEFVAR_PROG
,
PREDEFVAR_USER
,
PREDEFVAR_WORK
,
PREDEFVAR_HOME
,
PREDEFVAR_TEMP
,
PREDEFVAR_PATH
,
PREDEFVAR_LANG
,
PREDEFVAR_LANGID
,
PREDEFVAR_VLANG
,
PREDEFVAR_INSTPATH
,
PREDEFVAR_PROGPATH
,
PREDEFVAR_USERPATH
,
PREDEFVAR_INSTURL
,
PREDEFVAR_PROGURL
,
PREDEFVAR_USERURL
,
PREDEFVAR_WORKDIRURL
,
// New variable of hierachy service (#i32656#)
PREDEFVAR_BASEINSTURL
,
PREDEFVAR_USERDATAURL
,
PREDEFVAR_BRANDBASEURL
,
PREDEFVAR_COUNT
};
struct
PredefinedPathVariables
{
// Predefined variables supported by substitute variables
LanguageType
m_eLanguageType
;
// Lanuage type of Office
OUString
m_FixedVar
[
PREDEFVAR_COUNT
];
// Variable value access by PreDefVariable
OUString
m_FixedVarNames
[
PREDEFVAR_COUNT
];
// Variable name access by PreDefVariable
};
struct
ReSubstFixedVarOrder
{
sal_Int32
nVarValueLength
;
PreDefVariable
eVariable
;
bool
operator
<
(
const
ReSubstFixedVarOrder
&
aFixedVarOrder
)
const
{
// Reverse operator< to have high to low ordering
return
(
nVarValueLength
>
aFixedVarOrder
.
nVarValueLength
);
}
};
struct
ReSubstUserVarOrder
{
sal_Int32
nVarValueLength
;
OUString
aVarName
;
bool
operator
<
(
const
ReSubstUserVarOrder
&
aUserVarOrder
)
const
{
// Reverse operator< to have high to low ordering
return
(
nVarValueLength
>
aUserVarOrder
.
nVarValueLength
);
}
};
typedef
std
::
list
<
ReSubstFixedVarOrder
>
ReSubstFixedVarOrderVector
;
typedef
std
::
list
<
ReSubstUserVarOrder
>
ReSubstUserVarOrderVector
;
typedef
::
cppu
::
WeakComponentImplHelper2
<
css
::
util
::
XStringSubstitution
,
css
::
lang
::
XServiceInfo
>
SubstitutePathVariables_BASE
;
class
SubstitutePathVariables
:
private
osl
::
Mutex
,
public
SubstitutePathVariables_BASE
{
friend
class
SubstitutePathVariables_Impl
;
public
:
SubstitutePathVariables
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>&
xContext
);
virtual
~
SubstitutePathVariables
();
virtual
OUString
SAL_CALL
getImplementationName
()
throw
(
css
::
uno
::
RuntimeException
)
{
return
OUString
(
"com.sun.star.comp.framework.PathSubstitution"
);
}
virtual
sal_Bool
SAL_CALL
supportsService
(
OUString
const
&
ServiceName
)
throw
(
css
::
uno
::
RuntimeException
)
{
return
cppu
::
supportsService
(
this
,
ServiceName
);
}
virtual
css
::
uno
::
Sequence
<
OUString
>
SAL_CALL
getSupportedServiceNames
()
throw
(
css
::
uno
::
RuntimeException
)
{
css
::
uno
::
Sequence
<
OUString
>
aSeq
(
1
);
aSeq
[
0
]
=
OUString
(
"com.sun.star.util.PathSubstitution"
);
return
aSeq
;
}
// XStringSubstitution
virtual
OUString
SAL_CALL
substituteVariables
(
const
OUString
&
aText
,
sal_Bool
bSubstRequired
)
throw
(
::
com
::
sun
::
star
::
container
::
NoSuchElementException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
OUString
SAL_CALL
reSubstituteVariables
(
const
OUString
&
aText
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
OUString
SAL_CALL
getSubstituteVariableValue
(
const
OUString
&
variable
)
throw
(
::
com
::
sun
::
star
::
container
::
NoSuchElementException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
protected
:
DECL_LINK
(
implts_ConfigurationNotify
,
void
*
);
void
SetPredefinedPathVariables
(
PredefinedPathVariables
&
);
OUString
ConvertOSLtoUCBURL
(
const
OUString
&
aOSLCompliantURL
)
const
;
// Special case (transient) values can change during runtime!
// Don't store them in the pre defined struct
OUString
GetWorkPath
()
const
;
OUString
GetWorkVariableValue
()
const
;
OUString
GetPathVariableValue
()
const
;
OUString
GetHomeVariableValue
()
const
;
// XStringSubstitution implementation methods
OUString
impl_substituteVariable
(
const
OUString
&
aText
,
bool
bSustRequired
)
throw
(
::
com
::
sun
::
star
::
container
::
NoSuchElementException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
OUString
impl_reSubstituteVariables
(
const
OUString
&
aText
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
OUString
impl_getSubstituteVariableValue
(
const
OUString
&
variable
)
throw
(
::
com
::
sun
::
star
::
container
::
NoSuchElementException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
private
:
class
VarNameToIndexMap
:
public
boost
::
unordered_map
<
OUString
,
PreDefVariable
,
OUStringHash
,
::
std
::
equal_to
<
OUString
>
>
{
inline
void
free
()
{
VarNameToIndexMap
().
swap
(
*
this
);
}
};
VarNameToIndexMap
m_aPreDefVarMap
;
// Mapping from pre-def variable names to enum for array access
SubstituteVariables
m_aSubstVarMap
;
// Active rule set map indexed by variable name!
PredefinedPathVariables
m_aPreDefVars
;
// All predefined variables
SubstitutePathVariables_Impl
m_aImpl
;
// Implementation class that access the configuration
ReSubstFixedVarOrderVector
m_aReSubstFixedVarOrder
;
// To speed up resubstitution fixed variables (order for lookup)
ReSubstUserVarOrderVector
m_aReSubstUserVarOrder
;
// To speed up resubstitution user variables
css
::
uno
::
Reference
<
css
::
uno
::
XComponentContext
>
m_xContext
;
};
struct
FixedVariable
{
...
...
@@ -493,19 +740,8 @@ void SubstitutePathVariables_Impl::ReadSharePointRuleSetFromConfiguration(
}
}
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2
(
SubstitutePathVariables
,
::
cppu
::
OWeakObject
,
"com.sun.star.util.PathSubstitution"
,
IMPLEMENTATIONNAME_SUBSTITUTEPATHVARIABLES
)
DEFINE_INIT_SERVICE
(
SubstitutePathVariables
,
{}
)
SubstitutePathVariables
::
SubstitutePathVariables
(
const
Reference
<
XComponentContext
>&
xContext
)
:
ThreadHelpBase
(
),
SubstitutePathVariables_BASE
(
*
static_cast
<
osl
::
Mutex
*>
(
this
)
),
m_aImpl
(
LINK
(
this
,
SubstitutePathVariables
,
implts_ConfigurationNotify
)),
m_xContext
(
xContext
)
{
...
...
@@ -562,21 +798,21 @@ SubstitutePathVariables::~SubstitutePathVariables()
OUString
SAL_CALL
SubstitutePathVariables
::
substituteVariables
(
const
OUString
&
aText
,
sal_Bool
bSubstRequired
)
throw
(
NoSuchElementException
,
RuntimeException
)
{
ResetableGuard
aLock
(
m_aLock
);
osl
::
MutexGuard
g
(
rBHelper
.
rMutex
);
return
impl_substituteVariable
(
aText
,
bSubstRequired
);
}
OUString
SAL_CALL
SubstitutePathVariables
::
reSubstituteVariables
(
const
OUString
&
aText
)
throw
(
RuntimeException
)
{
ResetableGuard
aLock
(
m_aLock
);
osl
::
MutexGuard
g
(
rBHelper
.
rMutex
);
return
impl_reSubstituteVariables
(
aText
);
}
OUString
SAL_CALL
SubstitutePathVariables
::
getSubstituteVariableValue
(
const
OUString
&
aVariable
)
throw
(
NoSuchElementException
,
RuntimeException
)
{
ResetableGuard
aLock
(
m_aLock
);
osl
::
MutexGuard
g
(
rBHelper
.
rMutex
);
return
impl_getSubstituteVariableValue
(
aVariable
);
}
...
...
@@ -587,7 +823,7 @@ throw ( NoSuchElementException, RuntimeException )
IMPL_LINK_NOARG
(
SubstitutePathVariables
,
implts_ConfigurationNotify
)
{
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
ResetableGuard
aLock
(
m_aLock
);
osl
::
MutexGuard
g
(
rBHelper
.
rMutex
);
return
0
;
}
...
...
@@ -1109,6 +1345,31 @@ void SubstitutePathVariables::SetPredefinedPathVariables( PredefinedPathVariable
aPreDefPathVariables
.
m_FixedVar
[
PREDEFVAR_TEMP
]
=
ConvertOSLtoUCBURL
(
aTmp
);
}
}
// namespace framework
struct
Instance
{
explicit
Instance
(
css
::
uno
::
Reference
<
css
::
uno
::
XComponentContext
>
const
&
context
)
:
instance
(
static_cast
<
cppu
::
OWeakObject
*>
(
new
SubstitutePathVariables
(
context
)))
{
}
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
instance
;
};
struct
Singleton
:
public
rtl
::
StaticWithArg
<
Instance
,
css
::
uno
::
Reference
<
css
::
uno
::
XComponentContext
>
,
Singleton
>
{};
}
extern
"C"
SAL_DLLPUBLIC_EXPORT
css
::
uno
::
XInterface
*
SAL_CALL
com_sun_star_comp_framework_PathSubstitution_get_implementation
(
css
::
uno
::
XComponentContext
*
context
,
css
::
uno
::
Sequence
<
css
::
uno
::
Any
>
const
&
)
{
return
cppu
::
acquire
(
static_cast
<
cppu
::
OWeakObject
*>
(
Singleton
::
get
(
context
).
instance
.
get
()));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
framework/util/fwk.component
Dosyayı görüntüle @
6c15ca4d
...
...
@@ -96,7 +96,8 @@
constructor=
"com_sun_star_comp_framework_PathSettings_get_implementation"
>
<service
name=
"com.sun.star.util.PathSettings"
/>
</implementation>
<implementation
name=
"com.sun.star.comp.framework.PathSubstitution"
>
<implementation
name=
"com.sun.star.comp.framework.PathSubstitution"
constructor=
"com_sun_star_comp_framework_PathSubstitution_get_implementation"
>
<service
name=
"com.sun.star.util.PathSubstitution"
/>
</implementation>
<implementation
name=
"com.sun.star.comp.framework.PopupMenuControllerFactory"
...
...
solenv/bin/native-code.py
Dosyayı görüntüle @
6c15ca4d
...
...
@@ -57,6 +57,7 @@ core_constructor_list = [
"com_sun_star_comp_framework_ModuleManager_get_implementation"
,
"com_sun_star_comp_framework_ModuleUIConfigurationManager_get_implementation"
,
"com_sun_star_comp_framework_PathSettings_get_implementation"
,
"com_sun_star_comp_framework_PathSubstitution_get_implementation"
,
"com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation"
,
"com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation"
,
"com_sun_star_comp_framework_UIConfigurationManager_get_implementation"
,
...
...
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