1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rlrcitem.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 // INCLUDE ---------------------------------------------------------------
35 #include <svtools/rectitem.hxx>
42 #include <svx/dialogs.hrc>
44 #include <svx/ruler.hxx>
45 #include <svx/lrspitem.hxx>
46 #include <svx/ulspitem.hxx>
47 #include <svx/tstpitem.hxx>
48 #include "protitem.hxx"
49 #include "rlrcitem.hxx"
50 #include "rulritem.hxx"
51 #include <svtools/eitem.hxx>
53 // class SvxRulerItem ----------------------------------------------------
55 SvxRulerItem::SvxRulerItem(USHORT _nId
, SvxRuler
&rRul
, SfxBindings
&rBindings
)
56 : SfxControllerItem(_nId
, rBindings
),
61 // -----------------------------------------------------------------------
63 void SvxRulerItem::StateChanged( USHORT nSID
, SfxItemState eState
,
64 const SfxPoolItem
* pState
)
66 // SFX_ITEM_DONTCARE => pState == -1 => PTR_CAST buff
67 if ( eState
!= SFX_ITEM_AVAILABLE
)
72 // Linker / rechter Seitenrand
73 case SID_RULER_LR_MIN_MAX
:
75 const SfxRectangleItem
*pItem
= PTR_CAST(SfxRectangleItem
, pState
);
76 rRuler
.UpdateFrameMinMax(pItem
);
79 case SID_ATTR_LONG_LRSPACE
:
81 const SvxLongLRSpaceItem
*pItem
= PTR_CAST(SvxLongLRSpaceItem
, pState
);
82 DBG_ASSERT(pState
? 0 != pItem
: TRUE
, "SvxLRSpaceItem erwartet");
83 rRuler
.UpdateFrame(pItem
);
86 case SID_ATTR_LONG_ULSPACE
:
88 const SvxLongULSpaceItem
*pItem
= PTR_CAST(SvxLongULSpaceItem
, pState
);
89 DBG_ASSERT(pState
? 0 != pItem
: TRUE
, "SvxULSpaceItem erwartet");
90 rRuler
.UpdateFrame(pItem
);
93 case SID_ATTR_TABSTOP_VERTICAL
:
94 case SID_ATTR_TABSTOP
:
96 const SvxTabStopItem
*pItem
= PTR_CAST(SvxTabStopItem
, pState
);
97 DBG_ASSERT(pState
? 0 != pItem
: TRUE
, "SvxTabStopItem erwartet");
101 case SID_ATTR_PARA_LRSPACE_VERTICAL
:
102 case SID_ATTR_PARA_LRSPACE
:
104 const SvxLRSpaceItem
*pItem
= PTR_CAST(SvxLRSpaceItem
, pState
);
105 DBG_ASSERT(pState
? 0 != pItem
: TRUE
, "SvxLRSpaceItem erwartet");
106 rRuler
.UpdatePara(pItem
);
109 case SID_RULER_BORDERS_VERTICAL
:
110 case SID_RULER_BORDERS
:
112 case SID_RULER_ROWS_VERTICAL
:
114 const SvxColumnItem
*pItem
= PTR_CAST(SvxColumnItem
, pState
);
115 DBG_ASSERT(pState
? 0 != pItem
: TRUE
, "SvxColumnItem erwartet");
119 if(pItem
->IsConsistent())
120 rRuler
.Update(pItem
, nSID
);
122 DBG_ERROR("Spaltenitem corrupted");
125 rRuler
.Update(pItem
, nSID
);
127 rRuler
.Update(pItem
, nSID
);
131 case SID_RULER_PAGE_POS
:
132 { // Position Seite, Seitenbreite
133 const SvxPagePosSizeItem
*pItem
= PTR_CAST(SvxPagePosSizeItem
, pState
);
134 DBG_ASSERT(pState
? 0 != pItem
: TRUE
, "SvxPagePosSizeItem erwartet");
135 rRuler
.Update(pItem
);
138 case SID_RULER_OBJECT
:
139 { // Object-Selektion
140 const SvxObjectItem
*pItem
= PTR_CAST(SvxObjectItem
, pState
);
141 DBG_ASSERT(pState
? 0 != pItem
: TRUE
, "SvxObjectItem erwartet");
142 rRuler
.Update(pItem
);
145 case SID_RULER_PROTECT
:
147 const SvxProtectItem
*pItem
= PTR_CAST(SvxProtectItem
, pState
);
148 DBG_ASSERT(pState
? 0 != pItem
: TRUE
, "SvxProtectItem erwartet");
149 rRuler
.Update(pItem
);
152 case SID_RULER_BORDER_DISTANCE
:
154 const SvxLRSpaceItem
*pItem
= PTR_CAST(SvxLRSpaceItem
, pState
);
155 DBG_ASSERT(pState
? 0 != pItem
: TRUE
, "SvxLRSpaceItem erwartet");
156 rRuler
.UpdateParaBorder(pItem
);
159 case SID_RULER_TEXT_RIGHT_TO_LEFT
:
161 const SfxBoolItem
*pItem
= PTR_CAST(SfxBoolItem
, pState
);
162 DBG_ASSERT(pState
? 0 != pItem
: TRUE
, "SfxBoolItem erwartet");
163 rRuler
.UpdateTextRTL(pItem
);