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
f01f3120
Kaydet (Commit)
f01f3120
authored
Haz 09, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SwDBManager: extract StoreEmbeddedDataSource() from registration code
Change-Id: Ifc6471f58793cde057f354c4c6a549c073b7d34b
üst
2a0dda3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
20 deletions
+30
-20
dbmgr.hxx
sw/inc/dbmgr.hxx
+7
-0
dbmgr.cxx
sw/source/uibase/dbui/dbmgr.cxx
+23
-20
No files found.
sw/inc/dbmgr.hxx
Dosyayı görüntüle @
f01f3120
...
...
@@ -28,6 +28,8 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
namespace
com
{
namespace
sun
{
namespace
star
{
...
...
@@ -414,6 +416,11 @@ public:
void
setEmbeddedName
(
const
OUString
&
rEmbeddedName
,
SwDocShell
&
rDocShell
);
OUString
getEmbeddedName
()
const
;
static
void
StoreEmbeddedDataSource
(
const
css
::
uno
::
Reference
<
css
::
frame
::
XStorable
>&
xStorable
,
const
css
::
uno
::
Reference
<
css
::
embed
::
XStorage
>&
xStorage
,
const
OUString
&
rStreamRelPath
,
const
OUString
&
rOwnURL
);
};
#endif
...
...
sw/source/uibase/dbui/dbmgr.cxx
Dosyayı görüntüle @
f01f3120
...
...
@@ -2595,39 +2595,23 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
uno
::
Reference
<
frame
::
XStorable
>
xStore
(
xDS
->
getDatabaseDocument
(),
uno
::
UNO_QUERY_THROW
);
OUString
sOutputExt
=
".odb"
;
OUString
aOwnURL
=
lcl_getOwnURL
(
pDocShell
);
OUString
sTmpName
;
uno
::
Sequence
<
beans
::
PropertyValue
>
aSequence
;
if
(
aOwnURL
.
isEmpty
())
{
// Cannot embed, as embedded data source would need the URL of the parent document.
OUString
sHomePath
(
SvtPathOptions
().
GetWorkPath
());
utl
::
TempFile
aTempFile
(
sNewName
,
true
,
&
sOutputExt
,
pDestDir
?
pDestDir
:
&
sHomePath
);
aTempFile
.
EnableKillingFile
(
true
);
sTmpName
=
aTempFile
.
GetURL
();
OUString
sTmpName
=
aTempFile
.
GetURL
();
xStore
->
storeAsURL
(
sTmpName
,
uno
::
Sequence
<
beans
::
PropertyValue
>
());
}
else
{
// Embed
: construct vnd.sun.star.pkg:// URL for later loading, and TargetStorage/StreamRelPath for storing
.
// Embed.
OUString
aStreamRelPath
=
"EmbeddedDatabase"
;
sTmpName
=
"vnd.sun.star.pkg://"
;
sTmpName
+=
INetURLObject
::
encode
(
aOwnURL
,
INetURLObject
::
PART_AUTHORITY
,
INetURLObject
::
ENCODE_ALL
);
sTmpName
+=
"/"
+
aStreamRelPath
;
uno
::
Reference
<
embed
::
XStorage
>
xStorage
=
pDocShell
->
GetStorage
();
aSequence
=
comphelper
::
InitPropertySequence
(
{
{
"TargetStorage"
,
uno
::
makeAny
(
xStorage
)},
{
"StreamRelPath"
,
uno
::
makeAny
(
aStreamRelPath
)},
{
"BaseURI"
,
uno
::
makeAny
(
aOwnURL
)}
});
// Refer to the sub-storage name in the document settings, so
// we can load it again next time the file is imported.
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
xFactory
(
pDocShell
->
GetModel
(),
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xPropertySet
(
xFactory
->
createInstance
(
"com.sun.star.document.Settings"
),
uno
::
UNO_QUERY
);
xPropertySet
->
setPropertyValue
(
"EmbeddedDatabaseName"
,
uno
::
makeAny
(
aStreamRelPath
));
SwDBManager
::
StoreEmbeddedDataSource
(
xStore
,
xStorage
,
aStreamRelPath
,
aOwnURL
);
}
xStore
->
storeAsURL
(
sTmpName
,
aSequence
);
}
xDBContext
->
registerObject
(
sFind
,
xNewInstance
);
}
...
...
@@ -2638,6 +2622,25 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
return
sFind
;
}
void
SwDBManager
::
StoreEmbeddedDataSource
(
const
uno
::
Reference
<
frame
::
XStorable
>&
xStorable
,
const
uno
::
Reference
<
embed
::
XStorage
>&
xStorage
,
const
OUString
&
rStreamRelPath
,
const
OUString
&
rOwnURL
)
{
// Construct vnd.sun.star.pkg:// URL for later loading, and TargetStorage/StreamRelPath for storing.
OUString
sTmpName
=
"vnd.sun.star.pkg://"
;
sTmpName
+=
INetURLObject
::
encode
(
rOwnURL
,
INetURLObject
::
PART_AUTHORITY
,
INetURLObject
::
ENCODE_ALL
);
sTmpName
+=
"/"
+
rStreamRelPath
;
uno
::
Sequence
<
beans
::
PropertyValue
>
aSequence
=
comphelper
::
InitPropertySequence
(
{
{
"TargetStorage"
,
uno
::
makeAny
(
xStorage
)},
{
"StreamRelPath"
,
uno
::
makeAny
(
rStreamRelPath
)},
{
"BaseURI"
,
uno
::
makeAny
(
rOwnURL
)}
});
xStorable
->
storeAsURL
(
sTmpName
,
aSequence
);
}
OUString
SwDBManager
::
LoadAndRegisterDataSource
(
const
OUString
&
rURI
,
const
OUString
*
pPrefix
,
const
OUString
*
pDestDir
,
const
uno
::
Reference
<
beans
::
XPropertySet
>
*
pSettings
)
{
...
...
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