26#include <osl/diagnose.h>
35#include <sfx2/sfxsids.hrc>
37#include <sfx2/strings.hrc>
49 :
SfxTabPage(pPage, pController,
"sfx/ui/managestylepage.ui",
"ManageStylePage", &rAttrSet)
54 , aFollow(pStyle->GetFollow())
55 , aParent(pStyle->GetParent())
56 , nFlags(pStyle->GetMask())
57 , m_xName(m_xBuilder->weld_entry(
"name"))
58 , m_xAutoCB(m_xBuilder->weld_check_button(
"autoupdate"))
59 , m_xFollowFt(m_xBuilder->weld_label(
"nextstyleft"))
60 , m_xFollowLb(m_xBuilder->weld_combo_box(
"nextstyle"))
61 , m_xEditStyleBtn(m_xBuilder->weld_button(
"editstyle"))
62 , m_xBaseFt(m_xBuilder->weld_label(
"linkedwithft"))
63 , m_xBaseLb(m_xBuilder->weld_combo_box(
"linkedwith"))
64 , m_xEditLinkStyleBtn(m_xBuilder->weld_button(
"editlinkstyle"))
65 , m_xFilterFt(m_xBuilder->weld_label(
"categoryft"))
66 , m_xFilterLb(m_xBuilder->weld_combo_box(
"category"))
67 , m_xDescFt(m_xBuilder->weld_label(
"desc"))
71 const int nMaxWidth(
m_xFollowLb->get_approximate_digit_width() * 50);
74 m_xBaseLb->set_size_request(nMaxWidth , -1);
88 int linkSelectPos =
m_xBaseLb->get_active();
89 if ( linkSelectPos == 0 )
101 OSL_ENSURE( pPool,
"no Pool or no DocShell" );
142 pPoolStyle = pPool->
Next();
176 pPoolStyle = pPool->
Next();
199 sal_uInt16 nStyleFilterIdx = 0xffff;
206 if ( nMask == SfxStyleSearchBits::Auto )
213 if ( rTupel.
nFlags != SfxStyleSearchBits::Auto &&
214 rTupel.
nFlags != SfxStyleSearchBits::Used &&
215 rTupel.
nFlags != SfxStyleSearchBits::AllVisible &&
216 rTupel.
nFlags != SfxStyleSearchBits::All )
218 OUString
sId(OUString::number(
i));
220 if ( ( rTupel.
nFlags & nMask ) == nMask )
221 nStyleFilterIdx = nIdx;
226 if ( nStyleFilterIdx != 0xFFFF )
248 if(SfxItemState::SET == rAttrSet.
GetItemState(SID_ATTR_AUTO_STYLE_UPDATE))
264 const OUString& rNew )
299 MapUnit eUnit = MapUnit::MapCM;
309 switch ( eFieldUnit )
311 case FieldUnit::MM: eUnit = MapUnit::MapMM;
break;
314 case FieldUnit::KM: eUnit = MapUnit::MapCM;
break;
315 case FieldUnit::POINT:
316 case FieldUnit::PICA: eUnit = MapUnit::MapPoint;
break;
317 case FieldUnit::INCH:
318 case FieldUnit::FOOT:
319 case FieldUnit::MILE: eUnit = MapUnit::MapInch;
break;
322 OSL_FAIL(
"non supported field unit" );
329 OUString aTemplName(m_xFollowLb->get_active_text());
330 OUString aEditTemplName(m_xName->get_text());
331 m_xEditStyleBtn->set_sensitive(aTemplName != aEditTemplName);
336 OUString aTemplName(m_xFollowLb->get_active_text());
337 Execute_Impl(SID_STYLE_EDIT, aTemplName,
static_cast<sal_uInt16
>(pStyle->GetFamily()));
342 int linkSelectPos = m_xBaseLb->get_active();
343 if ( linkSelectPos == 0 )
344 m_xEditLinkStyleBtn->set_sensitive(
false);
346 m_xEditLinkStyleBtn->set_sensitive(
true);
351 OUString aTemplName(m_xBaseLb->get_active_text());
352 if (aTemplName !=
SfxResId(STR_NONE))
353 Execute_Impl( SID_STYLE_EDIT, aTemplName,
static_cast<sal_uInt16
>(pStyle->GetFamily()) );
358 sal_uInt16 nId,
const OUString &rStr, sal_uInt16 nFamily)
366 if( !rStr.isEmpty() )
367 pItems[
nCount++ ] = &aItem;
368 pItems[
nCount++ ] = &aFamily;
370 pItems[
nCount++ ] =
nullptr;
376 return pItem !=
nullptr;
407 UpdateName_Impl(m_xFollowLb.get(),
aStr);
436 if ( nFilterIdx != -1 &&
441 OSL_ENSURE(
pItem,
"No Item" );
534 return std::make_unique<SfxManageStyleSheetPage>(pPage, pController, *rAttrSet);
585 if (
m_xName->get_value_changed_from_saved())
594 VclMessageType::Info, VclButtonsType::Ok,
595 SfxResId(STR_TABPAGE_INVALIDNAME)));
606 const OUString aFollowEntry(
m_xFollowLb->get_active_text() );
613 VclMessageType::Info, VclButtonsType::Ok,
614 SfxResId(STR_TABPAGE_INVALIDSTYLE)));
625 OUString aParentEntry(
m_xBaseLb->get_active_text() );
628 aParentEntry.clear();
635 VclMessageType::Info, VclButtonsType::Ok,
636 SfxResId(STR_TABPAGE_INVALIDPARENT)));
SfxApplication * SfxGetpApp()
IMPL_LINK(SfxEventAsyncer_Impl, IdleHdl, Timer *, pAsyncIdle, void)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
SAL_DLLPRIVATE SfxDispatcher * GetDispatcher_Impl()
static SAL_DLLPRIVATE SfxModule * GetModule_Impl()
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
Method to execute a <SfxSlot>s over the Slot-Id.
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxStyleFamilyItem * pItem
std::unique_ptr< weld::ComboBox > m_xFollowLb
std::unique_ptr< weld::Button > m_xEditStyleBtn
virtual bool FillItemSet(SfxItemSet *) override
std::unique_ptr< weld::Label > m_xDescFt
virtual void Reset(const SfxItemSet *) override
std::unique_ptr< weld::Button > m_xEditLinkStyleBtn
virtual DeactivateRC DeactivatePage(SfxItemSet *) override
std::unique_ptr< weld::Label > m_xFilterFt
void SetDescriptionText_Impl()
SfxStyleSheetBase * pStyle
static bool Execute_Impl(sal_uInt16 nId, const OUString &rStr, sal_uInt16 nFamily)
std::optional< SfxStyleFamilies > mxFamilies
std::unique_ptr< weld::ComboBox > m_xBaseLb
std::unique_ptr< weld::Label > m_xFollowFt
std::unique_ptr< weld::Label > m_xBaseFt
SfxManageStyleSheetPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rAttrSet)
virtual ~SfxManageStyleSheetPage() override
void UpdateName_Impl(weld::ComboBox *, const OUString &rNew)
virtual void ActivatePage(const SfxItemSet &) override
SfxStyleSearchBits nFlags
std::unique_ptr< weld::ComboBox > m_xFilterLb
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
std::unique_ptr< weld::Entry > m_xName
std::unique_ptr< weld::CheckButton > m_xAutoCB
static SfxModule * GetActiveModule(SfxViewFrame *pFrame=nullptr)
virtual std::optional< SfxStyleFamilies > CreateStyleFamilies()
virtual SfxStyleSheetBasePool * GetStyleSheetPool()
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
With this method any objects of <SfxPoolItemu> subclasses can be accessed.
static OUString GenerateUnusedName(SfxStyleSheetBasePool &rPool, SfxStyleFamily eFam)
SfxStyleFamily GetFamily() const
const SfxStyleFilter & GetFilterList() const
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
SfxStyleSheetBase * Next()
SfxStyleSearchBits GetMask() const
virtual bool HasClearParentSupport() const
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true)
virtual const OUString & GetParent() const
const OUString & GetName() const
virtual bool HasFollowSupport() const
SfxStyleFamily GetFamily() const
bool IsUserDefined() const
virtual bool HasParentSupport() const
virtual const OUString & GetFollow() const
virtual bool SetParent(const OUString &)
virtual bool SetFollow(const OUString &)
void SetMask(SfxStyleSearchBits mask)
virtual OUString GetDescription(MapUnit eMetric)
void SetExchangeSupport()
weld::Window * GetFrameWeld() const
virtual int find_text(const OUString &rStr) const=0
virtual OUString get_active_text() const=0
void append_text(const OUString &rStr)
virtual void remove(int pos)=0
void set_active_text(const OUString &rStr)
virtual void set_text(const OUString &rText)=0
virtual OUString get_text() const=0
virtual OUString GetName() const override
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(SfxManageStyleSheetPage, EditStyleSelectHdl_Impl, weld::ComboBox &, void)
OString stripStart(const OString &rIn, char c)
OUString SfxResId(TranslateId aId)
SfxStyleSearchBits nFlags
std::vector< SfxFilterTuple > SfxStyleFilter