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
b3f5ab77
Kaydet (Commit)
b3f5ab77
authored
Haz 04, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
abpilot: embed the data source definition, if possible + requested
Change-Id: I0e70459e331995388b36c77c351bff89ece004a6
üst
b2117c98
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
5 deletions
+52
-5
abspilot.cxx
extensions/source/abpilot/abspilot.cxx
+1
-1
datasourcehandling.cxx
extensions/source/abpilot/datasourcehandling.cxx
+49
-3
datasourcehandling.hxx
extensions/source/abpilot/datasourcehandling.hxx
+2
-1
No files found.
extensions/source/abpilot/abspilot.cxx
Dosyayı görüntüle @
b3f5ab77
...
...
@@ -158,7 +158,7 @@ namespace abp
m_aNewDataSource
.
rename
(
m_aSettings
.
sDataSourceName
);
// 1. the data source
m_aNewDataSource
.
store
();
m_aNewDataSource
.
store
(
m_aSettings
);
// 2. check if we need to register the data source
if
(
m_aSettings
.
bRegisterDataSource
)
...
...
extensions/source/abpilot/datasourcehandling.cxx
Dosyayı görüntüle @
b3f5ab77
...
...
@@ -22,6 +22,7 @@
#include "abptypes.hxx"
#include "componentmodule.hxx"
#include "datasourcehandling.hxx"
#include "addresssettings.hxx"
#include <boost/noncopyable.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
...
...
@@ -46,7 +47,28 @@
#include <unotools/confignode.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <vcl/stdtext.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/viewfrm.hxx>
#include <comphelper/propertysequence.hxx>
namespace
{
/// Returns the URL of this object shell.
OUString
lcl_getOwnURL
(
SfxObjectShell
*
pObjectShell
)
{
OUString
aRet
;
if
(
!
pObjectShell
)
return
aRet
;
const
INetURLObject
&
rURLObject
=
pObjectShell
->
GetMedium
()
->
GetURLObject
();
aRet
=
rURLObject
.
GetMainURL
(
INetURLObject
::
DECODE_WITH_CHARSET
);
return
aRet
;
}
}
namespace
abp
{
...
...
@@ -54,6 +76,7 @@ namespace abp
using
namespace
::
utl
;
using
namespace
::
comphelper
;
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
lang
;
using
namespace
::
com
::
sun
::
star
::
sdb
;
...
...
@@ -347,8 +370,7 @@ namespace abp
delete
m_pImpl
;
}
void
ODataSource
::
store
()
void
ODataSource
::
store
(
const
AddressSettings
&
rSettings
)
{
if
(
!
isValid
())
// nothing to do
...
...
@@ -361,7 +383,31 @@ namespace abp
xStorable
.
set
(
xDocAccess
->
getDatabaseDocument
(),
css
::
uno
::
UNO_QUERY
);
OSL_ENSURE
(
xStorable
.
is
(),
"DataSource is no XStorable!"
);
if
(
xStorable
.
is
()
)
xStorable
->
storeAsURL
(
m_pImpl
->
sName
,
Sequence
<
PropertyValue
>
());
{
SfxObjectShell
*
pObjectShell
=
SfxViewFrame
::
Current
()
->
GetObjectShell
();
OUString
aOwnURL
=
lcl_getOwnURL
(
pObjectShell
);
if
(
aOwnURL
.
isEmpty
()
||
!
rSettings
.
bEmbedDataSource
)
{
// Cannot or should not embed.
xStorable
->
storeAsURL
(
m_pImpl
->
sName
,
Sequence
<
PropertyValue
>
());
}
else
{
// Embed.
OUString
aStreamRelPath
=
"EmbeddedDatabase"
;
OUString
sTmpName
=
"vnd.sun.star.pkg://"
;
sTmpName
+=
INetURLObject
::
encode
(
aOwnURL
,
INetURLObject
::
PART_AUTHORITY
,
INetURLObject
::
ENCODE_ALL
);
sTmpName
+=
"/"
+
aStreamRelPath
;
uno
::
Reference
<
embed
::
XStorage
>
xStorage
=
pObjectShell
->
GetStorage
();
uno
::
Sequence
<
beans
::
PropertyValue
>
aSequence
=
comphelper
::
InitPropertySequence
(
{
{
"TargetStorage"
,
uno
::
makeAny
(
xStorage
)},
{
"StreamRelPath"
,
uno
::
makeAny
(
aStreamRelPath
)}
});
xStorable
->
storeAsURL
(
sTmpName
,
aSequence
);
m_pImpl
->
sName
=
sTmpName
;
}
}
}
catch
(
const
Exception
&
)
{
...
...
extensions/source/abpilot/datasourcehandling.hxx
Dosyayı görüntüle @
b3f5ab77
...
...
@@ -95,6 +95,7 @@ namespace abp
struct
ODataSourceImpl
;
struct
PackageAccessControl
;
struct
AddressSettings
;
/** a non-UNO wrapper for a data source
<p>This class allows to access data sources without the need to compile the respective file with
exception handling enabled (hopefully :).</p>
...
...
@@ -159,7 +160,7 @@ namespace abp
void
disconnect
(
);
/// stores the database file
void
store
();
void
store
(
const
AddressSettings
&
rSettings
);
/// register the data source under the given name in the configuration
void
registerDataSource
(
const
OUString
&
_sRegisteredDataSourceName
);
...
...
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