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
c69cfa36
Kaydet (Commit)
c69cfa36
authored
Ock 17, 2001
tarafından
Michael Brauer
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
XML filter now is a component
üst
75994772
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
581 additions
and
196 deletions
+581
-196
swxml.cxx
sw/source/filter/xml/swxml.cxx
+70
-116
wrtxml.cxx
sw/source/filter/xml/wrtxml.cxx
+66
-42
xmlexp.cxx
sw/source/filter/xml/xmlexp.cxx
+99
-16
xmlexp.hxx
sw/source/filter/xml/xmlexp.hxx
+7
-2
xmlimp.cxx
sw/source/filter/xml/xmlimp.cxx
+127
-13
xmlimp.hxx
sw/source/filter/xml/xmlimp.hxx
+19
-2
makefile.mk
sw/source/ui/uno/makefile.mk
+8
-5
unofreg.cxx
sw/source/ui/uno/unofreg.cxx
+185
-0
No files found.
sw/source/filter/xml/swxml.cxx
Dosyayı görüntüle @
c69cfa36
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: swxml.cxx,v $
*
* $Revision: 1.
9
$
* $Revision: 1.
10
$
*
* last change: $Author:
cl $ $Date: 2001-01-12 16:34:00
$
* last change: $Author:
mib $ $Date: 2001-01-17 10:55:18
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -82,6 +82,9 @@
#ifndef _COM_SUN_STAR_IO_XACTIVEDATACONTROL_HPP_
#include <com/sun/star/io/XActiveDataControl.hpp>
#endif
#ifndef _COM_SUN_STAR_TEXT_XTEXTRANGE_HPP_
#include <com/sun/star/text/XTextRange.hpp>
#endif
#ifndef _SFXDOCFILE_HXX //autogen wg. SfxMedium
#include <sfx2/docfile.hxx>
...
...
@@ -105,6 +108,9 @@
#ifndef _DOCSH_HXX //autogen wg. SwDoc
#include <docsh.hxx>
#endif
#ifndef _UNOOBJ_HXX
#include <unoobj.hxx>
#endif
#ifndef _XMLGRHLP_HXX
#include <svx/xmlgrhlp.hxx>
#endif
...
...
@@ -115,7 +121,10 @@
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
text
;
using
namespace
::
com
::
sun
::
star
::
container
;
using
namespace
::
com
::
sun
::
star
::
document
;
using
namespace
::
com
::
sun
::
star
::
lang
;
using
namespace
::
rtl
;
XMLReader
::
XMLReader
()
...
...
@@ -129,6 +138,7 @@ int XMLReader::GetReaderType()
sal_uInt32
XMLReader
::
Read
(
SwDoc
&
rDoc
,
SwPaM
&
rPaM
,
const
String
&
rName
)
{
// Get service factory
Reference
<
lang
::
XMultiServiceFactory
>
xServiceFactory
=
comphelper
::
getProcessServiceFactory
();
ASSERT
(
xServiceFactory
.
is
(),
...
...
@@ -136,18 +146,6 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName )
if
(
!
xServiceFactory
.
is
()
)
return
ERR_SWG_READ_ERROR
;
// Get model
SwDocShell
*
pDocSh
=
rDoc
.
GetDocShell
();
ASSERT
(
pDocSh
,
"XMLReader::Read: got no doc shell"
);
if
(
!
pDocSh
)
return
ERR_SWG_READ_ERROR
;
Reference
<
frame
::
XModel
>
xModel
=
pDocSh
->
GetModel
();
ASSERT
(
xModel
.
is
(),
"XMLReader::Read: got no model"
);
if
(
!
xModel
.
is
()
)
return
ERR_SWG_READ_ERROR
;
// Get data source ...
DBG_ASSERT
(
pMedium
,
"There is the medium"
);
if
(
!
pMedium
)
...
...
@@ -155,20 +153,20 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName )
Reference
<
io
::
XActiveDataSource
>
xSource
;
Reference
<
XInterface
>
xPipe
;
Reference
<
document
::
XGraphicObjectResolver
>
xGraphicResolver
;
SvXMLGraphicHelper
*
pGraphicHelper
=
0
;
SvStorageStreamRef
xDocStream
;
xml
::
sax
::
InputSource
aParserInput
;
aParserInput
.
sSystemId
=
rName
;
Reference
<
document
::
XGraphicObjectResolver
>
xEmbeddedGraphicExport
;
SvXMLGraphicHelper
*
pGraphicHelper
=
0
;
SvStorageStreamRef
xDocStream
;
SvStorage
*
pStorage
=
pMedium
->
GetStorage
();
if
(
pStorage
)
{
pGraphicHelper
=
SvXMLGraphicHelper
::
Create
(
*
pStorage
,
GRAPHICHELPER_MODE_READ
,
sal_False
);
x
EmbeddedGraphicExport
=
pGraphicHelper
;
x
GraphicResolver
=
pGraphicHelper
;
OUString
sDocName
(
RTL_CONSTASCII_USTRINGPARAM
(
"Content.xml"
)
);
xDocStream
=
pStorage
->
OpenStream
(
sDocName
,
...
...
@@ -203,21 +201,51 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName )
}
// get parser
Reference
<
XInterface
>
xXMLParser
=
xServiceFactory
->
createInstance
(
OUString
::
createFromAscii
(
"com.sun.star.xml.sax.Parser"
)
);
ASSERT
(
xXMLParser
.
is
(),
Reference
<
xml
::
sax
::
XParser
>
xParser
(
xServiceFactory
->
createInstance
(
OUString
::
createFromAscii
(
"com.sun.star.xml.sax.Parser"
)
),
UNO_QUERY
);
ASSERT
(
xParser
.
is
(),
"XMLReader::Read: com.sun.star.xml.sax.Parser service missing"
);
if
(
!
x
XML
Parser
.
is
()
)
if
(
!
xParser
.
is
()
)
return
ERR_SWG_READ_ERROR
;
sal_uInt16
nStyleFamilyMask
=
SFX_STYLE_FAMILY_ALL
;
sal_Bool
bLoadDoc
;
sal_Bool
bInsert
;
// get filter
Sequence
<
Any
>
aArgs
(
1
);
Any
*
pArgs
=
aArgs
.
getArray
();
*
pArgs
++
<<=
xGraphicResolver
;
Reference
<
xml
::
sax
::
XDocumentHandler
>
xFilter
(
xServiceFactory
->
createInstanceWithArguments
(
OUString
::
createFromAscii
(
"com.sun.star.office.sax.importer.Writer"
),
aArgs
),
UNO_QUERY
);
ASSERT
(
xFilter
.
is
(),
"XMLReader::Read: com.sun.star.xml.sax.importer.Writer service missing"
);
if
(
!
xFilter
.
is
()
)
return
ERR_SWG_READ_ERROR
;
// connect parser and filter
xParser
->
setDocumentHandler
(
xFilter
);
// Get model
SwDocShell
*
pDocSh
=
rDoc
.
GetDocShell
();
ASSERT
(
pDocSh
,
"XMLReader::Read: got no doc shell"
);
if
(
!
pDocSh
)
return
ERR_SWG_READ_ERROR
;
Reference
<
lang
::
XComponent
>
xModelComp
(
pDocSh
->
GetModel
(),
UNO_QUERY
);
ASSERT
(
xModelComp
.
is
(),
"XMLReader::Read: got no model"
);
if
(
!
xModelComp
.
is
()
)
return
ERR_SWG_READ_ERROR
;
// connect model and filter
Reference
<
XImporter
>
xImporter
(
xFilter
,
UNO_QUERY
);
xImporter
->
setTargetDocument
(
xModelComp
);
if
(
aOpt
.
IsFmtsOnly
()
)
{
bLoadDoc
=
sal_False
;
bInsert
=
aOpt
.
IsMerge
();
nStyleFamilyMask
=
0U
;
sal_uInt16
nStyleFamilyMask
=
0U
;
if
(
aOpt
.
IsFrmFmts
()
)
nStyleFamilyMask
|=
SFX_STYLE_FAMILY_FRAME
;
if
(
aOpt
.
IsPageDescs
()
)
...
...
@@ -226,24 +254,24 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName )
nStyleFamilyMask
|=
(
SFX_STYLE_FAMILY_CHAR
|
SFX_STYLE_FAMILY_PARA
);
if
(
aOpt
.
IsNumRules
()
)
nStyleFamilyMask
|=
SFX_STYLE_FAMILY_PSEUDO
;
Reference
<
XUnoTunnel
>
xFilterTunnel
(
xFilter
,
UNO_QUERY
);
SwXMLImport
*
pFilter
=
(
SwXMLImport
*
)
xFilterTunnel
->
getSomething
(
SwXMLImport
::
getUnoTunnelId
()
);
pFilter
->
setStyleInsertMode
(
nStyleFamilyMask
,
!
aOpt
.
IsMerge
()
);
}
else
else
if
(
bInsertMode
)
{
bLoadDoc
=
sal_True
;
bInsert
=
bInsertMode
;
nStyleFamilyMask
=
SFX_STYLE_FAMILY_ALL
;
Reference
<
XTextRange
>
xTextRange
=
SwXTextRange
::
CreateTextRangeFromPosition
(
&
rDoc
,
*
rPaM
.
GetPoint
(),
0
);
Reference
<
XUnoTunnel
>
xFilterTunnel
(
xFilter
,
UNO_QUERY
);
SwXMLImport
*
pFilter
=
(
SwXMLImport
*
)
xFilterTunnel
->
getSomething
(
SwXMLImport
::
getUnoTunnelId
()
);
pFilter
->
setTextInsertMode
(
xTextRange
);
}
aOpt
.
ResetAllFmtsOnly
();
// get filter
Reference
<
xml
::
sax
::
XDocumentHandler
>
xFilter
=
new
SwXMLImport
(
rDoc
,
rPaM
,
bLoadDoc
,
bInsert
,
nStyleFamilyMask
,
xModel
,
xEmbeddedGraphicExport
,
pStorage
);
// connect parser and filter
Reference
<
xml
::
sax
::
XParser
>
xParser
(
xXMLParser
,
UNO_QUERY
);
xParser
->
setDocumentHandler
(
xFilter
);
rDoc
.
AddLink
();
// prevent deletion
sal_uInt32
nRet
=
0
;
...
...
@@ -272,82 +300,8 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName )
if
(
pGraphicHelper
)
SvXMLGraphicHelper
::
Destroy
(
pGraphicHelper
);
x
EmbeddedGraphicExport
=
0
;
x
GraphicResolver
=
0
;
rDoc
.
RemoveLink
();
return
nRet
;
}
/*************************************************************************
$Log: not supported by cvs2svn $
Revision 1.8 2001/01/05 09:58:11 mib
default styles
Revision 1.7 2001/01/03 11:40:56 mib
support for OLE objects in XML files
Revision 1.6 2000/12/06 08:39:34 mib
#81388#: Content stream now is called Content.xml
Revision 1.5 2000/12/02 10:57:15 mib
#80795#: use packages
Revision 1.4 2000/11/20 09:18:37 jp
must change: processfactory moved
Revision 1.3 2000/10/26 09:38:52 mib
tables within headers and footers
Revision 1.2 2000/10/06 06:37:01 mib
Added missing include XActiveDataControl
Revision 1.1.1.1 2000/09/18 17:14:59 hr
initial import
Revision 1.13 2000/09/18 16:05:04 willem.vandorp
OpenOffice header added.
Revision 1.12 2000/07/07 13:58:36 mib
text styles using StarOffice API
Revision 1.11 2000/05/03 12:08:05 mib
unicode
Revision 1.10 2000/03/21 15:10:56 os
UNOIII
Revision 1.9 2000/03/13 14:33:43 mib
UNO3
Revision 1.8 2000/02/11 14:40:44 hr
#70473# changes for unicode ( patched by automated patchtool )
Revision 1.7 1999/11/26 11:15:20 mib
loading of styles only and insert mode
Revision 1.6 1999/11/19 16:40:21 os
modules renamed
Revision 1.5 1999/11/19 15:27:05 mib
Opt: using OUString constructor instead of StringToOUString
Revision 1.4 1999/09/23 11:53:47 mib
i18n, token maps and hard paragraph attributes
Revision 1.3 1999/08/19 14:51:30 HR
#65293#: fixed exception macro usage
Rev 1.2 19 Aug 1999 16:51:30 HR
#65293#: fixed exception macro usage
Rev 1.1 17 Aug 1999 16:31:26 MIB
import
Rev 1.0 12 Aug 1999 12:28:08 MIB
Initial revision.
*************************************************************************/
sw/source/filter/xml/wrtxml.cxx
Dosyayı görüntüle @
c69cfa36
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtxml.cxx,v $
*
* $Revision: 1.1
1
$
* $Revision: 1.1
2
$
*
* last change: $Author:
cl $ $Date: 2001-01-12 16:34:01
$
* last change: $Author:
mib $ $Date: 2001-01-17 10:55:18
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -111,6 +111,8 @@ using namespace ::rtl;
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
container
;
using
namespace
::
com
::
sun
::
star
::
document
;
using
namespace
::
com
::
sun
::
star
::
beans
;
SwXMLWriter
::
SwXMLWriter
(
sal_Bool
bPl
)
:
bPlain
(
bPl
)
...
...
@@ -139,6 +141,7 @@ sal_uInt32 SwXMLWriter::WriteStorage()
sal_uInt32
SwXMLWriter
::
Write
(
SwPaM
&
rPaM
,
SfxMedium
&
rMed
,
const
String
*
pFileName
)
{
// Get service factory
Reference
<
lang
::
XMultiServiceFactory
>
xServiceFactory
=
comphelper
::
getProcessServiceFactory
();
ASSERT
(
xServiceFactory
.
is
(),
...
...
@@ -146,32 +149,24 @@ sal_uInt32 SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed,
if
(
!
xServiceFactory
.
is
()
)
return
ERR_SWG_WRITE_ERROR
;
Reference
<
XInterface
>
xWriter
=
xServiceFactory
->
createInstance
(
OUString
::
createFromAscii
(
"com.sun.star.xml.sax.Writer"
)
);
ASSERT
(
xWriter
.
is
(),
"SwXMLWriter::Write: com.sun.star.xml.sax.Writer service missing"
);
if
(
!
xWriter
.
is
())
return
ERR_SWG_WRITE_ERROR
;
Reference
<
frame
::
XModel
>
xModel
=
rPaM
.
GetDoc
()
->
GetDocShell
()
->
GetModel
();
ASSERT
(
xModel
.
is
(),
"XMLWriter::Write: got no model"
);
if
(
!
xModel
.
is
()
)
return
ERR_SWG_WRITE_ERROR
;
pDoc
=
rPaM
.
GetDoc
();
PutNumFmtFontsInAttrPool
();
// PutEditEngFontsInAttrPool();
// Get data sink ...
Reference
<
io
::
XOutputStream
>
xOut
;
SvStorageStreamRef
xDocStream
;
Reference
<
document
::
XGraphicObjectResolver
>
xGraphicResolver
;
SvXMLGraphicHelper
*
pGraphicHelper
=
0
;
SvStorage
*
pStorage
=
bPlain
?
0
:
rMed
.
GetOutputStorage
(
sal_True
);
if
(
pStorage
)
{
pGraphicHelper
=
SvXMLGraphicHelper
::
Create
(
*
pStorage
,
GRAPHICHELPER_MODE_WRITE
,
sal_False
);
xGraphicResolver
=
pGraphicHelper
;
OUString
sDocName
(
RTL_CONSTASCII_USTRINGPARAM
(
"Content.xml"
)
);
xDocStream
=
pStorage
->
OpenStream
(
sDocName
,
STREAM_WRITE
|
STREAM_SHARE_DENYWRITE
);
//
xDocStream->SetBufferSize( 16*1024 );
xDocStream
->
SetBufferSize
(
16
*
1024
);
xOut
=
new
utl
::
OOutputStreamWrapper
(
*
xDocStream
);
}
else
...
...
@@ -179,44 +174,70 @@ sal_uInt32 SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed,
xOut
=
rMed
.
GetDataSink
();
}
Reference
<
io
::
XActiveDataSource
>
xSrc
(
xWriter
,
UNO_QUERY
);
xSrc
->
setOutputStream
(
xOut
);
// get writer
Reference
<
io
::
XActiveDataSource
>
xWriter
(
xServiceFactory
->
createInstance
(
OUString
::
createFromAscii
(
"com.sun.star.xml.sax.Writer"
)
),
UNO_QUERY
);
ASSERT
(
xWriter
.
is
(),
"SwXMLWriter::Write: com.sun.star.xml.sax.Writer service missing"
);
if
(
!
xWriter
.
is
())
return
ERR_SWG_WRITE_ERROR
;
Reference
<
document
::
XGraphicObjectResolver
>
xEmbeddedGraphicExport
;
SvXMLGraphicHelper
*
pGraphicHelper
=
0
;
if
(
pStorage
)
{
pGraphicHelper
=
SvXMLGraphicHelper
::
Create
(
*
pStorage
,
GRAPHICHELPER_MODE_WRITE
,
sal_False
);
xEmbeddedGraphicExport
=
pGraphicHelper
;
}
// connect writer and output stream
xWriter
->
setOutputStream
(
xOut
);
// get filter
Reference
<
xml
::
sax
::
XDocumentHandler
>
xHandler
(
xWriter
,
UNO_QUERY
);
Sequence
<
Any
>
aArgs
(
2
);
Any
*
pArgs
=
aArgs
.
getArray
();
*
pArgs
++
<<=
xHandler
;
*
pArgs
++
<<=
xGraphicResolver
;
Reference
<
document
::
XExporter
>
xExporter
(
xServiceFactory
->
createInstanceWithArguments
(
OUString
::
createFromAscii
(
"com.sun.star.office.sax.exporter.Writer"
),
aArgs
),
UNO_QUERY
);
ASSERT
(
xExporter
.
is
(),
"XMLReader::Read: com.sun.star.xml.sax.exporter.Writer service missing"
);
if
(
!
xExporter
.
is
()
)
return
ERR_SWG_WRITE_ERROR
;
//Get model
Reference
<
lang
::
XComponent
>
xModelComp
(
rPaM
.
GetDoc
()
->
GetDocShell
()
->
GetModel
(),
UNO_QUERY
);
ASSERT
(
xModelComp
.
is
(),
"XMLWriter::Write: got no model"
);
if
(
!
xModelComp
.
is
()
)
return
ERR_SWG_WRITE_ERROR
;
SwXMLExport
*
pExp
=
new
SwXMLExport
(
xModel
,
rPaM
,
*
pFileName
,
xHandler
,
xEmbeddedGraphicExport
,
bWriteAll
,
bWriteOnlyFirstTable
,
bShowProgress
);
// connect model and filter
xExporter
->
setSourceDocument
(
xModelComp
);
Reference
<
document
::
XExporter
>
xExporter
(
pExp
);
pDoc
=
rPaM
.
GetDoc
();
PutNumFmtFontsInAttrPool
();
PutEditEngFontsInAttrPool
();
Sequence
<
PropertyValue
>
aProps
(
1
);
PropertyValue
*
pProps
=
aProps
.
getArray
();
pProps
->
Name
=
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"FileName"
)
);
(
pProps
++
)
->
Value
<<=
OUString
(
rMed
.
GetName
()
);
Reference
<
XFilter
>
xFilter
(
xExporter
,
UNO_QUERY
);
xFilter
->
filter
(
aProps
);
sal_uInt32
nRet
=
pExp
->
exportDoc
(
sXML_text
);
if
(
xDocStream
.
Is
()
)
xDocStream
->
Commit
();
if
(
pStorage
)
pDoc
->
GetDocShell
()
->
SaveAsChilds
(
pStorage
);
if
(
pGraphicHelper
)
SvXMLGraphicHelper
::
Destroy
(
pGraphicHelper
);
xEmbeddedGraphicExport
=
0
;
// delete pExp;
xGraphicResolver
=
0
;
ResetWriter
();
return
nRet
;
return
0
;
}
// -----------------------------------------------------------------------
...
...
@@ -232,11 +253,14 @@ void GetXMLWriter( const String& rName, WriterRef& xRet )
Source Code Control System - Header
$Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/wrtxml.cxx,v 1.1
1 2001-01-12 16:34:01 cl
Exp $
$Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/wrtxml.cxx,v 1.1
2 2001-01-17 10:55:18 mib
Exp $
Source Code Control System - Update
$Log: not supported by cvs2svn $
Revision 1.11 2001/01/12 16:34:01 cl
#82042# added support for xml filter components
Revision 1.10 2001/01/08 09:44:55 mib
Removed SwDoc and SvStorage members from SwXMLExport
...
...
sw/source/filter/xml/xmlexp.cxx
Dosyayı görüntüle @
c69cfa36
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexp.cxx,v $
*
* $Revision: 1.1
5
$
* $Revision: 1.1
6
$
*
* last change: $Author:
cl $ $Date: 2001-01-12 16:34:01
$
* last change: $Author:
mib $ $Date: 2001-01-17 10:55:18
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -94,6 +94,9 @@
#ifndef _XMLOFF_PROGRESSBARHELPER_HXX
#include <xmloff/ProgressBarHelper.hxx>
#endif
#ifndef _XMLOFF_XMLUCONV_HXX
#include <xmloff/xmluconv.hxx>
#endif
#ifndef _PAM_HXX //autogen wg. SwPaM
#include <pam.hxx>
...
...
@@ -110,6 +113,12 @@
#ifndef _DOCSTAT_HXX
#include <docstat.hxx>
#endif
#ifndef _SWSWERROR_H
#include <swerror.h>
#endif
#ifndef _UNOOBJ_HXX
#include <unoobj.hxx>
#endif
#ifndef _XMLTEXTE_HXX
#include <xmltexte.hxx>
...
...
@@ -120,6 +129,7 @@
using
namespace
::
rtl
;
using
namespace
::
com
::
sun
::
star
::
frame
;
using
namespace
::
com
::
sun
::
star
::
lang
;
using
namespace
::
com
::
sun
::
star
::
xml
::
sax
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
text
;
...
...
@@ -163,6 +173,27 @@ void SwXMLExport::SetCurPaM( SwPaM& rPaM, sal_Bool bWhole, sal_Bool bTabOnly )
}
#endif
SwXMLExport
::
SwXMLExport
()
:
SvXMLExport
(
MAP_INCH
,
sXML_text
),
#ifdef XML_CORE_API
pCurPaM
(
0
),
pOrigPaM
(
&
rPaM
),
#endif
pTableItemMapper
(
0
),
pTableLines
(
0
),
nContentProgressStart
(
0
),
#ifdef XML_CORE_API
bExportWholeDoc
(
bExpWholeDoc
),
bExportFirstTableOnly
(
bExpFirstTableOnly
),
#endif
bShowProgress
(
sal_True
),
sNumberFormat
(
RTL_CONSTASCII_USTRINGPARAM
(
"NumberFormat"
)),
sCell
(
RTL_CONSTASCII_USTRINGPARAM
(
"Cell"
))
{
_InitItemExport
();
}
#ifdef XML_CORE_API
SwXMLExport
::
SwXMLExport
(
const
Reference
<
XModel
>&
rModel
,
SwPaM
&
rPaM
,
const
OUString
&
rFileName
,
const
Reference
<
XDocumentHandler
>
&
rHandler
,
...
...
@@ -171,10 +202,8 @@ SwXMLExport::SwXMLExport( const Reference< XModel >& rModel, SwPaM& rPaM,
sal_Bool
bShowProg
)
:
SvXMLExport
(
rFileName
,
rHandler
,
rModel
,
rEmbeddedGrfObjs
,
SW_MOD
()
->
GetMetric
(
rPaM
.
GetDoc
()
->
IsHTMLMode
()
)
),
#ifdef XML_CORE_API
pCurPaM
(
0
),
pOrigPaM
(
&
rPaM
),
#endif
pTableItemMapper
(
0
),
pTableLines
(
0
),
nContentProgressStart
(
0
),
...
...
@@ -184,7 +213,29 @@ SwXMLExport::SwXMLExport( const Reference< XModel >& rModel, SwPaM& rPaM,
sNumberFormat
(
RTL_CONSTASCII_USTRINGPARAM
(
"NumberFormat"
)),
sCell
(
RTL_CONSTASCII_USTRINGPARAM
(
"Cell"
))
{
SwDoc
*
pDoc
=
rPaM
.
GetDoc
();
_InitItemExport
();
}
#endif
sal_uInt32
SwXMLExport
::
exportDoc
(
const
sal_Char
*
pClass
)
{
if
(
!
GetModel
().
is
()
)
return
ERR_SWG_WRITE_ERROR
;
Reference
<
XTextDocument
>
xTextDoc
(
GetModel
(),
UNO_QUERY
);
Reference
<
XText
>
xText
=
xTextDoc
->
getText
();
Reference
<
XUnoTunnel
>
xTextTunnel
(
xText
,
UNO_QUERY
);
ASSERT
(
xTextTunnel
.
is
(),
"missing XUnoTunnel for Cursor"
);
if
(
!
xTextTunnel
.
is
()
)
return
ERR_SWG_WRITE_ERROR
;
SwXText
*
pText
=
(
SwXText
*
)
xTextTunnel
->
getSomething
(
SwXText
::
getUnoTunnelId
()
);
ASSERT
(
pText
,
"SwXText missing"
);
if
(
!
pText
)
return
ERR_SWG_WRITE_ERROR
;
SwDoc
*
pDoc
=
pText
->
GetDoc
();
const
SfxPoolItem
*
pItem
;
const
SfxItemPool
&
rPool
=
pDoc
->
GetAttrPool
();
sal_uInt16
nItems
=
rPool
.
GetItemCount
(
RES_UNKNOWNATR_CONTAINER
);
...
...
@@ -219,14 +270,19 @@ SwXMLExport::SwXMLExport( const Reference< XModel >& rModel, SwPaM& rPaM,
}
}
MapUnit
eUnit
=
(
MapUnit
)
SW_MOD
()
->
GetMetric
(
pDoc
->
IsHTMLMode
()
);
if
(
GetMM100UnitConverter
().
getXMLMeasureUnit
()
!=
eUnit
)
{
GetMM100UnitConverter
().
setXMLMeasureUnit
(
eUnit
);
pTwipUnitConv
->
setXMLMeasureUnit
(
eUnit
);
}
SetExtended
(
bExtended
);
#ifdef XML_CORE_API
SetCurPaM
(
rPaM
,
bExportWholeDoc
,
bExportFirstTableOnly
);
#endif
_InitItemExport
();
// Update doc stat, so that correct values are exported and
// the progress works correctly.
SwDocStat
aDocStat
(
pDoc
->
GetDocStat
()
);
...
...
@@ -248,6 +304,21 @@ SwXMLExport::SwXMLExport( const Reference< XModel >& rModel, SwPaM& rPaM,
SdrModel
*
pModel
=
pDoc
->
GetDrawModel
();
if
(
pModel
)
pModel
->
GetPage
(
0
)
->
RecalcObjOrdNums
();
sal_uInt32
nRet
=
SvXMLExport
::
exportDoc
(
pClass
);
#ifdef XML_CORE_API
if
(
pCurPaM
)
{
while
(
pCurPaM
->
GetNext
()
!=
pCurPaM
)
delete
pCurPaM
->
GetNext
();
delete
pCurPaM
;
pCurPam
=
0
;
}
#endif
ASSERT
(
!
pTableLines
,
"there are table columns infos left"
);
return
nRet
;
}
XMLTextParagraphExport
*
SwXMLExport
::
CreateTextParagraphExport
()
...
...
@@ -262,16 +333,7 @@ XMLShapeExport* SwXMLExport::CreateShapeExport()
__EXPORT
SwXMLExport
::~
SwXMLExport
()
{
#ifdef XML_CORE_API
if
(
pCurPaM
)
{
while
(
pCurPaM
->
GetNext
()
!=
pCurPaM
)
delete
pCurPaM
->
GetNext
();
delete
pCurPaM
;
}
#endif
_FinitItemExport
();
ASSERT
(
!
pTableLines
,
"there are table columns infos left"
);
}
...
...
@@ -315,6 +377,27 @@ void SwXMLExport::_ExportContent()
#endif
}
Sequence
<
OUString
>
SAL_CALL
SwXMLExport_getSupportedServiceNames
()
throw
()
{
const
OUString
aServiceName
(
RTL_CONSTASCII_USTRINGPARAM
(
"com.sun.star.office.sax.exporter.Writer"
)
);
const
Sequence
<
OUString
>
aSeq
(
&
aServiceName
,
1
);
return
aSeq
;
}
OUString
SAL_CALL
SwXMLExport_getImplementationName
()
throw
()
{
return
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"SwXMLExport"
)
);
}
Reference
<
XInterface
>
SAL_CALL
SwXMLExport_createInstance
(
const
Reference
<
XMultiServiceFactory
>
&
rSMgr
)
throw
(
Exception
)
{
return
(
cppu
::
OWeakObject
*
)
new
SwXMLExport
;
}
#ifdef XML_CORE_API
void
SwXMLExport
::
ExportCurPaM
(
sal_Bool
bExportWholePaM
)
{
...
...
sw/source/filter/xml/xmlexp.hxx
Dosyayı görüntüle @
c69cfa36
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexp.hxx,v $
*
* $Revision: 1.1
2
$
* $Revision: 1.1
3
$
*
* last change: $Author:
cl $ $Date: 2001-01-12 16:34:01
$
* last change: $Author:
mib $ $Date: 2001-01-17 10:55:19
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -161,6 +161,8 @@ protected:
public
:
SwXMLExport
();
#ifdef XML_CORE_API
SwXMLExport
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XModel
>
&
rModel
,
SwPaM
&
rPaM
,
const
::
rtl
::
OUString
&
rFileName
,
...
...
@@ -170,8 +172,11 @@ public:
::
com
::
sun
::
star
::
document
::
XGraphicObjectResolver
>
&
,
sal_Bool
bExpWholeDoc
,
sal_Bool
bExpFirstTableOnly
,
sal_Bool
bShowProgr
);
#endif
virtual
~
SwXMLExport
();
virtual
sal_uInt32
exportDoc
(
const
sal_Char
*
pClass
=
0
);
inline
const
SvXMLUnitConverter
&
GetTwipUnitConverter
()
const
;
void
ExportTableAutoStyles
(
const
SwTableNode
&
rTblNd
);
...
...
sw/source/filter/xml/xmlimp.cxx
Dosyayı görüntüle @
c69cfa36
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimp.cxx,v $
*
* $Revision: 1.1
5
$
* $Revision: 1.1
6
$
*
* last change: $Author:
cl $ $Date: 2001-01-12 16:34:01
$
* last change: $Author:
mib $ $Date: 2001-01-17 10:55:19
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -65,6 +65,9 @@
#pragma hdrstop
#ifndef _COM_SUN_STAR_TEXT_XTEXTDOCUMENT_HPP_
#include <com/sun/star/text/XTextDocument.hpp>
#endif
#ifndef _COM_SUN_STAR_TEXT_XTEXTRANGE_HPP_
#include <com/sun/star/text/XTextRange.hpp>
#endif
...
...
@@ -259,6 +262,21 @@ SvXMLImportContext *SwXMLImport::CreateContext(
return
pContext
;
}
SwXMLImport
::
SwXMLImport
()
:
bLoadDoc
(
sal_True
),
bInsert
(
sal_False
),
nStyleFamilyMask
(
SFX_STYLE_FAMILY_ALL
),
pDocElemTokenMap
(
0
),
pTableElemTokenMap
(
0
),
pTableItemMapper
(
0
),
pSttNdIdx
(
0
),
bProgressValid
(
sal_False
),
bShowProgress
(
sal_True
),
nProgress
(
0
)
{
_InitItemImport
();
}
SwXMLImport
::
SwXMLImport
(
SwDoc
&
rDoc
,
const
SwPaM
&
rPaM
,
sal_Bool
bLDoc
,
sal_Bool
bInsertMode
,
sal_uInt16
nStyleFamMask
,
...
...
@@ -288,9 +306,88 @@ SwXMLImport::SwXMLImport(
Reference
<
XTextCursor
>
xTextCursor
=
xText
->
createTextCursorByRange
(
xTextRange
);
GetTextImport
()
->
SetCursor
(
xTextCursor
);
}
SwXMLImport
::~
SwXMLImport
()
{
delete
pDocElemTokenMap
;
delete
pTableElemTokenMap
;
_FinitItemImport
();
}
void
SwXMLImport
::
setTextInsertMode
(
const
Reference
<
XTextRange
>
&
rInsertPos
)
{
bInsert
=
sal_True
;
Reference
<
XText
>
xText
=
rInsertPos
->
getText
();
Reference
<
XTextCursor
>
xTextCursor
=
xText
->
createTextCursorByRange
(
rInsertPos
);
GetTextImport
()
->
SetCursor
(
xTextCursor
);
}
void
SwXMLImport
::
setStyleInsertMode
(
sal_uInt16
nFamilies
,
sal_Bool
bOverwrite
)
{
bInsert
=
!
bOverwrite
;
nStyleFamilyMask
=
nFamilies
;
bLoadDoc
=
sal_False
;
}
const
Sequence
<
sal_Int8
>
&
SwXMLImport
::
getUnoTunnelId
()
throw
()
{
static
uno
::
Sequence
<
sal_Int8
>
aSeq
=
::
CreateUnoTunnelId
();
return
aSeq
;
}
sal_Int64
SAL_CALL
SwXMLImport
::
getSomething
(
const
Sequence
<
sal_Int8
>&
rId
)
throw
(
RuntimeException
)
{
if
(
rId
.
getLength
()
==
16
&&
0
==
rtl_compareMemory
(
getUnoTunnelId
().
getConstArray
(),
rId
.
getConstArray
(),
16
)
)
{
return
(
sal_Int64
)
this
;
}
return
SvXMLImport
::
getSomething
(
rId
);
}
void
SwXMLImport
::
startDocument
(
void
)
{
DBG_ASSERT
(
GetModel
().
is
(),
"model is missing"
);
if
(
!
GetModel
().
is
()
)
return
;
// There only is a text cursor by now if we are in insert mode. In any
// other case we have to create one at the start of the document.
Reference
<
XTextCursor
>
xTextCursor
=
GetTextImport
()
->
GetCursor
();
if
(
!
xTextCursor
.
is
()
)
{
Reference
<
XTextDocument
>
xTextDoc
(
GetModel
(),
UNO_QUERY
);
Reference
<
XText
>
xText
=
xTextDoc
->
getText
();
xTextCursor
=
xText
->
createTextCursor
();
GetTextImport
()
->
SetCursor
(
xTextCursor
);
}
Reference
<
XUnoTunnel
>
xCrsrTunnel
(
xTextCursor
,
UNO_QUERY
);
ASSERT
(
xCrsrTunnel
.
is
(),
"missing XUnoTunnel for Cursor"
);
if
(
!
xCrsrTunnel
.
is
()
)
return
;
SwXTextCursor
*
pTxtCrsr
=
(
SwXTextCursor
*
)
xCrsrTunnel
->
getSomething
(
SwXTextCursor
::
getUnoTunnelId
()
);
ASSERT
(
pTxtCrsr
,
"SwXTextCursor missing"
);
if
(
!
pTxtCrsr
)
return
;
SwDoc
*
pDoc
=
pTxtCrsr
->
GetDoc
();
ASSERT
(
pDoc
,
"SwDoc missing"
);
if
(
!
pDoc
)
return
;
if
(
!
IsStylesOnlyMode
()
)
{
pSttNdIdx
=
new
SwNodeIndex
(
rDoc
.
GetNodes
()
);
pSttNdIdx
=
new
SwNodeIndex
(
pDoc
->
GetNodes
()
);
if
(
IsInsertMode
()
)
{
Reference
<
XUnoTunnel
>
xCrsrTunnel
(
GetTextImport
()
->
GetCursor
(),
...
...
@@ -304,24 +401,24 @@ SwXMLImport::SwXMLImport(
const
SwPosition
*
pPos
=
pPaM
->
GetPoint
();
// Split once and remember the node that has been splitted.
rDoc
.
SplitNode
(
*
pPos
);
pDoc
->
SplitNode
(
*
pPos
);
*
pSttNdIdx
=
pPos
->
nNode
.
GetIndex
()
-
1
;
// Split again.
rDoc
.
SplitNode
(
*
pPos
);
pDoc
->
SplitNode
(
*
pPos
);
// Insert all content into the new node
pPaM
->
Move
(
fnMoveBackward
);
rDoc
.
SetTxtFmtColl
(
*
pPaM
,
rDoc
.
GetTxtCollFromPool
(
RES_POOLCOLL_STANDARD
)
);
pDoc
->
SetTxtFmtColl
(
*
pPaM
,
pDoc
->
GetTxtCollFromPool
(
RES_POOLCOLL_STANDARD
)
);
}
}
// We need a draw model to be able to set the z order
rDoc
.
MakeDrawModel
();
pDoc
->
MakeDrawModel
();
}
SwXMLImport
::~
SwXMLImport
(
)
void
SwXMLImport
::
endDocument
(
void
)
{
if
(
!
IsStylesOnlyMode
()
)
{
...
...
@@ -483,12 +580,9 @@ SwXMLImport::~SwXMLImport()
GetTextImport
()
->
ResetCursor
();
delete
pSttNdIdx
;
delete
pDocElemTokenMap
;
delete
pTableElemTokenMap
;
_FinitItemImport
();
pSttNdIdx
=
0
;
}
XMLShapeImportHelper
*
SwXMLImport
::
CreateShapeImport
()
{
return
new
XMLTextShapeImportHelper
(
*
this
);
...
...
@@ -542,3 +636,23 @@ void SwXMLImport::ShowProgress( sal_Int32 nPercent )
}
}
uno
::
Sequence
<
OUString
>
SAL_CALL
SwXMLImport_getSupportedServiceNames
()
throw
()
{
const
OUString
aServiceName
(
RTL_CONSTASCII_USTRINGPARAM
(
"com.sun.star.office.sax.importer.Writer"
)
);
const
uno
::
Sequence
<
OUString
>
aSeq
(
&
aServiceName
,
1
);
return
aSeq
;
}
OUString
SAL_CALL
SwXMLImport_getImplementationName
()
throw
()
{
return
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"SwXMLImport"
)
);
}
uno
::
Reference
<
uno
::
XInterface
>
SAL_CALL
SwXMLImport_createInstance
(
const
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
&
rSMgr
)
throw
(
uno
::
Exception
)
{
return
(
cppu
::
OWeakObject
*
)
new
SwXMLImport
;
}
sw/source/filter/xml/xmlimp.hxx
Dosyayı görüntüle @
c69cfa36
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimp.hxx,v $
*
* $Revision: 1.1
1
$
* $Revision: 1.1
2
$
*
* last change: $Author:
cl $ $Date: 2001-01-12 16:34:01
$
* last change: $Author:
mib $ $Date: 2001-01-17 10:55:19
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -135,6 +135,7 @@ protected:
public
:
SwXMLImport
();
SwXMLImport
(
SwDoc
&
rDoc
,
const
SwPaM
&
rPaM
,
sal_Bool
bLoadDoc
,
sal_Bool
bInsertMode
,
sal_uInt16
nStyleFamMask
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
...
...
@@ -145,6 +146,22 @@ public:
~
SwXMLImport
();
void
setTextInsertMode
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
text
::
XTextRange
>
&
rInsertPos
);
void
setStyleInsertMode
(
sal_uInt16
nFamilies
,
sal_Bool
bOverwrite
);
// ::com::sun::star::xml::sax::XDocumentHandler
virtual
void
SAL_CALL
startDocument
(
void
)
throw
(
::
com
::
sun
::
star
::
xml
::
sax
::
SAXException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
void
SAL_CALL
endDocument
(
void
)
throw
(
::
com
::
sun
::
star
::
xml
::
sax
::
SAXException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
// XUnoTunnel
static
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int8
>
&
getUnoTunnelId
()
throw
();
virtual
sal_Int64
SAL_CALL
getSomething
(
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int8
>&
aIdentifier
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
void
InsertStyles
(
sal_Bool
bAuto
);
void
FinishStyles
();
...
...
sw/source/ui/uno/makefile.mk
Dosyayı görüntüle @
c69cfa36
...
...
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.
2
$
# $Revision: 1.
3
$
#
# last change: $Author:
os $ $Date: 2000-11-07 14:42:08
$
# last change: $Author:
mib $ $Date: 2001-01-17 10:54:44
$
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
...
...
@@ -86,7 +86,8 @@ CXXFILES = \
unoatxt.cxx
\
unomod.cxx
\
unotxvw.cxx
\
dlelstnr.cxx
dlelstnr.cxx
\
unofreg.cxx
SLOFILES
=
\
...
...
@@ -95,7 +96,8 @@ SLOFILES = \
$(SLO)$/
unoatxt.obj
\
$(SLO)$/
unomod.obj
\
$(SLO)$/
unotxvw.obj
\
$(SLO)$/
dlelstnr.obj
$(SLO)$/
dlelstnr.obj
\
$(SLO)$/
unofreg.obj
EXCEPTIONSFILES
=
\
$(SLO)$/
unodispatch.obj
\
...
...
@@ -103,7 +105,8 @@ EXCEPTIONSFILES= \
$(SLO)$/
unotxdoc.obj
\
$(SLO)$/
unoatxt.obj
\
$(SLO)$/
unomod.obj
\
$(SLO)$/
unotxvw.obj
$(SLO)$/
unotxvw.obj
\
$(SLO)$/
unofreg.obj
# --- Targets -------------------------------------------------------
...
...
sw/source/ui/uno/unofreg.cxx
0 → 100644
Dosyayı görüntüle @
c69cfa36
/*************************************************************************
*
* $RCSfile: unofreg.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: mib $ $Date: 2001-01-17 10:54:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (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.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include <string.h>
#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
#include <com/sun/star/registry/XRegistryKey.hpp>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#include <cppuhelper/factory.hxx>
#include <uno/lbnames.h>
using
namespace
rtl
;
using
namespace
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
::
lang
;
// xml import
extern
uno
::
Sequence
<
OUString
>
SAL_CALL
SwXMLImport_getSupportedServiceNames
()
throw
();
extern
OUString
SAL_CALL
SwXMLImport_getImplementationName
()
throw
();
extern
uno
::
Reference
<
uno
::
XInterface
>
SAL_CALL
SwXMLImport_createInstance
(
const
uno
::
Reference
<
XMultiServiceFactory
>
&
rSMgr
)
throw
(
uno
::
Exception
);
// xml export
extern
uno
::
Sequence
<
OUString
>
SAL_CALL
SwXMLExport_getSupportedServiceNames
()
throw
();
extern
OUString
SAL_CALL
SwXMLExport_getImplementationName
()
throw
();
extern
uno
::
Reference
<
uno
::
XInterface
>
SAL_CALL
SwXMLExport_createInstance
(
const
uno
::
Reference
<
XMultiServiceFactory
>
&
rSMgr
)
throw
(
uno
::
Exception
);
//
#ifdef __cplusplus
extern
"C"
{
#endif
void
SAL_CALL
component_getImplementationEnvironment
(
const
sal_Char
**
ppEnvTypeName
,
uno_Environment
**
ppEnv
)
{
*
ppEnvTypeName
=
CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
}
void
SAL_CALL
lcl_uno_writeInfo
(
registry
::
XRegistryKey
*
pRegistryKey
,
const
OUString
&
rImplementationName
,
const
uno
::
Sequence
<
OUString
>&
rServices
)
{
uno
::
Reference
<
registry
::
XRegistryKey
>
xNewKey
(
pRegistryKey
->
createKey
(
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"/"
)
)
+
rImplementationName
+
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"/UNO/SERVICES"
)
)
)
);
for
(
sal_Int32
i
=
0
;
i
<
rServices
.
getLength
();
i
++
)
xNewKey
->
createKey
(
rServices
.
getConstArray
()[
i
]);
}
sal_Bool
SAL_CALL
component_writeInfo
(
void
*
pServiceManager
,
void
*
pRegistryKey
)
{
if
(
pRegistryKey
)
{
try
{
registry
::
XRegistryKey
*
pKey
=
reinterpret_cast
<
registry
::
XRegistryKey
*
>
(
pRegistryKey
);
// xml filter
lcl_uno_writeInfo
(
pKey
,
SwXMLImport_getImplementationName
(),
SwXMLImport_getSupportedServiceNames
()
);
lcl_uno_writeInfo
(
pKey
,
SwXMLExport_getImplementationName
(),
SwXMLExport_getSupportedServiceNames
()
);
}
catch
(
registry
::
InvalidRegistryException
&
)
{
OSL_ENSHURE
(
sal_False
,
"### InvalidRegistryException!"
);
}
}
return
True
;
}
void
*
SAL_CALL
component_getFactory
(
const
sal_Char
*
pImplName
,
void
*
pServiceManager
,
void
*
pRegistryKey
)
{
void
*
pRet
=
0
;
if
(
pServiceManager
)
{
uno
::
Reference
<
XMultiServiceFactory
>
xMSF
(
reinterpret_cast
<
XMultiServiceFactory
*
>
(
pServiceManager
)
);
uno
::
Reference
<
XSingleServiceFactory
>
xFactory
;
const
sal_Int32
nImplNameLen
=
strlen
(
pImplName
);
if
(
SwXMLImport_getImplementationName
().
equalsAsciiL
(
pImplName
,
nImplNameLen
)
)
{
xFactory
=
::
cppu
::
createSingleFactory
(
xMSF
,
SwXMLImport_getImplementationName
(),
SwXMLImport_createInstance
,
SwXMLImport_getSupportedServiceNames
()
);
}
else
if
(
SwXMLExport_getImplementationName
().
equalsAsciiL
(
pImplName
,
nImplNameLen
)
)
{
xFactory
=
::
cppu
::
createSingleFactory
(
xMSF
,
SwXMLExport_getImplementationName
(),
SwXMLExport_createInstance
,
SwXMLExport_getSupportedServiceNames
()
);
}
if
(
xFactory
.
is
())
{
xFactory
->
acquire
();
pRet
=
xFactory
.
get
();
}
}
return
pRet
;
}
#ifdef __cplusplus
}
#endif
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