1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlgolbul.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #ifdef SD_DLLIMPLEMENTATION
35 #undef SD_DLLIMPLEMENTATION
38 #include "OutlineBulletDlg.hxx"
40 #ifndef _SVX_SVXIDS_HRC
41 #include <svx/svxids.hrc>
43 #include <sfx2/objsh.hxx>
44 #include <svx/drawitem.hxx>
45 #include <svx/bulitem.hxx>
46 #include <svx/eeitem.hxx>
48 #include <svx/numitem.hxx>
50 #include <svx/dialogs.hrc>
51 #include <svtools/intitem.hxx>
52 #include <svx/svdmark.hxx>
54 #include <svx/svdobj.hxx>
55 #include <svtools/style.hxx>
56 #include <drawdoc.hxx>
58 #ifndef _SD_SDRESID_HXX
59 #include "sdresid.hxx"
63 #include "dlgolbul.hrc"
64 #include "bulmaper.hxx"
65 #include "DrawDocShell.hxx"
66 #include <svx/svxids.hrc>
67 #include <svtools/aeitem.hxx>
71 /*************************************************************************
73 |* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
75 \************************************************************************/
77 OutlineBulletDlg::OutlineBulletDlg(
79 const SfxItemSet
* pAttr
,
81 : SfxTabDialog ( pParent
, SdResId(TAB_OUTLINEBULLET
) ),
88 aInputSet
.MergeRange( SID_PARAM_NUM_PRESET
, SID_PARAM_CUR_NUM_LEVEL
);
89 aInputSet
.Put( *pAttr
);
91 pOutputSet
= new SfxItemSet( *pAttr
);
92 pOutputSet
->ClearItem();
94 BOOL bOutliner
= FALSE
;
96 // Sonderbehandlung wenn eine Title Objekt selektiert wurde
99 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
100 const ULONG nCount
= rMarkList
.GetMarkCount();
101 for(ULONG nNum
= 0; nNum
< nCount
; nNum
++)
103 SdrObject
* pObj
= rMarkList
.GetMark(nNum
)->GetMarkedSdrObj();
104 if( pObj
->GetObjInventor() == SdrInventor
)
107 switch(pObj
->GetObjIdentifier())
112 case OBJ_OUTLINETEXT
:
120 if( SFX_ITEM_SET
!= aInputSet
.GetItemState(EE_PARA_NUMBULLET
))
122 const SvxNumBulletItem
*pItem
= NULL
;
125 SfxStyleSheetBasePool
* pSSPool
= pView
->GetDocSh()->GetStyleSheetPool();
126 String
aStyleName((SdResId(STR_LAYOUT_OUTLINE
)));
127 aStyleName
.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
128 SfxStyleSheetBase
* pFirstStyleSheet
= pSSPool
->Find( aStyleName
, SD_STYLE_FAMILY_PSEUDO
);
129 if( pFirstStyleSheet
)
130 pFirstStyleSheet
->GetItemSet().GetItemState(EE_PARA_NUMBULLET
, FALSE
, (const SfxPoolItem
**)&pItem
);
134 pItem
= (SvxNumBulletItem
*) aInputSet
.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET
);
136 DBG_ASSERT( pItem
, "Kein EE_PARA_NUMBULLET im Pool! [CL]" );
138 aInputSet
.Put(*pItem
, EE_PARA_NUMBULLET
);
142 if( SFX_ITEM_SET == aInputSet.GetItemState(EE_PARA_NUMBULLET, FALSE, &pItem ))
144 SvxNumRule& rItem = *((SvxNumBulletItem*)pItem)->GetNumRule();
145 for( int i = 0; i < 9; i++ )
147 SvxNumberFormat aNumberFormat = rItem.GetLevel(i);
152 if(bTitle
&& aInputSet
.GetItemState(EE_PARA_NUMBULLET
,TRUE
) == SFX_ITEM_ON
)
154 SvxNumBulletItem
* pItem
= (SvxNumBulletItem
*)aInputSet
.GetItem(EE_PARA_NUMBULLET
,TRUE
);
155 SvxNumRule
* pRule
= pItem
->GetNumRule();
158 SvxNumRule
aNewRule( *pRule
);
159 aNewRule
.SetFeatureFlag( NUM_NO_NUMBERS
, TRUE
);
161 SvxNumBulletItem
aNewItem( aNewRule
, EE_PARA_NUMBULLET
);
162 aInputSet
.Put(aNewItem
);
166 SetInputSet( &aInputSet
);
169 AddTabPage(RID_SVXPAGE_PICK_SINGLE_NUM
);
171 RemoveTabPage( RID_SVXPAGE_PICK_SINGLE_NUM
);
173 AddTabPage( RID_SVXPAGE_PICK_BULLET
);
174 AddTabPage( RID_SVXPAGE_PICK_BMP
);
175 AddTabPage(RID_SVXPAGE_NUM_OPTIONS
);
176 AddTabPage(RID_SVXPAGE_NUM_POSITION
);
180 OutlineBulletDlg::~OutlineBulletDlg()
185 void OutlineBulletDlg::PageCreated( USHORT nId
, SfxTabPage
&rPage
)
189 case RID_SVXPAGE_NUM_OPTIONS
:
193 FieldUnit eMetric
= pSdView
->GetDoc()->GetUIUnit();
194 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
195 aSet
.Put ( SfxAllEnumItem(SID_METRIC_ITEM
,(USHORT
)eMetric
));
196 rPage
.PageCreated(aSet
);
200 case RID_SVXPAGE_NUM_POSITION
:
204 FieldUnit eMetric
= pSdView
->GetDoc()->GetUIUnit();
205 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
206 aSet
.Put ( SfxAllEnumItem(SID_METRIC_ITEM
,(USHORT
)eMetric
));
207 rPage
.PageCreated(aSet
);
214 const SfxItemSet
* OutlineBulletDlg::GetOutputItemSet() const
216 SfxItemSet
aSet( *SfxTabDialog::GetOutputItemSet() );
217 pOutputSet
->Put( aSet
);
219 const SfxPoolItem
*pItem
= NULL
;
220 if( SFX_ITEM_SET
== pOutputSet
->GetItemState(pOutputSet
->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE
), FALSE
, &pItem
))
222 SdBulletMapper::MapFontsInNumRule( *((SvxNumBulletItem
*)pItem
)->GetNumRule(), *pOutputSet
);
225 SfxUInt16Item aBulletState( EE_PARA_BULLETSTATE, 1 );
226 pOutputSet->Put(aBulletState);
231 SdBulletMapper::PostMapNumBulletForDialog( *pOutputSet );
234 if(bTitle
&& pOutputSet
->GetItemState(EE_PARA_NUMBULLET
,TRUE
) == SFX_ITEM_ON
)
236 SvxNumBulletItem
* pBulletItem
= (SvxNumBulletItem
*)pOutputSet
->GetItem(EE_PARA_NUMBULLET
,TRUE
);
237 SvxNumRule
* pRule
= pBulletItem
->GetNumRule();
239 pRule
->SetFeatureFlag( NUM_NO_NUMBERS
, FALSE
);
245 } // end of namespace sd