28#include <osl/diagnose.h>
55 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/envformatpage.ui",
"EnvFormatPage", &
rSet)
57 , m_xAddrLeftField(m_xBuilder->weld_metric_spin_button(
"leftaddr",
FieldUnit::
CM))
58 , m_xAddrTopField(m_xBuilder->weld_metric_spin_button(
"topaddr",
FieldUnit::
CM))
59 , m_xAddrEditButton(m_xBuilder->weld_menu_button(
"addredit"))
60 , m_xSendLeftField(m_xBuilder->weld_metric_spin_button(
"leftsender",
FieldUnit::
CM))
61 , m_xSendTopField(m_xBuilder->weld_metric_spin_button(
"topsender",
FieldUnit::
CM))
62 , m_xSendEditButton(m_xBuilder->weld_menu_button(
"senderedit"))
63 , m_xSizeFormatBox(m_xBuilder->weld_combo_box(
"format"))
64 , m_xSizeWidthField(m_xBuilder->weld_metric_spin_button(
"width",
FieldUnit::
CM))
65 , m_xSizeHeightField(m_xBuilder->weld_metric_spin_button(
"height",
FieldUnit::
CM))
66 , m_xPreview(new
weld::CustomWeld(*m_xBuilder,
"preview", m_aPreview))
100 if (aPaperName.isEmpty())
104 while (nPos < m_xSizeFormatBox->get_count() &&
132 int lWidth = std::max(lWVal, lHVal);
133 int lHeight =
std::min(lWVal, lHVal);
135 if (&rEdit == m_xSizeWidthField.get() || &rEdit == m_xSizeHeightField.get())
137 int nRotatedWidth = lHeight;
138 int nRotatedHeight = lWidth;
140 Size(nRotatedWidth, nRotatedHeight), MapUnit::MapTwip);
141 for (
size_t i = 0;
i < m_aIDs.size(); ++
i)
142 if (m_aIDs[
i] == o3tl::narrowing<sal_uInt16>(ePaper))
143 m_xSizeFormatBox->set_active(
i);
146 if (m_aIDs[m_xSizeFormatBox->get_active()] == sal_uInt16(
PAPER_USER))
152 FormatHdl(*m_xSizeFormatBox);
156 FillItem(GetParentSwEnvDlg()->m_aEnvItem);
158 m_xPreview->queue_draw();
175 OSL_ENSURE(pSh,
"Shell missing");
179 OSL_ENSURE(pColl,
"Text collection missing");
191 const OUString sFormatStr = pColl->
GetName();
193 if (pDlg->Execute() ==
RET_OK)
195 SfxItemSet aOutputSet( *pDlg->GetOutputItemSet() );
197 pCollSet->
Put(aOutputSet);
211 const sal_uInt16 nDefDist = o3tl::narrowing<sal_uInt16>(
::GetTabDist( rDefTabs ));
212 SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist );
213 aTmpSet.
Put( aDefDistItem );
217 aTmpSet.
Put( aTabPos );
234 const OUString sFormatStr = pColl->
GetName();
244 if( (pDefaultsItem = pOutputSet->
GetItemIfSet( SID_ATTR_TABSTOP_DEFAULTS,
false )) &&
245 nDefDist != (nNewDist = pDefaultsItem->
GetValue()) )
250 pOutputSet->
ClearItem( SID_ATTR_TABSTOP_DEFAULTS );
252 if( pOutputSet->
Count() )
254 pCollSet->
Put(*pOutputSet);
275 SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS,
276 SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS,
277 SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
278 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER
283 for (
const auto& rPair : aRanges)
284 pAddrSet->MergeRange(rPair.first, rPair.second);
288 return pAddrSet.get();
300 const sal_uInt16 nPaper = m_aIDs[m_xSizeFormatBox->get_active()];
315 lAddrFromLeft = lWidth / 2;
316 lAddrFromTop = lHeight / 2;
328 FillItem(GetParentSwEnvDlg()->m_aEnvItem);
329 m_xPreview->queue_draw();
342 100 * (lWidth - 2 * 566), FieldUnit::TWIP);
344 100 * (lHeight - 2 * 566), FieldUnit::TWIP);
353 return std::make_unique<SwEnvFormatPage>(pPage, pController, *
rSet);
367 return DeactivateRC::LeavePage;
382 rItem.
m_nWidth = std::max(lWVal, lHVal);
389 rItem.
m_nWidth = std::max(lWVal, lHVal);
408 for (
size_t i = 0;
i <
m_aIDs.size(); ++
i)
409 if (
m_aIDs[
i] == o3tl::narrowing<sal_uInt16>(ePaper))
sal_uInt16 GetValue() const
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
XBitmapListRef GetBitmapList() const
XGradientListRef GetGradientList() const
XPatternListRef GetPatternList() const
XColorListRef GetColorList() const
XHatchListRef GetHatchList() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const WhichRangesContainer & GetRanges() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SfxItemPool & GetPool() const
virtual short run() override
const SfxItemSet * GetOutputItemSet() const
void SetExchangeSupport()
weld::Window * GetFrameWeld() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static OUString GetName(Paper ePaper)
static Paper GetSvxPaper(const Size &rSize, MapUnit eUnit)
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
virtual VclPtr< SfxAbstractTabDialog > CreateSwCharDlg(weld::Window *pParent, SwView &pVw, const SfxItemSet &rCoreSet, SwCharDlgMode nDialogMode, const OUString *pFormatStr=nullptr)=0
SwDoc * GetDoc()
returns Doc. But be careful!
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in document.
SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId)
std::unique_ptr< SfxItemSet > m_pSenderSet
std::unique_ptr< SfxItemSet > m_pAddresseeSet
std::unique_ptr< weld::MetricSpinButton > m_xAddrTopField
virtual bool FillItemSet(SfxItemSet *rSet) override
SwEnvFormatPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
std::unique_ptr< weld::MetricSpinButton > m_xSizeWidthField
SfxItemSet * GetCollItemSet(SwTextFormatColl const *pColl, bool bSender)
std::vector< sal_uInt16 > m_aIDs
std::unique_ptr< weld::MetricSpinButton > m_xAddrLeftField
std::unique_ptr< weld::MetricSpinButton > m_xSendTopField
virtual void ActivatePage(const SfxItemSet &rSet) override
std::unique_ptr< weld::ComboBox > m_xSizeFormatBox
SwEnvDlg * GetParentSwEnvDlg()
std::unique_ptr< weld::MenuButton > m_xAddrEditButton
std::unique_ptr< weld::MetricSpinButton > m_xSendLeftField
void Init(SwEnvDlg *pDialog)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
virtual void Reset(const SfxItemSet *rSet) override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
std::unique_ptr< weld::MetricSpinButton > m_xSizeHeightField
void Edit(std::u16string_view rIdent, bool bSender)
std::unique_ptr< weld::MenuButton > m_xSendEditButton
void FillItem(SwEnvItem &rItem)
virtual ~SwEnvFormatPage() override
sal_Int32 m_nSendFromLeft
sal_Int32 m_nAddrFromLeft
void SetDialog(SwEnvDlg *pDialog)
Represents the style of a paragraph.
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
const SwView & GetView() const
static tools::Long lUserH
static tools::Long lUserW
IMPL_LINK_NOARG(SwEnvFormatPage, FormatHdl, weld::ComboBox &, void)
IMPL_LINK(SwEnvFormatPage, ModifyHdl, weld::MetricSpinButton &, rEdit, void)
int getfieldval(const weld::MetricSpinButton &rField)
void setfieldval(weld::MetricSpinButton &rField, int lValue)
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr TypedWhichId< SvxFirstLineIndentItem > RES_MARGIN_FIRSTLINE(91)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr sal_uInt16 RES_PARATR_END(82)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SvxRightMarginItem > RES_MARGIN_RIGHT(93)
constexpr TypedWhichId< SvxTextLeftMarginItem > RES_MARGIN_TEXTLEFT(92)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
#define LINK(Instance, Class, Member)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
static constexpr auto Items
SwAbstractDialogFactory & GetFactory()
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
@ RES_POOLCOLL_ENVELOPE_ADDRESS
Addressee.
@ RES_POOLCOLL_SEND_ADDRESS
Sender.