LibreOffice Module svx (master) 1
rlrcitem.cxx
Go to the documentation of this file.
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#include <sal/log.hxx>
22#include <osl/diagnose.h>
23
24#include <svx/svxids.hrc>
25
26#include <svx/ruler.hxx>
27#include <editeng/lrspitem.hxx>
28#include <editeng/tstpitem.hxx>
29#include <editeng/protitem.hxx>
30#include "rlrcitem.hxx"
31#include <svx/rulritem.hxx>
32#include <svl/eitem.hxx>
33
34SvxRulerItem::SvxRulerItem(sal_uInt16 _nId, SvxRuler &rRul, SfxBindings &rBindings)
35: SfxControllerItem(_nId, rBindings),
36 rRuler(rRul)
37{
38}
39
40
42 const SfxPoolItem* pState)
43{
44 // SfxItemState::DONTCARE => pState == -1 => PTR_CAST buff
45 if ( eState != SfxItemState::DEFAULT )
46 pState = nullptr;
47
48 switch(nSID)
49 {
50 // Left / right margin
51 case SID_RULER_LR_MIN_MAX:
52 {
53 const SfxRectangleItem *pItem = dynamic_cast<const SfxRectangleItem*>( pState );
55 break;
56 }
57 case SID_ATTR_LONG_LRSPACE:
58 {
59 const SvxLongLRSpaceItem *pItem = dynamic_cast<const SvxLongLRSpaceItem*>( pState );
60 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SvxLRSpaceItem expected");
61 rRuler.UpdateFrame(pItem);
62 break;
63 }
64 case SID_ATTR_LONG_ULSPACE:
65 {
66 const SvxLongULSpaceItem *pItem = dynamic_cast<const SvxLongULSpaceItem*>( pState );
67 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SvxULSpaceItem expected");
68 rRuler.UpdateFrame(pItem);
69 break;
70 }
71 case SID_ATTR_TABSTOP_VERTICAL:
72 case SID_ATTR_TABSTOP:
73 {
74 const SvxTabStopItem *pItem = dynamic_cast<const SvxTabStopItem*>( pState );
75 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SvxTabStopItem expected");
76 rRuler.Update(pItem);
77 break;
78 }
79 case SID_ATTR_PARA_LRSPACE_VERTICAL:
80 case SID_ATTR_PARA_LRSPACE:
81 {
82 const SvxLRSpaceItem *pItem = dynamic_cast<const SvxLRSpaceItem*>( pState );
83 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SvxLRSpaceItem expected");
84 rRuler.UpdatePara(pItem);
85 break;
86 }
87 case SID_RULER_BORDERS_VERTICAL:
88 case SID_RULER_BORDERS:
89 case SID_RULER_ROWS:
90 case SID_RULER_ROWS_VERTICAL:
91 {
92 const SvxColumnItem *pItem = dynamic_cast<const SvxColumnItem*>( pState );
93 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SvxColumnItem expected");
94#ifdef DBG_UTIL
95 if(pItem)
96 {
97 if(pItem->IsConsistent())
98 rRuler.Update(pItem, nSID);
99 else
100 OSL_FAIL("Column item corrupted");
101 }
102 else
103 rRuler.Update(pItem, nSID);
104#else
105 rRuler.Update(pItem, nSID);
106#endif
107 break;
108 }
109 case SID_RULER_PAGE_POS:
110 { // Position page, page width
111 const SvxPagePosSizeItem *pItem = dynamic_cast<const SvxPagePosSizeItem*>( pState );
112 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SvxPagePosSizeItem expected");
113 rRuler.Update(pItem);
114 break;
115 }
116 case SID_RULER_OBJECT:
117 { // Object selection
118 const SvxObjectItem *pItem = dynamic_cast<const SvxObjectItem*>( pState );
119 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SvxObjectItem expected");
120 rRuler.Update(pItem);
121 break;
122 }
123 case SID_RULER_PROTECT:
124 {
125 const SvxProtectItem *pItem = dynamic_cast<const SvxProtectItem*>( pState );
126 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SvxProtectItem expected");
127 rRuler.Update(pItem);
128 break;
129 }
130 case SID_RULER_BORDER_DISTANCE:
131 {
132 const SvxLRSpaceItem *pItem = dynamic_cast<const SvxLRSpaceItem*>( pState );
133 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SvxLRSpaceItem expected");
134 rRuler.UpdateBorder(pItem);
135 }
136 break;
137 case SID_RULER_TEXT_RIGHT_TO_LEFT :
138 {
139 const SfxBoolItem *pItem = dynamic_cast<const SfxBoolItem*>( pState );
140 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SfxBoolItem expected");
141 rRuler.UpdateTextRTL(pItem);
142 }
143 break;
144 }
145}
146
147
148/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsConsistent() const
Definition: rulritem.cxx:616
virtual void StateChangedAtToolBoxControl(sal_uInt16, SfxItemState, const SfxPoolItem *pState) override
Definition: rlrcitem.cxx:41
SvxRulerItem(sal_uInt16 nId, SvxRuler &, SfxBindings &)
Definition: rlrcitem.cxx:34
SvxRuler & rRuler
Definition: rlrcitem.hxx:29
void UpdatePara(const SvxLRSpaceItem *pItem)
Definition: svxruler.cxx:871
void UpdateFrameMinMax(const SfxRectangleItem *pItem)
Definition: svxruler.cxx:655
void Update(const SvxTabStopItem *pItem)
Definition: svxruler.cxx:1100
void UpdateTextRTL(const SfxBoolItem *pItem)
Definition: svxruler.cxx:687
void UpdateBorder(const SvxLRSpaceItem *pItem)
Definition: svxruler.cxx:884
void UpdateFrame(const SvxLongLRSpaceItem *pItem)
Definition: svxruler.cxx:642
#define SAL_WARN_IF(condition, area, stream)
SfxItemState