Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <svl/rectitem.hxx>
21 :
22 :
23 :
24 :
25 :
26 :
27 : #include <svx/dialogs.hrc>
28 :
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>
37 :
38 : // class SvxRulerItem ----------------------------------------------------
39 :
40 0 : SvxRulerItem::SvxRulerItem(sal_uInt16 _nId, SvxRuler &rRul, SfxBindings &rBindings)
41 : : SfxControllerItem(_nId, rBindings),
42 0 : rRuler(rRul)
43 : {
44 0 : }
45 :
46 :
47 :
48 0 : void SvxRulerItem::StateChanged( sal_uInt16 nSID, SfxItemState eState,
49 : const SfxPoolItem* pState)
50 : {
51 : // SFX_ITEM_DONTCARE => pState == -1 => PTR_CAST buff
52 0 : if ( eState != SFX_ITEM_AVAILABLE )
53 0 : pState = 0;
54 :
55 0 : switch(nSID)
56 : {
57 : // Left / right margin
58 : case SID_RULER_LR_MIN_MAX:
59 : {
60 0 : const SfxRectangleItem *pItem = PTR_CAST(SfxRectangleItem, pState);
61 0 : rRuler.UpdateFrameMinMax(pItem);
62 0 : break;
63 : }
64 : case SID_ATTR_LONG_LRSPACE:
65 : {
66 0 : const SvxLongLRSpaceItem *pItem = PTR_CAST(SvxLongLRSpaceItem, pState);
67 : DBG_ASSERT(pState? 0 != pItem: true, "SvxLRSpaceItem expected");
68 0 : rRuler.UpdateFrame(pItem);
69 0 : break;
70 : }
71 : case SID_ATTR_LONG_ULSPACE:
72 : {
73 0 : const SvxLongULSpaceItem *pItem = PTR_CAST(SvxLongULSpaceItem, pState);
74 : DBG_ASSERT(pState? 0 != pItem: true, "SvxULSpaceItem expected");
75 0 : rRuler.UpdateFrame(pItem);
76 0 : break;
77 : }
78 : case SID_ATTR_TABSTOP_VERTICAL:
79 : case SID_ATTR_TABSTOP:
80 : {
81 0 : const SvxTabStopItem *pItem = PTR_CAST(SvxTabStopItem, pState);
82 : DBG_ASSERT(pState? 0 != pItem: true, "SvxTabStopItem expected");
83 0 : rRuler.Update(pItem);
84 0 : break;
85 : }
86 : case SID_ATTR_PARA_LRSPACE_VERTICAL:
87 : case SID_ATTR_PARA_LRSPACE:
88 : {
89 0 : const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
90 : DBG_ASSERT(pState? 0 != pItem: true, "SvxLRSpaceItem expected");
91 0 : rRuler.UpdatePara(pItem);
92 0 : break;
93 : }
94 : case SID_RULER_BORDERS_VERTICAL:
95 : case SID_RULER_BORDERS:
96 : case SID_RULER_ROWS:
97 : case SID_RULER_ROWS_VERTICAL:
98 : {
99 0 : const SvxColumnItem *pItem = PTR_CAST(SvxColumnItem, pState);
100 : DBG_ASSERT(pState? 0 != pItem: true, "SvxColumnItem expected");
101 : #ifdef DBG_UTIL
102 : if(pItem)
103 : {
104 : if(pItem->IsConsistent())
105 : rRuler.Update(pItem, nSID);
106 : else
107 : OSL_FAIL("Column item corrupted");
108 : }
109 : else
110 : rRuler.Update(pItem, nSID);
111 : #else
112 0 : rRuler.Update(pItem, nSID);
113 : #endif
114 0 : break;
115 : }
116 : case SID_RULER_PAGE_POS:
117 : { // Position page, page width
118 0 : const SvxPagePosSizeItem *pItem = PTR_CAST(SvxPagePosSizeItem, pState);
119 : DBG_ASSERT(pState? 0 != pItem: true, "SvxPagePosSizeItem expected");
120 0 : rRuler.Update(pItem);
121 0 : break;
122 : }
123 : case SID_RULER_OBJECT:
124 : { // Object selection
125 0 : const SvxObjectItem *pItem = PTR_CAST(SvxObjectItem, pState);
126 : DBG_ASSERT(pState? 0 != pItem: true, "SvxObjectItem expected");
127 0 : rRuler.Update(pItem);
128 0 : break;
129 : }
130 : case SID_RULER_PROTECT:
131 : {
132 0 : const SvxProtectItem *pItem = PTR_CAST(SvxProtectItem, pState);
133 : DBG_ASSERT(pState? 0 != pItem: true, "SvxProtectItem expected");
134 0 : rRuler.Update(pItem);
135 0 : break;
136 : }
137 : case SID_RULER_BORDER_DISTANCE:
138 : {
139 0 : const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
140 : DBG_ASSERT(pState? 0 != pItem: true, "SvxLRSpaceItem expected");
141 0 : rRuler.UpdateParaBorder(pItem);
142 : }
143 0 : break;
144 : case SID_RULER_TEXT_RIGHT_TO_LEFT :
145 : {
146 0 : const SfxBoolItem *pItem = PTR_CAST(SfxBoolItem, pState);
147 : DBG_ASSERT(pState? 0 != pItem: true, "SfxBoolItem expected");
148 0 : rRuler.UpdateTextRTL(pItem);
149 : }
150 0 : break;
151 : }
152 0 : }
153 :
154 :
155 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|