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
5eb6e49f
Kaydet (Commit)
5eb6e49f
authored
Mar 28, 2012
tarafından
Eike Rathke
Kaydeden (comit)
Matúš Kukan
Tem 17, 2012
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
tubes: shared_ptr for ScDocFunc chains and ScCollaboration
üst
66ee9a60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
20 deletions
+26
-20
sendfunc.cxx
sc/source/ui/collab/sendfunc.cxx
+26
-20
No files found.
sc/source/ui/collab/sendfunc.cxx
Dosyayı görüntüle @
5eb6e49f
...
@@ -256,20 +256,19 @@ public:
...
@@ -256,20 +256,19 @@ public:
class
ScDocFuncRecv
:
public
ScDocFunc
class
ScDocFuncRecv
:
public
ScDocFunc
{
{
ScDocFunc
*
mpChain
;
boost
::
shared_ptr
<
ScDocFuncDirect
>
mpChain
;
ScCollaboration
*
mpCollab
;
boost
::
shared_ptr
<
ScCollaboration
>
mpCollab
;
public
:
public
:
// FIXME: really ScDocFunc should be an abstract base
// FIXME: really ScDocFunc should be an abstract base
ScDocFuncRecv
(
ScDocShell
&
rDocSh
,
ScDocFunc
*
pChain
)
ScDocFuncRecv
(
ScDocShell
&
rDocSh
,
boost
::
shared_ptr
<
ScDocFuncDirect
>&
pChain
)
:
ScDocFunc
(
rDocSh
),
:
ScDocFunc
(
rDocSh
),
mpChain
(
pChain
),
mpChain
(
pChain
)
mpCollab
(
NULL
)
{
{
fprintf
(
stderr
,
"Receiver created !
\n
"
);
fprintf
(
stderr
,
"Receiver created !
\n
"
);
}
}
virtual
~
ScDocFuncRecv
()
{}
virtual
~
ScDocFuncRecv
()
{}
void
SetCollaboration
(
ScCollaboration
*
pCollab
)
void
SetCollaboration
(
boost
::
shared_ptr
<
ScCollaboration
>&
pCollab
)
{
{
mpCollab
=
pCollab
;
mpCollab
=
pCollab
;
}
}
...
@@ -380,8 +379,8 @@ void ScDocFuncRecv::fileReceived( rtl::OUString *pStr )
...
@@ -380,8 +379,8 @@ void ScDocFuncRecv::fileReceived( rtl::OUString *pStr )
class
ScDocFuncSend
:
public
ScDocFunc
class
ScDocFuncSend
:
public
ScDocFunc
{
{
ScDocFuncRecv
*
mpChain
;
boost
::
shared_ptr
<
ScDocFuncRecv
>
mpChain
;
ScCollaboration
*
mpCollab
;
boost
::
shared_ptr
<
ScCollaboration
>
mpCollab
;
void
SendMessage
(
ScChangeOpWriter
&
rOp
)
void
SendMessage
(
ScChangeOpWriter
&
rOp
)
{
{
...
@@ -424,16 +423,15 @@ class ScDocFuncSend : public ScDocFunc
...
@@ -424,16 +423,15 @@ class ScDocFuncSend : public ScDocFunc
public
:
public
:
// FIXME: really ScDocFunc should be an abstract base, so
// FIXME: really ScDocFunc should be an abstract base, so
// we don't need the rDocSh hack/pointer
// we don't need the rDocSh hack/pointer
ScDocFuncSend
(
ScDocShell
&
rDocSh
,
ScDocFuncRecv
*
pChain
)
ScDocFuncSend
(
ScDocShell
&
rDocSh
,
boost
::
shared_ptr
<
ScDocFuncRecv
>&
pChain
)
:
ScDocFunc
(
rDocSh
),
:
ScDocFunc
(
rDocSh
),
mpChain
(
pChain
),
mpChain
(
pChain
)
mpCollab
(
NULL
)
{
{
fprintf
(
stderr
,
"Sender created !
\n
"
);
fprintf
(
stderr
,
"Sender created !
\n
"
);
}
}
virtual
~
ScDocFuncSend
()
{}
virtual
~
ScDocFuncSend
()
{}
void
SetCollaboration
(
ScCollaboration
*
pCollab
)
void
SetCollaboration
(
boost
::
shared_ptr
<
ScCollaboration
>&
pCollab
)
{
{
mpCollab
=
pCollab
;
mpCollab
=
pCollab
;
}
}
...
@@ -562,20 +560,28 @@ public:
...
@@ -562,20 +560,28 @@ public:
SC_DLLPRIVATE
ScDocFunc
*
ScDocShell
::
CreateDocFunc
()
SC_DLLPRIVATE
ScDocFunc
*
ScDocShell
::
CreateDocFunc
()
{
{
// FIXME: the chains should be auto-ptrs, so should be collab
// With ScDocFuncDirect shared_ptr it should even be possible during
// runtime to replace a ScDocFuncDirect instance with a ScDocFuncSend
// chained instance (holding the same ScDocFuncDirect instance) and vice
// versa.
bool
bIsMaster
=
false
;
bool
bIsMaster
=
false
;
if
(
getenv
(
"INTERCEPT"
))
if
(
getenv
(
"INTERCEPT"
))
return
new
ScDocFuncSend
(
*
this
,
new
ScDocFuncRecv
(
*
this
,
new
ScDocFuncDirect
(
*
this
)
)
);
{
boost
::
shared_ptr
<
ScDocFuncDirect
>
pDirect
(
new
ScDocFuncDirect
(
*
this
)
);
boost
::
shared_ptr
<
ScDocFuncRecv
>
pReceiver
(
new
ScDocFuncRecv
(
*
this
,
pDirect
)
);
return
new
ScDocFuncSend
(
*
this
,
pReceiver
);
}
else
if
(
isCollabMode
(
bIsMaster
))
else
if
(
isCollabMode
(
bIsMaster
))
{
{
ScDocFuncRecv
*
pReceiver
=
new
ScDocFuncRecv
(
*
this
,
new
ScDocFuncDirect
(
*
this
)
);
boost
::
shared_ptr
<
ScDocFuncDirect
>
pDirect
(
new
ScDocFuncDirect
(
*
this
)
);
boost
::
shared_ptr
<
ScDocFuncRecv
>
pReceiver
(
new
ScDocFuncRecv
(
*
this
,
pDirect
)
);
ScDocFuncSend
*
pSender
=
new
ScDocFuncSend
(
*
this
,
pReceiver
);
ScDocFuncSend
*
pSender
=
new
ScDocFuncSend
(
*
this
,
pReceiver
);
bool
bOk
=
true
;
boost
::
shared_ptr
<
ScCollaboration
>
pCollab
(
new
ScCollaboration
);
ScCollaboration
*
pCollab
=
new
ScCollaboration
();
pCollab
->
sigPacketReceived
.
connect
(
pCollab
->
sigPacketReceived
.
connect
(
boost
::
bind
(
&
ScDocFuncRecv
::
packetReceived
,
pReceiver
,
_1
,
_2
));
boost
::
bind
(
&
ScDocFuncRecv
::
packetReceived
,
pReceiver
,
_1
,
_2
));
pCollab
->
sigFileReceived
.
connect
(
pCollab
->
sigFileReceived
.
connect
(
boost
::
bind
(
&
ScDocFuncRecv
::
fileReceived
,
pReceiver
,
_1
));
boost
::
bind
(
&
ScDocFuncRecv
::
fileReceived
,
pReceiver
,
_1
));
bool
bOk
=
true
;
bOk
=
bOk
&&
pCollab
->
initManager
(
!
bIsMaster
);
bOk
=
bOk
&&
pCollab
->
initManager
(
!
bIsMaster
);
if
(
bIsMaster
)
if
(
bIsMaster
)
{
{
...
@@ -590,7 +596,7 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc()
...
@@ -590,7 +596,7 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc()
else
else
{
{
fprintf
(
stderr
,
"Could not start collaboration.
\n
"
);
fprintf
(
stderr
,
"Could not start collaboration.
\n
"
);
delete
pCollab
;
// pCollab shared_ptr will be destructed
}
}
return
pSender
;
return
pSender
;
}
}
...
...
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