Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / svx / source / dialog / rlrcitem.cxx
blob6d17f81c987b1fe9f69e2be83907f390aa0b08e6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svl/rectitem.hxx>
27 #include <svx/dialogs.hrc>
29 #include <svx/ruler.hxx>
30 #include <editeng/lrspitem.hxx>
31 #include <editeng/ulspitem.hxx>
32 #include <editeng/tstpitem.hxx>
33 #include "editeng/protitem.hxx"
34 #include "rlrcitem.hxx"
35 #include "svx/rulritem.hxx"
36 #include <svl/eitem.hxx>
38 // class SvxRulerItem ----------------------------------------------------
40 SvxRulerItem::SvxRulerItem(sal_uInt16 _nId, SvxRuler &rRul, SfxBindings &rBindings)
41 : SfxControllerItem(_nId, rBindings),
42 rRuler(rRul)
48 void SvxRulerItem::StateChanged( sal_uInt16 nSID, SfxItemState eState,
49 const SfxPoolItem* pState)
51 // SFX_ITEM_DONTCARE => pState == -1 => PTR_CAST buff
52 if ( eState != SFX_ITEM_AVAILABLE )
53 pState = 0;
55 switch(nSID)
57 // Left / right margin
58 case SID_RULER_LR_MIN_MAX:
60 const SfxRectangleItem *pItem = PTR_CAST(SfxRectangleItem, pState);
61 rRuler.UpdateFrameMinMax(pItem);
62 break;
64 case SID_ATTR_LONG_LRSPACE:
66 const SvxLongLRSpaceItem *pItem = PTR_CAST(SvxLongLRSpaceItem, pState);
67 DBG_ASSERT(pState? 0 != pItem: true, "SvxLRSpaceItem expected");
68 rRuler.UpdateFrame(pItem);
69 break;
71 case SID_ATTR_LONG_ULSPACE:
73 const SvxLongULSpaceItem *pItem = PTR_CAST(SvxLongULSpaceItem, pState);
74 DBG_ASSERT(pState? 0 != pItem: true, "SvxULSpaceItem expected");
75 rRuler.UpdateFrame(pItem);
76 break;
78 case SID_ATTR_TABSTOP_VERTICAL:
79 case SID_ATTR_TABSTOP:
81 const SvxTabStopItem *pItem = PTR_CAST(SvxTabStopItem, pState);
82 DBG_ASSERT(pState? 0 != pItem: true, "SvxTabStopItem expected");
83 rRuler.Update(pItem);
84 break;
86 case SID_ATTR_PARA_LRSPACE_VERTICAL:
87 case SID_ATTR_PARA_LRSPACE:
89 const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
90 DBG_ASSERT(pState? 0 != pItem: true, "SvxLRSpaceItem expected");
91 rRuler.UpdatePara(pItem);
92 break;
94 case SID_RULER_BORDERS_VERTICAL:
95 case SID_RULER_BORDERS:
96 case SID_RULER_ROWS:
97 case SID_RULER_ROWS_VERTICAL:
99 const SvxColumnItem *pItem = PTR_CAST(SvxColumnItem, pState);
100 DBG_ASSERT(pState? 0 != pItem: true, "SvxColumnItem expected");
101 #ifdef DBG_UTIL
102 if(pItem)
104 if(pItem->IsConsistent())
105 rRuler.Update(pItem, nSID);
106 else
107 OSL_FAIL("Column item corrupted");
109 else
110 rRuler.Update(pItem, nSID);
111 #else
112 rRuler.Update(pItem, nSID);
113 #endif
114 break;
116 case SID_RULER_PAGE_POS:
117 { // Position page, page width
118 const SvxPagePosSizeItem *pItem = PTR_CAST(SvxPagePosSizeItem, pState);
119 DBG_ASSERT(pState? 0 != pItem: true, "SvxPagePosSizeItem expected");
120 rRuler.Update(pItem);
121 break;
123 case SID_RULER_OBJECT:
124 { // Object selection
125 const SvxObjectItem *pItem = PTR_CAST(SvxObjectItem, pState);
126 DBG_ASSERT(pState? 0 != pItem: true, "SvxObjectItem expected");
127 rRuler.Update(pItem);
128 break;
130 case SID_RULER_PROTECT:
132 const SvxProtectItem *pItem = PTR_CAST(SvxProtectItem, pState);
133 DBG_ASSERT(pState? 0 != pItem: true, "SvxProtectItem expected");
134 rRuler.Update(pItem);
135 break;
137 case SID_RULER_BORDER_DISTANCE:
139 const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
140 DBG_ASSERT(pState? 0 != pItem: true, "SvxLRSpaceItem expected");
141 rRuler.UpdateParaBorder(pItem);
143 break;
144 case SID_RULER_TEXT_RIGHT_TO_LEFT :
146 const SfxBoolItem *pItem = PTR_CAST(SfxBoolItem, pState);
147 DBG_ASSERT(pState? 0 != pItem: true, "SfxBoolItem expected");
148 rRuler.UpdateTextRTL(pItem);
150 break;
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */