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