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
fb31134e
Kaydet (Commit)
fb31134e
authored
May 14, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
refactor cui tabpages controls to use RenderContext
Change-Id: I91db162053cddfd669abe081e39bb85d3ee3e1f5
üst
9fd81f77
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
198 additions
and
344 deletions
+198
-344
backgrnd.cxx
cui/source/tabpages/backgrnd.cxx
+53
-142
numfmt.cxx
cui/source/tabpages/numfmt.cxx
+16
-17
numpages.cxx
cui/source/tabpages/numpages.cxx
+75
-85
tabstpge.cxx
cui/source/tabpages/tabstpge.cxx
+54
-100
No files found.
cui/source/tabpages/backgrnd.cxx
Dosyayı görüntüle @
fb31134e
...
...
@@ -37,11 +37,6 @@
#include <editeng/editrids.hrc>
#include <editeng/eerdll.hxx>
// table background
#define TBL_DEST_CELL 0
#define TBL_DEST_ROW 1
#define TBL_DEST_TBL 2
#include <editeng/brushitem.hxx>
#include "backgrnd.hxx"
...
...
@@ -58,8 +53,12 @@
#include <svtools/grfmgr.hxx>
#include <boost/scoped_ptr.hpp>
using
namespace
::
com
::
sun
::
star
;
// static ----------------------------------------------------------------
using
namespace
css
;
// table background
#define TBL_DEST_CELL 0
#define TBL_DEST_ROW 1
#define TBL_DEST_TBL 2
const
sal_uInt16
SvxBackgroundTabPage
::
pPageRanges
[]
=
{
...
...
@@ -142,14 +141,15 @@ static drawing::FillStyle lcl_getFillStyle(ListBox* pLbSelect)
static
void
lcl_setFillStyle
(
ListBox
*
pLbSelect
,
drawing
::
FillStyle
eStyle
)
{
for
(
int
i
=
0
;
i
<
pLbSelect
->
GetEntryCount
();
++
i
)
{
if
((
drawing
::
FillStyle
)
reinterpret_cast
<
sal_uLong
>
(
pLbSelect
->
GetEntryData
(
i
))
==
eStyle
)
{
pLbSelect
->
SelectEntryPos
(
i
);
return
;
}
}
}
sal_uInt16
GetItemId_Impl
(
ValueSet
&
rValueSet
,
const
Color
&
rCol
)
{
bool
bFound
=
false
;
...
...
@@ -170,13 +170,8 @@ sal_uInt16 GetItemId_Impl( ValueSet& rValueSet, const Color& rCol )
return
bFound
?
n
:
0
;
}
// class BackgroundPreview -----------------------------------------------
/* [Description]
preview window for brush or bitmap
*/
/** Preview window for brush or bitmap */
class
BackgroundPreviewImpl
:
public
vcl
::
Window
{
public
:
...
...
@@ -228,8 +223,6 @@ void BackgroundPreviewImpl::setBmp(bool bBmp)
Invalidate
();
}
BackgroundPreviewImpl
::~
BackgroundPreviewImpl
()
{
disposeOnce
();
...
...
@@ -255,29 +248,27 @@ void BackgroundPreviewImpl::NotifyChange( const Color& rColor )
}
}
void
BackgroundPreviewImpl
::
NotifyChange
(
const
Bitmap
*
pNewBitmap
)
{
if
(
bIsBmp
&&
(
pNewBitmap
||
pBitmap
)
)
if
(
bIsBmp
&&
(
pNewBitmap
||
pBitmap
)
)
{
if
(
pNewBitmap
&&
pBitmap
)
if
(
pNewBitmap
&&
pBitmap
)
*
pBitmap
=
*
pNewBitmap
;
else
if
(
pNewBitmap
&&
!
pBitmap
)
pBitmap
=
new
Bitmap
(
*
pNewBitmap
);
else
if
(
!
pNewBitmap
)
DELETEZ
(
pBitmap
);
else
if
(
pNewBitmap
&&
!
pBitmap
)
pBitmap
=
new
Bitmap
(
*
pNewBitmap
);
else
if
(
!
pNewBitmap
)
DELETEZ
(
pBitmap
);
recalcDrawPos
();
Invalidate
(
aDrawRect
);
Invalidate
(
aDrawRect
);
Update
();
}
}
void
BackgroundPreviewImpl
::
recalcDrawPos
()
{
if
(
pBitmap
)
if
(
pBitmap
)
{
Size
aSize
=
GetOutputSizePixel
();
// InnerSize == Size without one pixel border
...
...
@@ -287,10 +278,10 @@ void BackgroundPreviewImpl::recalcDrawPos()
aDrawSize
=
pBitmap
->
GetSizePixel
();
// bitmap bigger than preview window?
if
(
aDrawSize
.
Width
()
>
aInnerSize
.
Width
()
)
if
(
aDrawSize
.
Width
()
>
aInnerSize
.
Width
()
)
{
aDrawSize
.
Height
()
=
aDrawSize
.
Height
()
*
aInnerSize
.
Width
()
/
aDrawSize
.
Width
();
if
(
aDrawSize
.
Height
()
>
aInnerSize
.
Height
()
)
if
(
aDrawSize
.
Height
()
>
aInnerSize
.
Height
()
)
{
aDrawSize
.
Width
()
=
aDrawSize
.
Height
();
aDrawSize
.
Height
()
=
aInnerSize
.
Height
();
...
...
@@ -298,10 +289,10 @@ void BackgroundPreviewImpl::recalcDrawPos()
else
aDrawSize
.
Width
()
=
aInnerSize
.
Width
();
}
else
if
(
aDrawSize
.
Height
()
>
aInnerSize
.
Height
()
)
else
if
(
aDrawSize
.
Height
()
>
aInnerSize
.
Height
()
)
{
aDrawSize
.
Width
()
=
aDrawSize
.
Width
()
*
aInnerSize
.
Height
()
/
aDrawSize
.
Height
();
if
(
aDrawSize
.
Width
()
>
aInnerSize
.
Width
()
)
if
(
aDrawSize
.
Width
()
>
aInnerSize
.
Width
()
)
{
aDrawSize
.
Height
()
=
aDrawSize
.
Width
();
aDrawSize
.
Width
()
=
aInnerSize
.
Width
();
...
...
@@ -322,25 +313,27 @@ void BackgroundPreviewImpl::Resize()
recalcDrawPos
();
}
void
BackgroundPreviewImpl
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
)
{
const
StyleSettings
&
rStyleSettings
=
rRenderContext
.
GetSettings
().
GetStyleSettings
();
rRenderContext
.
SetBackground
(
Wallpaper
(
rStyleSettings
.
GetWindowColor
()));
rRenderContext
.
SetLineColor
();
if
(
bIsBmp
)
{
rRenderContext
.
SetFillColor
(
Color
(
COL_TRANSPARENT
));
}
rRenderContext
.
DrawRect
(
aDrawRect
);
void
BackgroundPreviewImpl
::
Paint
(
vcl
::
RenderContext
&
/*rRenderContext*/
,
const
Rectangle
&
)
{
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
SetBackground
(
Wallpaper
(
rStyleSettings
.
GetWindowColor
()));
SetLineColor
();
if
(
bIsBmp
)
SetFillColor
(
Color
(
COL_TRANSPARENT
)
);
DrawRect
(
aDrawRect
);
if
(
bIsBmp
)
{
if
(
pBitmap
)
DrawBitmap
(
aDrawPos
,
aDrawSize
,
*
pBitmap
);
if
(
bIsBmp
)
{
if
(
pBitmap
)
rRenderContext
.
DrawBitmap
(
aDrawPos
,
aDrawSize
,
*
pBitmap
);
else
{
Size
aSize
=
GetOutputSizePixel
();
DrawLine
(
Point
(
0
,
0
),
Point
(
aSize
.
Width
(),
aSize
.
Height
())
);
DrawLine
(
Point
(
0
,
aSize
.
Height
()),
Point
(
aSize
.
Width
(),
0
)
);
Size
aSize
=
rRenderContext
.
GetOutputSizePixel
();
rRenderContext
.
DrawLine
(
Point
(
0
,
0
),
Point
(
aSize
.
Width
(),
aSize
.
Height
())
);
rRenderContext
.
DrawLine
(
Point
(
0
,
aSize
.
Height
()),
Point
(
aSize
.
Width
(),
0
)
);
}
}
}
...
...
@@ -355,8 +348,6 @@ void BackgroundPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt )
Window
::
DataChanged
(
rDCEvt
);
}
// class SvxBackgroundTabPage --------------------------------------------
#define HDL(hdl) LINK(this,SvxBackgroundTabPage,hdl)
SvxBackgroundTabPage
::
SvxBackgroundTabPage
(
vcl
::
Window
*
pParent
,
const
SfxItemSet
&
rCoreSet
)
...
...
@@ -426,8 +417,6 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe
m_pBackgroundColorSet
->
SetText
(
SVX_RESSTR
(
RID_SVXSTR_TRANSPARENT
));
}
SvxBackgroundTabPage
::~
SvxBackgroundTabPage
()
{
disposeOnce
();
...
...
@@ -491,16 +480,11 @@ void SvxBackgroundTabPage::dispose()
SvxTabPage
::
dispose
();
}
VclPtr
<
SfxTabPage
>
SvxBackgroundTabPage
::
Create
(
vcl
::
Window
*
pParent
,
const
SfxItemSet
*
rAttrSet
)
VclPtr
<
SfxTabPage
>
SvxBackgroundTabPage
::
Create
(
vcl
::
Window
*
pParent
,
const
SfxItemSet
*
rAttrSet
)
{
return
VclPtr
<
SfxTabPage
>
(
new
SvxBackgroundTabPage
(
pParent
,
*
rAttrSet
),
SAL_NO_ACQUIRE
);
}
void
SvxBackgroundTabPage
::
Reset
(
const
SfxItemSet
*
rSet
)
{
// os: Such a nonsense! One will always find such an item somewhere,
...
...
@@ -728,26 +712,18 @@ void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet )
m_pBtnLink
->
Show
(
false
);
}
void
SvxBackgroundTabPage
::
FillUserData
()
/* [Description]
When destroying a SfxTabPage this virtual method is called,
/** When destroying a SfxTabPage this virtual method is called,
so that the TabPage can save internal information.
In this case the condition of the preview button is saved.
*/
void
SvxBackgroundTabPage
::
FillUserData
()
{
SetUserData
(
m_pBtnPreview
->
IsChecked
()
?
OUString
(
'1'
)
:
OUString
(
'0'
)
);
}
bool
SvxBackgroundTabPage
::
FillItemSet
(
SfxItemSet
*
rCoreSet
)
{
if
(
pPageImpl
->
pLoadIdle
&&
pPageImpl
->
pLoadIdle
->
IsActive
()
)
...
...
@@ -1078,15 +1054,8 @@ bool SvxBackgroundTabPage::FillItemSetWithWallpaperItem( SfxItemSet& rCoreSet, s
return
bModified
;
}
/** virtual method; is called on deactivation */
SfxTabPage
::
sfxpg
SvxBackgroundTabPage
::
DeactivatePage
(
SfxItemSet
*
_pSet
)
/* [Description]
virtual method; is called on deactivation
*/
{
if
(
pPageImpl
->
bIsImportDlgInExecute
)
return
KEEP_PAGE
;
...
...
@@ -1097,15 +1066,11 @@ SfxTabPage::sfxpg SvxBackgroundTabPage::DeactivatePage( SfxItemSet* _pSet )
return
LEAVE_PAGE
;
}
void
SvxBackgroundTabPage
::
PointChanged
(
vcl
::
Window
*
,
RECT_POINT
)
{
// has to be implemented so that position control can work
}
void
SvxBackgroundTabPage
::
ShowSelector
()
{
if
(
bAllowShowSelector
)
...
...
@@ -1136,9 +1101,6 @@ void SvxBackgroundTabPage::ShowSelector()
}
}
void
SvxBackgroundTabPage
::
RaiseLoadError_Impl
()
{
SfxErrorContext
aContext
(
ERRCTX_SVX_BACKGROUND
,
...
...
@@ -1152,8 +1114,6 @@ void SvxBackgroundTabPage::RaiseLoadError_Impl()
aBgdGraphicPath
)
);
}
bool
SvxBackgroundTabPage
::
LoadLinkedGraphic_Impl
()
{
bool
bResult
=
(
!
aBgdGraphicPath
.
isEmpty
()
)
&&
...
...
@@ -1163,9 +1123,6 @@ bool SvxBackgroundTabPage::LoadLinkedGraphic_Impl()
return
bResult
;
}
void
SvxBackgroundTabPage
::
FillColorValueSets_Impl
()
{
SfxObjectShell
*
pDocSh
=
SfxObjectShell
::
Current
();
...
...
@@ -1190,20 +1147,10 @@ void SvxBackgroundTabPage::FillColorValueSets_Impl()
m_pBackgroundColorSet
->
SetColCount
(
SvxColorValueSet
::
getColumnCount
());
}
void
SvxBackgroundTabPage
::
ShowColorUI_Impl
()
/* [Description]
Hide the controls for editing the bitmap
/** Hide the controls for editing the bitmap
and show the controls for color settings instead.
*/
void
SvxBackgroundTabPage
::
ShowColorUI_Impl
()
{
if
(
!
m_pBackGroundColorFrame
->
IsVisible
())
{
...
...
@@ -1223,16 +1170,10 @@ void SvxBackgroundTabPage::HideColorUI_Impl()
m_pBackGroundColorFrame
->
Hide
();
}
void
SvxBackgroundTabPage
::
ShowBitmapUI_Impl
()
/* [Description]
Hide the controls for color settings
/** Hide the controls for color settings
and show controls for editing the bitmap instead.
*/
void
SvxBackgroundTabPage
::
ShowBitmapUI_Impl
()
{
if
(
m_pLbSelect
->
IsVisible
()
&&
(
m_pBackGroundColorFrame
->
IsVisible
()
||
!
m_pFileFrame
->
IsVisible
()))
...
...
@@ -1310,8 +1251,6 @@ void SvxBackgroundTabPage::SetGraphicPosition_Impl( SvxGraphicPosition ePos )
m_pWndPosition
->
Invalidate
();
}
SvxGraphicPosition
SvxBackgroundTabPage
::
GetGraphicPosition_Impl
()
{
if
(
m_pBtnTile
->
IsChecked
()
)
...
...
@@ -1339,11 +1278,8 @@ SvxGraphicPosition SvxBackgroundTabPage::GetGraphicPosition_Impl()
// Handler
/** Handler, called when color selection is changed */
IMPL_LINK_NOARG
(
SvxBackgroundTabPage
,
BackgroundColorHdl_Impl
)
/*
Handler, called when color selection is changed
*/
{
sal_uInt16
nItemId
=
m_pBackgroundColorSet
->
GetSelectItemId
();
Color
aColor
=
nItemId
?
(
m_pBackgroundColorSet
->
GetItemColor
(
nItemId
)
)
:
Color
(
COL_TRANSPARENT
);
...
...
@@ -1355,8 +1291,6 @@ IMPL_LINK_NOARG(SvxBackgroundTabPage, BackgroundColorHdl_Impl)
return
0
;
}
IMPL_LINK_NOARG
(
SvxBackgroundTabPage
,
SelectHdl_Impl
)
{
if
(
drawing
::
FillStyle_SOLID
==
lcl_getFillStyle
(
m_pLbSelect
)
)
...
...
@@ -1372,8 +1306,6 @@ IMPL_LINK_NOARG(SvxBackgroundTabPage, SelectHdl_Impl)
return
0
;
}
IMPL_LINK
(
SvxBackgroundTabPage
,
FileClickHdl_Impl
,
CheckBox
*
,
pBox
)
{
if
(
m_pBtnLink
==
pBox
)
...
...
@@ -1421,8 +1353,6 @@ IMPL_LINK( SvxBackgroundTabPage, FileClickHdl_Impl, CheckBox*, pBox )
return
0
;
}
IMPL_LINK
(
SvxBackgroundTabPage
,
RadioClickHdl_Impl
,
RadioButton
*
,
pBtn
)
{
if
(
pBtn
==
m_pBtnPosition
)
...
...
@@ -1441,14 +1371,10 @@ IMPL_LINK( SvxBackgroundTabPage, RadioClickHdl_Impl, RadioButton*, pBtn )
return
0
;
}
IMPL_LINK_NOARG
(
SvxBackgroundTabPage
,
BrowseHdl_Impl
)
/* [Description]
Handler, called by pressing the browse button.
/** Handler, called by pressing the browse button.
Create graphic/insert dialog, set path and start.
*/
IMPL_LINK_NOARG
(
SvxBackgroundTabPage
,
BrowseHdl_Impl
)
{
if
(
pPageImpl
->
pLoadIdle
->
IsActive
()
)
return
0
;
...
...
@@ -1481,17 +1407,11 @@ IMPL_LINK_NOARG(SvxBackgroundTabPage, BrowseHdl_Impl)
return
0
;
}
IMPL_LINK_TYPED
(
SvxBackgroundTabPage
,
LoadIdleHdl_Impl
,
Idle
*
,
pIdle
,
void
)
/* [Description]
Delayed loading of the graphic.
/** Delayed loading of the graphic.
Graphic is only loaded, if it's
different to the current graphic.
*/
IMPL_LINK_TYPED
(
SvxBackgroundTabPage
,
LoadIdleHdl_Impl
,
Idle
*
,
pIdle
,
void
)
{
if
(
pIdle
==
pPageImpl
->
pLoadIdle
)
{
...
...
@@ -1541,8 +1461,6 @@ IMPL_LINK_TYPED( SvxBackgroundTabPage, LoadIdleHdl_Impl, Idle* , pIdle, void )
}
}
void
SvxBackgroundTabPage
::
ShowTblControl
()
{
m_pTblLBox
->
SetSelectHdl
(
HDL
(
TblDestinationHdl_Impl
)
);
...
...
@@ -1552,8 +1470,6 @@ void SvxBackgroundTabPage::ShowTblControl()
m_pAsGrid
->
Show
();
}
void
SvxBackgroundTabPage
::
ShowParaControl
(
bool
bCharOnly
)
{
m_pParaLBox
->
SetSelectHdl
(
HDL
(
ParaDestinationHdl_Impl
));
...
...
@@ -1567,7 +1483,6 @@ void SvxBackgroundTabPage::ShowParaControl(bool bCharOnly)
m_pParaLBox
->
SetData
(
m_pParaLBox
);
// here it can be recognized that this mode is turned on
}
IMPL_LINK
(
SvxBackgroundTabPage
,
TblDestinationHdl_Impl
,
ListBox
*
,
pBox
)
{
sal_Int32
nSelPos
=
pBox
->
GetSelectEntryPos
();
...
...
@@ -1656,8 +1571,6 @@ IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox )
return
0
;
}
IMPL_LINK
(
SvxBackgroundTabPage
,
ParaDestinationHdl_Impl
,
ListBox
*
,
pBox
)
{
sal_Int32
nSelPos
=
pBox
->
GetSelectEntryPos
();
...
...
@@ -1720,8 +1633,6 @@ IMPL_LINK( SvxBackgroundTabPage, ParaDestinationHdl_Impl, ListBox*, pBox )
return
0
;
}
void
SvxBackgroundTabPage
::
FillControls_Impl
(
const
SvxBrushItem
&
rBgdAttr
,
const
OUString
&
rUserData
)
{
...
...
@@ -1798,7 +1709,7 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
m_pBtnLink
->
Disable
();
}
if
(
bGraphTransparency
)
if
(
bGraphTransparency
)
{
const
GraphicObject
*
pObject
=
rBgdAttr
.
GetGraphicObject
();
if
(
pObject
)
...
...
cui/source/tabpages/numfmt.cxx
Dosyayı görüntüle @
fb31134e
...
...
@@ -145,36 +145,35 @@ void SvxNumberPreview::NotifyChange( const OUString& rPrevStr,
#*
#************************************************************************/
void
SvxNumberPreview
::
Paint
(
vcl
::
RenderContext
&
/*rRenderContext*/
,
const
Rectangle
&
)
void
SvxNumberPreview
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
)
{
vcl
::
Font
aDrawFont
=
GetFont
();
Size
aSzWnd
=
GetOutputSizePixel
();
vcl
::
Font
aDrawFont
=
rRenderContext
.
GetFont
();
Size
aSzWnd
=
rRenderContext
.
GetOutputSizePixel
();
OUString
aTmpStr
(
aPrevStr
);
long
nLeadSpace
=
(
aSzWnd
.
Width
()
-
GetTextWidth
(
aTmpStr
))
/
2
;
long
nLeadSpace
=
(
aSzWnd
.
Width
()
-
rRenderContext
.
GetTextWidth
(
aTmpStr
))
/
2
;
aDrawFont
.
SetColor
(
aPrevCol
);
SetFont
(
aDrawFont
);
aDrawFont
.
SetColor
(
aPrevCol
);
rRenderContext
.
SetFont
(
aDrawFont
);
if
(
mnPos
!=
-
1
)
if
(
mnPos
!=
-
1
)
{
long
nCharWidth
=
GetTextWidth
(
OUString
(
mnChar
)
);
long
nCharWidth
=
rRenderContext
.
GetTextWidth
(
OUString
(
mnChar
)
);
int
nNumCharsToInsert
=
0
;
if
(
nCharWidth
>
0
)
nNumCharsToInsert
=
nLeadSpace
/
nCharWidth
;
if
(
nCharWidth
>
0
)
nNumCharsToInsert
=
nLeadSpace
/
nCharWidth
;
if
(
nNumCharsToInsert
>
0
)
if
(
nNumCharsToInsert
>
0
)
{
for
(
int
i
=
0
;
i
<
nNumCharsToInsert
;
++
i
)
aTmpStr
=
aTmpStr
.
replaceAt
(
mnPos
,
0
,
OUString
(
mnChar
)
);
for
(
int
i
=
0
;
i
<
nNumCharsToInsert
;
++
i
)
aTmpStr
=
aTmpStr
.
replaceAt
(
mnPos
,
0
,
OUString
(
mnChar
)
);
}
}
Point
aPosText
=
Point
(
(
mnPos
!=
-
1
)
?
0
:
nLeadSpace
,
(
aSzWnd
.
Height
()
-
GetTextHeight
())
/
2
);
DrawText
(
aPosText
,
aTmpStr
);
Point
aPosText
=
Point
((
mnPos
!=
-
1
)
?
0
:
nLeadSpace
,
(
aSzWnd
.
Height
()
-
GetTextHeight
())
/
2
);
rRenderContext
.
DrawText
(
aPosText
,
aTmpStr
);
}
void
SvxNumberPreview
::
InitSettings
(
bool
bForeground
,
bool
bBackground
)
{
const
StyleSettings
&
rStyleSettings
=
Application
::
GetSettings
().
GetStyleSettings
();
...
...
cui/source/tabpages/numpages.cxx
Dosyayı görüntüle @
fb31134e
...
...
@@ -2477,32 +2477,32 @@ SvxNumberingPreview::SvxNumberingPreview(vcl::Window* pParent, WinBits nWinBits)
VCL_BUILDER_FACTORY_ARGS
(
SvxNumberingPreview
,
WB_BORDER
)
// paint preview of numeration
void
SvxNumberingPreview
::
Paint
(
vcl
::
RenderContext
&
/*rRenderContext*/
,
const
Rectangle
&
/*rRect*/
)
void
SvxNumberingPreview
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
/*rRect*/
)
{
Size
aSize
(
PixelToLogic
(
GetOutputSizePixel
()));
Size
aSize
(
rRenderContext
.
PixelToLogic
(
rRenderContext
.
GetOutputSizePixel
()));
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
const
StyleSettings
&
rStyleSettings
=
rRenderContext
.
GetSettings
().
GetStyleSettings
();
const
Color
aBackColor
=
rStyleSettings
.
GetFieldColor
();
const
Color
aTextColor
=
rStyleSettings
.
GetFieldTextColor
();
ScopedVclPtrInstance
<
VirtualDevice
>
pVDev
(
*
this
);
pVDev
->
EnableRTL
(
IsRTLEnabled
()
);
pVDev
->
SetMapMode
(
GetMapMode
());
pVDev
->
SetOutputSize
(
aSize
);
ScopedVclPtrInstance
<
VirtualDevice
>
pVDev
(
rRenderContext
);
pVDev
->
EnableRTL
(
rRenderContext
.
IsRTLEnabled
()
);
pVDev
->
SetMapMode
(
rRenderContext
.
GetMapMode
());
pVDev
->
SetOutputSize
(
aSize
);
Color
aLineColor
(
COL_LIGHTGRAY
);
if
(
aLineColor
==
aBackColor
)
if
(
aLineColor
==
aBackColor
)
aLineColor
.
Invert
();
pVDev
->
SetLineColor
(
aLineColor
);
pVDev
->
SetFillColor
(
aBackColor
);
pVDev
->
SetFillColor
(
aBackColor
);
if
(
pActNum
)
if
(
pActNum
)
{
sal_uInt16
nWidthRelation
;
if
(
nPageWidth
)
if
(
nPageWidth
)
{
nWidthRelation
=
sal_uInt16
(
nPageWidth
/
aSize
.
Width
());
if
(
bPosition
)
if
(
bPosition
)
nWidthRelation
=
nWidthRelation
*
2
/
3
;
else
nWidthRelation
=
nWidthRelation
/
4
;
...
...
@@ -2511,108 +2511,103 @@ void SvxNumberingPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const R
nWidthRelation
=
30
;
// chapter dialog
// height per level
sal_uInt16
nXStep
=
sal
::
static_int_cast
<
sal_uInt16
>
(
aSize
.
Width
()
/
(
3
*
pActNum
->
GetLevelCount
()));
if
(
pActNum
->
GetLevelCount
()
<
10
)
sal_uInt16
nXStep
=
sal
::
static_int_cast
<
sal_uInt16
>
(
aSize
.
Width
()
/
(
3
*
pActNum
->
GetLevelCount
()));
if
(
pActNum
->
GetLevelCount
()
<
10
)
nXStep
/=
2
;
sal_uInt16
nYStart
=
4
;
// the whole height mustn't be used for a single level
sal_uInt16
nYStep
=
sal
::
static_int_cast
<
sal_uInt16
>
((
aSize
.
Height
()
-
6
)
/
(
pActNum
->
GetLevelCount
()
>
1
?
pActNum
->
GetLevelCount
()
:
5
));
aStdFont
=
OutputDevice
::
GetDefaultFont
(
DefaultFontType
::
UI_SANS
,
MsLangId
::
getSystemLanguage
(),
DEFAULTFONT_FLAGS_ONLYONE
);
sal_uInt16
nYStep
=
sal
::
static_int_cast
<
sal_uInt16
>
((
aSize
.
Height
()
-
6
)
/
(
pActNum
->
GetLevelCount
()
>
1
?
pActNum
->
GetLevelCount
()
:
5
));
aStdFont
=
OutputDevice
::
GetDefaultFont
(
DefaultFontType
::
UI_SANS
,
MsLangId
::
getSystemLanguage
(),
DEFAULTFONT_FLAGS_ONLYONE
);
aStdFont
.
SetColor
(
aTextColor
);
aStdFont
.
SetFillColor
(
aBackColor
);
sal_uInt16
nFontHeight
=
nYStep
*
6
/
10
;
if
(
bPosition
)
if
(
bPosition
)
nFontHeight
=
nYStep
*
15
/
10
;
aStdFont
.
SetSize
(
Size
(
0
,
nFontHeight
));
SvxNodeNum
aNum
(
(
sal_uInt8
)
0
);
SvxNodeNum
aNum
(
sal_uInt8
(
0
)
);
sal_uInt16
nPreNum
=
pActNum
->
GetLevel
(
0
).
GetStart
();
if
(
bPosition
)
if
(
bPosition
)
{
sal_uInt16
nLineHeight
=
nFontHeight
*
8
/
7
;
sal_uInt8
nStart
=
0
;
while
(
!
(
nActLevel
&
(
1
<<
nStart
))
)
while
(
!
(
nActLevel
&
(
1
<<
nStart
))
)
{
nStart
++
;
}
if
(
nStart
)
if
(
nStart
)
nStart
--
;
sal_uInt8
nEnd
=
std
::
min
(
(
sal_uInt8
)(
nStart
+
3
),
(
sal_uInt8
)
pActNum
->
GetLevelCount
()
);
for
(
sal_uInt8
nLevel
=
nStart
;
nLevel
<
nEnd
;
++
nLevel
)
sal_uInt8
nEnd
=
std
::
min
(
sal_uInt8
(
nStart
+
3
),
sal_uInt8
(
pActNum
->
GetLevelCount
())
);
for
(
sal_uInt8
nLevel
=
nStart
;
nLevel
<
nEnd
;
++
nLevel
)
{
const
SvxNumberFormat
&
rFmt
=
pActNum
->
GetLevel
(
nLevel
);
aNum
.
GetLevelVal
()[
nLevel
]
=
rFmt
.
GetStart
();
aNum
.
GetLevelVal
()[
nLevel
]
=
rFmt
.
GetStart
();
sal_uInt16
nXStart
(
0
);
short
nTextOffset
(
0
);
sal_uInt16
nNumberXPos
(
0
);
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_WIDTH_AND_POSITION
)
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_WIDTH_AND_POSITION
)
{
nXStart
=
rFmt
.
GetAbsLSpace
()
/
nWidthRelation
;
nTextOffset
=
rFmt
.
GetCharTextDistance
()
/
nWidthRelation
;
nNumberXPos
=
nXStart
;
sal_uInt16
nFirstLineOffset
=
(
-
rFmt
.
GetFirstLineOffset
())
/
nWidthRelation
;
if
(
nFirstLineOffset
<=
nNumberXPos
)
if
(
nFirstLineOffset
<=
nNumberXPos
)
nNumberXPos
=
nNumberXPos
-
nFirstLineOffset
;
else
nNumberXPos
=
0
;
// in draw this is valid
if
(
nTextOffset
<
0
)
if
(
nTextOffset
<
0
)
nNumberXPos
=
nNumberXPos
+
nTextOffset
;
}
else
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_ALIGNMENT
)
else
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_ALIGNMENT
)
{
const
long
nTmpNumberXPos
(
(
rFmt
.
GetIndentAt
()
+
rFmt
.
GetFirstLineIndent
()
)
/
nWidthRelation
);
if
(
nTmpNumberXPos
<
0
)
const
long
nTmpNumberXPos
((
rFmt
.
GetIndentAt
()
+
rFmt
.
GetFirstLineIndent
()
)
/
nWidthRelation
);
if
(
nTmpNumberXPos
<
0
)
{
nNumberXPos
=
0
;
}
else
{
nNumberXPos
=
static_cast
<
sal_uInt16
>
(
nTmpNumberXPos
);
nNumberXPos
=
static_cast
<
sal_uInt16
>
(
nTmpNumberXPos
);
}
}
sal_uInt16
nBulletWidth
=
0
;
if
(
SVX_NUM_BITMAP
==
(
rFmt
.
GetNumberingType
()
&
(
~
LINK_TOKEN
)))
if
(
SVX_NUM_BITMAP
==
(
rFmt
.
GetNumberingType
()
&
(
~
LINK_TOKEN
)))
{
nBulletWidth
=
rFmt
.
IsShowSymbol
()
?
lcl_DrawGraphic
(
pVDev
.
get
(),
rFmt
,
nNumberXPos
,
nYStart
,
nWidthRelation
)
:
0
;
nBulletWidth
=
rFmt
.
IsShowSymbol
()
?
lcl_DrawGraphic
(
pVDev
.
get
(),
rFmt
,
nNumberXPos
,
nYStart
,
nWidthRelation
)
:
0
;
}
else
if
(
SVX_NUM_CHAR_SPECIAL
==
rFmt
.
GetNumberingType
()
)
else
if
(
SVX_NUM_CHAR_SPECIAL
==
rFmt
.
GetNumberingType
()
)
{
nBulletWidth
=
rFmt
.
IsShowSymbol
()
?
lcl_DrawBullet
(
pVDev
.
get
(),
rFmt
,
nNumberXPos
,
nYStart
,
aStdFont
.
GetSize
())
:
0
;
nBulletWidth
=
rFmt
.
IsShowSymbol
()
?
lcl_DrawBullet
(
pVDev
.
get
(),
rFmt
,
nNumberXPos
,
nYStart
,
aStdFont
.
GetSize
())
:
0
;
}
else
{
pVDev
->
SetFont
(
aStdFont
);
aNum
.
SetLevel
(
nLevel
);
if
(
pActNum
->
IsContinuousNumbering
())
aNum
.
SetLevel
(
nLevel
);
if
(
pActNum
->
IsContinuousNumbering
())
aNum
.
GetLevelVal
()[
nLevel
]
=
nPreNum
;
OUString
aText
(
pActNum
->
MakeNumString
(
aNum
));
vcl
::
Font
aSaveFont
=
pVDev
->
GetFont
();
vcl
::
Font
aColorFont
(
aSaveFont
);
Color
aTmpBulletColor
=
rFmt
.
GetBulletColor
();
if
(
aTmpBulletColor
.
GetColor
()
==
COL_AUTO
)
if
(
aTmpBulletColor
.
GetColor
()
==
COL_AUTO
)
aTmpBulletColor
=
Color
(
aBackColor
.
IsDark
()
?
COL_WHITE
:
COL_BLACK
);
else
if
(
aTmpBulletColor
==
aBackColor
)
else
if
(
aTmpBulletColor
==
aBackColor
)
aTmpBulletColor
.
Invert
();
aColorFont
.
SetColor
(
aTmpBulletColor
);
pVDev
->
SetFont
(
aColorFont
);
pVDev
->
DrawText
(
Point
(
nNumberXPos
,
nYStart
),
aText
);
pVDev
->
DrawText
(
Point
(
nNumberXPos
,
nYStart
),
aText
);
pVDev
->
SetFont
(
aSaveFont
);
nBulletWidth
=
(
sal_uInt16
)
pVDev
->
GetTextWidth
(
aText
);
nBulletWidth
=
sal_uInt16
(
pVDev
->
GetTextWidth
(
aText
)
);
nPreNum
++
;
}
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_ALIGNMENT
&&
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_ALIGNMENT
&&
rFmt
.
GetLabelFollowedBy
()
==
SvxNumberFormat
::
SPACE
)
{
pVDev
->
SetFont
(
aStdFont
);
...
...
@@ -2622,23 +2617,22 @@ void SvxNumberingPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const R
}
sal_uInt16
nTextXPos
(
0
);
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_WIDTH_AND_POSITION
)
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_WIDTH_AND_POSITION
)
{
nTextXPos
=
nXStart
;
if
(
nTextOffset
<
0
)
if
(
nTextOffset
<
0
)
nTextXPos
=
nTextXPos
+
nTextOffset
;
if
(
nNumberXPos
+
nBulletWidth
+
nTextOffset
>
nTextXPos
)
if
(
nNumberXPos
+
nBulletWidth
+
nTextOffset
>
nTextXPos
)
nTextXPos
=
nNumberXPos
+
nBulletWidth
+
nTextOffset
;
}
else
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_ALIGNMENT
)
else
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_ALIGNMENT
)
{
switch
(
rFmt
.
GetLabelFollowedBy
()
)
switch
(
rFmt
.
GetLabelFollowedBy
()
)
{
case
SvxNumberFormat
:
:
LISTTAB
:
{
nTextXPos
=
static_cast
<
sal_uInt16
>
(
rFmt
.
GetListtabPos
()
/
nWidthRelation
);
if
(
nTextXPos
<
nNumberXPos
+
nBulletWidth
)
nTextXPos
=
static_cast
<
sal_uInt16
>
(
rFmt
.
GetListtabPos
()
/
nWidthRelation
);
if
(
nTextXPos
<
nNumberXPos
+
nBulletWidth
)
{
nTextXPos
=
nNumberXPos
+
nBulletWidth
;
}
...
...
@@ -2652,46 +2646,44 @@ void SvxNumberingPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const R
break
;
}
nXStart
=
static_cast
<
sal_uInt16
>
(
rFmt
.
GetIndentAt
()
/
nWidthRelation
);
nXStart
=
static_cast
<
sal_uInt16
>
(
rFmt
.
GetIndentAt
()
/
nWidthRelation
);
}
Rectangle
aRect1
(
Point
(
nTextXPos
,
nYStart
+
nFontHeight
/
2
),
Size
(
aSize
.
Width
()
/
2
,
2
));
pVDev
->
SetFillColor
(
aBackColor
);
pVDev
->
DrawRect
(
aRect1
);
pVDev
->
SetFillColor
(
aBackColor
);
pVDev
->
DrawRect
(
aRect1
);
Rectangle
aRect2
(
Point
(
nXStart
,
nYStart
+
nLineHeight
+
nFontHeight
/
2
),
Size
(
aSize
.
Width
()
/
2
,
2
));
pVDev
->
DrawRect
(
aRect2
);
pVDev
->
DrawRect
(
aRect2
);
nYStart
+=
2
*
nLineHeight
;
}
}
else
{
//#i5153# painting gray or black rectangles as 'normal' numbering text
OUString
sMsg
(
"Preview"
);
OUString
sMsg
(
"Preview"
);
long
nWidth
=
pVDev
->
GetTextWidth
(
sMsg
);
long
nTextHeight
=
pVDev
->
GetTextHeight
();
long
nRectHeight
=
nTextHeight
*
2
/
3
;
long
nTopOffset
=
nTextHeight
-
nRectHeight
;
Color
aBlackColor
(
COL_BLACK
);
if
(
aBlackColor
==
aBackColor
)
if
(
aBlackColor
==
aBackColor
)
aBlackColor
.
Invert
();
for
(
sal_uInt8
nLevel
=
0
;
nLevel
<
pActNum
->
GetLevelCount
();
++
nLevel
,
nYStart
=
nYStart
+
nYStep
)
for
(
sal_uInt8
nLevel
=
0
;
nLevel
<
pActNum
->
GetLevelCount
();
++
nLevel
,
nYStart
=
nYStart
+
nYStep
)
{
const
SvxNumberFormat
&
rFmt
=
pActNum
->
GetLevel
(
nLevel
);
aNum
.
GetLevelVal
()[
nLevel
]
=
rFmt
.
GetStart
();
sal_uInt16
nXStart
(
0
);
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_WIDTH_AND_POSITION
)
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_WIDTH_AND_POSITION
)
{
nXStart
=
rFmt
.
GetAbsLSpace
()
/
nWidthRelation
;
}
else
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_ALIGNMENT
)
else
if
(
rFmt
.
GetPositionAndSpaceMode
()
==
SvxNumberFormat
::
LABEL_ALIGNMENT
)
{
const
long
nTmpXStart
(
(
rFmt
.
GetIndentAt
()
+
rFmt
.
GetFirstLineIndent
()
)
/
nWidthRelation
);
if
(
nTmpXStart
<
0
)
const
long
nTmpXStart
((
rFmt
.
GetIndentAt
()
+
rFmt
.
GetFirstLineIndent
()
)
/
nWidthRelation
);
if
(
nTmpXStart
<
0
)
{
nXStart
=
0
;
}
...
...
@@ -2703,17 +2695,17 @@ void SvxNumberingPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const R
nXStart
/=
2
;
nXStart
+=
2
;
sal_uInt16
nTextOffset
=
2
*
nXStep
;
if
(
SVX_NUM_BITMAP
==
(
rFmt
.
GetNumberingType
()
&
(
~
LINK_TOKEN
))
)
if
(
SVX_NUM_BITMAP
==
(
rFmt
.
GetNumberingType
()
&
(
~
LINK_TOKEN
))
)
{
if
(
rFmt
.
IsShowSymbol
())
if
(
rFmt
.
IsShowSymbol
())
{
nTextOffset
=
lcl_DrawGraphic
(
pVDev
.
get
(),
rFmt
,
nXStart
,
nYStart
,
nWidthRelation
);
nTextOffset
=
nTextOffset
+
nXStep
;
}
}
else
if
(
SVX_NUM_CHAR_SPECIAL
==
rFmt
.
GetNumberingType
()
)
else
if
(
SVX_NUM_CHAR_SPECIAL
==
rFmt
.
GetNumberingType
()
)
{
if
(
rFmt
.
IsShowSymbol
())
if
(
rFmt
.
IsShowSymbol
())
{
nTextOffset
=
lcl_DrawBullet
(
pVDev
.
get
(),
rFmt
,
nXStart
,
nYStart
,
aStdFont
.
GetSize
());
nTextOffset
=
nTextOffset
+
nXStep
;
...
...
@@ -2723,33 +2715,33 @@ void SvxNumberingPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const R
{
vcl
::
Font
aColorFont
(
aStdFont
);
Color
aTmpBulletColor
=
rFmt
.
GetBulletColor
();
if
(
aTmpBulletColor
.
GetColor
()
==
COL_AUTO
)
if
(
aTmpBulletColor
.
GetColor
()
==
COL_AUTO
)
aTmpBulletColor
=
Color
(
aBackColor
.
IsDark
()
?
COL_WHITE
:
COL_BLACK
);
else
if
(
aTmpBulletColor
==
aBackColor
)
else
if
(
aTmpBulletColor
==
aBackColor
)
aTmpBulletColor
.
Invert
();
aColorFont
.
SetColor
(
aTmpBulletColor
);
pVDev
->
SetFont
(
aColorFont
);
aNum
.
SetLevel
(
nLevel
);
if
(
pActNum
->
IsContinuousNumbering
())
if
(
pActNum
->
IsContinuousNumbering
())
aNum
.
GetLevelVal
()[
nLevel
]
=
nPreNum
;
OUString
aText
(
pActNum
->
MakeNumString
(
aNum
));
pVDev
->
DrawText
(
Point
(
nXStart
,
nYStart
),
aText
);
OUString
aText
(
pActNum
->
MakeNumString
(
aNum
));
pVDev
->
DrawText
(
Point
(
nXStart
,
nYStart
),
aText
);
pVDev
->
SetFont
(
aStdFont
);
nTextOffset
=
(
sal_uInt16
)
pVDev
->
GetTextWidth
(
aText
);
nTextOffset
=
nTextOffset
+
nXStep
;
nPreNum
++
;
}
if
(
pOutlineNames
)
if
(
pOutlineNames
)
{
//#i5153# outline numberings still use the style names as text
pVDev
->
SetFont
(
aStdFont
);
sMsg
=
pOutlineNames
[
nLevel
];
pVDev
->
DrawText
(
Point
(
nXStart
+
nTextOffset
,
nYStart
),
sMsg
);
pVDev
->
DrawText
(
Point
(
nXStart
+
nTextOffset
,
nYStart
),
sMsg
);
}
else
{
//#i5153# the selected rectangle(s) should be black
if
(
0
!=
(
nActLevel
&
(
1
<<
nLevel
)))
if
(
0
!=
(
nActLevel
&
(
1
<<
nLevel
)))
{
pVDev
->
SetFillColor
(
aBlackColor
);
pVDev
->
SetLineColor
(
aBlackColor
);
...
...
@@ -2766,9 +2758,7 @@ void SvxNumberingPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const R
}
}
}
DrawOutDev
(
Point
(
0
,
0
),
aSize
,
Point
(
0
,
0
),
aSize
,
*
pVDev
);
rRenderContext
.
DrawOutDev
(
Point
(),
aSize
,
Point
(),
aSize
,
*
pVDev
);
}
//See uiconfig/swriter/ui/outlinepositionpage.ui for effectively a duplicate
...
...
cui/source/tabpages/tabstpge.cxx
Dosyayı görüntüle @
fb31134e
...
...
@@ -54,7 +54,7 @@ public:
virtual
~
TabWin_Impl
()
{
disposeOnce
();
}
virtual
void
dispose
()
SAL_OVERRIDE
{
mpPage
.
clear
();
vcl
::
Window
::
dispose
();
}
virtual
void
Paint
(
vcl
::
RenderContext
&
/*rRenderContext*/
,
const
Rectangle
&
rRect
)
SAL_OVERRIDE
;
virtual
void
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
rRect
)
SAL_OVERRIDE
;
void
SetTabulatorTabPage
(
SvxTabulatorTabPage
*
pPage
)
{
mpPage
=
pPage
;
}
void
SetTabStyle
(
sal_uInt16
nStyle
)
{
nTabStyle
=
nStyle
;
}
...
...
@@ -62,8 +62,6 @@ public:
VCL_BUILDER_FACTORY_ARGS
(
TabWin_Impl
,
0
)
// static ----------------------------------------------------------------
const
sal_uInt16
SvxTabulatorTabPage
::
pRanges
[]
=
{
SID_ATTR_TABSTOP
,
...
...
@@ -71,8 +69,6 @@ const sal_uInt16 SvxTabulatorTabPage::pRanges[] =
0
};
// C function ------------------------------------------------------------
void
FillUpWithDefTabs_Impl
(
long
nDefDist
,
SvxTabStopItem
&
rTabs
)
{
if
(
rTabs
.
Count
()
)
...
...
@@ -83,8 +79,6 @@ void FillUpWithDefTabs_Impl( long nDefDist, SvxTabStopItem& rTabs )
}
}
// class TabWin_Impl -----------------------------------------------------
void
TabWin_Impl
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
)
{
// Paint tabulators
...
...
@@ -95,18 +89,13 @@ void TabWin_Impl::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
Ruler
::
DrawTab
(
rRenderContext
,
rRenderContext
.
GetSettings
().
GetStyleSettings
().
GetFontColor
(),
aPoint
,
nTabStyle
);
}
// class SvxTabulatorTabPage ---------------------------------------------
SvxTabulatorTabPage
::
SvxTabulatorTabPage
(
vcl
::
Window
*
pParent
,
const
SfxItemSet
&
rAttr
)
:
SfxTabPage
(
pParent
,
"ParagraphTabsPage"
,
"cui/ui/paratabspage.ui"
,
&
rAttr
),
aAktTab
(
0
),
aNewTabs
(
0
,
0
,
SVX_TAB_ADJUST_LEFT
,
GetWhich
(
SID_ATTR_TABSTOP
)
),
nDefDist
(
0
),
eDefUnit
(
FUNIT_100TH_MM
),
bCheck
(
false
)
SvxTabulatorTabPage
::
SvxTabulatorTabPage
(
vcl
::
Window
*
pParent
,
const
SfxItemSet
&
rAttr
)
:
SfxTabPage
(
pParent
,
"ParagraphTabsPage"
,
"cui/ui/paratabspage.ui"
,
&
rAttr
)
,
aAktTab
(
0
)
,
aNewTabs
(
0
,
0
,
SVX_TAB_ADJUST_LEFT
,
GetWhich
(
SID_ATTR_TABSTOP
))
,
nDefDist
(
0
)
,
eDefUnit
(
FUNIT_100TH_MM
)
,
bCheck
(
false
)
{
get
(
m_pTabBox
,
"ED_TABPOS"
);
//the tab images
...
...
@@ -218,125 +207,115 @@ void SvxTabulatorTabPage::dispose()
SfxTabPage
::
dispose
();
}
bool
SvxTabulatorTabPage
::
FillItemSet
(
SfxItemSet
*
rSet
)
bool
SvxTabulatorTabPage
::
FillItemSet
(
SfxItemSet
*
rSet
)
{
bool
bModified
=
false
;
// Put the controls' values in here
if
(
m_pNewBtn
->
IsEnabled
()
)
if
(
m_pNewBtn
->
IsEnabled
()
)
NewHdl_Impl
(
0
);
// Call the LoseFocus-Handler first
GetDezCharHdl_Impl
(
m_pDezChar
);
GetFillCharHdl_Impl
(
m_pFillChar
);
GetDezCharHdl_Impl
(
m_pDezChar
);
GetFillCharHdl_Impl
(
m_pFillChar
);
FillUpWithDefTabs_Impl
(
nDefDist
,
aNewTabs
);
FillUpWithDefTabs_Impl
(
nDefDist
,
aNewTabs
);
SfxItemPool
*
pPool
=
rSet
->
GetPool
();
MapUnit
eUnit
=
(
MapUnit
)
pPool
->
GetMetric
(
GetWhich
(
SID_ATTR_TABSTOP
)
);
const
SfxPoolItem
*
pOld
=
GetOldItem
(
*
rSet
,
SID_ATTR_TABSTOP
);
MapUnit
eUnit
=
(
MapUnit
)
pPool
->
GetMetric
(
GetWhich
(
SID_ATTR_TABSTOP
)
);
const
SfxPoolItem
*
pOld
=
GetOldItem
(
*
rSet
,
SID_ATTR_TABSTOP
);
if
(
MAP_100TH_MM
!=
eUnit
)
if
(
MAP_100TH_MM
!=
eUnit
)
{
// If the ItemSet contains a LRSpaceItem with negative first line indent,
// the TabStopItem needs to have a DefTab at position 0.
const
SfxPoolItem
*
pLRSpace
;
// If not in the new set, then maybe in the old one
if
(
SfxItemState
::
SET
!=
rSet
->
GetItemState
(
GetWhich
(
SID_ATTR_LRSPACE
),
true
,
&
pLRSpace
)
)
pLRSpace
=
GetOldItem
(
*
rSet
,
SID_ATTR_LRSPACE
);
if
(
SfxItemState
::
SET
!=
rSet
->
GetItemState
(
GetWhich
(
SID_ATTR_LRSPACE
),
true
,
&
pLRSpace
)
)
pLRSpace
=
GetOldItem
(
*
rSet
,
SID_ATTR_LRSPACE
);
if
(
pLRSpace
&&
static_cast
<
const
SvxLRSpaceItem
*>
(
pLRSpace
)
->
GetTxtFirstLineOfst
()
<
0
)
if
(
pLRSpace
&&
static_cast
<
const
SvxLRSpaceItem
*>
(
pLRSpace
)
->
GetTxtFirstLineOfst
()
<
0
)
{
SvxTabStop
aNull
(
0
,
SVX_TAB_ADJUST_DEFAULT
);
aNewTabs
.
Insert
(
aNull
);
SvxTabStop
aNull
(
0
,
SVX_TAB_ADJUST_DEFAULT
);
aNewTabs
.
Insert
(
aNull
);
}
SvxTabStopItem
aTmp
(
aNewTabs
);
aTmp
.
Remove
(
0
,
aTmp
.
Count
()
);
SvxTabStopItem
aTmp
(
aNewTabs
);
aTmp
.
Remove
(
0
,
aTmp
.
Count
()
);
for
(
sal_uInt16
i
=
0
;
i
<
aNewTabs
.
Count
();
++
i
)
for
(
sal_uInt16
i
=
0
;
i
<
aNewTabs
.
Count
();
++
i
)
{
SvxTabStop
aTmpStop
=
aNewTabs
[
i
];
aTmpStop
.
GetTabPos
()
=
LogicToLogic
(
aTmpStop
.
GetTabPos
(),
MAP_100TH_MM
,
eUnit
);
aTmp
.
Insert
(
aTmpStop
);
aTmpStop
.
GetTabPos
()
=
LogicToLogic
(
aTmpStop
.
GetTabPos
(),
MAP_100TH_MM
,
eUnit
);
aTmp
.
Insert
(
aTmpStop
);
}
if
(
!
pOld
||
!
(
*
static_cast
<
const
SvxTabStopItem
*>
(
pOld
)
==
aTmp
)
)
if
(
!
pOld
||
!
(
*
static_cast
<
const
SvxTabStopItem
*>
(
pOld
)
==
aTmp
)
)
{
rSet
->
Put
(
aTmp
);
rSet
->
Put
(
aTmp
);
bModified
=
true
;
}
}
else
if
(
!
pOld
||
!
(
*
static_cast
<
const
SvxTabStopItem
*>
(
pOld
)
==
aNewTabs
)
)
else
if
(
!
pOld
||
!
(
*
static_cast
<
const
SvxTabStopItem
*>
(
pOld
)
==
aNewTabs
)
)
{
rSet
->
Put
(
aNewTabs
);
rSet
->
Put
(
aNewTabs
);
bModified
=
true
;
}
return
bModified
;
}
VclPtr
<
SfxTabPage
>
SvxTabulatorTabPage
::
Create
(
vcl
::
Window
*
pParent
,
const
SfxItemSet
*
rSet
)
VclPtr
<
SfxTabPage
>
SvxTabulatorTabPage
::
Create
(
vcl
::
Window
*
pParent
,
const
SfxItemSet
*
rSet
)
{
return
VclPtr
<
SfxTabPage
>
(
new
SvxTabulatorTabPage
(
pParent
,
*
rSet
),
SAL_NO_ACQUIRE
);
return
VclPtr
<
SfxTabPage
>
(
new
SvxTabulatorTabPage
(
pParent
,
*
rSet
),
SAL_NO_ACQUIRE
);
}
void
SvxTabulatorTabPage
::
Reset
(
const
SfxItemSet
*
rSet
)
void
SvxTabulatorTabPage
::
Reset
(
const
SfxItemSet
*
rSet
)
{
SfxItemPool
*
pPool
=
rSet
->
GetPool
();
MapUnit
eUnit
=
(
MapUnit
)
pPool
->
GetMetric
(
GetWhich
(
SID_ATTR_TABSTOP
)
);
MapUnit
eUnit
=
(
MapUnit
)
pPool
->
GetMetric
(
GetWhich
(
SID_ATTR_TABSTOP
)
);
// Current tabs
const
SfxPoolItem
*
pItem
=
GetItem
(
*
rSet
,
SID_ATTR_TABSTOP
);
const
SfxPoolItem
*
pItem
=
GetItem
(
*
rSet
,
SID_ATTR_TABSTOP
);
if
(
pItem
)
if
(
pItem
)
{
if
(
MAP_100TH_MM
!=
eUnit
)
if
(
MAP_100TH_MM
!=
eUnit
)
{
SvxTabStopItem
aTmp
(
*
static_cast
<
const
SvxTabStopItem
*>
(
pItem
)
);
aNewTabs
.
Remove
(
0
,
aNewTabs
.
Count
()
);
SvxTabStopItem
aTmp
(
*
static_cast
<
const
SvxTabStopItem
*>
(
pItem
)
);
aNewTabs
.
Remove
(
0
,
aNewTabs
.
Count
()
);
for
(
sal_uInt16
i
=
0
;
i
<
aTmp
.
Count
();
++
i
)
for
(
sal_uInt16
i
=
0
;
i
<
aTmp
.
Count
();
++
i
)
{
SvxTabStop
aTmpStop
=
aTmp
[
i
];
aTmpStop
.
GetTabPos
()
=
LogicToLogic
(
aTmpStop
.
GetTabPos
(),
eUnit
,
MAP_100TH_MM
);
aNewTabs
.
Insert
(
aTmpStop
);
aTmpStop
.
GetTabPos
()
=
LogicToLogic
(
aTmpStop
.
GetTabPos
(),
eUnit
,
MAP_100TH_MM
);
aNewTabs
.
Insert
(
aTmpStop
);
}
}
else
aNewTabs
=
*
static_cast
<
const
SvxTabStopItem
*>
(
pItem
);
}
else
aNewTabs
.
Remove
(
0
,
aNewTabs
.
Count
()
);
aNewTabs
.
Remove
(
0
,
aNewTabs
.
Count
()
);
// Defaul tab distance
nDefDist
=
SVX_TAB_DEFDIST
;
pItem
=
GetItem
(
*
rSet
,
SID_ATTR_TABSTOP_DEFAULTS
);
pItem
=
GetItem
(
*
rSet
,
SID_ATTR_TABSTOP_DEFAULTS
);
if
(
pItem
)
nDefDist
=
LogicToLogic
(
(
long
)
static_cast
<
const
SfxUInt16Item
*>
(
pItem
)
->
GetValue
(),
eUnit
,
MAP_100TH_MM
);
if
(
pItem
)
nDefDist
=
LogicToLogic
(
long
(
static_cast
<
const
SfxUInt16Item
*>
(
pItem
)
->
GetValue
()),
eUnit
,
MAP_100TH_MM
);
// Tab pos currently selected
sal_uInt16
nTabPos
=
0
;
pItem
=
GetItem
(
*
rSet
,
SID_ATTR_TABSTOP_POS
);
pItem
=
GetItem
(
*
rSet
,
SID_ATTR_TABSTOP_POS
);
if
(
pItem
)
if
(
pItem
)
nTabPos
=
static_cast
<
const
SfxUInt16Item
*>
(
pItem
)
->
GetValue
();
InitTabPos_Impl
(
nTabPos
);
InitTabPos_Impl
(
nTabPos
);
}
void
SvxTabulatorTabPage
::
DisableControls
(
const
sal_uInt16
nFlag
)
void
SvxTabulatorTabPage
::
DisableControls
(
const
sal_uInt16
nFlag
)
{
if
(
(
TABTYPE_LEFT
&
nFlag
)
==
TABTYPE_LEFT
)
if
(
(
TABTYPE_LEFT
&
nFlag
)
==
TABTYPE_LEFT
)
{
m_pLeftTab
->
Disable
();
m_pLeftWin
->
Disable
();
...
...
@@ -377,8 +356,6 @@ void SvxTabulatorTabPage::DisableControls( const sal_uInt16 nFlag )
m_pFillFrame
->
Disable
();
}
SfxTabPage
::
sfxpg
SvxTabulatorTabPage
::
DeactivatePage
(
SfxItemSet
*
_pSet
)
{
if
(
_pSet
)
...
...
@@ -386,20 +363,17 @@ SfxTabPage::sfxpg SvxTabulatorTabPage::DeactivatePage( SfxItemSet* _pSet )
return
LEAVE_PAGE
;
}
void
SvxTabulatorTabPage
::
InitTabPos_Impl
(
sal_uInt16
nTabPos
)
{
m_pTabBox
->
Clear
();
long
nOffset
=
0
;
const
SfxPoolItem
*
pItem
=
0
;
if
(
GetItemSet
().
GetItemState
(
SID_ATTR_TABSTOP_OFFSET
,
true
,
&
pItem
)
==
SfxItemState
::
SET
)
if
(
GetItemSet
().
GetItemState
(
SID_ATTR_TABSTOP_OFFSET
,
true
,
&
pItem
)
==
SfxItemState
::
SET
)
{
nOffset
=
static_cast
<
const
SfxInt32Item
*>
(
pItem
)
->
GetValue
();
MapUnit
eUnit
=
(
MapUnit
)
GetItemSet
().
GetPool
()
->
GetMetric
(
GetWhich
(
SID_ATTR_TABSTOP
)
);
nOffset
=
OutputDevice
::
LogicToLogic
(
nOffset
,
eUnit
,
MAP_100TH_MM
);
MapUnit
eUnit
=
(
MapUnit
)
GetItemSet
().
GetPool
()
->
GetMetric
(
GetWhich
(
SID_ATTR_TABSTOP
)
);
nOffset
=
OutputDevice
::
LogicToLogic
(
nOffset
,
eUnit
,
MAP_100TH_MM
);
}
// Correct current TabPos and default tabs
...
...
@@ -442,8 +416,6 @@ void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos )
}
}
void
SvxTabulatorTabPage
::
SetFillAndTabType_Impl
()
{
RadioButton
*
pTypeBtn
=
0
;
...
...
@@ -489,8 +461,6 @@ void SvxTabulatorTabPage::SetFillAndTabType_Impl()
pFillBtn
->
Check
();
}
IMPL_LINK
(
SvxTabulatorTabPage
,
NewHdl_Impl
,
Button
*
,
pBtn
)
{
// Add a new one and select it
...
...
@@ -547,8 +517,6 @@ IMPL_LINK( SvxTabulatorTabPage, NewHdl_Impl, Button *, pBtn )
return
0
;
}
IMPL_LINK_NOARG
(
SvxTabulatorTabPage
,
DelHdl_Impl
)
{
sal_Int32
nPos
=
m_pTabBox
->
GetValuePos
(
m_pTabBox
->
GetValue
()
);
...
...
@@ -590,8 +558,6 @@ IMPL_LINK_NOARG(SvxTabulatorTabPage, DelHdl_Impl)
return
0
;
}
IMPL_LINK_NOARG
(
SvxTabulatorTabPage
,
DelAllHdl_Impl
)
{
if
(
aNewTabs
.
Count
()
)
...
...
@@ -605,8 +571,6 @@ IMPL_LINK_NOARG(SvxTabulatorTabPage, DelAllHdl_Impl)
return
0
;
}
IMPL_LINK
(
SvxTabulatorTabPage
,
TabTypeCheckHdl_Impl
,
RadioButton
*
,
pBox
)
{
bCheck
=
true
;
...
...
@@ -640,8 +604,6 @@ IMPL_LINK( SvxTabulatorTabPage, TabTypeCheckHdl_Impl, RadioButton *, pBox )
return
0
;
}
IMPL_LINK
(
SvxTabulatorTabPage
,
FillTypeCheckHdl_Impl
,
RadioButton
*
,
pBox
)
{
bCheck
=
true
;
...
...
@@ -671,8 +633,6 @@ IMPL_LINK( SvxTabulatorTabPage, FillTypeCheckHdl_Impl, RadioButton *, pBox )
return
0
;
}
IMPL_LINK
(
SvxTabulatorTabPage
,
GetFillCharHdl_Impl
,
Edit
*
,
pEdit
)
{
OUString
aChar
(
pEdit
->
GetText
()
);
...
...
@@ -689,8 +649,6 @@ IMPL_LINK( SvxTabulatorTabPage, GetFillCharHdl_Impl, Edit *, pEdit )
return
0
;
}
IMPL_LINK
(
SvxTabulatorTabPage
,
GetDezCharHdl_Impl
,
Edit
*
,
pEdit
)
{
OUString
aChar
(
pEdit
->
GetText
()
);
...
...
@@ -706,8 +664,6 @@ IMPL_LINK( SvxTabulatorTabPage, GetDezCharHdl_Impl, Edit *, pEdit )
return
0
;
}
IMPL_LINK_NOARG
(
SvxTabulatorTabPage
,
SelectHdl_Impl
)
{
sal_Int32
nPos
=
m_pTabBox
->
GetValuePos
(
m_pTabBox
->
GetValue
(
eDefUnit
),
eDefUnit
);
...
...
@@ -720,8 +676,6 @@ IMPL_LINK_NOARG(SvxTabulatorTabPage, SelectHdl_Impl)
return
0
;
}
IMPL_LINK_NOARG
(
SvxTabulatorTabPage
,
ModifyHdl_Impl
)
{
sal_Int32
nPos
=
m_pTabBox
->
GetValuePos
(
m_pTabBox
->
GetValue
(
eDefUnit
),
eDefUnit
);
...
...
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