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
7068b56b
Kaydet (Commit)
7068b56b
authored
Tem 15, 2015
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
vcl: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I11bd73ff134895d05c7ce054b5ef26829a3bf8c3
üst
218be53f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
28 deletions
+29
-28
btndlg.hxx
include/vcl/btndlg.hxx
+4
-2
btndlg.cxx
vcl/source/window/btndlg.cxx
+25
-26
No files found.
include/vcl/btndlg.hxx
Dosyayı görüntüle @
7068b56b
...
@@ -20,11 +20,13 @@
...
@@ -20,11 +20,13 @@
#ifndef INCLUDED_VCL_BTNDLG_HXX
#ifndef INCLUDED_VCL_BTNDLG_HXX
#define INCLUDED_VCL_BTNDLG_HXX
#define INCLUDED_VCL_BTNDLG_HXX
#include <boost/ptr_container/ptr_vector.hpp>
#include <vcl/dllapi.h>
#include <vcl/dllapi.h>
#include <vcl/dialog.hxx>
#include <vcl/dialog.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <vector>
#include <memory>
struct
ImplBtnDlgItem
;
struct
ImplBtnDlgItem
;
class
PushButton
;
class
PushButton
;
...
@@ -81,7 +83,7 @@ private:
...
@@ -81,7 +83,7 @@ private:
ButtonDialog
&
operator
=
(
const
ButtonDialog
&
)
SAL_DELETED_FUNCTION
;
ButtonDialog
&
operator
=
(
const
ButtonDialog
&
)
SAL_DELETED_FUNCTION
;
private
:
private
:
boost
::
ptr_vector
<
ImplBtnDlgItem
>
ma
ItemList
;
std
::
vector
<
std
::
unique_ptr
<
ImplBtnDlgItem
>>
m_
ItemList
;
Size
maPageSize
;
Size
maPageSize
;
Size
maCtrlSize
;
Size
maCtrlSize
;
long
mnButtonSize
;
long
mnButtonSize
;
...
...
vcl/source/window/btndlg.cxx
Dosyayı görüntüle @
7068b56b
...
@@ -24,8 +24,6 @@
...
@@ -24,8 +24,6 @@
#include <vcl/button.hxx>
#include <vcl/button.hxx>
#include <vcl/btndlg.hxx>
#include <vcl/btndlg.hxx>
typedef
boost
::
ptr_vector
<
ImplBtnDlgItem
>::
iterator
btn_iterator
;
typedef
boost
::
ptr_vector
<
ImplBtnDlgItem
>::
const_iterator
btn_const_iterator
;
struct
ImplBtnDlgItem
struct
ImplBtnDlgItem
{
{
...
@@ -64,12 +62,12 @@ ButtonDialog::~ButtonDialog()
...
@@ -64,12 +62,12 @@ ButtonDialog::~ButtonDialog()
void
ButtonDialog
::
dispose
()
void
ButtonDialog
::
dispose
()
{
{
for
(
btn_iterator
it
=
maItemList
.
begin
();
it
!=
maItemList
.
end
();
++
i
t
)
for
(
auto
&
it
:
m_ItemLis
t
)
{
{
if
(
it
->
mbOwnButton
)
if
(
it
->
mbOwnButton
)
it
->
mpPushButton
.
disposeAndClear
();
it
->
mpPushButton
.
disposeAndClear
();
}
}
m
a
ItemList
.
clear
();
m
_
ItemList
.
clear
();
Dialog
::
dispose
();
Dialog
::
dispose
();
}
}
...
@@ -97,7 +95,7 @@ VclPtr<PushButton> ButtonDialog::ImplCreatePushButton( ButtonDialogFlags nBtnFla
...
@@ -97,7 +95,7 @@ VclPtr<PushButton> ButtonDialog::ImplCreatePushButton( ButtonDialogFlags nBtnFla
ImplBtnDlgItem
*
ButtonDialog
::
ImplGetItem
(
sal_uInt16
nId
)
const
ImplBtnDlgItem
*
ButtonDialog
::
ImplGetItem
(
sal_uInt16
nId
)
const
{
{
for
(
btn_const_iterator
it
=
maItemList
.
begin
();
it
!=
maItemList
.
end
();
++
i
t
)
for
(
auto
&
it
:
m_ItemLis
t
)
{
{
if
(
it
->
mnId
==
nId
)
if
(
it
->
mnId
==
nId
)
return
const_cast
<
ImplBtnDlgItem
*>
(
&
(
*
it
));
return
const_cast
<
ImplBtnDlgItem
*>
(
&
(
*
it
));
...
@@ -116,7 +114,7 @@ long ButtonDialog::ImplGetButtonSize()
...
@@ -116,7 +114,7 @@ long ButtonDialog::ImplGetButtonSize()
long
nSepSize
=
0
;
long
nSepSize
=
0
;
maCtrlSize
=
Size
(
IMPL_MINSIZE_BUTTON_WIDTH
,
IMPL_MINSIZE_BUTTON_HEIGHT
);
maCtrlSize
=
Size
(
IMPL_MINSIZE_BUTTON_WIDTH
,
IMPL_MINSIZE_BUTTON_HEIGHT
);
for
(
btn_iterator
it
=
maItemList
.
begin
();
it
!=
maItemList
.
end
();
++
i
t
)
for
(
auto
&
it
:
m_ItemLis
t
)
{
{
nSepSize
+=
nLastSepSize
;
nSepSize
+=
nLastSepSize
;
...
@@ -140,7 +138,7 @@ long ButtonDialog::ImplGetButtonSize()
...
@@ -140,7 +138,7 @@ long ButtonDialog::ImplGetButtonSize()
nLastSepSize
=
IMPL_SEP_BUTTON_Y
;
nLastSepSize
=
IMPL_SEP_BUTTON_Y
;
}
}
long
nButtonCount
=
ma
ItemList
.
size
();
size_t
const
nButtonCount
=
m_
ItemList
.
size
();
if
(
GetStyle
()
&
WB_HORZ
)
if
(
GetStyle
()
&
WB_HORZ
)
mnButtonSize
=
nSepSize
+
(
nButtonCount
*
maCtrlSize
.
Width
());
mnButtonSize
=
nSepSize
+
(
nButtonCount
*
maCtrlSize
.
Width
());
...
@@ -192,7 +190,7 @@ void ButtonDialog::ImplPosControls()
...
@@ -192,7 +190,7 @@ void ButtonDialog::ImplPosControls()
}
}
// Arrange PushButtons
// Arrange PushButtons
for
(
btn_iterator
it
=
maItemList
.
begin
();
it
!=
maItemList
.
end
();
++
i
t
)
for
(
auto
&
it
:
m_ItemLis
t
)
{
{
if
(
GetStyle
()
&
WB_HORZ
)
if
(
GetStyle
()
&
WB_HORZ
)
nX
+=
it
->
mnSepSize
;
nX
+=
it
->
mnSepSize
;
...
@@ -215,7 +213,7 @@ void ButtonDialog::ImplPosControls()
...
@@ -215,7 +213,7 @@ void ButtonDialog::ImplPosControls()
IMPL_LINK
(
ButtonDialog
,
ImplClickHdl
,
PushButton
*
,
pBtn
)
IMPL_LINK
(
ButtonDialog
,
ImplClickHdl
,
PushButton
*
,
pBtn
)
{
{
for
(
btn_iterator
it
=
maItemList
.
begin
();
it
!=
maItemList
.
end
();
++
i
t
)
for
(
auto
&
it
:
m_ItemLis
t
)
{
{
if
(
it
->
mpPushButton
==
pBtn
)
if
(
it
->
mpPushButton
==
pBtn
)
{
{
...
@@ -237,7 +235,7 @@ void ButtonDialog::StateChanged( StateChangedType nType )
...
@@ -237,7 +235,7 @@ void ButtonDialog::StateChanged( StateChangedType nType )
if
(
nType
==
StateChangedType
::
InitShow
)
if
(
nType
==
StateChangedType
::
InitShow
)
{
{
ImplPosControls
();
ImplPosControls
();
for
(
btn_iterator
it
=
maItemList
.
begin
();
it
!=
maItemList
.
end
();
++
i
t
)
for
(
auto
&
it
:
m_ItemLis
t
)
{
{
if
(
it
->
mpPushButton
&&
it
->
mbOwnButton
)
if
(
it
->
mpPushButton
&&
it
->
mbOwnButton
)
it
->
mpPushButton
->
SetZOrder
(
0
,
ZOrderFlags
::
Last
);
it
->
mpPushButton
->
SetZOrder
(
0
,
ZOrderFlags
::
Last
);
...
@@ -246,7 +244,7 @@ void ButtonDialog::StateChanged( StateChangedType nType )
...
@@ -246,7 +244,7 @@ void ButtonDialog::StateChanged( StateChangedType nType )
// Set focus on default button.
// Set focus on default button.
if
(
mnFocusButtonId
!=
BUTTONDIALOG_BUTTON_NOTFOUND
)
if
(
mnFocusButtonId
!=
BUTTONDIALOG_BUTTON_NOTFOUND
)
{
{
for
(
btn_iterator
it
=
maItemList
.
begin
();
it
!=
maItemList
.
end
();
++
i
t
)
for
(
auto
&
it
:
m_ItemLis
t
)
{
{
if
(
it
->
mnId
==
mnFocusButtonId
)
if
(
it
->
mnId
==
mnFocusButtonId
)
{
{
...
@@ -277,7 +275,7 @@ void ButtonDialog::AddButton( const OUString& rText, sal_uInt16 nId,
...
@@ -277,7 +275,7 @@ void ButtonDialog::AddButton( const OUString& rText, sal_uInt16 nId,
ButtonDialogFlags
nBtnFlags
,
long
nSepPixel
)
ButtonDialogFlags
nBtnFlags
,
long
nSepPixel
)
{
{
// PageItem anlegen
// PageItem anlegen
ImplBtnDlgItem
*
pItem
=
new
ImplBtnDlgItem
;
std
::
unique_ptr
<
ImplBtnDlgItem
>
pItem
(
new
ImplBtnDlgItem
)
;
pItem
->
mnId
=
nId
;
pItem
->
mnId
=
nId
;
pItem
->
mbOwnButton
=
true
;
pItem
->
mbOwnButton
=
true
;
pItem
->
mnSepSize
=
nSepPixel
;
pItem
->
mnSepSize
=
nSepPixel
;
...
@@ -286,7 +284,7 @@ void ButtonDialog::AddButton( const OUString& rText, sal_uInt16 nId,
...
@@ -286,7 +284,7 @@ void ButtonDialog::AddButton( const OUString& rText, sal_uInt16 nId,
if
(
!
rText
.
isEmpty
())
if
(
!
rText
.
isEmpty
())
pItem
->
mpPushButton
->
SetText
(
rText
);
pItem
->
mpPushButton
->
SetText
(
rText
);
m
aItemList
.
push_back
(
pItem
);
m
_ItemList
.
push_back
(
std
::
move
(
pItem
)
);
if
(
nBtnFlags
&
ButtonDialogFlags
::
Focus
)
if
(
nBtnFlags
&
ButtonDialogFlags
::
Focus
)
mnFocusButtonId
=
nId
;
mnFocusButtonId
=
nId
;
...
@@ -298,7 +296,7 @@ void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId,
...
@@ -298,7 +296,7 @@ void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId,
ButtonDialogFlags
nBtnFlags
,
long
nSepPixel
)
ButtonDialogFlags
nBtnFlags
,
long
nSepPixel
)
{
{
// PageItem anlegen
// PageItem anlegen
ImplBtnDlgItem
*
pItem
=
new
ImplBtnDlgItem
;
std
::
unique_ptr
<
ImplBtnDlgItem
>
pItem
(
new
ImplBtnDlgItem
)
;
pItem
->
mnId
=
nId
;
pItem
->
mnId
=
nId
;
pItem
->
mbOwnButton
=
true
;
pItem
->
mbOwnButton
=
true
;
pItem
->
mnSepSize
=
nSepPixel
;
pItem
->
mnSepSize
=
nSepPixel
;
...
@@ -322,23 +320,24 @@ void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId,
...
@@ -322,23 +320,24 @@ void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId,
if
(
nBtnFlags
&
ButtonDialogFlags
::
Focus
)
if
(
nBtnFlags
&
ButtonDialogFlags
::
Focus
)
mnFocusButtonId
=
nId
;
mnFocusButtonId
=
nId
;
m
aItemList
.
push_back
(
pItem
);
m
_ItemList
.
push_back
(
std
::
move
(
pItem
)
);
mbFormat
=
true
;
mbFormat
=
true
;
}
}
void
ButtonDialog
::
RemoveButton
(
sal_uInt16
nId
)
void
ButtonDialog
::
RemoveButton
(
sal_uInt16
nId
)
{
{
for
(
btn_iterator
it
=
maItemList
.
begin
();
it
!=
maItemList
.
end
();
++
it
)
for
(
std
::
vector
<
std
::
unique_ptr
<
ImplBtnDlgItem
>>::
iterator
it
=
m_ItemList
.
begin
();
it
!=
m_ItemList
.
end
();
++
it
)
{
{
if
(
it
->
mnId
==
nId
)
if
(
(
*
it
)
->
mnId
==
nId
)
{
{
it
->
mpPushButton
->
Hide
();
(
*
it
)
->
mpPushButton
->
Hide
();
if
(
it
->
mbOwnButton
)
if
(
(
*
it
)
->
mbOwnButton
)
it
->
mpPushButton
.
disposeAndClear
();
(
*
it
)
->
mpPushButton
.
disposeAndClear
();
else
else
it
->
mpPushButton
.
clear
();
(
*
it
)
->
mpPushButton
.
clear
();
m
a
ItemList
.
erase
(
it
);
m
_
ItemList
.
erase
(
it
);
return
;
return
;
}
}
}
}
...
@@ -348,21 +347,21 @@ void ButtonDialog::RemoveButton( sal_uInt16 nId )
...
@@ -348,21 +347,21 @@ void ButtonDialog::RemoveButton( sal_uInt16 nId )
void
ButtonDialog
::
Clear
()
void
ButtonDialog
::
Clear
()
{
{
for
(
btn_iterator
it
=
maItemList
.
begin
();
it
!=
maItemList
.
end
();
++
i
t
)
for
(
auto
&
it
:
m_ItemLis
t
)
{
{
it
->
mpPushButton
->
Hide
();
it
->
mpPushButton
->
Hide
();
if
(
it
->
mbOwnButton
)
if
(
it
->
mbOwnButton
)
it
->
mpPushButton
.
disposeAndClear
();
it
->
mpPushButton
.
disposeAndClear
();
}
}
m
a
ItemList
.
clear
();
m
_
ItemList
.
clear
();
mbFormat
=
true
;
mbFormat
=
true
;
}
}
sal_uInt16
ButtonDialog
::
GetButtonId
(
sal_uInt16
nButton
)
const
sal_uInt16
ButtonDialog
::
GetButtonId
(
sal_uInt16
nButton
)
const
{
{
if
(
nButton
<
m
a
ItemList
.
size
()
)
if
(
nButton
<
m
_
ItemList
.
size
()
)
return
m
aItemList
[
nButton
].
mnId
;
return
m
_ItemList
[
nButton
]
->
mnId
;
else
else
return
BUTTONDIALOG_BUTTON_NOTFOUND
;
return
BUTTONDIALOG_BUTTON_NOTFOUND
;
}
}
...
...
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