xref: /aoo41x/main/svx/source/dialog/rlrcitem.cxx (revision f6e50924)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f6e50924SAndrew Rist  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f6e50924SAndrew Rist  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19*f6e50924SAndrew Rist  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // INCLUDE ---------------------------------------------------------------
28cdf0e10cSrcweir #include <svl/rectitem.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <svx/dialogs.hrc>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <svx/ruler.hxx>
38cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
39cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
40cdf0e10cSrcweir #include <editeng/tstpitem.hxx>
41cdf0e10cSrcweir #include "editeng/protitem.hxx"
42cdf0e10cSrcweir #include "rlrcitem.hxx"
43cdf0e10cSrcweir #include "svx/rulritem.hxx"
44cdf0e10cSrcweir #include <svl/eitem.hxx>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir // class SvxRulerItem ----------------------------------------------------
47cdf0e10cSrcweir 
SvxRulerItem(sal_uInt16 _nId,SvxRuler & rRul,SfxBindings & rBindings)48cdf0e10cSrcweir SvxRulerItem::SvxRulerItem(sal_uInt16 _nId, SvxRuler &rRul, SfxBindings &rBindings)
49cdf0e10cSrcweir : SfxControllerItem(_nId, rBindings),
50cdf0e10cSrcweir   rRuler(rRul)
51cdf0e10cSrcweir {
52cdf0e10cSrcweir }
53cdf0e10cSrcweir 
54cdf0e10cSrcweir // -----------------------------------------------------------------------
55cdf0e10cSrcweir 
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)56cdf0e10cSrcweir void SvxRulerItem::StateChanged( sal_uInt16 nSID, SfxItemState eState,
57cdf0e10cSrcweir 								 const SfxPoolItem* pState)
58cdf0e10cSrcweir {
59cdf0e10cSrcweir 	// SFX_ITEM_DONTCARE => pState == -1 => PTR_CAST buff
60cdf0e10cSrcweir 	if ( eState != SFX_ITEM_AVAILABLE )
61cdf0e10cSrcweir 		pState = 0;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	switch(nSID)
64cdf0e10cSrcweir 	{
65cdf0e10cSrcweir 		// Linker / rechter Seitenrand
66cdf0e10cSrcweir 		case SID_RULER_LR_MIN_MAX:
67cdf0e10cSrcweir 		{
68cdf0e10cSrcweir 			const SfxRectangleItem *pItem = PTR_CAST(SfxRectangleItem, pState);
69cdf0e10cSrcweir 			rRuler.UpdateFrameMinMax(pItem);
70cdf0e10cSrcweir 			break;
71cdf0e10cSrcweir 		}
72cdf0e10cSrcweir         case SID_ATTR_LONG_LRSPACE:
73cdf0e10cSrcweir 		{
74cdf0e10cSrcweir 			const SvxLongLRSpaceItem *pItem = PTR_CAST(SvxLongLRSpaceItem, pState);
75cdf0e10cSrcweir 			DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxLRSpaceItem erwartet");
76cdf0e10cSrcweir 			rRuler.UpdateFrame(pItem);
77cdf0e10cSrcweir 			break;
78cdf0e10cSrcweir 		}
79cdf0e10cSrcweir         case SID_ATTR_LONG_ULSPACE:
80cdf0e10cSrcweir 		{
81cdf0e10cSrcweir 			const SvxLongULSpaceItem *pItem = PTR_CAST(SvxLongULSpaceItem, pState);
82cdf0e10cSrcweir 			DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxULSpaceItem erwartet");
83cdf0e10cSrcweir 			rRuler.UpdateFrame(pItem);
84cdf0e10cSrcweir 			break;
85cdf0e10cSrcweir 		}
86cdf0e10cSrcweir         case SID_ATTR_TABSTOP_VERTICAL:
87cdf0e10cSrcweir         case SID_ATTR_TABSTOP:
88cdf0e10cSrcweir 		{
89cdf0e10cSrcweir 			const SvxTabStopItem *pItem = PTR_CAST(SvxTabStopItem, pState);
90cdf0e10cSrcweir 			DBG_ASSERT(pState?  0 != pItem: sal_True, "SvxTabStopItem erwartet");
91cdf0e10cSrcweir 			rRuler.Update(pItem);
92cdf0e10cSrcweir 			break;
93cdf0e10cSrcweir 		}
94cdf0e10cSrcweir         case SID_ATTR_PARA_LRSPACE_VERTICAL:
95cdf0e10cSrcweir         case SID_ATTR_PARA_LRSPACE:
96cdf0e10cSrcweir 		{
97cdf0e10cSrcweir 			const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
98cdf0e10cSrcweir 			DBG_ASSERT(pState?  0 != pItem: sal_True, "SvxLRSpaceItem erwartet");
99cdf0e10cSrcweir 			rRuler.UpdatePara(pItem);
100cdf0e10cSrcweir 			break;
101cdf0e10cSrcweir 		}
102cdf0e10cSrcweir         case SID_RULER_BORDERS_VERTICAL:
103cdf0e10cSrcweir         case SID_RULER_BORDERS:
104cdf0e10cSrcweir 		case SID_RULER_ROWS:
105cdf0e10cSrcweir 		case SID_RULER_ROWS_VERTICAL:
106cdf0e10cSrcweir 		{
107cdf0e10cSrcweir 			const SvxColumnItem *pItem = PTR_CAST(SvxColumnItem, pState);
108cdf0e10cSrcweir 			DBG_ASSERT(pState?  0 != pItem: sal_True, "SvxColumnItem erwartet");
109cdf0e10cSrcweir #ifdef DBG_UTIL
110cdf0e10cSrcweir 			if(pItem)
111cdf0e10cSrcweir 			{
112cdf0e10cSrcweir 				if(pItem->IsConsistent())
113cdf0e10cSrcweir                     rRuler.Update(pItem, nSID);
114cdf0e10cSrcweir 				else
115cdf0e10cSrcweir 					DBG_ERROR("Spaltenitem corrupted");
116cdf0e10cSrcweir 			}
117cdf0e10cSrcweir 			else
118cdf0e10cSrcweir                 rRuler.Update(pItem, nSID);
119cdf0e10cSrcweir #else
120cdf0e10cSrcweir             rRuler.Update(pItem, nSID);
121cdf0e10cSrcweir #endif
122cdf0e10cSrcweir 			break;
123cdf0e10cSrcweir 		}
124cdf0e10cSrcweir 		case SID_RULER_PAGE_POS:
125cdf0e10cSrcweir 		{	// Position Seite, Seitenbreite
126cdf0e10cSrcweir 			const SvxPagePosSizeItem *pItem = PTR_CAST(SvxPagePosSizeItem, pState);
127cdf0e10cSrcweir 			DBG_ASSERT(pState?  0 != pItem: sal_True, "SvxPagePosSizeItem erwartet");
128cdf0e10cSrcweir 			rRuler.Update(pItem);
129cdf0e10cSrcweir 			break;
130cdf0e10cSrcweir 		}
131cdf0e10cSrcweir 		case SID_RULER_OBJECT:
132cdf0e10cSrcweir 		{	// Object-Selektion
133cdf0e10cSrcweir 			const SvxObjectItem *pItem = PTR_CAST(SvxObjectItem, pState);
134cdf0e10cSrcweir 			DBG_ASSERT(pState?  0 != pItem: sal_True, "SvxObjectItem erwartet");
135cdf0e10cSrcweir 			rRuler.Update(pItem);
136cdf0e10cSrcweir 			break;
137cdf0e10cSrcweir 		}
138cdf0e10cSrcweir 		case SID_RULER_PROTECT:
139cdf0e10cSrcweir 		{
140cdf0e10cSrcweir 			const SvxProtectItem *pItem = PTR_CAST(SvxProtectItem, pState);
141cdf0e10cSrcweir 			DBG_ASSERT(pState?  0 != pItem: sal_True, "SvxProtectItem erwartet");
142cdf0e10cSrcweir 			rRuler.Update(pItem);
143cdf0e10cSrcweir 			break;
144cdf0e10cSrcweir 		}
145cdf0e10cSrcweir         case SID_RULER_BORDER_DISTANCE:
146cdf0e10cSrcweir         {
147cdf0e10cSrcweir             const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
148cdf0e10cSrcweir 			DBG_ASSERT(pState?  0 != pItem: sal_True, "SvxLRSpaceItem erwartet");
149cdf0e10cSrcweir             rRuler.UpdateParaBorder(pItem);
150cdf0e10cSrcweir         }
151cdf0e10cSrcweir         break;
152cdf0e10cSrcweir         case SID_RULER_TEXT_RIGHT_TO_LEFT :
153cdf0e10cSrcweir         {
154cdf0e10cSrcweir             const SfxBoolItem *pItem = PTR_CAST(SfxBoolItem, pState);
155cdf0e10cSrcweir             DBG_ASSERT(pState?  0 != pItem: sal_True, "SfxBoolItem erwartet");
156cdf0e10cSrcweir             rRuler.UpdateTextRTL(pItem);
157cdf0e10cSrcweir         }
158cdf0e10cSrcweir         break;
159cdf0e10cSrcweir 	}
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 
163