Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <editeng/eeitem.hxx>
30 : :
31 : : #include "svdibrow.hxx"
32 : :
33 : : #include <stdlib.h>
34 : :
35 : : #include "svx/svditext.hxx"
36 : : #include <editeng/flditem.hxx>
37 : : #include <editeng/editdata.hxx>
38 : : #include <svx/svdpool.hxx>
39 : : #include <svx/svdattr.hxx>
40 : : #include <svx/svdattrx.hxx>
41 : : #include <svx/svdview.hxx>
42 : : #include <svx/xenum.hxx>
43 : : #include <svx/xlineit0.hxx>
44 : : #include <svx/xlnstwit.hxx>
45 : : #include <svx/xlnedwit.hxx>
46 : : #include <svx/xfillit0.hxx>
47 : : #include <svx/xflbmtit.hxx>
48 : : #include <svx/xtextit0.hxx>
49 : : #include <svx/xflbstit.hxx>
50 : : #include <svx/xflbtoxy.hxx>
51 : : #include <svx/xftshit.hxx>
52 : : #include <editeng/colritem.hxx>
53 : :
54 : :
55 : : #include "editeng/fontitem.hxx"
56 : : #include <editeng/fhgtitem.hxx>
57 : :
58 : : #include <editeng/charscaleitem.hxx>
59 : : #include <svl/whiter.hxx>
60 : : #include <svl/flagitem.hxx>
61 : : #include <svl/ptitem.hxx>
62 : : #include <svl/rectitem.hxx>
63 : :
64 : : #include <svl/rngitem.hxx>
65 : : #include <svx/sdrpaintwindow.hxx>
66 : :
67 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
68 : :
69 : : #define ITEMBROWSER_WHICHCOL_ID 1
70 : : #define ITEMBROWSER_STATECOL_ID 2
71 : : #define ITEMBROWSER_TYPECOL_ID 3
72 : : #define ITEMBROWSER_NAMECOL_ID 4
73 : : #define ITEMBROWSER_VALUECOL_ID 5
74 : :
75 : : enum ItemType {
76 : : ITEM_DONTKNOW, ITEM_BYTE, ITEM_INT16, ITEM_UINT16, ITEM_INT32, ITEM_UINT32,
77 : : ITEM_ENUM, ITEM_BOOL, ITEM_FLAG, ITEM_STRING, ITEM_POINT, ITEM_RECT, ITEM_RANGE, ITEM_LRANGE,
78 : : ITEM_FRACTION,
79 : : ITEM_XCOLOR,
80 : : ITEM_COLOR,
81 : : ITEM_FONT, ITEM_FONTHEIGHT, ITEM_FONTWIDTH, ITEM_FIELD
82 : : };
83 : :
84 [ # # ][ # # ]: 0 : class ImpItemListRow
85 : : {
86 : : public:
87 : : XubString aName;
88 : : XubString aValue;
89 : : SfxItemState eState;
90 : : sal_uInt16 nWhichId;
91 : :
92 : : TypeId pType;
93 : : ItemType eItemType;
94 : :
95 : : sal_Int32 nVal;
96 : : sal_Int32 nMin;
97 : : sal_Int32 nMax;
98 : :
99 : : sal_Bool bComment;
100 : : sal_Bool bIsNum;
101 : : sal_Bool bCanNum;
102 : :
103 : : public:
104 : 0 : ImpItemListRow()
105 : : : eState(SFX_ITEM_UNKNOWN),
106 : : nWhichId(0),
107 : : pType(NULL),
108 : : eItemType(ITEM_DONTKNOW),
109 : : nVal(0),
110 : : nMin(0),
111 : : nMax(0),
112 : : bComment(sal_False),
113 : : bIsNum(sal_False),
114 [ # # ]: 0 : bCanNum(sal_False)
115 : 0 : {}
116 : :
117 : : XubString GetItemTypeStr() const;
118 : : sal_Bool operator==(const ImpItemListRow& rEntry) const;
119 : 0 : sal_Bool operator!=(const ImpItemListRow& rEntry) const { return !operator==(rEntry); }
120 : : };
121 : :
122 : 0 : XubString ImpItemListRow::GetItemTypeStr() const
123 : : {
124 : 0 : XubString aStr;
125 : :
126 [ # # # # : 0 : switch(eItemType)
# # # # #
# # # # #
# # # # #
# # ]
127 : : {
128 [ # # ]: 0 : case ITEM_BYTE : aStr.AppendAscii("Byte"); break;
129 [ # # ]: 0 : case ITEM_INT16 : aStr.AppendAscii("Int16"); break;
130 [ # # ]: 0 : case ITEM_UINT16 : aStr.AppendAscii("UInt16"); break;
131 [ # # ]: 0 : case ITEM_INT32 : aStr.AppendAscii("Int32"); break;
132 [ # # ]: 0 : case ITEM_UINT32 : aStr.AppendAscii("UInt32"); break;
133 [ # # ]: 0 : case ITEM_ENUM : aStr.AppendAscii("Enum"); break;
134 [ # # ]: 0 : case ITEM_BOOL : aStr.AppendAscii("Bool"); break;
135 [ # # ]: 0 : case ITEM_FLAG : aStr.AppendAscii("Flag"); break;
136 [ # # ]: 0 : case ITEM_STRING : aStr.AppendAscii("String"); break;
137 [ # # ]: 0 : case ITEM_POINT : aStr.AppendAscii("Point"); break;
138 [ # # ]: 0 : case ITEM_RECT : aStr.AppendAscii("Rectangle");break;
139 [ # # ]: 0 : case ITEM_RANGE : aStr.AppendAscii("Range"); break;
140 [ # # ]: 0 : case ITEM_LRANGE : aStr.AppendAscii("LRange"); break;
141 [ # # ]: 0 : case ITEM_FRACTION : aStr.AppendAscii("Fraction"); break;
142 [ # # ]: 0 : case ITEM_XCOLOR : aStr.AppendAscii("XColor"); break;
143 [ # # ]: 0 : case ITEM_COLOR : aStr.AppendAscii("Color"); break;
144 [ # # ]: 0 : case ITEM_FONT : aStr.AppendAscii("Font"); break;
145 [ # # ]: 0 : case ITEM_FONTHEIGHT:aStr.AppendAscii("FontHeight");break;
146 [ # # ]: 0 : case ITEM_FONTWIDTH :aStr.AppendAscii("FontWidth"); break;
147 [ # # ]: 0 : case ITEM_FIELD :aStr.AppendAscii("Field"); break;
148 : 0 : default: break;
149 : : }
150 : :
151 : 0 : return aStr;
152 : : }
153 : :
154 : 0 : sal_Bool ImpItemListRow::operator==(const ImpItemListRow& rEntry) const
155 : : {
156 : 0 : return (aName.Equals(rEntry.aName)
157 : 0 : && aValue.Equals(rEntry.aValue)
158 : : && eState==rEntry.eState
159 : : && nWhichId==rEntry.nWhichId
160 : : && bComment==rEntry.bComment
161 : : && bIsNum==rEntry.bIsNum
162 : : && bCanNum==rEntry.bCanNum
163 : : && pType==rEntry.pType
164 : : && eItemType==rEntry.eItemType
165 : : && nVal==rEntry.nVal
166 : : && nMin==rEntry.nMin
167 [ # # ][ # # ]: 0 : && nMax==rEntry.nMax);
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
168 : : }
169 : :
170 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
171 : :
172 : : class ImpItemEdit: public Edit
173 : : {
174 : : _SdrItemBrowserControl* pBrowse;
175 : :
176 : : public:
177 : 0 : ImpItemEdit(Window* pParent, _SdrItemBrowserControl* pBrowse_, WinBits nBits=0)
178 : : : Edit(pParent, nBits),
179 : 0 : pBrowse(pBrowse_)
180 : 0 : {}
181 : :
182 : : virtual ~ImpItemEdit();
183 : : virtual void KeyInput(const KeyEvent& rEvt);
184 : : };
185 : :
186 : 0 : ImpItemEdit::~ImpItemEdit()
187 : : {
188 [ # # ]: 0 : }
189 : :
190 : 0 : void ImpItemEdit::KeyInput(const KeyEvent& rKEvt)
191 : : {
192 : 0 : _SdrItemBrowserControl* pBrowseMerk = pBrowse;
193 : :
194 : 0 : sal_uInt16 nKeyCode(rKEvt.GetKeyCode().GetCode() + rKEvt.GetKeyCode().GetModifier());
195 : :
196 [ # # ]: 0 : if(nKeyCode == KEY_RETURN)
197 : : {
198 : 0 : pBrowseMerk->EndChangeEntry();
199 : 0 : pBrowseMerk->GrabFocus();
200 : : }
201 [ # # ]: 0 : else if(nKeyCode == KEY_ESCAPE)
202 : : {
203 : 0 : pBrowseMerk->BrkChangeEntry();
204 : 0 : pBrowseMerk->GrabFocus();
205 : : }
206 [ # # ][ # # ]: 0 : else if(nKeyCode == KEY_UP || nKeyCode == KEY_DOWN)
207 : : {
208 : 0 : pBrowseMerk->EndChangeEntry();
209 : 0 : pBrowseMerk->GrabFocus();
210 : 0 : pBrowseMerk->KeyInput(rKEvt);
211 : : }
212 : : else
213 : 0 : Edit::KeyInput(rKEvt);
214 : 0 : }
215 : :
216 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
217 : :
218 : : #define MYBROWSEMODE (BROWSER_THUMBDRAGGING|BROWSER_KEEPHIGHLIGHT|BROWSER_NO_HSCROLL|BROWSER_HIDECURSOR)
219 : :
220 : 0 : _SdrItemBrowserControl::_SdrItemBrowserControl(Window* pParent, WinBits nBits):
221 : : BrowseBox(pParent,nBits,MYBROWSEMODE),
222 [ # # ][ # # ]: 0 : aList()
[ # # ][ # # ]
223 : : {
224 [ # # ]: 0 : ImpCtor();
225 : 0 : }
226 : :
227 [ # # ]: 0 : _SdrItemBrowserControl::~_SdrItemBrowserControl()
228 : : {
229 [ # # ]: 0 : if(pEditControl)
230 [ # # ][ # # ]: 0 : delete pEditControl;
231 : :
232 [ # # ]: 0 : if(pAktChangeEntry)
233 [ # # ][ # # ]: 0 : delete pAktChangeEntry;
234 : :
235 [ # # ]: 0 : Clear();
236 [ # # ]: 0 : }
237 : :
238 : 0 : void _SdrItemBrowserControl::ImpCtor()
239 : : {
240 : 0 : pEditControl = NULL;
241 : 0 : pAktChangeEntry = NULL;
242 : 0 : nLastWhichOfs = 0;
243 : 0 : nLastWhich = 0;
244 : 0 : nLastWhichOben = 0; // not implemented yet
245 : 0 : nLastWhichUnten = 0; // not implemented yet
246 : 0 : bWhichesButNames = sal_False;
247 : 0 : bDontHideIneffectiveItems = sal_False;
248 : 0 : bDontSortItems = sal_False;
249 : 0 : bShowWhichIds = sal_False;
250 : 0 : bShowRealValues = sal_False;
251 : 0 : bShowWhichIds = sal_True; // not implemented yet
252 : 0 : bShowRealValues = sal_True; // not implemented yet
253 : :
254 : 0 : rtl_TextEncoding aTextEncoding = osl_getThreadTextEncoding();
255 : :
256 : : InsertDataColumn(
257 : : ITEMBROWSER_WHICHCOL_ID,
258 : : String("Which", aTextEncoding),
259 [ # # ][ # # ]: 0 : GetTextWidth(String(" Which ", aTextEncoding)) + 2);
[ # # ][ # # ]
260 : : InsertDataColumn(
261 : : ITEMBROWSER_STATECOL_ID,
262 : : String("State", aTextEncoding),
263 [ # # ][ # # ]: 0 : Max(GetTextWidth(String(" State ", aTextEncoding)) + 2 ,
[ # # ]
264 [ # # ][ # # ]: 0 : GetTextWidth(String("DontCare", aTextEncoding)) + 2));
[ # # ][ # # ]
265 : : InsertDataColumn(
266 : : ITEMBROWSER_TYPECOL_ID ,
267 : : String("Type", aTextEncoding),
268 [ # # ][ # # ]: 0 : GetTextWidth(String(" Type_ ", aTextEncoding)) + 2);
[ # # ][ # # ]
269 : : InsertDataColumn(
270 : : ITEMBROWSER_NAMECOL_ID ,
271 : : String("Name", aTextEncoding),
272 [ # # ]: 0 : 150);
273 : : InsertDataColumn(
274 : : ITEMBROWSER_VALUECOL_ID,
275 : : String("Value", aTextEncoding),
276 [ # # ][ # # ]: 0 : GetTextWidth(String("12345678901234567890", aTextEncoding)));
[ # # ][ # # ]
277 : : SetDataRowHeight(
278 : 0 : GetTextHeight());
279 : :
280 : 0 : long nWdt=GetColumnWidth(ITEMBROWSER_WHICHCOL_ID)+
281 : 0 : GetColumnWidth(ITEMBROWSER_STATECOL_ID)+
282 : 0 : GetColumnWidth(ITEMBROWSER_TYPECOL_ID )+
283 : 0 : GetColumnWidth(ITEMBROWSER_NAMECOL_ID )+
284 : 0 : GetColumnWidth(ITEMBROWSER_VALUECOL_ID);
285 : :
286 : 0 : long nHgt=GetTitleHeight()+16*GetDataRowHeight();
287 : :
288 [ # # ]: 0 : SetOutputSizePixel(Size(nWdt,nHgt));
289 : 0 : }
290 : :
291 : 0 : void _SdrItemBrowserControl::Clear()
292 : : {
293 : 0 : sal_uIntPtr nAnz=aList.size();
294 [ # # ]: 0 : for (sal_uIntPtr nNum=0; nNum<nAnz; nNum++) {
295 [ # # ]: 0 : delete ImpGetEntry(nNum);
296 : : }
297 : 0 : aList.clear();
298 : 0 : BrowseBox::Clear();
299 : 0 : }
300 : :
301 : 0 : long _SdrItemBrowserControl::GetRowCount() const
302 : : {
303 : 0 : return aList.size();
304 : : }
305 : :
306 : 0 : sal_Bool _SdrItemBrowserControl::SeekRow(long nRow)
307 : : {
308 : 0 : nAktPaintRow=nRow;
309 : 0 : return sal_True;
310 : : }
311 : :
312 : 0 : String _SdrItemBrowserControl::GetCellText(long _nRow, sal_uInt16 _nColId) const
313 : : {
314 : 0 : String sRet;
315 [ # # ][ # # ]: 0 : if ( _nRow >= 0 && _nRow < (sal_Int32)aList.size() )
[ # # ]
316 : : {
317 [ # # ]: 0 : ImpItemListRow* pEntry = ImpGetEntry(_nRow);
318 [ # # ]: 0 : if ( pEntry )
319 : : {
320 [ # # ]: 0 : if ( pEntry->bComment )
321 : : {
322 [ # # ]: 0 : if (_nColId == ITEMBROWSER_NAMECOL_ID)
323 [ # # ]: 0 : sRet = pEntry->aName;
324 : : }
325 : : else
326 : : {
327 [ # # ]: 0 : rtl_TextEncoding aTextEncoding = osl_getThreadTextEncoding();
328 : :
329 [ # # ][ # # ]: 0 : sRet = XubString("???", aTextEncoding);
[ # # ]
330 [ # # # # : 0 : switch (_nColId)
# # ]
331 : : {
332 : : case ITEMBROWSER_WHICHCOL_ID:
333 [ # # ][ # # ]: 0 : sRet = UniString::CreateFromInt32(pEntry->nWhichId); break;
[ # # ]
334 : : case ITEMBROWSER_STATECOL_ID:
335 : : {
336 [ # # # # : 0 : switch (pEntry->eState)
# # ]
337 : : {
338 [ # # ][ # # ]: 0 : case SFX_ITEM_UNKNOWN : sRet=String("Uknown", aTextEncoding); break;
[ # # ]
339 [ # # ][ # # ]: 0 : case SFX_ITEM_DISABLED: sRet=String("Disabled", aTextEncoding); break;
[ # # ]
340 [ # # ][ # # ]: 0 : case SFX_ITEM_DONTCARE: sRet=String("DontCare", aTextEncoding); break;
[ # # ]
341 [ # # ][ # # ]: 0 : case SFX_ITEM_SET : sRet=String("Set", aTextEncoding); break;
[ # # ]
342 [ # # ][ # # ]: 0 : case SFX_ITEM_DEFAULT : sRet=String("Default", aTextEncoding); break;
[ # # ]
343 : : } // switch
344 : 0 : } break;
345 [ # # ][ # # ]: 0 : case ITEMBROWSER_TYPECOL_ID: sRet = pEntry->GetItemTypeStr(); break;
[ # # ]
346 [ # # ]: 0 : case ITEMBROWSER_NAMECOL_ID: sRet = pEntry->aName; break;
347 [ # # ]: 0 : case ITEMBROWSER_VALUECOL_ID: sRet = pEntry->aValue; break;
348 : : } // switch
349 : : }
350 : : }
351 : : }
352 : 0 : return sRet;
353 : : }
354 : :
355 : 0 : void _SdrItemBrowserControl::PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const
356 : : {
357 [ # # ][ # # ]: 0 : if (nAktPaintRow<0 || (sal_uIntPtr)nAktPaintRow>=aList.size()) {
[ # # ]
358 : 0 : return;
359 : : }
360 : 0 : Rectangle aR(rRect);
361 : 0 : aR.Bottom()++;
362 [ # # ]: 0 : ImpItemListRow* pEntry=ImpGetEntry(nAktPaintRow);
363 [ # # ]: 0 : if (pEntry->bComment)
364 : : {
365 [ # # ]: 0 : if (nColumnId==ITEMBROWSER_NAMECOL_ID)
366 : : {
367 [ # # ]: 0 : rDev.SetLineColor();
368 [ # # ]: 0 : rDev.SetFillColor( Color( COL_LIGHTGRAY ) );
369 : 0 : aR.Left()=0;
370 [ # # ]: 0 : aR.Right()=rDev.GetOutputSize().Width();
371 [ # # ]: 0 : rDev.DrawRect(aR);
372 [ # # ]: 0 : rDev.DrawText(rRect.TopLeft(),pEntry->aName);
373 : : }
374 : : } else {
375 [ # # ][ # # ]: 0 : rDev.SetClipRegion(aR);
[ # # ]
376 [ # # ][ # # ]: 0 : rDev.DrawText(aR.TopLeft(),GetCellText(nAktPaintRow,nColumnId));
[ # # ]
377 [ # # ]: 0 : rDev.SetClipRegion();
378 : : }
379 : : }
380 : :
381 : 0 : sal_uIntPtr _SdrItemBrowserControl::GetCurrentPos() const
382 : : {
383 : 0 : sal_uIntPtr nRet=CONTAINER_ENTRY_NOTFOUND;
384 [ # # ]: 0 : if (GetSelectRowCount()==1) {
385 : 0 : long nPos=((BrowseBox*)this)->FirstSelectedRow();
386 [ # # ][ # # ]: 0 : if (nPos>=0 && (sal_uIntPtr)nPos<aList.size()) {
[ # # ]
387 : 0 : nRet=(sal_uIntPtr)nPos;
388 : : }
389 : : }
390 : 0 : return nRet;
391 : : }
392 : :
393 : 0 : sal_uInt16 _SdrItemBrowserControl::GetCurrentWhich() const
394 : : {
395 : 0 : sal_uInt16 nRet=0;
396 : 0 : sal_uIntPtr nPos=GetCurrentPos();
397 [ # # ]: 0 : if (nPos!=CONTAINER_ENTRY_NOTFOUND) {
398 : 0 : nRet=ImpGetEntry(nPos)->nWhichId;
399 : : }
400 : 0 : return nRet;
401 : : }
402 : :
403 : 0 : void _SdrItemBrowserControl::DoubleClick(const BrowserMouseEvent&)
404 : : {
405 : 0 : sal_uIntPtr nPos=GetCurrentPos();
406 [ # # ]: 0 : if (nPos!=CONTAINER_ENTRY_NOTFOUND) {
407 : 0 : BegChangeEntry(nPos);
408 : : }
409 : 0 : }
410 : :
411 : 0 : void _SdrItemBrowserControl::KeyInput(const KeyEvent& rKEvt)
412 : : {
413 : 0 : sal_uInt16 nKeyCode=rKEvt.GetKeyCode().GetCode()+rKEvt.GetKeyCode().GetModifier();
414 : 0 : bool bAusgewertet = false;
415 : 0 : sal_uIntPtr nPos=GetCurrentPos();
416 [ # # ]: 0 : if (nPos!=CONTAINER_ENTRY_NOTFOUND) {
417 [ # # ]: 0 : if (nKeyCode==KEY_RETURN) {
418 [ # # ]: 0 : if (BegChangeEntry(nPos)) bAusgewertet = true;
419 [ # # ]: 0 : } else if (nKeyCode==KEY_ESCAPE) {
420 : : // ...
421 [ # # ]: 0 : } else if (rKEvt.GetKeyCode().GetModifier()==KEY_SHIFT+KEY_MOD1+KEY_MOD2) { // Ctrl
422 [ # # ]: 0 : if (nKeyCode==KEY_SHIFT+KEY_MOD1+KEY_MOD2+KEY_W) {
423 : 0 : bWhichesButNames=!bWhichesButNames;
424 : 0 : SetDirty();
425 : : }
426 [ # # ]: 0 : if (nKeyCode==KEY_SHIFT+KEY_MOD1+KEY_MOD2+KEY_I) {
427 : 0 : bDontHideIneffectiveItems=!bDontHideIneffectiveItems;
428 : 0 : SetDirty();
429 : : }
430 [ # # ]: 0 : if (nKeyCode==KEY_SHIFT+KEY_MOD1+KEY_MOD2+KEY_S) {
431 : 0 : bDontSortItems=!bDontSortItems;
432 : 0 : SetDirty();
433 : : }
434 : : }
435 : : }
436 [ # # ]: 0 : if (!bAusgewertet) BrowseBox::KeyInput(rKEvt);
437 : 0 : }
438 : :
439 : 0 : void _SdrItemBrowserControl::SetDirty()
440 : : {
441 : 0 : aSetDirtyHdl.Call(this);
442 : 0 : }
443 : :
444 : 0 : Rectangle _SdrItemBrowserControl::GetFieldCharacterBounds(sal_Int32 /*_nRow*/,sal_Int32 /*_nColumnPos*/,sal_Int32 /*nIndex*/)
445 : : {
446 : : // no accessibility implementation required
447 : 0 : return Rectangle();
448 : : }
449 : :
450 : 0 : sal_Int32 _SdrItemBrowserControl::GetFieldIndexAtPoint(sal_Int32 /*_nRow*/,sal_Int32 /*_nColumnPos*/,const Point& /*_rPoint*/)
451 : : {
452 : : // no accessibility implementation required
453 : 0 : return -1;
454 : : }
455 : :
456 : 0 : void _SdrItemBrowserControl::Select()
457 : : {
458 : 0 : EndChangeEntry();
459 : 0 : BrowseBox::Select();
460 : 0 : ImpSaveWhich();
461 : 0 : }
462 : :
463 : 0 : void _SdrItemBrowserControl::ImpSaveWhich()
464 : : {
465 : 0 : sal_uInt16 nWh=GetCurrentWhich();
466 [ # # ]: 0 : if (nWh!=0) {
467 : 0 : long nPos=GetCurrentPos();
468 : 0 : long nTop=GetTopRow();
469 : 0 : long nBtm=GetTopRow()+GetVisibleRows()+1;
470 : 0 : nLastWhich=nWh;
471 : 0 : nLastWhichOfs=nPos-nTop;
472 [ # # ]: 0 : if (nTop<0) nTop=0;
473 [ # # ]: 0 : if (nBtm>=(long)aList.size()) nBtm=aList.size()-1;
474 : 0 : nLastWhichOben=ImpGetEntry(nTop)->nWhichId;
475 : 0 : nLastWhichUnten=ImpGetEntry(nBtm)->nWhichId;
476 : : }
477 : 0 : }
478 : :
479 : 0 : void _SdrItemBrowserControl::ImpRestoreWhich()
480 : : {
481 [ # # ]: 0 : if (nLastWhich!=0) {
482 : 0 : bool bFnd = false;
483 : 0 : sal_uIntPtr nAnz=aList.size();
484 : : sal_uIntPtr nNum;
485 [ # # ][ # # ]: 0 : for (nNum=0; nNum<nAnz && !bFnd; nNum++) {
[ # # ]
486 : 0 : ImpItemListRow* pEntry=ImpGetEntry(nNum);
487 [ # # ]: 0 : if (!pEntry->bComment) {
488 : 0 : sal_uInt16 nWh=pEntry->nWhichId;
489 [ # # ]: 0 : if (nWh==nLastWhich) bFnd = true;
490 : : }
491 : : }
492 [ # # ]: 0 : if (bFnd) {
493 : 0 : long nPos=nNum-1;
494 : 0 : long nWhichOfs=nPos-GetTopRow();
495 [ # # ]: 0 : if (nWhichOfs!=nLastWhichOfs) {
496 : 0 : ScrollRows(nWhichOfs-nLastWhichOfs);
497 : : }
498 : 0 : GoToRow(nPos);
499 : : }
500 : : }
501 : 0 : }
502 : :
503 : 0 : bool _SdrItemBrowserControl::BegChangeEntry(sal_uIntPtr nPos)
504 : : {
505 : 0 : BrkChangeEntry();
506 : 0 : bool bRet = false;
507 : 0 : ImpItemListRow* pEntry=ImpGetEntry(nPos);
508 [ # # ][ # # ]: 0 : if (pEntry!=NULL && !pEntry->bComment) {
509 [ # # ]: 0 : SetMode(MYBROWSEMODE & ~BROWSER_KEEPHIGHLIGHT);
510 [ # # ][ # # ]: 0 : pEditControl=new ImpItemEdit(&GetDataWindow(),this,0);
511 [ # # ]: 0 : Rectangle aRect(GetFieldRectPixel(nPos,ITEMBROWSER_VALUECOL_ID,sal_False));
512 : 0 : aRect.Left()+=2; // little offset for the Edit, so it's exact to the pixel
513 : 0 : aRect.Right()--;
514 [ # # ][ # # ]: 0 : pEditControl->SetPosSizePixel(aRect.TopLeft(),aRect.GetSize());
515 [ # # ]: 0 : pEditControl->SetText(pEntry->aValue);
516 [ # # ][ # # ]: 0 : pEditControl->SetBackground( Wallpaper(Color(COL_LIGHTGRAY)));
[ # # ]
517 [ # # ]: 0 : Font aFont(pEditControl->GetFont());
518 [ # # ]: 0 : aFont.SetFillColor(Color(COL_LIGHTGRAY));
519 [ # # ]: 0 : pEditControl->SetFont(aFont);
520 [ # # ]: 0 : pEditControl->Show();
521 [ # # ]: 0 : pEditControl->GrabFocus();
522 [ # # ]: 0 : pEditControl->SetSelection(Selection(SELECTION_MIN,SELECTION_MAX));
523 [ # # ]: 0 : Window* pParent=GetParent();
524 [ # # ][ # # ]: 0 : aWNamMerk=pParent->GetText();
[ # # ]
525 [ # # ]: 0 : XubString aNeuNam(aWNamMerk);
526 [ # # ]: 0 : aNeuNam += sal_Unicode(' ');
527 [ # # ][ # # ]: 0 : aNeuNam += pEntry->GetItemTypeStr();
[ # # ]
528 [ # # ]: 0 : if (pEntry->bCanNum) {
529 [ # # ]: 0 : aNeuNam.AppendAscii(": ");
530 [ # # ][ # # ]: 0 : aNeuNam += UniString::CreateFromInt32(pEntry->nMin);
[ # # ]
531 [ # # ]: 0 : aNeuNam.AppendAscii("..");
532 [ # # ][ # # ]: 0 : aNeuNam += UniString::CreateFromInt32(pEntry->nMax);
[ # # ]
533 : : }
534 [ # # ]: 0 : aNeuNam.AppendAscii(" - Type 'del' to reset to default.");
535 [ # # ]: 0 : pParent->SetText(aNeuNam);
536 [ # # ][ # # ]: 0 : pAktChangeEntry=new ImpItemListRow(*pEntry);
537 [ # # ][ # # ]: 0 : bRet = true;
538 : : }
539 : 0 : return bRet;
540 : : }
541 : :
542 : 0 : bool _SdrItemBrowserControl::EndChangeEntry()
543 : : {
544 : 0 : bool bRet = false;
545 [ # # ]: 0 : if (pEditControl!=NULL) {
546 : 0 : aEntryChangedHdl.Call(this);
547 [ # # ]: 0 : delete pEditControl;
548 : 0 : pEditControl=NULL;
549 [ # # ]: 0 : delete pAktChangeEntry;
550 : 0 : pAktChangeEntry=NULL;
551 : 0 : Window* pParent=GetParent();
552 : 0 : pParent->SetText(aWNamMerk);
553 : 0 : SetMode(MYBROWSEMODE);
554 : 0 : bRet = true;
555 : : }
556 : 0 : return bRet;
557 : : }
558 : :
559 : 0 : void _SdrItemBrowserControl::BrkChangeEntry()
560 : : {
561 [ # # ]: 0 : if (pEditControl!=NULL) {
562 [ # # ]: 0 : delete pEditControl;
563 : 0 : pEditControl=NULL;
564 [ # # ]: 0 : delete pAktChangeEntry;
565 : 0 : pAktChangeEntry=NULL;
566 : 0 : Window* pParent=GetParent();
567 : 0 : pParent->SetText(aWNamMerk);
568 : 0 : SetMode(MYBROWSEMODE);
569 : : }
570 : 0 : }
571 : :
572 : 0 : void _SdrItemBrowserControl::ImpSetEntry(const ImpItemListRow& rEntry, sal_uIntPtr nEntryNum)
573 : : {
574 : 0 : ImpItemListRow* pAktEntry=ImpGetEntry(nEntryNum);
575 [ # # ]: 0 : if (pAktEntry==NULL) {
576 [ # # ][ # # ]: 0 : aList.push_back(new ImpItemListRow(rEntry));
577 : 0 : RowInserted(nEntryNum);
578 [ # # ]: 0 : } else if (*pAktEntry!=rEntry) {
579 : 0 : bool bStateDiff=rEntry.eState!=pAktEntry->eState;
580 : 0 : bool bValueDiff=!rEntry.aValue.Equals(pAktEntry->aValue);
581 : 0 : bool bAllDiff = true;
582 [ # # ][ # # ]: 0 : if (bStateDiff || bValueDiff) {
583 : : // check whether only state and/or value have changed
584 [ # # ]: 0 : ImpItemListRow aTest(rEntry);
585 : 0 : aTest.eState=pAktEntry->eState;
586 [ # # ]: 0 : aTest.aValue=pAktEntry->aValue;
587 [ # # ][ # # ]: 0 : if (aTest==*pAktEntry) bAllDiff = false;
[ # # ]
588 : : }
589 : 0 : *pAktEntry=rEntry;
590 [ # # ]: 0 : if (bAllDiff) {
591 : 0 : RowModified(nEntryNum);
592 : : } else {
593 [ # # ]: 0 : if (bStateDiff) RowModified(nEntryNum,ITEMBROWSER_STATECOL_ID);
594 [ # # ]: 0 : if (bValueDiff) RowModified(nEntryNum,ITEMBROWSER_VALUECOL_ID);
595 : : }
596 : : }
597 : 0 : }
598 : :
599 : 0 : bool ImpGetItem(const SfxItemSet& rSet, sal_uInt16 nWhich, const SfxPoolItem*& rpItem)
600 : : {
601 : 0 : SfxItemState eState=rSet.GetItemState(nWhich,sal_True,&rpItem);
602 [ # # ]: 0 : if (eState==SFX_ITEM_DEFAULT) {
603 : 0 : rpItem=&rSet.Get(nWhich);
604 : : }
605 [ # # ][ # # ]: 0 : return (eState==SFX_ITEM_DEFAULT || eState==SFX_ITEM_SET) && rpItem!=NULL;
[ # # ]
606 : : }
607 : :
608 : 0 : bool IsItemIneffective(sal_uInt16 nWhich, const SfxItemSet* pSet, sal_uInt16& rIndent)
609 : : {
610 : 0 : rIndent=0;
611 [ # # ]: 0 : if (pSet==NULL) return sal_False;
612 : 0 : const SfxPoolItem* pItem=NULL;
613 : 0 : bool bRet = false;
614 [ # # # # : 0 : switch (nWhich) {
# # # # #
# # # # #
# # ]
615 : : case XATTR_LINEDASH :
616 : : case XATTR_LINEWIDTH :
617 : : case XATTR_LINECOLOR :
618 : : case XATTR_LINESTART :
619 : : case XATTR_LINEEND :
620 : : case XATTR_LINESTARTWIDTH :
621 : : case XATTR_LINEENDWIDTH :
622 : : case XATTR_LINESTARTCENTER :
623 : : case XATTR_LINEENDCENTER :
624 : : case XATTR_LINETRANSPARENCE : {
625 : 0 : rIndent=1;
626 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_LINESTYLE,pItem)) {
627 : 0 : XLineStyle eLineStyle=((const XLineStyleItem*)pItem)->GetValue();
628 [ # # ]: 0 : if (eLineStyle==XLINE_NONE) return sal_True;
629 [ # # ][ # # ]: 0 : if (eLineStyle!=XLINE_DASH && nWhich==XATTR_LINEDASH) return sal_True;
630 : : }
631 [ # # ][ # # ]: 0 : if (nWhich==XATTR_LINESTART || nWhich==XATTR_LINESTARTCENTER) {
632 : 0 : rIndent=2;
633 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_LINESTARTWIDTH,pItem)) {
634 : 0 : sal_Int32 nWdt=((const XLineStartWidthItem*)pItem)->GetValue();
635 [ # # ]: 0 : if (nWdt==0) return sal_True;
636 : : }
637 : : }
638 [ # # ][ # # ]: 0 : if (nWhich==XATTR_LINEEND || nWhich==XATTR_LINEENDCENTER) {
639 : 0 : rIndent=2;
640 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_LINEENDWIDTH,pItem)) {
641 : 0 : sal_Int32 nWdt=((const XLineEndWidthItem*)pItem)->GetValue();
642 [ # # ]: 0 : if (nWdt==0) return sal_True;
643 : : }
644 : : }
645 : 0 : } break;
646 : : case XATTR_FILLCOLOR : /* only for Style=Color */
647 : : case XATTR_FILLGRADIENT : /* only for Style=Gradient */
648 : : case XATTR_FILLHATCH : /* only for Style=Hatch */
649 : : case XATTR_FILLTRANSPARENCE : /* only for Style=Color */
650 : : case XATTR_GRADIENTSTEPCOUNT : /* only for Style=Gradient */
651 : : case XATTR_FILLBACKGROUND : /* only for Style=Hatch */
652 : : {
653 : 0 : rIndent=1;
654 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_FILLSTYLE,pItem)) {
655 : 0 : XFillStyle eFillStyle=((const XFillStyleItem*)pItem)->GetValue();
656 [ # # ]: 0 : if (eFillStyle==XFILL_NONE) return sal_True;
657 : : // transparency currently only for SolidFill
658 [ # # ][ # # ]: 0 : if (eFillStyle!=XFILL_SOLID && (nWhich==XATTR_FILLCOLOR || nWhich==XATTR_FILLTRANSPARENCE)) return sal_True;
[ # # ]
659 [ # # ][ # # ]: 0 : if (eFillStyle!=XFILL_GRADIENT && (nWhich==XATTR_FILLGRADIENT || nWhich==XATTR_GRADIENTSTEPCOUNT)) return sal_True;
[ # # ]
660 [ # # ][ # # ]: 0 : if (eFillStyle!=XFILL_HATCH && (nWhich==XATTR_FILLHATCH || nWhich==XATTR_FILLBACKGROUND)) return sal_True;
[ # # ]
661 : : }
662 : 0 : } break;
663 : : case XATTR_FILLBITMAP :
664 : : case XATTR_FILLBMP_TILE :
665 : : case XATTR_FILLBMP_POS : /* currently only if TILE=sal_True */
666 : : case XATTR_FILLBMP_SIZEX : /* only if not Stretch */
667 : : case XATTR_FILLBMP_SIZEY : /* only if not Stretch */
668 : : case XATTR_FILLBMP_SIZELOG : /* only if SIZELOG=sal_False to reset to sal_True (old) -> but is still in use */
669 : : case XATTR_FILLBMP_TILEOFFSETX : /* only if TILE=sal_True */
670 : : case XATTR_FILLBMP_TILEOFFSETY : /* only if TILE=sal_True */
671 : : case XATTR_FILLBMP_STRETCH : /* only if TILE=sal_False */
672 : : case XATTR_FILLBMP_POSOFFSETX : /* only if TILE=sal_True*/
673 : : case XATTR_FILLBMP_POSOFFSETY : { /* only if TILE=sal_True*/
674 : 0 : rIndent=1;
675 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_FILLSTYLE,pItem)) {
676 : 0 : XFillStyle eFillStyle=((const XFillStyleItem*)pItem)->GetValue();
677 [ # # ]: 0 : if (eFillStyle!=XFILL_BITMAP) return sal_True;
678 : : }
679 [ # # ][ # # ]: 0 : if (nWhich==XATTR_FILLBITMAP || nWhich==XATTR_FILLBMP_TILE) {
680 : 0 : return sal_False; // always selectable
681 : : }
682 : 0 : bool bTileTRUE = false;
683 : 0 : bool bTileFALSE = false;
684 : 0 : bool bStretchTRUE = false;
685 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_FILLBMP_TILE,pItem)) {
686 : 0 : bTileTRUE=((const XFillBmpTileItem*)pItem)->GetValue();
687 : 0 : bTileFALSE=!bTileTRUE;
688 : : }
689 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_FILLBMP_STRETCH,pItem)) {
690 : 0 : bStretchTRUE=((const XFillBmpStretchItem*)pItem)->GetValue();
691 : : }
692 : : // Stretch not selectable if Tile=TRUE
693 [ # # ]: 0 : if (nWhich==XATTR_FILLBMP_STRETCH) return bTileTRUE;
694 : : // and 7+1 items (sub-attributes) remain
695 : 0 : rIndent=2;
696 : : // Pos (enum) not selectable if Tile=FALSE
697 [ # # ]: 0 : if (nWhich==XATTR_FILLBMP_POS) return bTileFALSE;
698 : : // SizeXY not selectable if Stretch=TRUE
699 [ # # ][ # # ]: 0 : if (nWhich==XATTR_FILLBMP_SIZEX || nWhich==XATTR_FILLBMP_SIZEY) {
700 [ # # ][ # # ]: 0 : return bTileFALSE && bStretchTRUE;
701 : : }
702 : : // 2 items specially for Tile
703 [ # # ][ # # ]: 0 : if (nWhich==XATTR_FILLBMP_POSOFFSETX || nWhich==XATTR_FILLBMP_POSOFFSETY) {
704 : 0 : return bTileFALSE;
705 : : }
706 : : // another 2 items specially for Tile -- however, these exclude each other
707 [ # # ][ # # ]: 0 : if (nWhich==XATTR_FILLBMP_TILEOFFSETX || nWhich==XATTR_FILLBMP_TILEOFFSETY) {
708 [ # # ]: 0 : if (bTileFALSE) return sal_True;
709 : 0 : sal_uInt16 nX=0,nY=0;
710 : 0 : bool bX = false,bY = false;
711 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_FILLBMP_TILEOFFSETX,pItem)) {
712 : 0 : nX=((const XFillBmpTileOffsetXItem*)pItem)->GetValue();
713 : 0 : bX = true;
714 : : }
715 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_FILLBMP_TILEOFFSETY,pItem)) {
716 : 0 : nY=((const XFillBmpTileOffsetYItem*)pItem)->GetValue();
717 : 0 : bY = true;
718 : : }
719 [ # # ]: 0 : if (nWhich==XATTR_FILLBMP_TILEOFFSETX) {
720 [ # # ][ # # ]: 0 : if (nX!=0 || !bX) return sal_False;
721 [ # # ]: 0 : if (nY!=0) return sal_True;
722 : : } else {
723 [ # # ][ # # ]: 0 : if (nY!=0 || !bY) return sal_False;
724 [ # # ]: 0 : if (nX!=0) return sal_True;
725 : : }
726 : : }
727 : : // SizeLog not selectable if Stretch=TRUE and/or
728 : : // if SizeLog=sal_False.
729 : : // -> apparently still in use
730 : : // (sal_True is the static PoolDefault)
731 [ # # ]: 0 : if (nWhich==XATTR_FILLBMP_SIZELOG) {
732 [ # # ][ # # ]: 0 : if (bTileFALSE && bStretchTRUE) return sal_True;
733 : : }
734 : 0 : } break;
735 : :
736 : : case XATTR_FORMTXTADJUST :
737 : : case XATTR_FORMTXTDISTANCE :
738 : : case XATTR_FORMTXTSTART :
739 : : case XATTR_FORMTXTMIRROR :
740 : : case XATTR_FORMTXTOUTLINE :
741 : : case XATTR_FORMTXTSHADOW :
742 : : case XATTR_FORMTXTSHDWCOLOR :
743 : : case XATTR_FORMTXTSHDWXVAL :
744 : : case XATTR_FORMTXTSHDWYVAL :
745 : : case XATTR_FORMTXTSTDFORM :
746 : : case XATTR_FORMTXTHIDEFORM :
747 : : case XATTR_FORMTXTSHDWTRANSP: {
748 : 0 : rIndent=1;
749 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_FORMTXTSTYLE,pItem)) {
750 : 0 : XFormTextStyle eStyle=((const XFormTextStyleItem*)pItem)->GetValue();
751 [ # # ]: 0 : if (eStyle==XFT_NONE) return sal_True;
752 : : }
753 [ # # ][ # # ]: 0 : if ((nWhich>=XATTR_FORMTXTSHDWCOLOR && nWhich<=XATTR_FORMTXTSHDWYVAL) || nWhich>=XATTR_FORMTXTSHDWTRANSP) {
[ # # ]
754 : 0 : rIndent=2;
755 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,XATTR_FORMTXTSHADOW,pItem)) {
756 : 0 : XFormTextShadow eShadow=((const XFormTextShadowItem*)pItem)->GetValue();
757 [ # # ]: 0 : if (eShadow==XFTSHADOW_NONE) return sal_True;
758 : : }
759 : : }
760 : 0 : } break;
761 : :
762 : : case SDRATTR_SHADOWCOLOR :
763 : : case SDRATTR_SHADOWXDIST :
764 : : case SDRATTR_SHADOWYDIST :
765 : : case SDRATTR_SHADOWTRANSPARENCE:
766 : : case SDRATTR_SHADOW3D :
767 : : case SDRATTR_SHADOWPERSP : {
768 : 0 : rIndent=1;
769 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_SHADOW,pItem)) {
770 : 0 : bool bShadow=((const SdrShadowItem*)pItem)->GetValue();
771 [ # # ]: 0 : if (!bShadow) return sal_True;
772 : : }
773 : 0 : } break;
774 : :
775 : : case SDRATTR_CAPTIONANGLE: {
776 : 0 : rIndent=1;
777 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_CAPTIONFIXEDANGLE,pItem)) {
778 : 0 : bool bFixed=((const SdrCaptionFixedAngleItem*)pItem)->GetValue();
779 [ # # ]: 0 : if (!bFixed) return sal_True;
780 : : }
781 : 0 : } break;
782 : : case SDRATTR_CAPTIONESCREL:
783 : : case SDRATTR_CAPTIONESCABS: {
784 : 0 : rIndent=1;
785 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_CAPTIONESCISREL,pItem)) {
786 : 0 : bool bRel=((const SdrCaptionEscIsRelItem*)pItem)->GetValue();
787 [ # # ][ # # ]: 0 : if (bRel && nWhich==SDRATTR_CAPTIONESCABS) return sal_True;
788 [ # # ][ # # ]: 0 : if (!bRel && nWhich==SDRATTR_CAPTIONESCREL) return sal_True;
789 : : }
790 : 0 : } break;
791 : : case SDRATTR_CAPTIONLINELEN: {
792 : 0 : rIndent=1;
793 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_CAPTIONFITLINELEN,pItem)) {
794 : 0 : bool bFit=((const SdrCaptionFitLineLenItem*)pItem)->GetValue();
795 [ # # ]: 0 : if (bFit) return sal_True;
796 : : }
797 : 0 : } break;
798 : :
799 : : case SDRATTR_TEXT_MINFRAMEHEIGHT:
800 : : case SDRATTR_TEXT_MAXFRAMEHEIGHT: {
801 : 0 : rIndent=1;
802 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_TEXT_AUTOGROWHEIGHT,pItem)) {
803 : 0 : bool bAutoGrow=((const SdrTextAutoGrowHeightItem*)pItem)->GetValue();
804 [ # # ]: 0 : if (!bAutoGrow) return sal_True;
805 : : }
806 : 0 : } break;
807 : : case SDRATTR_TEXT_MINFRAMEWIDTH:
808 : : case SDRATTR_TEXT_MAXFRAMEWIDTH: {
809 : 0 : rIndent=1;
810 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_TEXT_AUTOGROWWIDTH,pItem)) {
811 : 0 : bool bAutoGrow=((const SdrTextAutoGrowWidthItem*)pItem)->GetValue();
812 [ # # ]: 0 : if (!bAutoGrow) return sal_True;
813 : : }
814 : 0 : } break;
815 : : case SDRATTR_TEXT_VERTADJUST:
816 : : case SDRATTR_TEXT_HORZADJUST: {
817 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_TEXT_FITTOSIZE,pItem)) {
818 : 0 : SdrFitToSizeType eFit=((const SdrTextFitToSizeTypeItem*)pItem)->GetValue();
819 [ # # ]: 0 : if (eFit!=SDRTEXTFIT_NONE) return sal_True;
820 : : }
821 : 0 : } break;
822 : :
823 : : case SDRATTR_TEXT_ANIDIRECTION :
824 : : case SDRATTR_TEXT_ANISTARTINSIDE:
825 : : case SDRATTR_TEXT_ANISTOPINSIDE :
826 : : case SDRATTR_TEXT_ANICOUNT :
827 : : case SDRATTR_TEXT_ANIDELAY :
828 : : case SDRATTR_TEXT_ANIAMOUNT : {
829 : 0 : rIndent=1;
830 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_TEXT_ANIKIND,pItem)) {
831 : 0 : SdrTextAniKind eAniKind=((const SdrTextAniKindItem*)pItem)->GetValue();
832 [ # # ]: 0 : if (eAniKind==SDRTEXTANI_NONE) return sal_True;
833 [ # # ][ # # ]: 0 : if (eAniKind==SDRTEXTANI_BLINK && (nWhich==SDRATTR_TEXT_ANIDIRECTION || nWhich==SDRATTR_TEXT_ANIAMOUNT)) return sal_True;
[ # # ]
834 [ # # ][ # # ]: 0 : if (eAniKind==SDRTEXTANI_SLIDE && (nWhich==SDRATTR_TEXT_ANISTARTINSIDE || nWhich==SDRATTR_TEXT_ANISTOPINSIDE)) return sal_True;
[ # # ]
835 : : }
836 : 0 : } break;
837 : :
838 : 0 : case SDRATTR_EDGELINEDELTAANZ: return sal_True;
839 : : case SDRATTR_EDGELINE1DELTA:
840 : : case SDRATTR_EDGELINE2DELTA:
841 : : case SDRATTR_EDGELINE3DELTA: {
842 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_EDGEKIND,pItem)) {
843 : 0 : SdrEdgeKind eKind=((const SdrEdgeKindItem*)pItem)->GetValue();
844 [ # # ]: 0 : if (eKind==SDREDGE_THREELINES) {
845 [ # # ]: 0 : if (nWhich>SDRATTR_EDGELINE2DELTA) return sal_True;
846 : 0 : else return sal_False;
847 : : }
848 [ # # ][ # # ]: 0 : if (eKind!=SDREDGE_ORTHOLINES && eKind!=SDREDGE_BEZIER) return sal_True;
849 : : }
850 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_EDGELINEDELTAANZ,pItem)) {
851 : 0 : sal_uInt16 nAnz=((const SdrEdgeLineDeltaAnzItem*)pItem)->GetValue();
852 [ # # ]: 0 : if (nAnz==0) return sal_True;
853 [ # # ][ # # ]: 0 : if (nAnz==1 && nWhich>SDRATTR_EDGELINE1DELTA) return sal_True;
854 [ # # ][ # # ]: 0 : if (nAnz==2 && nWhich>SDRATTR_EDGELINE2DELTA) return sal_True;
855 [ # # ][ # # ]: 0 : if (nAnz==3 && nWhich>SDRATTR_EDGELINE3DELTA) return sal_True;
856 : : }
857 : 0 : } break;
858 : :
859 : : case SDRATTR_CIRCSTARTANGLE:
860 : : case SDRATTR_CIRCENDANGLE : {
861 : 0 : rIndent=1;
862 [ # # ][ # # ]: 0 : if (ImpGetItem(*pSet,SDRATTR_CIRCKIND,pItem)) {
863 : 0 : SdrCircKind eKind=((const SdrCircKindItem*)pItem)->GetValue();
864 [ # # ]: 0 : if (eKind==SDRCIRC_FULL) return sal_True;
865 : : }
866 : 0 : } break;
867 : : } // switch
868 : 0 : return bRet;
869 : : }
870 : :
871 : 0 : sal_uInt16 ImpSortWhich(sal_uInt16 nWhich)
872 : : {
873 [ # # # # : 0 : switch (nWhich) {
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # #
# ]
874 : : // Line
875 : 0 : case XATTR_LINESTART : nWhich=XATTR_LINETRANSPARENCE ; break;
876 : 0 : case XATTR_LINEEND : nWhich=XATTR_LINESTARTWIDTH ; break;
877 : 0 : case XATTR_LINESTARTWIDTH : nWhich=XATTR_LINESTART ; break;
878 : 0 : case XATTR_LINEENDWIDTH : nWhich=XATTR_LINESTARTCENTER ; break;
879 : 0 : case XATTR_LINESTARTCENTER : nWhich=XATTR_LINEENDWIDTH ; break;
880 : 0 : case XATTR_LINEENDCENTER : nWhich=XATTR_LINEEND ; break;
881 : 0 : case XATTR_LINETRANSPARENCE : nWhich=XATTR_LINEENDCENTER ; break;
882 : :
883 : : // Fill
884 : 0 : case XATTR_FILLBMP_POS : nWhich=XATTR_FILLBMP_STRETCH ; break;
885 : 0 : case XATTR_FILLBMP_SIZEX : nWhich=XATTR_FILLBMP_POS ; break;
886 : 0 : case XATTR_FILLBMP_SIZEY : nWhich=XATTR_FILLBMP_SIZEX ; break;
887 : 0 : case XATTR_FILLBMP_SIZELOG : nWhich=XATTR_FILLBMP_SIZEY ; break;
888 : 0 : case XATTR_FILLBMP_TILEOFFSETX : nWhich=XATTR_FILLBMP_SIZELOG ; break;
889 : 0 : case XATTR_FILLBMP_TILEOFFSETY : nWhich=XATTR_FILLBMP_TILEOFFSETX ; break;
890 : 0 : case XATTR_FILLBMP_STRETCH : nWhich=XATTR_FILLBMP_TILEOFFSETY ; break;
891 : :
892 : : // Fontwork
893 : 0 : case XATTR_FORMTXTSHADOW : nWhich=XATTR_FORMTXTSTDFORM ; break;
894 : 0 : case XATTR_FORMTXTSHDWCOLOR : nWhich=XATTR_FORMTXTHIDEFORM ; break;
895 : 0 : case XATTR_FORMTXTSHDWXVAL : nWhich=XATTR_FORMTXTSHADOW ; break;
896 : 0 : case XATTR_FORMTXTSHDWYVAL : nWhich=XATTR_FORMTXTSHDWCOLOR ; break;
897 : 0 : case XATTR_FORMTXTSTDFORM : nWhich=XATTR_FORMTXTSHDWXVAL ; break;
898 : 0 : case XATTR_FORMTXTHIDEFORM : nWhich=XATTR_FORMTXTSHDWYVAL ; break;
899 : :
900 : : // Misc
901 : 0 : case SDRATTR_TEXT_MINFRAMEHEIGHT: nWhich=SDRATTR_TEXT_FITTOSIZE ; break;
902 : 0 : case SDRATTR_TEXT_AUTOGROWHEIGHT: nWhich=SDRATTR_TEXT_LEFTDIST ; break;
903 : 0 : case SDRATTR_TEXT_FITTOSIZE : nWhich=SDRATTR_TEXT_RIGHTDIST ; break;
904 : 0 : case SDRATTR_TEXT_LEFTDIST : nWhich=SDRATTR_TEXT_UPPERDIST ; break;
905 : 0 : case SDRATTR_TEXT_RIGHTDIST : nWhich=SDRATTR_TEXT_LOWERDIST ; break;
906 : 0 : case SDRATTR_TEXT_UPPERDIST : nWhich=SDRATTR_TEXT_AUTOGROWWIDTH ; break;
907 : 0 : case SDRATTR_TEXT_LOWERDIST : nWhich=SDRATTR_TEXT_MINFRAMEWIDTH ; break;
908 : 0 : case SDRATTR_TEXT_VERTADJUST : nWhich=SDRATTR_TEXT_MAXFRAMEWIDTH ; break;
909 : 0 : case SDRATTR_TEXT_MAXFRAMEHEIGHT: nWhich=SDRATTR_TEXT_AUTOGROWHEIGHT; break;
910 : 0 : case SDRATTR_TEXT_MINFRAMEWIDTH : nWhich=SDRATTR_TEXT_MINFRAMEHEIGHT; break;
911 : 0 : case SDRATTR_TEXT_MAXFRAMEWIDTH : nWhich=SDRATTR_TEXT_MAXFRAMEHEIGHT; break;
912 : 0 : case SDRATTR_TEXT_AUTOGROWWIDTH : nWhich=SDRATTR_TEXT_HORZADJUST ; break;
913 : 0 : case SDRATTR_TEXT_HORZADJUST : nWhich=SDRATTR_TEXT_VERTADJUST ; break;
914 : : } // switch
915 : 0 : return nWhich;
916 : : }
917 : :
918 : : #define INSERTCOMMENT(nStartId,nEndId,aStr) \
919 : : { if (nWhich0<nStartId && nWhich>=nStartId && nWhich<=nEndId) aCommentStr=aStr; }
920 : :
921 : 0 : void _SdrItemBrowserControl::SetAttributes(const SfxItemSet* pSet, const SfxItemSet* p2ndSet)
922 : : {
923 : 0 : SetMode(MYBROWSEMODE & ~BROWSER_KEEPHIGHLIGHT);
924 [ # # ]: 0 : if (pSet!=NULL) {
925 [ # # ]: 0 : rtl_TextEncoding aTextEncoding = osl_getThreadTextEncoding();
926 : 0 : sal_uInt16 nEntryNum=0;
927 [ # # ]: 0 : SfxWhichIter aIter(*pSet);
928 : 0 : const SfxItemPool* pPool=pSet->GetPool();
929 : 0 : sal_uInt16 nWhich0=0;
930 [ # # ]: 0 : sal_uInt16 nWhich=aIter.FirstWhich();
931 [ # # ]: 0 : while (nWhich!=0) {
932 : : // Now sort this a little bit differently.
933 : : // Only works as long as there are no InvalidItems, i. e. no gaps
934 : : // at this position in the Set.
935 [ # # ]: 0 : if (!bDontSortItems) nWhich=ImpSortWhich(nWhich);
936 [ # # ]: 0 : SfxItemState eState=pSet->GetItemState(nWhich);
937 [ # # ]: 0 : if (p2ndSet!=NULL) {
938 [ # # ]: 0 : SfxItemState e2ndState=p2ndSet->GetItemState(nWhich);
939 [ # # ]: 0 : if (eState==SFX_ITEM_DEFAULT) eState=SFX_ITEM_DISABLED;
940 [ # # ]: 0 : else if (e2ndState==SFX_ITEM_DEFAULT) eState=SFX_ITEM_DEFAULT;
941 : : }
942 [ # # ]: 0 : if (eState!=SFX_ITEM_DISABLED) {
943 [ # # ]: 0 : const SfxPoolItem& rItem=pSet->Get(nWhich);
944 : 0 : sal_uInt16 nIndent=0;
945 [ # # ][ # # ]: 0 : if (!HAS_BASE(SfxVoidItem,&rItem) && !HAS_BASE(SfxSetItem,&rItem) && (!IsItemIneffective(nWhich,pSet,nIndent) || bDontHideIneffectiveItems)) {
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
946 [ # # ]: 0 : XubString aCommentStr;
947 : :
948 [ # # ][ # # ]: 0 : INSERTCOMMENT(XATTR_LINE_FIRST,XATTR_LINE_LAST,String("L I N I E", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
949 [ # # ][ # # ]: 0 : INSERTCOMMENT(XATTR_FILL_FIRST,XATTR_FILL_LAST,String("F L � C H E", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
950 [ # # ][ # # ]: 0 : INSERTCOMMENT(XATTR_TEXT_FIRST,XATTR_TEXT_LAST,String("F O N T W O R K", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
951 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_SHADOW_FIRST,SDRATTR_SHADOW_LAST,String("S C H A T T E N", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
952 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_CAPTION_FIRST,SDRATTR_CAPTION_LAST,String("L E G E N D E", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
953 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_MISC_FIRST,SDRATTR_MISC_LAST,String("V E R S C H I E D E N E S", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
954 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_EDGE_FIRST,SDRATTR_EDGE_LAST,String("V E R B I N D E R", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
955 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_MEASURE_FIRST,SDRATTR_MEASURE_LAST,String("B E M A S S U N G", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
956 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_CIRC_FIRST,SDRATTR_CIRC_LAST,String("K R E I S", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
957 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_NOTPERSIST_FIRST,SDRATTR_NOTPERSIST_LAST,String("N O T P E R S I S T", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
958 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_MOVEX,SDRATTR_VERTSHEARONE,String("Transformationen auf alle Objekte einzeln", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
959 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_RESIZEXALL,SDRATTR_VERTSHEARALL,String("Transformationen auf alle Objekte gemeinsam", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
960 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_TRANSFORMREF1X,SDRATTR_TRANSFORMREF2Y,String("View-Referenzpunkte", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
961 [ # # ][ # # ]: 0 : INSERTCOMMENT(SDRATTR_GRAF_FIRST,SDRATTR_GRAF_LAST,String("G R A F I K", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
962 [ # # ][ # # ]: 0 : INSERTCOMMENT(EE_ITEMS_START,EE_ITEMS_END,String("E D I T E N G I N E", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
963 [ # # ][ # # ]: 0 : INSERTCOMMENT(EE_ITEMS_END+1,EE_ITEMS_END+1,String("... by Joe Merten, JME Engineering Berlin ...", aTextEncoding));
[ # # ][ # # ]
[ # # ][ # # ]
964 : :
965 [ # # ]: 0 : if(aCommentStr.Len())
966 : : {
967 [ # # ]: 0 : ImpItemListRow aEntry;
968 : 0 : aEntry.bComment = true;
969 [ # # ]: 0 : aEntry.aName=aCommentStr;
970 [ # # ]: 0 : ImpSetEntry(aEntry,nEntryNum);
971 [ # # ]: 0 : nEntryNum++;
972 : : }
973 : 0 : nWhich0=nWhich;
974 [ # # ]: 0 : ImpItemListRow aEntry;
975 [ # # ]: 0 : SdrItemPool::TakeItemName(nWhich, aEntry.aName);
976 : 0 : nIndent*=2;
977 : :
978 [ # # ]: 0 : while(nIndent > 0)
979 : : {
980 [ # # ]: 0 : aEntry.aName.Insert(sal_Unicode(' '), 0);
981 : 0 : nIndent--;
982 : : }
983 : :
984 : 0 : aEntry.eState=eState;
985 : 0 : aEntry.nWhichId=nWhich;
986 [ # # ]: 0 : if (!IsInvalidItem(&rItem)) {
987 [ # # ]: 0 : aEntry.pType=rItem.Type();
988 : 0 : aEntry.nMax=0x7FFFFFFF;
989 : 0 : aEntry.nMin=-aEntry.nMax;
990 : 0 : aEntry.nVal=-4711;
991 [ # # ][ # # ]: 0 : if (HAS_BASE(SfxByteItem ,&rItem)) aEntry.eItemType=ITEM_BYTE;
[ # # ][ # # ]
[ # # ]
992 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxInt16Item ,&rItem)) aEntry.eItemType=ITEM_INT16;
[ # # ][ # # ]
[ # # ]
993 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxUInt16Item ,&rItem)) aEntry.eItemType=ITEM_UINT16;
[ # # ][ # # ]
[ # # ]
994 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxInt32Item ,&rItem)) aEntry.eItemType=ITEM_INT32;
[ # # ][ # # ]
[ # # ]
995 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxUInt32Item ,&rItem)) aEntry.eItemType=ITEM_UINT32;
[ # # ][ # # ]
[ # # ]
996 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxEnumItemInterface,&rItem)) aEntry.eItemType=ITEM_ENUM;
[ # # ][ # # ]
[ # # ]
997 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxBoolItem ,&rItem)) aEntry.eItemType=ITEM_BOOL;
[ # # ][ # # ]
[ # # ]
998 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxFlagItem ,&rItem)) aEntry.eItemType=ITEM_FLAG;
[ # # ][ # # ]
[ # # ]
999 [ # # ][ # # ]: 0 : else if (HAS_BASE(XColorItem ,&rItem)) aEntry.eItemType=ITEM_XCOLOR;
[ # # ][ # # ]
[ # # ]
1000 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxStringItem ,&rItem)) aEntry.eItemType=ITEM_STRING;
[ # # ][ # # ]
[ # # ]
1001 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxPointItem ,&rItem)) aEntry.eItemType=ITEM_POINT;
[ # # ][ # # ]
[ # # ]
1002 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxRectangleItem,&rItem)) aEntry.eItemType=ITEM_RECT;
[ # # ][ # # ]
[ # # ]
1003 [ # # ][ # # ]: 0 : else if (HAS_BASE(SfxRangeItem ,&rItem)) aEntry.eItemType=ITEM_RANGE;
[ # # ][ # # ]
[ # # ]
1004 [ # # ][ # # ]: 0 : else if (HAS_BASE(SdrFractionItem ,&rItem)) aEntry.eItemType=ITEM_FRACTION;
[ # # ][ # # ]
[ # # ]
1005 [ # # ][ # # ]: 0 : else if (HAS_BASE(SvxColorItem ,&rItem)) aEntry.eItemType=ITEM_COLOR;
[ # # ][ # # ]
[ # # ]
1006 [ # # ][ # # ]: 0 : else if (HAS_BASE(SvxFontItem ,&rItem)) aEntry.eItemType=ITEM_FONT;
[ # # ][ # # ]
[ # # ]
1007 [ # # ][ # # ]: 0 : else if (HAS_BASE(SvxFontHeightItem,&rItem))aEntry.eItemType=ITEM_FONTHEIGHT;
[ # # ][ # # ]
[ # # ]
1008 [ # # ][ # # ]: 0 : else if (HAS_BASE(SvxCharScaleWidthItem,&rItem)) aEntry.eItemType=ITEM_FONTWIDTH;
[ # # ][ # # ]
[ # # ]
1009 [ # # ][ # # ]: 0 : else if (HAS_BASE(SvxFieldItem ,&rItem)) aEntry.eItemType=ITEM_FIELD;
[ # # ][ # # ]
[ # # ]
1010 [ # # # # : 0 : switch (aEntry.eItemType) {
# # # # #
# # ]
1011 : 0 : case ITEM_BYTE : aEntry.bIsNum = true; aEntry.nVal=((SfxByteItem &)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=255; break;
1012 : 0 : case ITEM_INT16 : aEntry.bIsNum = true; aEntry.nVal=((SfxInt16Item &)rItem).GetValue(); aEntry.nMin=-32767; aEntry.nMax=32767; break;
1013 : 0 : case ITEM_UINT16 : aEntry.bIsNum = true; aEntry.nVal=((SfxUInt16Item&)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=65535; break;
1014 : 0 : case ITEM_INT32 : aEntry.bIsNum = true; aEntry.nVal=((SfxInt32Item &)rItem).GetValue(); break;
1015 : 0 : case ITEM_UINT32 : aEntry.bIsNum = true; aEntry.nVal=((SfxUInt32Item&)rItem).GetValue(); aEntry.nMin=0; /*aEntry.nMax=0xFF...*/;break;
1016 [ # # ][ # # ]: 0 : case ITEM_ENUM : aEntry.bCanNum = true; aEntry.nVal=((SfxEnumItemInterface&)rItem).GetEnumValue(); aEntry.nMin=0; aEntry.nMax=((SfxEnumItemInterface&)rItem).GetValueCount()-1; break;
1017 : 0 : case ITEM_BOOL : aEntry.bCanNum = true; aEntry.nVal=((SfxBoolItem &)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=1; break;
1018 : 0 : case ITEM_FLAG : aEntry.bCanNum = true; aEntry.nVal=((SfxFlagItem &)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=0xFFFF; break;
1019 : 0 : case ITEM_FONTHEIGHT: aEntry.bCanNum = true; aEntry.nVal=((SvxFontHeightItem&)rItem).GetHeight(); aEntry.nMin=0; break;
1020 : 0 : case ITEM_FONTWIDTH : aEntry.bCanNum = true; aEntry.nVal=((SvxCharScaleWidthItem&)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=0xFFFF;break;
1021 : 0 : default: break;
1022 : : } // switch
1023 [ # # ]: 0 : if (aEntry.bIsNum) aEntry.bCanNum = true;
1024 : :
1025 : : rItem.GetPresentation(SFX_ITEM_PRESENTATION_NAMELESS,
1026 : 0 : pPool->GetMetric(nWhich),
1027 [ # # ][ # # ]: 0 : SFX_MAPUNIT_MM, aEntry.aValue);
1028 [ # # ]: 0 : if (aEntry.bCanNum)
1029 : : {
1030 [ # # ]: 0 : aEntry.aValue.InsertAscii(": ",0);
1031 [ # # ][ # # ]: 0 : aEntry.aValue.Insert(UniString::CreateFromInt32(aEntry.nVal),0);
[ # # ]
1032 : : }
1033 : : }
1034 : : else
1035 : : {
1036 [ # # ][ # # ]: 0 : aEntry.aValue = String("InvalidItem", aTextEncoding);
[ # # ]
1037 : : }
1038 [ # # ]: 0 : ImpSetEntry(aEntry,nEntryNum);
1039 [ # # ][ # # ]: 0 : nEntryNum++;
1040 : : }
1041 : : }
1042 [ # # ]: 0 : nWhich=aIter.NextWhich();
1043 : : } // while
1044 : :
1045 [ # # ]: 0 : if (aList.size()>nEntryNum) { // maybe still too many entries
1046 : 0 : size_t const nTooMuch = aList.size() - nEntryNum;
1047 [ # # ]: 0 : for (size_t n = nEntryNum; n < aList.size(); ++n) {
1048 [ # # ][ # # ]: 0 : delete aList[n];
1049 : : }
1050 [ # # ][ # # ]: 0 : aList.erase(aList.begin() + nEntryNum, aList.end());
1051 [ # # ]: 0 : RowRemoved(nEntryNum,nTooMuch);
1052 [ # # ]: 0 : }
1053 : : } else {
1054 : 0 : Clear(); // if pSet==NULL
1055 : : }
1056 : 0 : ImpRestoreWhich();
1057 : 0 : SetMode(MYBROWSEMODE);
1058 : 0 : }
1059 : :
1060 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1061 : :
1062 : 0 : _SdrItemBrowserWindow::_SdrItemBrowserWindow(Window* pParent, WinBits nBits):
1063 : : FloatingWindow(pParent,nBits),
1064 [ # # ]: 0 : aBrowse(this)
1065 : : {
1066 [ # # ][ # # ]: 0 : SetOutputSizePixel(aBrowse.GetSizePixel());
1067 [ # # ][ # # ]: 0 : SetText(String("Joe's ItemBrowser", osl_getThreadTextEncoding()));
[ # # ][ # # ]
1068 [ # # ]: 0 : aBrowse.Show();
1069 : 0 : }
1070 : :
1071 [ # # ]: 0 : _SdrItemBrowserWindow::~_SdrItemBrowserWindow()
1072 : : {
1073 [ # # ]: 0 : }
1074 : :
1075 : 0 : void _SdrItemBrowserWindow::Resize()
1076 : : {
1077 [ # # ]: 0 : aBrowse.SetSizePixel(GetOutputSizePixel());
1078 : 0 : }
1079 : :
1080 : 0 : void _SdrItemBrowserWindow::GetFocus()
1081 : : {
1082 : 0 : aBrowse.GrabFocus();
1083 : 0 : }
1084 : :
1085 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
1086 : :
1087 : 0 : SdrItemBrowser::SdrItemBrowser(SdrView& rView):
1088 : : _SdrItemBrowserWindow(ImpGetViewWin(rView)),
1089 : : pView(&rView),
1090 [ # # ]: 0 : bDirty(sal_False)
1091 : : {
1092 [ # # ]: 0 : aIdleTimer.SetTimeoutHdl(LINK(this,SdrItemBrowser,IdleHdl));
1093 [ # # ]: 0 : GetBrowserControl().SetEntryChangedHdl(LINK(this,SdrItemBrowser,ChangedHdl));
1094 [ # # ]: 0 : GetBrowserControl().SetSetDirtyHdl(LINK(this,SdrItemBrowser,SetDirtyHdl));
1095 [ # # ]: 0 : SetDirty();
1096 : 0 : }
1097 : :
1098 : 0 : Window* SdrItemBrowser::ImpGetViewWin(SdrView& rView)
1099 : : {
1100 : 0 : const sal_uInt32 nWinCount(rView.PaintWindowCount());
1101 : :
1102 [ # # ]: 0 : for(sal_uInt32 a(0L); a < nWinCount; a++)
1103 : : {
1104 : 0 : SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
1105 : :
1106 [ # # ]: 0 : if(OUTDEV_WINDOW == pCandidate->GetOutputDevice().GetOutDevType())
1107 : : {
1108 : 0 : return (Window*)(&pCandidate->GetOutputDevice());
1109 : : }
1110 : : }
1111 : :
1112 : 0 : return 0L;
1113 : : }
1114 : :
1115 : 0 : void SdrItemBrowser::ForceParent()
1116 : : {
1117 : 0 : Window* pWin=ImpGetViewWin(*pView);
1118 [ # # ]: 0 : if (pWin!=NULL) SetParent(pWin);
1119 : 0 : }
1120 : :
1121 : 0 : void SdrItemBrowser::SetDirty()
1122 : : {
1123 [ # # ]: 0 : if (!bDirty) {
1124 : 0 : bDirty = true;
1125 : 0 : aIdleTimer.SetTimeout(1);
1126 : 0 : aIdleTimer.Start();
1127 : : }
1128 : 0 : }
1129 : :
1130 : 0 : void SdrItemBrowser::Undirty()
1131 : : {
1132 [ # # ]: 0 : aIdleTimer.Stop();
1133 : 0 : bDirty = sal_False;
1134 : :
1135 [ # # ]: 0 : SfxItemSet aSet(pView->GetModel()->GetItemPool());
1136 [ # # ]: 0 : pView->GetAttributes(aSet);
1137 : :
1138 [ # # ]: 0 : if(pView->AreObjectsMarked())
1139 : : {
1140 [ # # ]: 0 : SfxItemSet a2ndSet(pView->GetModel()->GetItemPool());
1141 [ # # ]: 0 : pView->GetAttributes(a2ndSet, sal_True);
1142 : :
1143 [ # # ][ # # ]: 0 : SetAttributes(&aSet,&a2ndSet);
1144 : : }
1145 : : else
1146 : : {
1147 [ # # ]: 0 : SetAttributes(&aSet);
1148 [ # # ]: 0 : }
1149 : 0 : }
1150 : :
1151 : 0 : IMPL_LINK_NOARG(SdrItemBrowser, IdleHdl)
1152 : : {
1153 : 0 : Undirty();
1154 : 0 : return 0;
1155 : : }
1156 : :
1157 : 0 : IMPL_LINK(SdrItemBrowser,ChangedHdl,_SdrItemBrowserControl*,pBrowse)
1158 : : {
1159 : 0 : const ImpItemListRow* pEntry=pBrowse->GetAktChangeEntry();
1160 [ # # ]: 0 : if (pEntry!=NULL)
1161 : : {
1162 [ # # ]: 0 : SfxItemSet aSet(pView->GetModel()->GetItemPool());
1163 [ # # ]: 0 : pView->GetAttributes(aSet);
1164 : :
1165 [ # # ]: 0 : SfxItemSet aNewSet(*aSet.GetPool(),pEntry->nWhichId,pEntry->nWhichId);
1166 [ # # ][ # # ]: 0 : rtl::OUString aNewText(pBrowse->GetNewEntryValue());
[ # # ]
1167 : 0 : sal_Bool bDel( aNewText == "del"
1168 : 0 : || aNewText == "Del"
1169 : 0 : || aNewText == "DEL"
1170 : 0 : || aNewText == "default"
1171 : 0 : || aNewText == "Default"
1172 [ # # ][ # # : 0 : || aNewText == "DEFAULT" );
# # # # #
# # # ]
1173 : :
1174 [ # # ]: 0 : if (!bDel) {
1175 [ # # ][ # # ]: 0 : SfxPoolItem* pNewItem=aSet.Get(pEntry->nWhichId).Clone();
1176 : 0 : long nLongVal = aNewText.toInt32();
1177 [ # # ]: 0 : if (pEntry->bCanNum) {
1178 [ # # ]: 0 : if (nLongVal>pEntry->nMax) nLongVal=pEntry->nMax;
1179 [ # # ]: 0 : if (nLongVal<pEntry->nMin) nLongVal=pEntry->nMin;
1180 : : }
1181 : 0 : bool bPairX = true;
1182 : 0 : bool bPairY = false;
1183 : 0 : sal_uInt16 nSepLen=1;
1184 : 0 : long nLongX = aNewText.toInt32();
1185 : 0 : long nLongY=0;
1186 : 0 : sal_Int32 nPos = aNewText.indexOf(sal_Unicode('/'));
1187 [ # # ]: 0 : if (nPos==-1) nPos=aNewText.indexOf(sal_Unicode(':'));
1188 [ # # ]: 0 : if (nPos==-1) nPos=aNewText.indexOf(sal_Unicode(' '));
1189 [ # # ][ # # ]: 0 : if (nPos==-1) { nPos=aNewText.indexOf(".."); if (nPos!=-1) nSepLen=2; }
1190 [ # # ]: 0 : if (nPos!=01)
1191 : : {
1192 : 0 : bPairX=nPos>0;
1193 : 0 : rtl::OUString s(aNewText.copy(nPos+nSepLen));
1194 : 0 : bPairY = !aNewText.isEmpty();
1195 : 0 : nLongY = s.toInt32();
1196 : : }
1197 [ # # # # : 0 : switch (pEntry->eItemType) {
# # # # #
# # # # #
# # # # #
# # ]
1198 : 0 : case ITEM_BYTE : ((SfxByteItem *)pNewItem)->SetValue((sal_uInt8 )nLongVal); break;
1199 : 0 : case ITEM_INT16 : ((SfxInt16Item *)pNewItem)->SetValue((sal_Int16 )nLongVal); break;
1200 : 0 : case ITEM_UINT16: ((SfxUInt16Item*)pNewItem)->SetValue((sal_uInt16)nLongVal); break;
1201 : : case ITEM_INT32: {
1202 [ # # ][ # # ]: 0 : if(HAS_BASE(SdrAngleItem, pNewItem))
[ # # ][ # # ]
[ # # ]
1203 : : {
1204 : 0 : aNewText = aNewText.replace(',', '.');
1205 : 0 : double nVal = aNewText.toFloat();
1206 : 0 : nLongVal = (long)(nVal * 100 + 0.5);
1207 : : }
1208 : 0 : ((SfxInt32Item *)pNewItem)->SetValue((sal_Int32)nLongVal);
1209 : 0 : } break;
1210 : 0 : case ITEM_UINT32: ((SfxUInt32Item*)pNewItem)->SetValue(aNewText.toInt32()); break;
1211 [ # # ]: 0 : case ITEM_ENUM : ((SfxEnumItemInterface*)pNewItem)->SetEnumValue((sal_uInt16)nLongVal); break;
1212 : : case ITEM_BOOL: {
1213 : 0 : aNewText = aNewText.toAsciiUpperCase();
1214 [ # # ]: 0 : if (aNewText == "TRUE") nLongVal=1;
1215 [ # # ]: 0 : if (aNewText == "JA") nLongVal=1;
1216 [ # # ]: 0 : if (aNewText == "AN") nLongVal=1;
1217 [ # # ]: 0 : if (aNewText == "EIN") nLongVal=1;
1218 [ # # ]: 0 : if (aNewText == "ON") nLongVal=1;
1219 [ # # ]: 0 : if (aNewText == "YES") nLongVal=1;
1220 : 0 : ((SfxBoolItem*)pNewItem)->SetValue((sal_Bool)nLongVal);
1221 : 0 : } break;
1222 : 0 : case ITEM_FLAG : ((SfxFlagItem *)pNewItem)->SetValue((sal_uInt16)nLongVal); break;
1223 [ # # ][ # # ]: 0 : case ITEM_STRING: ((SfxStringItem*)pNewItem)->SetValue(aNewText); break;
[ # # ]
1224 : 0 : case ITEM_POINT : ((SfxPointItem*)pNewItem)->SetValue(Point(nLongX,nLongY)); break;
1225 : 0 : case ITEM_RECT : break;
1226 : : case ITEM_RANGE : {
1227 : 0 : ((SfxRangeItem*)pNewItem)->From()=(sal_uInt16)nLongX;
1228 : 0 : ((SfxRangeItem*)pNewItem)->From()=(sal_uInt16)nLongY;
1229 : 0 : } break;
1230 : : case ITEM_LRANGE : {
1231 : 0 : } break;
1232 : : case ITEM_FRACTION: {
1233 [ # # ]: 0 : if (!bPairX) nLongX=1;
1234 [ # # ]: 0 : if (!bPairY) nLongY=1;
1235 [ # # ][ # # ]: 0 : ((SdrFractionItem*)pNewItem)->SetValue(Fraction(nLongX,nLongY));
1236 : 0 : } break;
1237 : 0 : case ITEM_XCOLOR: break;
1238 : 0 : case ITEM_COLOR: break;
1239 : : case ITEM_FONT: {
1240 : 0 : ((SvxFontItem*)pNewItem)->SetFamily( FAMILY_DONTKNOW );
1241 [ # # ][ # # ]: 0 : ((SvxFontItem*)pNewItem)->SetFamilyName(aNewText);
[ # # ]
1242 [ # # ][ # # ]: 0 : ((SvxFontItem*)pNewItem)->SetStyleName( String() );
[ # # ]
1243 : 0 : } break;
1244 : : case ITEM_FONTHEIGHT: {
1245 : 0 : sal_uIntPtr nHgt=0;
1246 : 0 : sal_uInt16 nProp=100;
1247 [ # # ]: 0 : if (aNewText.indexOf(sal_Unicode('%')) != -1) {
1248 : 0 : nProp=(sal_uInt16)nLongVal;
1249 : : } else {
1250 : 0 : nHgt=nLongVal;
1251 : : }
1252 [ # # ]: 0 : ((SvxFontHeightItem*)pNewItem)->SetHeight(nHgt,nProp);
1253 : 0 : } break;
1254 : : case ITEM_FONTWIDTH: {
1255 : 0 : sal_uInt16 nProp=100;
1256 [ # # ]: 0 : if (aNewText.indexOf(sal_Unicode('%')) != -1) {
1257 : 0 : nProp=(sal_uInt16)nLongVal;
1258 : : }
1259 : 0 : ((SvxCharScaleWidthItem*)pNewItem)->SetValue(nProp);
1260 : 0 : } break;
1261 : 0 : case ITEM_FIELD: break;
1262 : 0 : default: break;
1263 : : } // switch
1264 [ # # ]: 0 : aNewSet.Put(*pNewItem);
1265 [ # # ][ # # ]: 0 : delete pNewItem;
1266 : : }
1267 [ # # ][ # # ]: 0 : pView->SetAttributes(aNewSet,bDel);
[ # # ]
1268 : : }
1269 : 0 : return 0;
1270 : : }
1271 : :
1272 : 0 : IMPL_LINK_NOARG(SdrItemBrowser, SetDirtyHdl)
1273 : : {
1274 : 0 : SetDirty();
1275 : 0 : return 0;
1276 : : }
1277 : :
1278 : :
1279 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|