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
a040a7b6
Kaydet (Commit)
a040a7b6
authored
Eyl 04, 2003
tarafından
Oliver Bolte
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
INTEGRATION: CWS cliuno01 (1.16.6); FILE MERGED
2003/06/13 12:15:53 dbo 1.16.6.1: #110159# xml importer service
üst
e8d19019
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
100 deletions
+26
-100
imexp.cxx
xmlscript/test/imexp.cxx
+26
-100
No files found.
xmlscript/test/imexp.cxx
Dosyayı görüntüle @
a040a7b6
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: imexp.cxx,v $
*
* $Revision: 1.1
6
$
* $Revision: 1.1
7
$
*
* last change: $Author:
rt $ $Date: 2003-04-23 16:54:52
$
* last change: $Author:
obo $ $Date: 2003-09-04 09:20:37
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -61,6 +61,7 @@
#include <stdio.h>
#include <rtl/memory.h>
#include "osl/file.h"
#include <rtl/ustrbuf.hxx>
...
...
@@ -102,104 +103,23 @@ using namespace ::com::sun::star::uno;
static
void
reg
(
Reference
<
registry
::
XImplementationRegistration
>
const
&
xReg
,
char
const
*
lib
,
bool
upd
=
false
)
{
OUStringBuffer
buf
(
32
);
#ifndef SAL_W32
buf
.
appendAsciiL
(
RTL_CONSTASCII_STRINGPARAM
(
"lib"
)
);
#endif
buf
.
appendAscii
(
lib
);
if
(
upd
)
{
buf
.
append
(
(
sal_Int32
)
SUPD
);
#ifdef SAL_W32
buf
.
appendAscii
(
"mi"
);
#else
#ifdef SOLARIS
buf
.
appendAscii
(
"ss"
);
#else
buf
.
appendAscii
(
"li"
);
#endif
#endif
}
#ifndef SAL_W32
buf
.
appendAscii
(
".so"
);
#endif
xReg
->
registerImplementation
(
OUString
::
createFromAscii
(
"com.sun.star.loader.SharedLibrary"
),
buf
.
makeStringAndClear
(),
Reference
<
registry
::
XSimpleRegistry
>
()
);
}
Reference
<
XComponentContext
>
createInitialComponentContext
()
Reference
<
XComponentContext
>
createInitialComponentContext
(
OUString
const
&
inst_dir
)
{
Reference
<
XComponentContext
>
xContext
;
try
{
::
rtl
::
OUString
localRegistry
=
OUString
::
createFromAscii
(
"xmlscript.rdb"
);
//"::comphelper::getPathToUserRegistry();
::
rtl
::
OUString
systemRegistry
=
::
comphelper
::
getPathToSystemRegistry
();
OUString
file_url
;
oslFileError
rc
=
osl_getFileURLFromSystemPath
(
inst_dir
.
pData
,
&
file_url
.
pData
);
OSL_ASSERT
(
osl_File_E_None
==
rc
);
Reference
<
registry
::
XSimpleRegistry
>
xLocalRegistry
(
::
cppu
::
createSimpleRegistry
()
);
Reference
<
registry
::
XSimpleRegistry
>
xSystemRegistry
(
::
cppu
::
createSimpleRegistry
()
);
if
(
xLocalRegistry
.
is
()
&&
(
localRegistry
.
getLength
()
>
0
)
)
{
try
{
xLocalRegistry
->
open
(
localRegistry
,
sal_False
,
sal_True
);
}
catch
(
registry
::
InvalidRegistryException
&
)
{
}
if
(
!
xLocalRegistry
->
isValid
()
)
xLocalRegistry
->
open
(
localRegistry
,
sal_True
,
sal_True
);
}
::
rtl
::
OUString
unorc
=
file_url
+
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"/program/"
SAL_CONFIGFILE
(
"uno"
))
);
if
(
xSystemRegistry
.
is
()
&&
(
systemRegistry
.
getLength
()
>
0
)
)
xSystemRegistry
->
open
(
systemRegistry
,
sal_True
,
sal_False
);
if
(
(
xLocalRegistry
.
is
()
&&
xLocalRegistry
->
isValid
())
&&
(
xSystemRegistry
.
is
()
&&
xSystemRegistry
->
isValid
())
)
{
Reference
<
registry
::
XSimpleRegistry
>
xReg
(
::
cppu
::
createNestedRegistry
()
);
Sequence
<
Any
>
seqAnys
(
2
);
seqAnys
[
0
]
<<=
xLocalRegistry
;
seqAnys
[
1
]
<<=
xSystemRegistry
;
Reference
<
lang
::
XInitialization
>
xInit
(
xReg
,
UNO_QUERY
);
xInit
->
initialize
(
seqAnys
);
xContext
=
::
cppu
::
bootstrap_InitialComponentContext
(
xReg
);
}
else
{
throw
Exception
(
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"no registry!"
)
),
Reference
<
XInterface
>
()
);
}
Reference
<
XInterface
>
x
(
xContext
->
getServiceManager
()
->
createInstanceWithContext
(
OUString
::
createFromAscii
(
"com.sun.star.xml.sax.Parser"
),
xContext
)
);
if
(
!
x
.
is
())
// register only once
{
Reference
<
registry
::
XImplementationRegistration
>
xReg
(
xContext
->
getServiceManager
()
->
createInstanceWithContext
(
OUString
::
createFromAscii
(
"com.sun.star.registry.ImplementationRegistration"
),
xContext
),
UNO_QUERY
);
xReg
->
registerImplementation
(
OUString
::
createFromAscii
(
"com.sun.star.loader.SharedLibrary"
),
OUString
::
createFromAscii
(
"sax.uno"
SAL_DLLEXTENSION
),
Reference
<
registry
::
XSimpleRegistry
>
()
);
reg
(
xReg
,
"sax"
);
reg
(
xReg
,
"tk"
,
true
);
reg
(
xReg
,
"svt"
,
true
);
reg
(
xReg
,
"i18n"
,
true
);
}
return
defaultBootstrap_InitialComponentContext
(
unorc
);
}
catch
(
Exception
&
rExc
)
...
...
@@ -286,14 +206,16 @@ MyApp aMyApp;
void
MyApp
::
Main
()
{
if
(
GetCommandLineParamCount
()
<
1
)
if
(
GetCommandLineParamCount
()
<
2
)
{
OSL_ENSURE
(
0
,
"usage: imexp inputfile [outputfile]
\n
"
);
OSL_ENSURE
(
0
,
"usage: imexp in
st_dir in
putfile [outputfile]
\n
"
);
return
;
}
Reference
<
XComponentContext
>
xContext
(
createInitialComponentContext
()
);
Reference
<
lang
::
XMultiServiceFactory
>
xMSF
(
xContext
->
getServiceManager
(),
UNO_QUERY
);
Reference
<
XComponentContext
>
xContext
(
createInitialComponentContext
(
OUString
(
GetCommandLineParam
(
0
)
)
)
);
Reference
<
lang
::
XMultiServiceFactory
>
xMSF
(
xContext
->
getServiceManager
(),
UNO_QUERY
);
try
{
...
...
@@ -303,8 +225,11 @@ void MyApp::Main()
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"com.sun.star.awt.ExtToolkit"
)
)
),
UNO_QUERY
);
// import dialogs
OString
aParam1
(
OUStringToOString
(
OUString
(
GetCommandLineParam
(
0
)
),
RTL_TEXTENCODING_ASCII_US
)
);
Reference
<
container
::
XNameContainer
>
xModel
(
importFile
(
aParam1
.
getStr
(),
xContext
)
);
OString
aParam1
(
OUStringToOString
(
OUString
(
GetCommandLineParam
(
1
)
),
RTL_TEXTENCODING_ASCII_US
)
);
Reference
<
container
::
XNameContainer
>
xModel
(
importFile
(
aParam1
.
getStr
(),
xContext
)
);
OSL_ASSERT
(
xModel
.
is
()
);
Reference
<
awt
::
XControl
>
xDlg
(
xMSF
->
createInstance
(
...
...
@@ -314,10 +239,11 @@ void MyApp::Main()
Reference
<
awt
::
XDialog
>
xD
(
xDlg
,
UNO_QUERY
);
xD
->
execute
();
if
(
GetCommandLineParamCount
()
==
2
)
if
(
GetCommandLineParamCount
()
==
3
)
{
// write modified dialogs
OString
aParam2
(
OUStringToOString
(
OUString
(
GetCommandLineParam
(
1
)
),
RTL_TEXTENCODING_ASCII_US
)
);
OString
aParam2
(
OUStringToOString
(
OUString
(
GetCommandLineParam
(
2
)
),
RTL_TEXTENCODING_ASCII_US
)
);
exportToFile
(
aParam2
.
getStr
(),
xModel
,
xContext
);
}
}
...
...
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