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
d3f4ee2b
Kaydet (Commit)
d3f4ee2b
authored
Şub 23, 2012
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adapted SvtMatchContext_Impl to safer-to-use salhelper::Thread
üst
b5764eb9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
37 deletions
+32
-37
inettbc.hxx
svtools/inc/svtools/inettbc.hxx
+2
-1
inettbc.cxx
svtools/source/control/inettbc.cxx
+30
-36
No files found.
svtools/inc/svtools/inettbc.hxx
Dosyayı görüntüle @
d3f4ee2b
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
// includes *****************************************************************
// includes *****************************************************************
#include "rtl/ref.hxx"
#include "svtools/svtdllapi.h"
#include "svtools/svtdllapi.h"
#include <tools/string.hxx>
#include <tools/string.hxx>
#include <tools/urlobj.hxx>
#include <tools/urlobj.hxx>
...
@@ -47,7 +48,7 @@ friend class SvtURLBox_Impl;
...
@@ -47,7 +48,7 @@ friend class SvtURLBox_Impl;
Link
aOpenHdl
;
Link
aOpenHdl
;
String
aBaseURL
;
String
aBaseURL
;
String
aPlaceHolder
;
String
aPlaceHolder
;
SvtMatchContext_Impl
*
pCtx
;
rtl
::
Reference
<
SvtMatchContext_Impl
>
pCtx
;
SvtURLBox_Impl
*
pImp
;
SvtURLBox_Impl
*
pImp
;
INetProtocol
eSmartProtocol
;
INetProtocol
eSmartProtocol
;
sal_Bool
bAutoCompleteMode
:
1
;
sal_Bool
bAutoCompleteMode
:
1
;
...
...
svtools/source/control/inettbc.cxx
Dosyayı görüntüle @
d3f4ee2b
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <comphelper/string.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/toolbox.hxx>
#include <
osl
/thread.hxx>
#include <
salhelper
/thread.hxx>
#include <osl/mutex.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/svapp.hxx>
#include <unotools/historyoptions.hxx>
#include <unotools/historyoptions.hxx>
...
@@ -96,7 +96,7 @@ public:
...
@@ -96,7 +96,7 @@ public:
}
}
};
};
class
SvtMatchContext_Impl
:
public
::
osl
::
Thread
class
SvtMatchContext_Impl
:
public
salhelper
::
Thread
{
{
static
::
osl
::
Mutex
*
pDirMutex
;
static
::
osl
::
Mutex
*
pDirMutex
;
...
@@ -113,9 +113,9 @@ class SvtMatchContext_Impl : public ::osl::Thread
...
@@ -113,9 +113,9 @@ class SvtMatchContext_Impl : public ::osl::Thread
DECL_STATIC_LINK
(
SvtMatchContext_Impl
,
Select_Impl
,
void
*
);
DECL_STATIC_LINK
(
SvtMatchContext_Impl
,
Select_Impl
,
void
*
);
virtual
void
SAL_CALL
onTerminated
(
);
virtual
~
SvtMatchContext_Impl
(
);
virtual
void
SAL_CALL
run
();
virtual
void
execute
();
v
irtual
void
SAL_CALL
Cancel
();
v
oid
doExecute
();
void
Insert
(
const
String
&
rCompletion
,
const
String
&
rURL
,
sal_Bool
bForce
=
sal_False
);
void
Insert
(
const
String
&
rCompletion
,
const
String
&
rURL
,
sal_Bool
bForce
=
sal_False
);
void
ReadFolder
(
const
String
&
rURL
,
const
String
&
rMatch
,
sal_Bool
bSmart
);
void
ReadFolder
(
const
String
&
rURL
,
const
String
&
rMatch
,
sal_Bool
bSmart
);
void
FillPicklist
(
std
::
vector
<
rtl
::
OUString
>&
rPickList
);
void
FillPicklist
(
std
::
vector
<
rtl
::
OUString
>&
rPickList
);
...
@@ -124,7 +124,6 @@ public:
...
@@ -124,7 +124,6 @@ public:
static
::
osl
::
Mutex
*
GetMutex
();
static
::
osl
::
Mutex
*
GetMutex
();
SvtMatchContext_Impl
(
SvtURLBox
*
pBoxP
,
const
String
&
rText
);
SvtMatchContext_Impl
(
SvtURLBox
*
pBoxP
,
const
String
&
rText
);
~
SvtMatchContext_Impl
();
void
Stop
();
void
Stop
();
};
};
...
@@ -140,7 +139,8 @@ public:
...
@@ -140,7 +139,8 @@ public:
SvtMatchContext_Impl
::
SvtMatchContext_Impl
(
SvtMatchContext_Impl
::
SvtMatchContext_Impl
(
SvtURLBox
*
pBoxP
,
const
String
&
rText
)
SvtURLBox
*
pBoxP
,
const
String
&
rText
)
:
aLink
(
STATIC_LINK
(
this
,
SvtMatchContext_Impl
,
Select_Impl
)
)
:
Thread
(
"SvtMatchContext_Impl"
)
,
aLink
(
STATIC_LINK
(
this
,
SvtMatchContext_Impl
,
Select_Impl
)
)
,
aBaseURL
(
pBoxP
->
aBaseURL
)
,
aBaseURL
(
pBoxP
->
aBaseURL
)
,
aText
(
rText
)
,
aText
(
rText
)
,
pBox
(
pBoxP
)
,
pBox
(
pBoxP
)
...
@@ -151,8 +151,6 @@ SvtMatchContext_Impl::SvtMatchContext_Impl(
...
@@ -151,8 +151,6 @@ SvtMatchContext_Impl::SvtMatchContext_Impl(
aLink
.
CreateMutex
();
aLink
.
CreateMutex
();
FillPicklist
(
aPickList
);
FillPicklist
(
aPickList
);
create
();
}
}
SvtMatchContext_Impl
::~
SvtMatchContext_Impl
()
SvtMatchContext_Impl
::~
SvtMatchContext_Impl
()
...
@@ -188,22 +186,15 @@ void SvtMatchContext_Impl::FillPicklist(std::vector<rtl::OUString>& rPickList)
...
@@ -188,22 +186,15 @@ void SvtMatchContext_Impl::FillPicklist(std::vector<rtl::OUString>& rPickList)
}
}
}
}
void
SAL_CALL
SvtMatchContext_Impl
::
Cancel
()
{
// Cancel button pressed
terminate
();
}
void
SvtMatchContext_Impl
::
Stop
()
void
SvtMatchContext_Impl
::
Stop
()
{
{
bStop
=
sal_True
;
bStop
=
sal_True
;
terminate
();
if
(
isRunning
()
)
terminate
();
}
}
void
SvtMatchContext_Impl
::
onTerminated
(
)
void
SvtMatchContext_Impl
::
execute
(
)
{
{
doExecute
();
aLink
.
Call
(
this
);
aLink
.
Call
(
this
);
}
}
...
@@ -220,7 +211,6 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, )
...
@@ -220,7 +211,6 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, )
if
(
pThis
->
bStop
)
if
(
pThis
->
bStop
)
{
{
// completions was stopped, no display
// completions was stopped, no display
delete
pThis
;
return
0
;
return
0
;
}
}
...
@@ -293,8 +283,7 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, )
...
@@ -293,8 +283,7 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, )
// the box has this control as a member so we have to set that member
// the box has this control as a member so we have to set that member
// to zero before deleting ourself.
// to zero before deleting ourself.
pBox
->
pCtx
=
NULL
;
pBox
->
pCtx
.
clear
();
delete
pThis
;
return
0
;
return
0
;
}
}
...
@@ -567,7 +556,7 @@ String SvtURLBox::ParseSmart( String aText, String aBaseURL, String aWorkDir )
...
@@ -567,7 +556,7 @@ String SvtURLBox::ParseSmart( String aText, String aBaseURL, String aWorkDir )
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
void
SvtMatchContext_Impl
::
run
()
void
SvtMatchContext_Impl
::
doExecute
()
{
{
::
osl
::
MutexGuard
aGuard
(
GetMutex
()
);
::
osl
::
MutexGuard
aGuard
(
GetMutex
()
);
if
(
bStop
)
if
(
bStop
)
...
@@ -750,19 +739,20 @@ void SvtURLBox::TryAutoComplete( sal_Bool bForce )
...
@@ -750,19 +739,20 @@ void SvtURLBox::TryAutoComplete( sal_Bool bForce )
aCurText
.
Erase
(
nLen
);
aCurText
.
Erase
(
nLen
);
if
(
aCurText
.
Len
()
&&
bIsAutoCompleteEnabled
)
if
(
aCurText
.
Len
()
&&
bIsAutoCompleteEnabled
)
{
{
if
(
pCtx
)
if
(
pCtx
.
is
()
)
{
{
pCtx
->
Stop
();
pCtx
->
Stop
();
pCtx
=
NULL
;
pCtx
->
join
();
pCtx
.
clear
();
}
}
pCtx
=
new
SvtMatchContext_Impl
(
this
,
aCurText
);
pCtx
=
new
SvtMatchContext_Impl
(
this
,
aCurText
);
pCtx
->
launch
();
}
}
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
SvtURLBox
::
SvtURLBox
(
Window
*
pParent
,
INetProtocol
eSmart
)
SvtURLBox
::
SvtURLBox
(
Window
*
pParent
,
INetProtocol
eSmart
)
:
ComboBox
(
pParent
,
WB_DROPDOWN
|
WB_AUTOSIZE
|
WB_AUTOHSCROLL
),
:
ComboBox
(
pParent
,
WB_DROPDOWN
|
WB_AUTOSIZE
|
WB_AUTOHSCROLL
),
pCtx
(
0
),
eSmartProtocol
(
eSmart
),
eSmartProtocol
(
eSmart
),
bAutoCompleteMode
(
sal_False
),
bAutoCompleteMode
(
sal_False
),
bOnlyDirectories
(
sal_False
),
bOnlyDirectories
(
sal_False
),
...
@@ -783,7 +773,6 @@ SvtURLBox::SvtURLBox( Window* pParent, INetProtocol eSmart )
...
@@ -783,7 +773,6 @@ SvtURLBox::SvtURLBox( Window* pParent, INetProtocol eSmart )
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
SvtURLBox
::
SvtURLBox
(
Window
*
pParent
,
WinBits
_nStyle
,
INetProtocol
eSmart
)
SvtURLBox
::
SvtURLBox
(
Window
*
pParent
,
WinBits
_nStyle
,
INetProtocol
eSmart
)
:
ComboBox
(
pParent
,
_nStyle
),
:
ComboBox
(
pParent
,
_nStyle
),
pCtx
(
0
),
eSmartProtocol
(
eSmart
),
eSmartProtocol
(
eSmart
),
bAutoCompleteMode
(
sal_False
),
bAutoCompleteMode
(
sal_False
),
bOnlyDirectories
(
sal_False
),
bOnlyDirectories
(
sal_False
),
...
@@ -799,7 +788,6 @@ SvtURLBox::SvtURLBox( Window* pParent, WinBits _nStyle, INetProtocol eSmart )
...
@@ -799,7 +788,6 @@ SvtURLBox::SvtURLBox( Window* pParent, WinBits _nStyle, INetProtocol eSmart )
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
SvtURLBox
::
SvtURLBox
(
Window
*
pParent
,
const
ResId
&
_rResId
,
INetProtocol
eSmart
)
SvtURLBox
::
SvtURLBox
(
Window
*
pParent
,
const
ResId
&
_rResId
,
INetProtocol
eSmart
)
:
ComboBox
(
pParent
,
_rResId
),
:
ComboBox
(
pParent
,
_rResId
),
pCtx
(
0
),
eSmartProtocol
(
eSmart
),
eSmartProtocol
(
eSmart
),
bAutoCompleteMode
(
sal_False
),
bAutoCompleteMode
(
sal_False
),
bOnlyDirectories
(
sal_False
),
bOnlyDirectories
(
sal_False
),
...
@@ -828,10 +816,10 @@ void SvtURLBox::ImplInit()
...
@@ -828,10 +816,10 @@ void SvtURLBox::ImplInit()
SvtURLBox
::~
SvtURLBox
()
SvtURLBox
::~
SvtURLBox
()
{
{
if
(
pCtx
)
if
(
pCtx
.
is
()
)
{
{
pCtx
->
Stop
();
pCtx
->
Stop
();
pCtx
=
NULL
;
pCtx
->
join
()
;
}
}
delete
pImp
;
delete
pImp
;
...
@@ -839,15 +827,19 @@ SvtURLBox::~SvtURLBox()
...
@@ -839,15 +827,19 @@ SvtURLBox::~SvtURLBox()
void
SvtURLBox
::
UpdatePickList
(
)
void
SvtURLBox
::
UpdatePickList
(
)
{
{
if
(
pCtx
)
if
(
pCtx
.
is
()
)
{
{
pCtx
->
Stop
();
pCtx
->
Stop
();
pCtx
=
NULL
;
pCtx
->
join
();
pCtx
.
clear
();
}
}
String
sText
=
GetText
();
String
sText
=
GetText
();
if
(
sText
.
Len
()
&&
bIsAutoCompleteEnabled
)
if
(
sText
.
Len
()
&&
bIsAutoCompleteEnabled
)
{
pCtx
=
new
SvtMatchContext_Impl
(
this
,
sText
);
pCtx
=
new
SvtMatchContext_Impl
(
this
,
sText
);
pCtx
->
launch
();
}
}
}
void
SvtURLBox
::
SetSmartProtocol
(
INetProtocol
eProt
)
void
SvtURLBox
::
SetSmartProtocol
(
INetProtocol
eProt
)
...
@@ -927,10 +919,11 @@ void SvtURLBox::UpdatePicklistForSmartProtocol_Impl()
...
@@ -927,10 +919,11 @@ void SvtURLBox::UpdatePicklistForSmartProtocol_Impl()
sal_Bool
SvtURLBox
::
ProcessKey
(
const
KeyCode
&
rKey
)
sal_Bool
SvtURLBox
::
ProcessKey
(
const
KeyCode
&
rKey
)
{
{
// every key input stops the current matching thread
// every key input stops the current matching thread
if
(
pCtx
)
if
(
pCtx
.
is
()
)
{
{
pCtx
->
Stop
();
pCtx
->
Stop
();
pCtx
=
NULL
;
pCtx
->
join
();
pCtx
.
clear
();
}
}
KeyCode
aCode
(
rKey
.
GetCode
()
);
KeyCode
aCode
(
rKey
.
GetCode
()
);
...
@@ -1068,10 +1061,11 @@ long SvtURLBox::Notify( NotifyEvent &rEvt )
...
@@ -1068,10 +1061,11 @@ long SvtURLBox::Notify( NotifyEvent &rEvt )
{
{
if
(
!
GetText
().
Len
()
)
if
(
!
GetText
().
Len
()
)
ClearModifyFlag
();
ClearModifyFlag
();
if
(
pCtx
)
if
(
pCtx
.
is
()
)
{
{
pCtx
->
Stop
();
pCtx
->
Stop
();
pCtx
=
NULL
;
pCtx
->
join
();
pCtx
.
clear
();
}
}
}
}
...
...
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