1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <editeng/eeitem.hxx>
22 #include "svdibrow.hxx"
26 #include <editeng/flditem.hxx>
27 #include <editeng/editdata.hxx>
28 #include <svx/svdpool.hxx>
29 #include <svx/svdattr.hxx>
30 #include <svx/svdattrx.hxx>
31 #include <svx/svdview.hxx>
32 #include <svx/xenum.hxx>
33 #include <svx/xlineit0.hxx>
34 #include <svx/xlnstwit.hxx>
35 #include <svx/xlnedwit.hxx>
36 #include <svx/xfillit0.hxx>
37 #include <svx/xflbmtit.hxx>
38 #include <svx/xtextit0.hxx>
39 #include <svx/xflbstit.hxx>
40 #include <svx/xflbtoxy.hxx>
41 #include <svx/xftshit.hxx>
42 #include <editeng/colritem.hxx>
45 #include "editeng/fontitem.hxx"
46 #include <editeng/fhgtitem.hxx>
48 #include <editeng/charscaleitem.hxx>
49 #include <svl/whiter.hxx>
50 #include <svl/flagitem.hxx>
51 #include <svl/ptitem.hxx>
52 #include <svl/rectitem.hxx>
54 #include <svl/rngitem.hxx>
55 #include <svx/sdrpaintwindow.hxx>
57 ////////////////////////////////////////////////////////////////////////////////////////////////////
59 #define ITEMBROWSER_WHICHCOL_ID 1
60 #define ITEMBROWSER_STATECOL_ID 2
61 #define ITEMBROWSER_TYPECOL_ID 3
62 #define ITEMBROWSER_NAMECOL_ID 4
63 #define ITEMBROWSER_VALUECOL_ID 5
66 ITEM_DONTKNOW
, ITEM_BYTE
, ITEM_INT16
, ITEM_UINT16
, ITEM_INT32
, ITEM_UINT32
,
67 ITEM_ENUM
, ITEM_BOOL
, ITEM_FLAG
, ITEM_STRING
, ITEM_POINT
, ITEM_RECT
, ITEM_RANGE
, ITEM_LRANGE
,
71 ITEM_FONT
, ITEM_FONTHEIGHT
, ITEM_FONTWIDTH
, ITEM_FIELD
95 : eState(SFX_ITEM_UNKNOWN
),
98 eItemType(ITEM_DONTKNOW
),
107 XubString
GetItemTypeStr() const;
108 bool operator==(const ImpItemListRow
& rEntry
) const;
109 bool operator!=(const ImpItemListRow
& rEntry
) const { return !operator==(rEntry
); }
112 XubString
ImpItemListRow::GetItemTypeStr() const
118 case ITEM_BYTE
: aStr
.AppendAscii("Byte"); break;
119 case ITEM_INT16
: aStr
.AppendAscii("Int16"); break;
120 case ITEM_UINT16
: aStr
.AppendAscii("UInt16"); break;
121 case ITEM_INT32
: aStr
.AppendAscii("Int32"); break;
122 case ITEM_UINT32
: aStr
.AppendAscii("UInt32"); break;
123 case ITEM_ENUM
: aStr
.AppendAscii("Enum"); break;
124 case ITEM_BOOL
: aStr
.AppendAscii("Bool"); break;
125 case ITEM_FLAG
: aStr
.AppendAscii("Flag"); break;
126 case ITEM_STRING
: aStr
.AppendAscii("String"); break;
127 case ITEM_POINT
: aStr
.AppendAscii("Point"); break;
128 case ITEM_RECT
: aStr
.AppendAscii("Rectangle");break;
129 case ITEM_RANGE
: aStr
.AppendAscii("Range"); break;
130 case ITEM_LRANGE
: aStr
.AppendAscii("LRange"); break;
131 case ITEM_FRACTION
: aStr
.AppendAscii("Fraction"); break;
132 case ITEM_XCOLOR
: aStr
.AppendAscii("XColor"); break;
133 case ITEM_COLOR
: aStr
.AppendAscii("Color"); break;
134 case ITEM_FONT
: aStr
.AppendAscii("Font"); break;
135 case ITEM_FONTHEIGHT
:aStr
.AppendAscii("FontHeight");break;
136 case ITEM_FONTWIDTH
:aStr
.AppendAscii("FontWidth"); break;
137 case ITEM_FIELD
:aStr
.AppendAscii("Field"); break;
144 bool ImpItemListRow::operator==(const ImpItemListRow
& rEntry
) const
146 return (aName
.equals(rEntry
.aName
)
147 && aValue
.equals(rEntry
.aValue
)
148 && eState
==rEntry
.eState
149 && nWhichId
==rEntry
.nWhichId
150 && bComment
==rEntry
.bComment
151 && bIsNum
==rEntry
.bIsNum
152 && bCanNum
==rEntry
.bCanNum
153 && pType
==rEntry
.pType
154 && eItemType
==rEntry
.eItemType
157 && nMax
==rEntry
.nMax
);
160 ////////////////////////////////////////////////////////////////////////////////////////////////////
162 class ImpItemEdit
: public Edit
164 _SdrItemBrowserControl
* pBrowse
;
167 ImpItemEdit(Window
* pParent
, _SdrItemBrowserControl
* pBrowse_
, WinBits nBits
=0)
168 : Edit(pParent
, nBits
),
172 virtual ~ImpItemEdit();
173 virtual void KeyInput(const KeyEvent
& rEvt
);
176 ImpItemEdit::~ImpItemEdit()
180 void ImpItemEdit::KeyInput(const KeyEvent
& rKEvt
)
182 _SdrItemBrowserControl
* pBrowseMerk
= pBrowse
;
184 sal_uInt16
nKeyCode(rKEvt
.GetKeyCode().GetCode() + rKEvt
.GetKeyCode().GetModifier());
186 if(nKeyCode
== KEY_RETURN
)
188 pBrowseMerk
->EndChangeEntry();
189 pBrowseMerk
->GrabFocus();
191 else if(nKeyCode
== KEY_ESCAPE
)
193 pBrowseMerk
->BrkChangeEntry();
194 pBrowseMerk
->GrabFocus();
196 else if(nKeyCode
== KEY_UP
|| nKeyCode
== KEY_DOWN
)
198 pBrowseMerk
->EndChangeEntry();
199 pBrowseMerk
->GrabFocus();
200 pBrowseMerk
->KeyInput(rKEvt
);
203 Edit::KeyInput(rKEvt
);
206 ////////////////////////////////////////////////////////////////////////////////////////////////////
208 #define MYBROWSEMODE (BROWSER_THUMBDRAGGING|BROWSER_KEEPHIGHLIGHT|BROWSER_NO_HSCROLL|BROWSER_HIDECURSOR)
210 _SdrItemBrowserControl::_SdrItemBrowserControl(Window
* pParent
, WinBits nBits
):
211 BrowseBox(pParent
,nBits
,MYBROWSEMODE
),
217 _SdrItemBrowserControl::~_SdrItemBrowserControl()
221 delete pAktChangeEntry
;
226 void _SdrItemBrowserControl::ImpCtor()
229 pAktChangeEntry
= NULL
;
232 nLastWhichOben
= 0; // not implemented yet
233 nLastWhichUnten
= 0; // not implemented yet
234 bWhichesButNames
= sal_False
;
235 bDontHideIneffectiveItems
= sal_False
;
236 bDontSortItems
= sal_False
;
237 bShowWhichIds
= sal_False
;
238 bShowRealValues
= sal_False
;
239 bShowWhichIds
= sal_True
; // not implemented yet
240 bShowRealValues
= sal_True
; // not implemented yet
242 rtl_TextEncoding aTextEncoding
= osl_getThreadTextEncoding();
245 ITEMBROWSER_WHICHCOL_ID
,
246 String("Which", aTextEncoding
),
247 GetTextWidth(String(" Which ", aTextEncoding
)) + 2);
249 ITEMBROWSER_STATECOL_ID
,
250 String("State", aTextEncoding
),
251 std::max(GetTextWidth(String(" State ", aTextEncoding
)) + 2 ,
252 GetTextWidth(String("DontCare", aTextEncoding
)) + 2));
254 ITEMBROWSER_TYPECOL_ID
,
255 String("Type", aTextEncoding
),
256 GetTextWidth(String(" Type_ ", aTextEncoding
)) + 2);
258 ITEMBROWSER_NAMECOL_ID
,
259 String("Name", aTextEncoding
),
262 ITEMBROWSER_VALUECOL_ID
,
263 String("Value", aTextEncoding
),
264 GetTextWidth(String("12345678901234567890", aTextEncoding
)));
268 long nWdt
=GetColumnWidth(ITEMBROWSER_WHICHCOL_ID
)+
269 GetColumnWidth(ITEMBROWSER_STATECOL_ID
)+
270 GetColumnWidth(ITEMBROWSER_TYPECOL_ID
)+
271 GetColumnWidth(ITEMBROWSER_NAMECOL_ID
)+
272 GetColumnWidth(ITEMBROWSER_VALUECOL_ID
);
274 long nHgt
=GetTitleHeight()+16*GetDataRowHeight();
276 SetOutputSizePixel(Size(nWdt
,nHgt
));
279 void _SdrItemBrowserControl::Clear()
281 sal_uIntPtr nAnz
=aList
.size();
282 for (sal_uIntPtr nNum
=0; nNum
<nAnz
; nNum
++) {
283 delete ImpGetEntry(nNum
);
289 long _SdrItemBrowserControl::GetRowCount() const
294 sal_Bool
_SdrItemBrowserControl::SeekRow(long nRow
)
300 String
_SdrItemBrowserControl::GetCellText(long _nRow
, sal_uInt16 _nColId
) const
303 if ( _nRow
>= 0 && _nRow
< (sal_Int32
)aList
.size() )
305 ImpItemListRow
* pEntry
= ImpGetEntry(_nRow
);
308 if ( pEntry
->bComment
)
310 if (_nColId
== ITEMBROWSER_NAMECOL_ID
)
311 sRet
= pEntry
->aName
;
315 rtl_TextEncoding aTextEncoding
= osl_getThreadTextEncoding();
317 sRet
= XubString("???", aTextEncoding
);
320 case ITEMBROWSER_WHICHCOL_ID
:
321 sRet
= OUString::valueOf( static_cast<sal_Int32
>(pEntry
->nWhichId
) ); break;
322 case ITEMBROWSER_STATECOL_ID
:
324 switch (pEntry
->eState
)
326 case SFX_ITEM_UNKNOWN
: sRet
=String("Uknown", aTextEncoding
); break;
327 case SFX_ITEM_DISABLED
: sRet
=String("Disabled", aTextEncoding
); break;
328 case SFX_ITEM_DONTCARE
: sRet
=String("DontCare", aTextEncoding
); break;
329 case SFX_ITEM_SET
: sRet
=String("Set", aTextEncoding
); break;
330 case SFX_ITEM_DEFAULT
: sRet
=String("Default", aTextEncoding
); break;
333 case ITEMBROWSER_TYPECOL_ID
: sRet
= pEntry
->GetItemTypeStr(); break;
334 case ITEMBROWSER_NAMECOL_ID
: sRet
= pEntry
->aName
; break;
335 case ITEMBROWSER_VALUECOL_ID
: sRet
= pEntry
->aValue
; break;
343 void _SdrItemBrowserControl::PaintField(OutputDevice
& rDev
, const Rectangle
& rRect
, sal_uInt16 nColumnId
) const
345 if (nAktPaintRow
<0 || (sal_uIntPtr
)nAktPaintRow
>=aList
.size()) {
350 ImpItemListRow
* pEntry
=ImpGetEntry(nAktPaintRow
);
351 if (pEntry
->bComment
)
353 if (nColumnId
==ITEMBROWSER_NAMECOL_ID
)
356 rDev
.SetFillColor( Color( COL_LIGHTGRAY
) );
358 aR
.Right()=rDev
.GetOutputSize().Width();
360 rDev
.DrawText(rRect
.TopLeft(),pEntry
->aName
);
363 rDev
.SetClipRegion(Region(aR
));
364 rDev
.DrawText(aR
.TopLeft(),GetCellText(nAktPaintRow
,nColumnId
));
365 rDev
.SetClipRegion();
369 sal_uIntPtr
_SdrItemBrowserControl::GetCurrentPos() const
371 sal_uIntPtr nRet
=CONTAINER_ENTRY_NOTFOUND
;
372 if (GetSelectRowCount()==1) {
373 long nPos
=((BrowseBox
*)this)->FirstSelectedRow();
374 if (nPos
>=0 && (sal_uIntPtr
)nPos
<aList
.size()) {
375 nRet
=(sal_uIntPtr
)nPos
;
381 sal_uInt16
_SdrItemBrowserControl::GetCurrentWhich() const
384 sal_uIntPtr nPos
=GetCurrentPos();
385 if (nPos
!=CONTAINER_ENTRY_NOTFOUND
) {
386 nRet
=ImpGetEntry(nPos
)->nWhichId
;
391 void _SdrItemBrowserControl::DoubleClick(const BrowserMouseEvent
&)
393 sal_uIntPtr nPos
=GetCurrentPos();
394 if (nPos
!=CONTAINER_ENTRY_NOTFOUND
) {
395 BegChangeEntry(nPos
);
399 void _SdrItemBrowserControl::KeyInput(const KeyEvent
& rKEvt
)
401 sal_uInt16 nKeyCode
=rKEvt
.GetKeyCode().GetCode()+rKEvt
.GetKeyCode().GetModifier();
402 bool bAusgewertet
= false;
403 sal_uIntPtr nPos
=GetCurrentPos();
404 if (nPos
!=CONTAINER_ENTRY_NOTFOUND
) {
405 if (nKeyCode
==KEY_RETURN
) {
406 if (BegChangeEntry(nPos
)) bAusgewertet
= true;
407 } else if (nKeyCode
==KEY_ESCAPE
) {
409 } else if (rKEvt
.GetKeyCode().GetModifier()==KEY_SHIFT
+KEY_MOD1
+KEY_MOD2
) { // Ctrl
410 if (nKeyCode
==KEY_SHIFT
+KEY_MOD1
+KEY_MOD2
+KEY_W
) {
411 bWhichesButNames
=!bWhichesButNames
;
414 if (nKeyCode
==KEY_SHIFT
+KEY_MOD1
+KEY_MOD2
+KEY_I
) {
415 bDontHideIneffectiveItems
=!bDontHideIneffectiveItems
;
418 if (nKeyCode
==KEY_SHIFT
+KEY_MOD1
+KEY_MOD2
+KEY_S
) {
419 bDontSortItems
=!bDontSortItems
;
424 if (!bAusgewertet
) BrowseBox::KeyInput(rKEvt
);
427 void _SdrItemBrowserControl::SetDirty()
429 aSetDirtyHdl
.Call(this);
432 Rectangle
_SdrItemBrowserControl::GetFieldCharacterBounds(sal_Int32
/*_nRow*/,sal_Int32
/*_nColumnPos*/,sal_Int32
/*nIndex*/)
434 // no accessibility implementation required
438 sal_Int32
_SdrItemBrowserControl::GetFieldIndexAtPoint(sal_Int32
/*_nRow*/,sal_Int32
/*_nColumnPos*/,const Point
& /*_rPoint*/)
440 // no accessibility implementation required
444 void _SdrItemBrowserControl::Select()
451 void _SdrItemBrowserControl::ImpSaveWhich()
453 sal_uInt16 nWh
=GetCurrentWhich();
455 long nPos
=GetCurrentPos();
456 long nTop
=GetTopRow();
457 long nBtm
=GetTopRow()+GetVisibleRows()+1;
459 nLastWhichOfs
=nPos
-nTop
;
461 if (nBtm
>=(long)aList
.size()) nBtm
=aList
.size()-1;
462 nLastWhichOben
=ImpGetEntry(nTop
)->nWhichId
;
463 nLastWhichUnten
=ImpGetEntry(nBtm
)->nWhichId
;
467 void _SdrItemBrowserControl::ImpRestoreWhich()
471 sal_uIntPtr nAnz
=aList
.size();
473 for (nNum
=0; nNum
<nAnz
&& !bFnd
; nNum
++) {
474 ImpItemListRow
* pEntry
=ImpGetEntry(nNum
);
475 if (!pEntry
->bComment
) {
476 sal_uInt16 nWh
=pEntry
->nWhichId
;
477 if (nWh
==nLastWhich
) bFnd
= true;
482 long nWhichOfs
=nPos
-GetTopRow();
483 if (nWhichOfs
!=nLastWhichOfs
) {
484 ScrollRows(nWhichOfs
-nLastWhichOfs
);
491 bool _SdrItemBrowserControl::BegChangeEntry(sal_uIntPtr nPos
)
495 ImpItemListRow
* pEntry
=ImpGetEntry(nPos
);
496 if (pEntry
!=NULL
&& !pEntry
->bComment
) {
497 SetMode(MYBROWSEMODE
& ~BROWSER_KEEPHIGHLIGHT
);
498 pEditControl
=new ImpItemEdit(&GetDataWindow(),this,0);
499 Rectangle
aRect(GetFieldRectPixel(nPos
,ITEMBROWSER_VALUECOL_ID
,sal_False
));
500 aRect
.Left()+=2; // little offset for the Edit, so it's exact to the pixel
502 pEditControl
->SetPosSizePixel(aRect
.TopLeft(),aRect
.GetSize());
503 pEditControl
->SetText(pEntry
->aValue
);
504 pEditControl
->SetBackground( Wallpaper(Color(COL_LIGHTGRAY
)));
505 Font
aFont(pEditControl
->GetFont());
506 aFont
.SetFillColor(Color(COL_LIGHTGRAY
));
507 pEditControl
->SetFont(aFont
);
508 pEditControl
->Show();
509 pEditControl
->GrabFocus();
510 pEditControl
->SetSelection(Selection(SELECTION_MIN
,SELECTION_MAX
));
511 Window
* pParent
=GetParent();
512 aWNamMerk
=pParent
->GetText();
513 XubString
aNeuNam(aWNamMerk
);
514 aNeuNam
+= sal_Unicode(' ');
515 aNeuNam
+= pEntry
->GetItemTypeStr();
516 if (pEntry
->bCanNum
) {
517 aNeuNam
.AppendAscii(": ");
518 aNeuNam
+= OUString::valueOf(pEntry
->nMin
);
519 aNeuNam
.AppendAscii("..");
520 aNeuNam
+= OUString::valueOf(pEntry
->nMax
);
522 aNeuNam
.AppendAscii(" - Type 'del' to reset to default.");
523 pParent
->SetText(aNeuNam
);
524 pAktChangeEntry
=new ImpItemListRow(*pEntry
);
530 bool _SdrItemBrowserControl::EndChangeEntry()
533 if (pEditControl
!=NULL
) {
534 aEntryChangedHdl
.Call(this);
537 delete pAktChangeEntry
;
538 pAktChangeEntry
=NULL
;
539 Window
* pParent
=GetParent();
540 pParent
->SetText(aWNamMerk
);
541 SetMode(MYBROWSEMODE
);
547 void _SdrItemBrowserControl::BrkChangeEntry()
549 if (pEditControl
!=NULL
) {
552 delete pAktChangeEntry
;
553 pAktChangeEntry
=NULL
;
554 Window
* pParent
=GetParent();
555 pParent
->SetText(aWNamMerk
);
556 SetMode(MYBROWSEMODE
);
560 void _SdrItemBrowserControl::ImpSetEntry(const ImpItemListRow
& rEntry
, sal_uIntPtr nEntryNum
)
562 SAL_WARN_IF(nEntryNum
> aList
.size(), "svx", "trying to set item " << nEntryNum
<< "in a vector of size " << aList
.size());
563 if (nEntryNum
>= aList
.size()) {
564 nEntryNum
= aList
.size();
565 aList
.push_back(new ImpItemListRow(rEntry
));
566 RowInserted(nEntryNum
);
568 ImpItemListRow
* pAktEntry
=ImpGetEntry(nEntryNum
);
569 if (*pAktEntry
!=rEntry
) {
570 bool bStateDiff
=rEntry
.eState
!=pAktEntry
->eState
;
571 bool bValueDiff
=!rEntry
.aValue
.equals(pAktEntry
->aValue
);
572 bool bAllDiff
= true;
573 if (bStateDiff
|| bValueDiff
) {
574 // check whether only state and/or value have changed
575 ImpItemListRow
aTest(rEntry
);
576 aTest
.eState
=pAktEntry
->eState
;
577 aTest
.aValue
=pAktEntry
->aValue
;
578 if (aTest
==*pAktEntry
) bAllDiff
= false;
582 RowModified(nEntryNum
);
584 if (bStateDiff
) RowModified(nEntryNum
,ITEMBROWSER_STATECOL_ID
);
585 if (bValueDiff
) RowModified(nEntryNum
,ITEMBROWSER_VALUECOL_ID
);
591 bool ImpGetItem(const SfxItemSet
& rSet
, sal_uInt16 nWhich
, const SfxPoolItem
*& rpItem
)
593 SfxItemState eState
=rSet
.GetItemState(nWhich
,sal_True
,&rpItem
);
594 if (eState
==SFX_ITEM_DEFAULT
) {
595 rpItem
=&rSet
.Get(nWhich
);
597 return (eState
==SFX_ITEM_DEFAULT
|| eState
==SFX_ITEM_SET
) && rpItem
!=NULL
;
600 bool IsItemIneffective(sal_uInt16 nWhich
, const SfxItemSet
* pSet
, sal_uInt16
& rIndent
)
603 if (pSet
==NULL
) return sal_False
;
604 const SfxPoolItem
* pItem
=NULL
;
607 case XATTR_LINEDASH
:
608 case XATTR_LINEWIDTH
:
609 case XATTR_LINECOLOR
:
610 case XATTR_LINESTART
:
612 case XATTR_LINESTARTWIDTH
:
613 case XATTR_LINEENDWIDTH
:
614 case XATTR_LINESTARTCENTER
:
615 case XATTR_LINEENDCENTER
:
616 case XATTR_LINETRANSPARENCE
: {
618 if (ImpGetItem(*pSet
,XATTR_LINESTYLE
,pItem
)) {
619 XLineStyle eLineStyle
=((const XLineStyleItem
*)pItem
)->GetValue();
620 if (eLineStyle
==XLINE_NONE
) return sal_True
;
621 if (eLineStyle
!=XLINE_DASH
&& nWhich
==XATTR_LINEDASH
) return sal_True
;
623 if (nWhich
==XATTR_LINESTART
|| nWhich
==XATTR_LINESTARTCENTER
) {
625 if (ImpGetItem(*pSet
,XATTR_LINESTARTWIDTH
,pItem
)) {
626 sal_Int32 nWdt
=((const XLineStartWidthItem
*)pItem
)->GetValue();
627 if (nWdt
==0) return sal_True
;
630 if (nWhich
==XATTR_LINEEND
|| nWhich
==XATTR_LINEENDCENTER
) {
632 if (ImpGetItem(*pSet
,XATTR_LINEENDWIDTH
,pItem
)) {
633 sal_Int32 nWdt
=((const XLineEndWidthItem
*)pItem
)->GetValue();
634 if (nWdt
==0) return sal_True
;
638 case XATTR_FILLCOLOR
: /* only for Style=Color */
639 case XATTR_FILLGRADIENT
: /* only for Style=Gradient */
640 case XATTR_FILLHATCH
: /* only for Style=Hatch */
641 case XATTR_FILLTRANSPARENCE
: /* only for Style=Color */
642 case XATTR_GRADIENTSTEPCOUNT
: /* only for Style=Gradient */
643 case XATTR_FILLBACKGROUND
: /* only for Style=Hatch */
646 if (ImpGetItem(*pSet
,XATTR_FILLSTYLE
,pItem
)) {
647 XFillStyle eFillStyle
=((const XFillStyleItem
*)pItem
)->GetValue();
648 if (eFillStyle
==XFILL_NONE
) return sal_True
;
649 // transparency currently only for SolidFill
650 if (eFillStyle
!=XFILL_SOLID
&& (nWhich
==XATTR_FILLCOLOR
|| nWhich
==XATTR_FILLTRANSPARENCE
)) return sal_True
;
651 if (eFillStyle
!=XFILL_GRADIENT
&& (nWhich
==XATTR_FILLGRADIENT
|| nWhich
==XATTR_GRADIENTSTEPCOUNT
)) return sal_True
;
652 if (eFillStyle
!=XFILL_HATCH
&& (nWhich
==XATTR_FILLHATCH
|| nWhich
==XATTR_FILLBACKGROUND
)) return sal_True
;
655 case XATTR_FILLBITMAP
:
656 case XATTR_FILLBMP_TILE
:
657 case XATTR_FILLBMP_POS
: /* currently only if TILE=sal_True */
658 case XATTR_FILLBMP_SIZEX
: /* only if not Stretch */
659 case XATTR_FILLBMP_SIZEY
: /* only if not Stretch */
660 case XATTR_FILLBMP_SIZELOG
: /* only if SIZELOG=sal_False to reset to sal_True (old) -> but is still in use */
661 case XATTR_FILLBMP_TILEOFFSETX
: /* only if TILE=sal_True */
662 case XATTR_FILLBMP_TILEOFFSETY
: /* only if TILE=sal_True */
663 case XATTR_FILLBMP_STRETCH
: /* only if TILE=sal_False */
664 case XATTR_FILLBMP_POSOFFSETX
: /* only if TILE=sal_True*/
665 case XATTR_FILLBMP_POSOFFSETY
: { /* only if TILE=sal_True*/
667 if (ImpGetItem(*pSet
,XATTR_FILLSTYLE
,pItem
)) {
668 XFillStyle eFillStyle
=((const XFillStyleItem
*)pItem
)->GetValue();
669 if (eFillStyle
!=XFILL_BITMAP
) return sal_True
;
671 if (nWhich
==XATTR_FILLBITMAP
|| nWhich
==XATTR_FILLBMP_TILE
) {
672 return sal_False
; // always selectable
674 bool bTileTRUE
= false;
675 bool bTileFALSE
= false;
676 bool bStretchTRUE
= false;
677 if (ImpGetItem(*pSet
,XATTR_FILLBMP_TILE
,pItem
)) {
678 bTileTRUE
=((const XFillBmpTileItem
*)pItem
)->GetValue();
679 bTileFALSE
=!bTileTRUE
;
681 if (ImpGetItem(*pSet
,XATTR_FILLBMP_STRETCH
,pItem
)) {
682 bStretchTRUE
=((const XFillBmpStretchItem
*)pItem
)->GetValue();
684 // Stretch not selectable if Tile=TRUE
685 if (nWhich
==XATTR_FILLBMP_STRETCH
) return bTileTRUE
;
686 // and 7+1 items (sub-attributes) remain
688 // Pos (enum) not selectable if Tile=FALSE
689 if (nWhich
==XATTR_FILLBMP_POS
) return bTileFALSE
;
690 // SizeXY not selectable if Stretch=TRUE
691 if (nWhich
==XATTR_FILLBMP_SIZEX
|| nWhich
==XATTR_FILLBMP_SIZEY
) {
692 return bTileFALSE
&& bStretchTRUE
;
694 // 2 items specially for Tile
695 if (nWhich
==XATTR_FILLBMP_POSOFFSETX
|| nWhich
==XATTR_FILLBMP_POSOFFSETY
) {
698 // another 2 items specially for Tile -- however, these exclude each other
699 if (nWhich
==XATTR_FILLBMP_TILEOFFSETX
|| nWhich
==XATTR_FILLBMP_TILEOFFSETY
) {
700 if (bTileFALSE
) return sal_True
;
701 sal_uInt16 nX
=0,nY
=0;
702 bool bX
= false,bY
= false;
703 if (ImpGetItem(*pSet
,XATTR_FILLBMP_TILEOFFSETX
,pItem
)) {
704 nX
=((const XFillBmpTileOffsetXItem
*)pItem
)->GetValue();
707 if (ImpGetItem(*pSet
,XATTR_FILLBMP_TILEOFFSETY
,pItem
)) {
708 nY
=((const XFillBmpTileOffsetYItem
*)pItem
)->GetValue();
711 if (nWhich
==XATTR_FILLBMP_TILEOFFSETX
) {
712 if (nX
!=0 || !bX
) return sal_False
;
713 if (nY
!=0) return sal_True
;
715 if (nY
!=0 || !bY
) return sal_False
;
716 if (nX
!=0) return sal_True
;
719 // SizeLog not selectable if Stretch=TRUE and/or
720 // if SizeLog=sal_False.
721 // -> apparently still in use
722 // (sal_True is the static PoolDefault)
723 if (nWhich
==XATTR_FILLBMP_SIZELOG
) {
724 if (bTileFALSE
&& bStretchTRUE
) return sal_True
;
728 case XATTR_FORMTXTADJUST
:
729 case XATTR_FORMTXTDISTANCE
:
730 case XATTR_FORMTXTSTART
:
731 case XATTR_FORMTXTMIRROR
:
732 case XATTR_FORMTXTOUTLINE
:
733 case XATTR_FORMTXTSHADOW
:
734 case XATTR_FORMTXTSHDWCOLOR
:
735 case XATTR_FORMTXTSHDWXVAL
:
736 case XATTR_FORMTXTSHDWYVAL
:
737 case XATTR_FORMTXTSTDFORM
:
738 case XATTR_FORMTXTHIDEFORM
:
739 case XATTR_FORMTXTSHDWTRANSP
: {
741 if (ImpGetItem(*pSet
,XATTR_FORMTXTSTYLE
,pItem
)) {
742 XFormTextStyle eStyle
=((const XFormTextStyleItem
*)pItem
)->GetValue();
743 if (eStyle
==XFT_NONE
) return sal_True
;
745 if ((nWhich
>=XATTR_FORMTXTSHDWCOLOR
&& nWhich
<=XATTR_FORMTXTSHDWYVAL
) || nWhich
>=XATTR_FORMTXTSHDWTRANSP
) {
747 if (ImpGetItem(*pSet
,XATTR_FORMTXTSHADOW
,pItem
)) {
748 XFormTextShadow eShadow
=((const XFormTextShadowItem
*)pItem
)->GetValue();
749 if (eShadow
==XFTSHADOW_NONE
) return sal_True
;
754 case SDRATTR_SHADOWCOLOR
:
755 case SDRATTR_SHADOWXDIST
:
756 case SDRATTR_SHADOWYDIST
:
757 case SDRATTR_SHADOWTRANSPARENCE
:
758 case SDRATTR_SHADOW3D
:
759 case SDRATTR_SHADOWPERSP
: {
761 if (ImpGetItem(*pSet
,SDRATTR_SHADOW
,pItem
)) {
762 bool bShadow
=((const SdrShadowItem
*)pItem
)->GetValue();
763 if (!bShadow
) return sal_True
;
767 case SDRATTR_CAPTIONANGLE
: {
769 if (ImpGetItem(*pSet
,SDRATTR_CAPTIONFIXEDANGLE
,pItem
)) {
770 bool bFixed
=((const SdrCaptionFixedAngleItem
*)pItem
)->GetValue();
771 if (!bFixed
) return sal_True
;
774 case SDRATTR_CAPTIONESCREL
:
775 case SDRATTR_CAPTIONESCABS
: {
777 if (ImpGetItem(*pSet
,SDRATTR_CAPTIONESCISREL
,pItem
)) {
778 bool bRel
=((const SdrCaptionEscIsRelItem
*)pItem
)->GetValue();
779 if (bRel
&& nWhich
==SDRATTR_CAPTIONESCABS
) return sal_True
;
780 if (!bRel
&& nWhich
==SDRATTR_CAPTIONESCREL
) return sal_True
;
783 case SDRATTR_CAPTIONLINELEN
: {
785 if (ImpGetItem(*pSet
,SDRATTR_CAPTIONFITLINELEN
,pItem
)) {
786 bool bFit
=((const SdrCaptionFitLineLenItem
*)pItem
)->GetValue();
787 if (bFit
) return sal_True
;
791 case SDRATTR_TEXT_MINFRAMEHEIGHT
:
792 case SDRATTR_TEXT_MAXFRAMEHEIGHT
: {
794 if (ImpGetItem(*pSet
,SDRATTR_TEXT_AUTOGROWHEIGHT
,pItem
)) {
795 bool bAutoGrow
=((const SdrTextAutoGrowHeightItem
*)pItem
)->GetValue();
796 if (!bAutoGrow
) return sal_True
;
799 case SDRATTR_TEXT_MINFRAMEWIDTH
:
800 case SDRATTR_TEXT_MAXFRAMEWIDTH
: {
802 if (ImpGetItem(*pSet
,SDRATTR_TEXT_AUTOGROWWIDTH
,pItem
)) {
803 bool bAutoGrow
=((const SdrTextAutoGrowWidthItem
*)pItem
)->GetValue();
804 if (!bAutoGrow
) return sal_True
;
807 case SDRATTR_TEXT_VERTADJUST
:
808 case SDRATTR_TEXT_HORZADJUST
: {
809 if (ImpGetItem(*pSet
,SDRATTR_TEXT_FITTOSIZE
,pItem
)) {
810 SdrFitToSizeType eFit
=((const SdrTextFitToSizeTypeItem
*)pItem
)->GetValue();
811 if (eFit
!=SDRTEXTFIT_NONE
) return sal_True
;
815 case SDRATTR_TEXT_ANIDIRECTION
:
816 case SDRATTR_TEXT_ANISTARTINSIDE
:
817 case SDRATTR_TEXT_ANISTOPINSIDE
:
818 case SDRATTR_TEXT_ANICOUNT
:
819 case SDRATTR_TEXT_ANIDELAY
:
820 case SDRATTR_TEXT_ANIAMOUNT
: {
822 if (ImpGetItem(*pSet
,SDRATTR_TEXT_ANIKIND
,pItem
)) {
823 SdrTextAniKind eAniKind
=((const SdrTextAniKindItem
*)pItem
)->GetValue();
824 if (eAniKind
==SDRTEXTANI_NONE
) return sal_True
;
825 if (eAniKind
==SDRTEXTANI_BLINK
&& (nWhich
==SDRATTR_TEXT_ANIDIRECTION
|| nWhich
==SDRATTR_TEXT_ANIAMOUNT
)) return sal_True
;
826 if (eAniKind
==SDRTEXTANI_SLIDE
&& (nWhich
==SDRATTR_TEXT_ANISTARTINSIDE
|| nWhich
==SDRATTR_TEXT_ANISTOPINSIDE
)) return sal_True
;
830 case SDRATTR_EDGELINEDELTAANZ
: return sal_True
;
831 case SDRATTR_EDGELINE1DELTA
:
832 case SDRATTR_EDGELINE2DELTA
:
833 case SDRATTR_EDGELINE3DELTA
: {
834 if (ImpGetItem(*pSet
,SDRATTR_EDGEKIND
,pItem
)) {
835 SdrEdgeKind eKind
=((const SdrEdgeKindItem
*)pItem
)->GetValue();
836 if (eKind
==SDREDGE_THREELINES
) {
837 if (nWhich
>SDRATTR_EDGELINE2DELTA
) return sal_True
;
838 else return sal_False
;
840 if (eKind
!=SDREDGE_ORTHOLINES
&& eKind
!=SDREDGE_BEZIER
) return sal_True
;
842 if (ImpGetItem(*pSet
,SDRATTR_EDGELINEDELTAANZ
,pItem
)) {
843 sal_uInt16 nAnz
=((const SdrEdgeLineDeltaAnzItem
*)pItem
)->GetValue();
844 if (nAnz
==0) return sal_True
;
845 if (nAnz
==1 && nWhich
>SDRATTR_EDGELINE1DELTA
) return sal_True
;
846 if (nAnz
==2 && nWhich
>SDRATTR_EDGELINE2DELTA
) return sal_True
;
847 if (nAnz
==3 && nWhich
>SDRATTR_EDGELINE3DELTA
) return sal_True
;
851 case SDRATTR_CIRCSTARTANGLE
:
852 case SDRATTR_CIRCENDANGLE
: {
854 if (ImpGetItem(*pSet
,SDRATTR_CIRCKIND
,pItem
)) {
855 SdrCircKind eKind
=((const SdrCircKindItem
*)pItem
)->GetValue();
856 if (eKind
==SDRCIRC_FULL
) return sal_True
;
863 sal_uInt16
ImpSortWhich(sal_uInt16 nWhich
)
867 case XATTR_LINESTART
: nWhich
=XATTR_LINETRANSPARENCE
; break;
868 case XATTR_LINEEND
: nWhich
=XATTR_LINESTARTWIDTH
; break;
869 case XATTR_LINESTARTWIDTH
: nWhich
=XATTR_LINESTART
; break;
870 case XATTR_LINEENDWIDTH
: nWhich
=XATTR_LINESTARTCENTER
; break;
871 case XATTR_LINESTARTCENTER
: nWhich
=XATTR_LINEENDWIDTH
; break;
872 case XATTR_LINEENDCENTER
: nWhich
=XATTR_LINEEND
; break;
873 case XATTR_LINETRANSPARENCE
: nWhich
=XATTR_LINEENDCENTER
; break;
876 case XATTR_FILLBMP_POS
: nWhich
=XATTR_FILLBMP_STRETCH
; break;
877 case XATTR_FILLBMP_SIZEX
: nWhich
=XATTR_FILLBMP_POS
; break;
878 case XATTR_FILLBMP_SIZEY
: nWhich
=XATTR_FILLBMP_SIZEX
; break;
879 case XATTR_FILLBMP_SIZELOG
: nWhich
=XATTR_FILLBMP_SIZEY
; break;
880 case XATTR_FILLBMP_TILEOFFSETX
: nWhich
=XATTR_FILLBMP_SIZELOG
; break;
881 case XATTR_FILLBMP_TILEOFFSETY
: nWhich
=XATTR_FILLBMP_TILEOFFSETX
; break;
882 case XATTR_FILLBMP_STRETCH
: nWhich
=XATTR_FILLBMP_TILEOFFSETY
; break;
885 case XATTR_FORMTXTSHADOW
: nWhich
=XATTR_FORMTXTSTDFORM
; break;
886 case XATTR_FORMTXTSHDWCOLOR
: nWhich
=XATTR_FORMTXTHIDEFORM
; break;
887 case XATTR_FORMTXTSHDWXVAL
: nWhich
=XATTR_FORMTXTSHADOW
; break;
888 case XATTR_FORMTXTSHDWYVAL
: nWhich
=XATTR_FORMTXTSHDWCOLOR
; break;
889 case XATTR_FORMTXTSTDFORM
: nWhich
=XATTR_FORMTXTSHDWXVAL
; break;
890 case XATTR_FORMTXTHIDEFORM
: nWhich
=XATTR_FORMTXTSHDWYVAL
; break;
893 case SDRATTR_TEXT_MINFRAMEHEIGHT
: nWhich
=SDRATTR_TEXT_FITTOSIZE
; break;
894 case SDRATTR_TEXT_AUTOGROWHEIGHT
: nWhich
=SDRATTR_TEXT_LEFTDIST
; break;
895 case SDRATTR_TEXT_FITTOSIZE
: nWhich
=SDRATTR_TEXT_RIGHTDIST
; break;
896 case SDRATTR_TEXT_LEFTDIST
: nWhich
=SDRATTR_TEXT_UPPERDIST
; break;
897 case SDRATTR_TEXT_RIGHTDIST
: nWhich
=SDRATTR_TEXT_LOWERDIST
; break;
898 case SDRATTR_TEXT_UPPERDIST
: nWhich
=SDRATTR_TEXT_AUTOGROWWIDTH
; break;
899 case SDRATTR_TEXT_LOWERDIST
: nWhich
=SDRATTR_TEXT_MINFRAMEWIDTH
; break;
900 case SDRATTR_TEXT_VERTADJUST
: nWhich
=SDRATTR_TEXT_MAXFRAMEWIDTH
; break;
901 case SDRATTR_TEXT_MAXFRAMEHEIGHT
: nWhich
=SDRATTR_TEXT_AUTOGROWHEIGHT
; break;
902 case SDRATTR_TEXT_MINFRAMEWIDTH
: nWhich
=SDRATTR_TEXT_MINFRAMEHEIGHT
; break;
903 case SDRATTR_TEXT_MAXFRAMEWIDTH
: nWhich
=SDRATTR_TEXT_MAXFRAMEHEIGHT
; break;
904 case SDRATTR_TEXT_AUTOGROWWIDTH
: nWhich
=SDRATTR_TEXT_HORZADJUST
; break;
905 case SDRATTR_TEXT_HORZADJUST
: nWhich
=SDRATTR_TEXT_VERTADJUST
; break;
910 #define INSERTCOMMENT(nStartId,nEndId,aStr) \
911 { if (nWhich0<nStartId && nWhich>=nStartId && nWhich<=nEndId) aCommentStr=aStr; }
913 void _SdrItemBrowserControl::SetAttributes(const SfxItemSet
* pSet
, const SfxItemSet
* p2ndSet
)
915 SetMode(MYBROWSEMODE
& ~BROWSER_KEEPHIGHLIGHT
);
917 rtl_TextEncoding aTextEncoding
= osl_getThreadTextEncoding();
918 sal_uInt16 nEntryNum
=0;
919 SfxWhichIter
aIter(*pSet
);
920 const SfxItemPool
* pPool
=pSet
->GetPool();
921 sal_uInt16 nWhich0
=0;
922 sal_uInt16 nWhich
=aIter
.FirstWhich();
924 // Now sort this a little bit differently.
925 // Only works as long as there are no InvalidItems, i. e. no gaps
926 // at this position in the Set.
927 if (!bDontSortItems
) nWhich
=ImpSortWhich(nWhich
);
928 SfxItemState eState
=pSet
->GetItemState(nWhich
);
930 SfxItemState e2ndState
=p2ndSet
->GetItemState(nWhich
);
931 if (eState
==SFX_ITEM_DEFAULT
) eState
=SFX_ITEM_DISABLED
;
932 else if (e2ndState
==SFX_ITEM_DEFAULT
) eState
=SFX_ITEM_DEFAULT
;
934 if (eState
!=SFX_ITEM_DISABLED
) {
935 const SfxPoolItem
& rItem
=pSet
->Get(nWhich
);
936 sal_uInt16 nIndent
=0;
937 if (!HAS_BASE(SfxVoidItem
,&rItem
) && !HAS_BASE(SfxSetItem
,&rItem
) && (!IsItemIneffective(nWhich
,pSet
,nIndent
) || bDontHideIneffectiveItems
)) {
938 XubString aCommentStr
;
940 INSERTCOMMENT(XATTR_LINE_FIRST
,XATTR_LINE_LAST
,String("L I N I E", aTextEncoding
));
941 INSERTCOMMENT(XATTR_FILL_FIRST
,XATTR_FILL_LAST
,String("F L � C H E", aTextEncoding
));
942 INSERTCOMMENT(XATTR_TEXT_FIRST
,XATTR_TEXT_LAST
,String("F O N T W O R K", aTextEncoding
));
943 INSERTCOMMENT(SDRATTR_SHADOW_FIRST
,SDRATTR_SHADOW_LAST
,String("S C H A T T E N", aTextEncoding
));
944 INSERTCOMMENT(SDRATTR_CAPTION_FIRST
,SDRATTR_CAPTION_LAST
,String("L E G E N D E", aTextEncoding
));
945 INSERTCOMMENT(SDRATTR_MISC_FIRST
,SDRATTR_MISC_LAST
,String("V E R S C H I E D E N E S", aTextEncoding
));
946 INSERTCOMMENT(SDRATTR_EDGE_FIRST
,SDRATTR_EDGE_LAST
,String("V E R B I N D E R", aTextEncoding
));
947 INSERTCOMMENT(SDRATTR_MEASURE_FIRST
,SDRATTR_MEASURE_LAST
,String("B E M A S S U N G", aTextEncoding
));
948 INSERTCOMMENT(SDRATTR_CIRC_FIRST
,SDRATTR_CIRC_LAST
,String("K R E I S", aTextEncoding
));
949 INSERTCOMMENT(SDRATTR_NOTPERSIST_FIRST
,SDRATTR_NOTPERSIST_LAST
,String("N O T P E R S I S T", aTextEncoding
));
950 INSERTCOMMENT(SDRATTR_MOVEX
,SDRATTR_VERTSHEARONE
,String("Transformationen auf alle Objekte einzeln", aTextEncoding
));
951 INSERTCOMMENT(SDRATTR_RESIZEXALL
,SDRATTR_VERTSHEARALL
,String("Transformationen auf alle Objekte gemeinsam", aTextEncoding
));
952 INSERTCOMMENT(SDRATTR_TRANSFORMREF1X
,SDRATTR_TRANSFORMREF2Y
,String("View-Referenzpunkte", aTextEncoding
));
953 INSERTCOMMENT(SDRATTR_GRAF_FIRST
,SDRATTR_GRAF_LAST
,String("G R A F I K", aTextEncoding
));
954 INSERTCOMMENT(EE_ITEMS_START
,EE_ITEMS_END
,String("E D I T E N G I N E", aTextEncoding
));
955 INSERTCOMMENT(EE_ITEMS_END
+1,EE_ITEMS_END
+1,String("... by Joe Merten, JME Engineering Berlin ...", aTextEncoding
));
957 if(aCommentStr
.Len())
959 ImpItemListRow aEntry
;
960 aEntry
.bComment
= true;
961 aEntry
.aName
=aCommentStr
;
962 ImpSetEntry(aEntry
,nEntryNum
);
966 ImpItemListRow aEntry
;
967 SdrItemPool::TakeItemName(nWhich
, aEntry
.aName
);
972 aEntry
.aName
= " " + aEntry
.aName
;
976 aEntry
.eState
=eState
;
977 aEntry
.nWhichId
=nWhich
;
978 if (!IsInvalidItem(&rItem
)) {
979 aEntry
.pType
=rItem
.Type();
980 aEntry
.nMax
=0x7FFFFFFF;
981 aEntry
.nMin
=-aEntry
.nMax
;
983 if (HAS_BASE(SfxByteItem
,&rItem
)) aEntry
.eItemType
=ITEM_BYTE
;
984 else if (HAS_BASE(SfxInt16Item
,&rItem
)) aEntry
.eItemType
=ITEM_INT16
;
985 else if (HAS_BASE(SfxUInt16Item
,&rItem
)) aEntry
.eItemType
=ITEM_UINT16
;
986 else if (HAS_BASE(SfxInt32Item
,&rItem
)) aEntry
.eItemType
=ITEM_INT32
;
987 else if (HAS_BASE(SfxUInt32Item
,&rItem
)) aEntry
.eItemType
=ITEM_UINT32
;
988 else if (HAS_BASE(SfxEnumItemInterface
,&rItem
)) aEntry
.eItemType
=ITEM_ENUM
;
989 else if (HAS_BASE(SfxBoolItem
,&rItem
)) aEntry
.eItemType
=ITEM_BOOL
;
990 else if (HAS_BASE(SfxFlagItem
,&rItem
)) aEntry
.eItemType
=ITEM_FLAG
;
991 else if (HAS_BASE(XColorItem
,&rItem
)) aEntry
.eItemType
=ITEM_XCOLOR
;
992 else if (HAS_BASE(SfxStringItem
,&rItem
)) aEntry
.eItemType
=ITEM_STRING
;
993 else if (HAS_BASE(SfxPointItem
,&rItem
)) aEntry
.eItemType
=ITEM_POINT
;
994 else if (HAS_BASE(SfxRectangleItem
,&rItem
)) aEntry
.eItemType
=ITEM_RECT
;
995 else if (HAS_BASE(SfxRangeItem
,&rItem
)) aEntry
.eItemType
=ITEM_RANGE
;
996 else if (HAS_BASE(SdrFractionItem
,&rItem
)) aEntry
.eItemType
=ITEM_FRACTION
;
997 else if (HAS_BASE(SvxColorItem
,&rItem
)) aEntry
.eItemType
=ITEM_COLOR
;
998 else if (HAS_BASE(SvxFontItem
,&rItem
)) aEntry
.eItemType
=ITEM_FONT
;
999 else if (HAS_BASE(SvxFontHeightItem
,&rItem
))aEntry
.eItemType
=ITEM_FONTHEIGHT
;
1000 else if (HAS_BASE(SvxCharScaleWidthItem
,&rItem
)) aEntry
.eItemType
=ITEM_FONTWIDTH
;
1001 else if (HAS_BASE(SvxFieldItem
,&rItem
)) aEntry
.eItemType
=ITEM_FIELD
;
1002 switch (aEntry
.eItemType
) {
1003 case ITEM_BYTE
: aEntry
.bIsNum
= true; aEntry
.nVal
=((SfxByteItem
&)rItem
).GetValue(); aEntry
.nMin
=0; aEntry
.nMax
=255; break;
1004 case ITEM_INT16
: aEntry
.bIsNum
= true; aEntry
.nVal
=((SfxInt16Item
&)rItem
).GetValue(); aEntry
.nMin
=-32767; aEntry
.nMax
=32767; break;
1005 case ITEM_UINT16
: aEntry
.bIsNum
= true; aEntry
.nVal
=((SfxUInt16Item
&)rItem
).GetValue(); aEntry
.nMin
=0; aEntry
.nMax
=65535; break;
1006 case ITEM_INT32
: aEntry
.bIsNum
= true; aEntry
.nVal
=((SfxInt32Item
&)rItem
).GetValue(); break;
1007 case ITEM_UINT32
: aEntry
.bIsNum
= true; aEntry
.nVal
=((SfxUInt32Item
&)rItem
).GetValue(); aEntry
.nMin
=0; /*aEntry.nMax=0xFF...*/;break;
1008 case ITEM_ENUM
: aEntry
.bCanNum
= true; aEntry
.nVal
=((SfxEnumItemInterface
&)rItem
).GetEnumValue(); aEntry
.nMin
=0; aEntry
.nMax
=((SfxEnumItemInterface
&)rItem
).GetValueCount()-1; break;
1009 case ITEM_BOOL
: aEntry
.bCanNum
= true; aEntry
.nVal
=((SfxBoolItem
&)rItem
).GetValue(); aEntry
.nMin
=0; aEntry
.nMax
=1; break;
1010 case ITEM_FLAG
: aEntry
.bCanNum
= true; aEntry
.nVal
=((SfxFlagItem
&)rItem
).GetValue(); aEntry
.nMin
=0; aEntry
.nMax
=0xFFFF; break;
1011 case ITEM_FONTHEIGHT
: aEntry
.bCanNum
= true; aEntry
.nVal
=((SvxFontHeightItem
&)rItem
).GetHeight(); aEntry
.nMin
=0; break;
1012 case ITEM_FONTWIDTH
: aEntry
.bCanNum
= true; aEntry
.nVal
=((SvxCharScaleWidthItem
&)rItem
).GetValue(); aEntry
.nMin
=0; aEntry
.nMax
=0xFFFF;break;
1015 if (aEntry
.bIsNum
) aEntry
.bCanNum
= true;
1017 rItem
.GetPresentation(SFX_ITEM_PRESENTATION_NAMELESS
,
1018 pPool
->GetMetric(nWhich
),
1019 SFX_MAPUNIT_MM
, aEntry
.aValue
);
1022 aEntry
.aValue
= OUString::number(aEntry
.nVal
) + ": " + aEntry
.aValue
;
1027 aEntry
.aValue
= String("InvalidItem", aTextEncoding
);
1029 ImpSetEntry(aEntry
,nEntryNum
);
1033 nWhich
=aIter
.NextWhich();
1036 if (aList
.size()>nEntryNum
) { // maybe still too many entries
1037 size_t const nTooMuch
= aList
.size() - nEntryNum
;
1038 for (size_t n
= nEntryNum
; n
< aList
.size(); ++n
) {
1041 aList
.erase(aList
.begin() + nEntryNum
, aList
.end());
1042 RowRemoved(nEntryNum
,nTooMuch
);
1045 Clear(); // if pSet==NULL
1048 SetMode(MYBROWSEMODE
);
1051 ////////////////////////////////////////////////////////////////////////////////////////////////////
1053 _SdrItemBrowserWindow::_SdrItemBrowserWindow(Window
* pParent
, WinBits nBits
):
1054 FloatingWindow(pParent
,nBits
),
1057 SetOutputSizePixel(aBrowse
.GetSizePixel());
1058 SetText(String("Joe's ItemBrowser", osl_getThreadTextEncoding()));
1062 _SdrItemBrowserWindow::~_SdrItemBrowserWindow()
1066 void _SdrItemBrowserWindow::Resize()
1068 aBrowse
.SetSizePixel(GetOutputSizePixel());
1071 void _SdrItemBrowserWindow::GetFocus()
1073 aBrowse
.GrabFocus();
1076 ////////////////////////////////////////////////////////////////////////////////////////////////////
1078 SdrItemBrowser::SdrItemBrowser(SdrView
& rView
):
1079 _SdrItemBrowserWindow(ImpGetViewWin(rView
)),
1083 aIdleTimer
.SetTimeoutHdl(LINK(this,SdrItemBrowser
,IdleHdl
));
1084 GetBrowserControl().SetEntryChangedHdl(LINK(this,SdrItemBrowser
,ChangedHdl
));
1085 GetBrowserControl().SetSetDirtyHdl(LINK(this,SdrItemBrowser
,SetDirtyHdl
));
1089 Window
* SdrItemBrowser::ImpGetViewWin(SdrView
& rView
)
1091 const sal_uInt32
nWinCount(rView
.PaintWindowCount());
1093 for(sal_uInt32
a(0L); a
< nWinCount
; a
++)
1095 SdrPaintWindow
* pCandidate
= rView
.GetPaintWindow(a
);
1097 if(OUTDEV_WINDOW
== pCandidate
->GetOutputDevice().GetOutDevType())
1099 return (Window
*)(&pCandidate
->GetOutputDevice());
1106 void SdrItemBrowser::ForceParent()
1108 Window
* pWin
=ImpGetViewWin(*pView
);
1109 if (pWin
!=NULL
) SetParent(pWin
);
1112 void SdrItemBrowser::SetDirty()
1116 aIdleTimer
.SetTimeout(1);
1121 void SdrItemBrowser::Undirty()
1126 SfxItemSet
aSet(pView
->GetModel()->GetItemPool());
1127 pView
->GetAttributes(aSet
);
1129 if(pView
->AreObjectsMarked())
1131 SfxItemSet
a2ndSet(pView
->GetModel()->GetItemPool());
1132 pView
->GetAttributes(a2ndSet
, sal_True
);
1134 SetAttributes(&aSet
,&a2ndSet
);
1138 SetAttributes(&aSet
);
1142 IMPL_LINK_NOARG(SdrItemBrowser
, IdleHdl
)
1148 IMPL_LINK(SdrItemBrowser
,ChangedHdl
,_SdrItemBrowserControl
*,pBrowse
)
1150 const ImpItemListRow
* pEntry
=pBrowse
->GetAktChangeEntry();
1153 SfxItemSet
aSet(pView
->GetModel()->GetItemPool());
1154 pView
->GetAttributes(aSet
);
1156 SfxItemSet
aNewSet(*aSet
.GetPool(),pEntry
->nWhichId
,pEntry
->nWhichId
);
1157 OUString
aNewText(pBrowse
->GetNewEntryValue());
1158 sal_Bool
bDel( aNewText
== "del"
1159 || aNewText
== "Del"
1160 || aNewText
== "DEL"
1161 || aNewText
== "default"
1162 || aNewText
== "Default"
1163 || aNewText
== "DEFAULT" );
1166 SfxPoolItem
* pNewItem
=aSet
.Get(pEntry
->nWhichId
).Clone();
1167 long nLongVal
= aNewText
.toInt32();
1168 if (pEntry
->bCanNum
) {
1169 if (nLongVal
>pEntry
->nMax
) nLongVal
=pEntry
->nMax
;
1170 if (nLongVal
<pEntry
->nMin
) nLongVal
=pEntry
->nMin
;
1173 bool bPairY
= false;
1174 sal_uInt16 nSepLen
=1;
1175 long nLongX
= aNewText
.toInt32();
1177 sal_Int32 nPos
= aNewText
.indexOf(sal_Unicode('/'));
1178 if (nPos
==-1) nPos
=aNewText
.indexOf(sal_Unicode(':'));
1179 if (nPos
==-1) nPos
=aNewText
.indexOf(sal_Unicode(' '));
1180 if (nPos
==-1) { nPos
=aNewText
.indexOf(".."); if (nPos
!=-1) nSepLen
=2; }
1184 OUString
s(aNewText
.copy(nPos
+nSepLen
));
1185 bPairY
= !aNewText
.isEmpty();
1186 nLongY
= s
.toInt32();
1188 switch (pEntry
->eItemType
) {
1189 case ITEM_BYTE
: ((SfxByteItem
*)pNewItem
)->SetValue((sal_uInt8
)nLongVal
); break;
1190 case ITEM_INT16
: ((SfxInt16Item
*)pNewItem
)->SetValue((sal_Int16
)nLongVal
); break;
1191 case ITEM_UINT16
: ((SfxUInt16Item
*)pNewItem
)->SetValue((sal_uInt16
)nLongVal
); break;
1193 if(HAS_BASE(SdrAngleItem
, pNewItem
))
1195 aNewText
= aNewText
.replace(',', '.');
1196 double nVal
= aNewText
.toFloat();
1197 nLongVal
= (long)(nVal
* 100 + 0.5);
1199 ((SfxInt32Item
*)pNewItem
)->SetValue((sal_Int32
)nLongVal
);
1201 case ITEM_UINT32
: ((SfxUInt32Item
*)pNewItem
)->SetValue(aNewText
.toInt32()); break;
1202 case ITEM_ENUM
: ((SfxEnumItemInterface
*)pNewItem
)->SetEnumValue((sal_uInt16
)nLongVal
); break;
1204 aNewText
= aNewText
.toAsciiUpperCase();
1205 if (aNewText
== "TRUE") nLongVal
=1;
1206 if (aNewText
== "JA") nLongVal
=1;
1207 if (aNewText
== "AN") nLongVal
=1;
1208 if (aNewText
== "EIN") nLongVal
=1;
1209 if (aNewText
== "ON") nLongVal
=1;
1210 if (aNewText
== "YES") nLongVal
=1;
1211 ((SfxBoolItem
*)pNewItem
)->SetValue((sal_Bool
)nLongVal
);
1213 case ITEM_FLAG
: ((SfxFlagItem
*)pNewItem
)->SetValue((sal_uInt16
)nLongVal
); break;
1214 case ITEM_STRING
: ((SfxStringItem
*)pNewItem
)->SetValue(aNewText
); break;
1215 case ITEM_POINT
: ((SfxPointItem
*)pNewItem
)->SetValue(Point(nLongX
,nLongY
)); break;
1216 case ITEM_RECT
: break;
1218 ((SfxRangeItem
*)pNewItem
)->From()=(sal_uInt16
)nLongX
;
1219 ((SfxRangeItem
*)pNewItem
)->From()=(sal_uInt16
)nLongY
;
1221 case ITEM_LRANGE
: {
1223 case ITEM_FRACTION
: {
1224 if (!bPairX
) nLongX
=1;
1225 if (!bPairY
) nLongY
=1;
1226 ((SdrFractionItem
*)pNewItem
)->SetValue(Fraction(nLongX
,nLongY
));
1228 case ITEM_XCOLOR
: break;
1229 case ITEM_COLOR
: break;
1231 ((SvxFontItem
*)pNewItem
)->SetFamily( FAMILY_DONTKNOW
);
1232 ((SvxFontItem
*)pNewItem
)->SetFamilyName(aNewText
);
1233 ((SvxFontItem
*)pNewItem
)->SetStyleName( String() );
1235 case ITEM_FONTHEIGHT
: {
1237 sal_uInt16 nProp
=100;
1238 if (aNewText
.indexOf(sal_Unicode('%')) != -1) {
1239 nProp
=(sal_uInt16
)nLongVal
;
1243 ((SvxFontHeightItem
*)pNewItem
)->SetHeight(nHgt
,nProp
);
1245 case ITEM_FONTWIDTH
: {
1246 sal_uInt16 nProp
=100;
1247 if (aNewText
.indexOf(sal_Unicode('%')) != -1) {
1248 nProp
=(sal_uInt16
)nLongVal
;
1250 ((SvxCharScaleWidthItem
*)pNewItem
)->SetValue(nProp
);
1252 case ITEM_FIELD
: break;
1255 aNewSet
.Put(*pNewItem
);
1258 pView
->SetAttributes(aNewSet
,bDel
);
1263 IMPL_LINK_NOARG(SdrItemBrowser
, SetDirtyHdl
)
1270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */