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