43#define ROUND(x) static_cast<tools::Long>((x) + .5)
56 if (rP1.
Y() == rP2.
Y())
59 aArr[0].setX( rP2.
X() - 5 );
60 aArr[0].setY( rP2.
Y() - 2 );
61 aArr[1].setX( rP2.
X() );
62 aArr[1].setY( rP2.
Y() );
63 aArr[2].setX( rP2.
X() - 5 );
64 aArr[2].setY( rP2.
Y() + 2 );
69 aArr[0].setX( rP2.
X() - 2 );
70 aArr[0].setY( rP2.
Y() - 5 );
71 aArr[1].setX( rP2.
X() + 2 );
72 aArr[1].setY( rP2.
Y() - 5 );
73 aArr[2].setX( rP2.
X() );
74 aArr[2].setY( rP2.
Y() );
84 if (rP1.
Y() == rP2.
Y())
103 , m_aHDistStr(
SwResId(STR_HDIST))
104 , m_aVDistStr(
SwResId(STR_VDIST))
105 , m_aWidthStr(
SwResId(STR_WIDTH))
106 , m_aHeightStr(
SwResId(STR_HEIGHT))
107 , m_aLeftStr(
SwResId(STR_LEFT))
108 , m_aUpperStr(
SwResId(STR_UPPER))
109 , m_aColsStr(
SwResId(STR_COLS))
110 , m_aRowsStr(
SwResId(STR_ROWS))
124 CustomWidgetController::SetDrawingArea(pWidget);
146 const double fxpix = double(lOutWPix - (2 * (
m_lLeftWidth + 15))) / double(lOutWPix);
161 rRenderContext.
Erase();
167 rRenderContext.
SetFont(aPaintFont);
179 const float fx = float(lOutWPix23) / std::max(
tools::Long(1), lDispW);
180 const float fy = float(lOutHPix23) / std::max(
tools::Long(1), lDispH);
187 const tools::Long lX0 = (lOutWPix - lOutlineW) / 2;
188 const tools::Long lY0 = (lOutHPix - lOutlineH) / 2;
204 rRenderContext.
DrawLine(
Point(lX0 + lOutlineW - 1, lY0),
Point(lX0 + lOutlineW - 1, lY0 + lOutlineH - 1));
206 rRenderContext.
DrawLine(
Point(lX0, lY0 + lOutlineH - 1),
Point(lX0 + lOutlineW - 1, lY0 + lOutlineH - 1));
213 for (sal_Int32 nRow = 0; nRow < nRows; ++nRow)
214 for (sal_Int32 nCol = 0; nCol < nCols; ++nCol)
225 DrawArrow(rRenderContext,
Point(lX0, lY0 - 5),
Point(lX1, lY0 - 5),
false);
226 DrawArrow(rRenderContext,
Point(lX, lY0 - 10),
Point(lX, lY0 - 5),
true);
233 DrawArrow(rRenderContext,
Point(lX0 - 5, lY0),
Point(lX0 - 5, lY1),
false);
253 DrawArrow(rRenderContext,
Point(lX1, lY0 - 5),
Point(lX3, lY0 - 5),
false);
254 DrawArrow(rRenderContext,
Point(lX, lY0 - 10),
Point(lX, lY0 - 5),
true);
261 DrawArrow(rRenderContext,
Point(lX0 - 5, lY1),
Point(lX0 - 5, lY3),
false);
268 DrawArrow(rRenderContext,
Point(lX0, lY),
Point(lX0 + lOutlineW - 1, lY),
true);
275 DrawArrow(rRenderContext,
Point(lX, lY0),
Point(lX, lY0 + lOutlineH - 1),
true);
287 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/labelformatpage.ui",
"LabelFormatPage", &
rSet)
288 , m_aPreviewIdle(
"SwLabFormatPage Preview")
291 , m_xMakeFI(m_xBuilder->weld_label(
"make"))
292 , m_xTypeFI(m_xBuilder->weld_label(
"type"))
293 , m_xPreview(new
weld::CustomWeld(*m_xBuilder,
"preview", m_aPreview))
294 , m_xHDistField(m_xBuilder->weld_metric_spin_button(
"hori",
FieldUnit::
CM))
295 , m_xVDistField(m_xBuilder->weld_metric_spin_button(
"vert",
FieldUnit::
CM))
296 , m_xWidthField(m_xBuilder->weld_metric_spin_button(
"width",
FieldUnit::
CM))
297 , m_xHeightField(m_xBuilder->weld_metric_spin_button(
"height",
FieldUnit::
CM))
298 , m_xLeftField(m_xBuilder->weld_metric_spin_button(
"left",
FieldUnit::
CM))
299 , m_xUpperField(m_xBuilder->weld_metric_spin_button(
"top",
FieldUnit::
CM))
300 , m_xColsField(m_xBuilder->weld_spin_button(
"cols"))
301 , m_xRowsField(m_xBuilder->weld_spin_button(
"rows"))
302 , m_xPWidthField(m_xBuilder->weld_metric_spin_button(
"pagewidth",
FieldUnit::
CM))
303 , m_xPHeightField(m_xBuilder->weld_metric_spin_button(
"pageheight",
FieldUnit::
CM))
304 , m_xSavePB(m_xBuilder->weld_button(
"save"))
347 m_aPreviewIdle.Start();
353 m_aPreviewIdle.Start();
359 m_aPreviewIdle.Stop();
362 m_aPreview.UpdateItem(m_aItem);
380 lMinPWidth = lLeft + (nCols - 1) * lHDist + lWidth,
381 lMinPHeight = lUpper + (nRows - 1) * lVDist + lHeight;
386 m_xHDistField->set_max(100 * ((lMax - lLeft ) / std::max(1, nCols)), FieldUnit::TWIP);
387 m_xVDistField->set_max(100 * ((lMax - lUpper) / std::max(1, nRows)), FieldUnit::TWIP);
407 return std::make_unique<SwLabFormatPage>(pPage, pController, *
rSet);
421 return DeactivateRC::LeavePage;
495 aRec.
m_nCols =
static_cast< sal_Int32
>(m_xColsField->get_value());
496 aRec.
m_nRows =
static_cast< sal_Int32
>(m_xRowsField->get_value());
499 aRec.
m_bCont = m_aItem.m_bCont;
501 aSaveDlg.
SetLabel(m_aItem.m_aLstMake, m_aItem.m_aLstType);
506 const std::vector<OUString>& rMan = GetParentSwLabDlg()->GetLabelsConfig().GetManufacturers();
507 std::vector<OUString>& rMakes(GetParentSwLabDlg()->Makes());
508 if(rMakes.size() < rMan.size())
512 m_xMakeFI->set_label(m_aItem.m_aMake);
513 m_xTypeFI->set_label(m_aItem.m_aType);
518 : GenericDialogController(pParent->getDialog(),
"modules/swriter/ui/savelabeldialog.ui",
"SaveLabelDialog")
520 , m_pLabDialog(pParent)
522 , m_xMakeCB(m_xBuilder->weld_combo_box(
"brand"))
523 , m_xTypeED(m_xBuilder->weld_entry(
"type"))
524 , m_xOKPB(m_xBuilder->weld_button(
"ok"))
532 for (
const auto &
i : rMan)
545 OUString sMake(m_xMakeCB->get_active_text());
546 OUString
sType(m_xTypeED->get_text());
551 SAL_WARN(
"sw.envelp",
"label is predefined and cannot be overwritten" );
553 std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog(
"CannotSaveLabelDialog"));
559 std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog(
"QuerySaveLabelDialog"));
560 xQuery->set_primary_text(xQuery->get_primary_text().
561 replaceAll(
"%1", sMake).replaceAll(
"%2",
sType));
562 xQuery->set_secondary_text(xQuery->get_secondary_text().
563 replaceAll(
"%1", sMake).replaceAll(
"%2",
sType));
568 m_rLabRec.m_aType =
sType;
Reference< XExecutableDialog > m_xDialog
const StyleSettings & GetStyleSettings() const
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
const vcl::Font & GetFont() const
void SetFont(const vcl::Font &rNewFont)
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void DrawPolygon(const tools::Polygon &rPoly)
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
const AllSettings & GetSettings() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void SetExchangeSupport()
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetWindowColor() const
void GetLabItem(SwLabItem &rItem)
SwLabelConfig & GetLabelsConfig()
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
std::unique_ptr< weld::Button > m_xSavePB
virtual bool FillItemSet(SfxItemSet *rSet) override
std::unique_ptr< weld::MetricSpinButton > m_xPHeightField
std::unique_ptr< weld::Label > m_xTypeFI
SwLabFormatPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
std::unique_ptr< weld::Label > m_xMakeFI
std::unique_ptr< weld::MetricSpinButton > m_xUpperField
std::unique_ptr< weld::SpinButton > m_xRowsField
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
std::unique_ptr< weld::MetricSpinButton > m_xHeightField
std::unique_ptr< weld::MetricSpinButton > m_xWidthField
std::unique_ptr< weld::MetricSpinButton > m_xPWidthField
virtual ~SwLabFormatPage() override
SwLabDlg * GetParentSwLabDlg()
void FillItem(SwLabItem &rItem)
std::unique_ptr< weld::MetricSpinButton > m_xLeftField
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< weld::MetricSpinButton > m_xHDistField
virtual void ActivatePage(const SfxItemSet &rSet) override
std::unique_ptr< weld::MetricSpinButton > m_xVDistField
std::unique_ptr< weld::SpinButton > m_xColsField
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
void UpdateItem(const SwLabItem &rItem)
tools::Long m_lHDistWidth
tools::Long m_lHeightWidth
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
tools::Long m_lVDistWidth
tools::Long m_lUpperWidth
bool IsPredefinedLabel(const OUString &rManufacturer, const OUString &rType)
const std::vector< OUString > & GetManufacturers() const
void SaveLabel(const OUString &rManufacturer, const OUString &rType, const SwLabRec &rRec)
bool HasLabel(const OUString &rManufacturer, const OUString &rType)
bool GetLabel(SwLabItem &rItem)
void SetLabel(const OUString &rMake, const OUString &rType)
std::unique_ptr< weld::ComboBox > m_xMakeCB
SwSaveLabelDlg(SwLabDlg *pParent, SwLabRec &rRec)
std::unique_ptr< weld::Button > m_xOKPB
virtual ~SwSaveLabelDlg() override
std::unique_ptr< weld::Entry > m_xTypeED
const Color & GetFontColor() const
static const SwViewOption & GetCurrentViewOptions()
void SetPriority(TaskPriority ePriority)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
void SetTransparent(bool bTransparent)
void SetFillColor(const Color &)
void SetColor(const Color &)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_LIGHTGRAYBLUE(0xE0, 0xE0, 0xFF)
IMPL_LINK_NOARG(SwLabFormatPage, MetricModifyHdl, weld::MetricSpinButton &, void)
int getfldval(const weld::MetricSpinButton &rField)
void setfldval(weld::MetricSpinButton &rField, int lValue)
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
OUString SwResId(TranslateId aId)