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 "OutlineBulletDlg.hxx"
22 #include <svx/svxids.hrc>
23 #include <sfx2/objsh.hxx>
24 #include <svx/drawitem.hxx>
25 #include <editeng/bulletitem.hxx>
26 #include <editeng/eeitem.hxx>
28 #include <editeng/numitem.hxx>
30 #include <svx/dialogs.hrc>
31 #include <svl/intitem.hxx>
32 #include <svx/svdmark.hxx>
34 #include <svx/svdobj.hxx>
35 #include <svl/style.hxx>
36 #include <drawdoc.hxx>
38 #include "sdresid.hxx"
41 #include "dlgolbul.hrc"
42 #include "bulmaper.hxx"
43 #include "DrawDocShell.hxx"
44 #include <svl/aeitem.hxx>
49 * Constructor of tab dialog: append pages to the dialog
51 OutlineBulletDlg::OutlineBulletDlg(
53 const SfxItemSet
* pAttr
,
55 : SfxTabDialog ( pParent
, SdResId(TAB_OUTLINEBULLET
) ),
62 aInputSet
.MergeRange( SID_PARAM_NUM_PRESET
, SID_PARAM_CUR_NUM_LEVEL
);
63 aInputSet
.Put( *pAttr
);
65 pOutputSet
= new SfxItemSet( *pAttr
);
66 pOutputSet
->ClearItem();
68 sal_Bool bOutliner
= sal_False
;
70 // special treatment if a title object is selected
73 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
74 const sal_uLong nCount
= rMarkList
.GetMarkCount();
75 for(sal_uLong nNum
= 0; nNum
< nCount
; nNum
++)
77 SdrObject
* pObj
= rMarkList
.GetMark(nNum
)->GetMarkedSdrObj();
78 if( pObj
->GetObjInventor() == SdrInventor
)
81 switch(pObj
->GetObjIdentifier())
94 if( SFX_ITEM_SET
!= aInputSet
.GetItemState(EE_PARA_NUMBULLET
))
96 const SvxNumBulletItem
*pItem
= NULL
;
99 SfxStyleSheetBasePool
* pSSPool
= pView
->GetDocSh()->GetStyleSheetPool();
100 String
aStyleName((SdResId(STR_LAYOUT_OUTLINE
)));
101 aStyleName
.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
102 SfxStyleSheetBase
* pFirstStyleSheet
= pSSPool
->Find( aStyleName
, SD_STYLE_FAMILY_PSEUDO
);
103 if( pFirstStyleSheet
)
104 pFirstStyleSheet
->GetItemSet().GetItemState(EE_PARA_NUMBULLET
, sal_False
, (const SfxPoolItem
**)&pItem
);
108 pItem
= (SvxNumBulletItem
*) aInputSet
.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET
);
110 DBG_ASSERT( pItem
, "No EE_PARA_NUMBULLET in Pool! [CL]" );
112 aInputSet
.Put(*pItem
, EE_PARA_NUMBULLET
);
115 if(bTitle
&& aInputSet
.GetItemState(EE_PARA_NUMBULLET
,sal_True
) == SFX_ITEM_ON
)
117 SvxNumBulletItem
* pItem
= (SvxNumBulletItem
*)aInputSet
.GetItem(EE_PARA_NUMBULLET
,sal_True
);
118 SvxNumRule
* pRule
= pItem
->GetNumRule();
121 SvxNumRule
aNewRule( *pRule
);
122 aNewRule
.SetFeatureFlag( NUM_NO_NUMBERS
, sal_True
);
124 SvxNumBulletItem
aNewItem( aNewRule
, EE_PARA_NUMBULLET
);
125 aInputSet
.Put(aNewItem
);
129 SetInputSet( &aInputSet
);
132 AddTabPage(RID_SVXPAGE_PICK_SINGLE_NUM
);
134 RemoveTabPage( RID_SVXPAGE_PICK_SINGLE_NUM
);
136 AddTabPage( RID_SVXPAGE_PICK_BULLET
);
137 AddTabPage( RID_SVXPAGE_PICK_BMP
);
138 AddTabPage(RID_SVXPAGE_NUM_OPTIONS
);
139 AddTabPage(RID_SVXPAGE_NUM_POSITION
);
143 OutlineBulletDlg::~OutlineBulletDlg()
148 void OutlineBulletDlg::PageCreated( sal_uInt16 nId
, SfxTabPage
&rPage
)
152 case RID_SVXPAGE_NUM_OPTIONS
:
156 FieldUnit eMetric
= pSdView
->GetDoc().GetUIUnit();
157 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
158 aSet
.Put ( SfxAllEnumItem(SID_METRIC_ITEM
,(sal_uInt16
)eMetric
));
159 rPage
.PageCreated(aSet
);
163 case RID_SVXPAGE_NUM_POSITION
:
167 FieldUnit eMetric
= pSdView
->GetDoc().GetUIUnit();
168 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
169 aSet
.Put ( SfxAllEnumItem(SID_METRIC_ITEM
,(sal_uInt16
)eMetric
));
170 rPage
.PageCreated(aSet
);
177 const SfxItemSet
* OutlineBulletDlg::GetOutputItemSet() const
179 SfxItemSet
aSet( *SfxTabDialog::GetOutputItemSet() );
180 pOutputSet
->Put( aSet
);
182 const SfxPoolItem
*pItem
= NULL
;
183 if( SFX_ITEM_SET
== pOutputSet
->GetItemState(pOutputSet
->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE
), sal_False
, &pItem
))
185 SdBulletMapper::MapFontsInNumRule( *((SvxNumBulletItem
*)pItem
)->GetNumRule(), *pOutputSet
);
187 // #i35937 - removed EE_PARA_BULLETSTATE setting
191 if(bTitle
&& pOutputSet
->GetItemState(EE_PARA_NUMBULLET
,sal_True
) == SFX_ITEM_ON
)
193 SvxNumBulletItem
* pBulletItem
= (SvxNumBulletItem
*)pOutputSet
->GetItem(EE_PARA_NUMBULLET
,sal_True
);
194 SvxNumRule
* pRule
= pBulletItem
->GetNumRule();
196 pRule
->SetFeatureFlag( NUM_NO_NUMBERS
, sal_False
);
202 } // end of namespace sd
204 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */