32#include <rtl/ustrbuf.hxx>
42#include <com/sun/star/i18n/BreakIterator.hpp>
43#include <com/sun/star/i18n/ScriptType.hpp>
45#include <osl/diagnose.h>
55using namespace css::uno;
56using namespace css::lang;
68 CustomWidgetController::SetDrawingArea(pDrawingArea);
75 CustomWidgetController::Resize();
109 OUStringBuffer
aStr(nChars);
110 for (sal_Int32
i = 0;
i < nChars;
i++)
112 return aStr.makeStringAndClear();
144 scriptType = css::i18n::ScriptType::LATIN;
226 OSL_ENSURE(pFormat,
"character style doesn't exist!");
283 OSL_ENSURE(
mnLineH > 0,
"We cannot make it that small");
323 SvxFont& rFnt = (nScript == css::i18n::ScriptType::ASIAN)
325 : ((nScript == css::i18n::ScriptType::COMPLEX)
352 Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
353 m_xBreak = css::i18n::BreakIterator::create(xContext);
357 if( css::i18n::ScriptType::WEAK == nScript )
360 if( nChg <
maText.getLength() )
363 nScript = css::i18n::ScriptType::LATIN;
370 if( nChg >=
maText.getLength() || nChg < 0 )
394 SvxFont& rFnt = (nScript == css::i18n::ScriptType::ASIAN)
396 : ((nScript == css::i18n::ScriptType::COMPLEX)
404 nTextWidth += nWidth;
407 case css::i18n::ScriptType::ASIAN:
410 case css::i18n::ScriptType::COMPLEX:
423 nCJKHeight -= nCJKAscent;
424 nCTLHeight -= nCTLAscent;
425 if (nHeight < nCJKHeight)
426 nHeight = nCJKHeight;
427 if (nAscent < nCJKAscent)
428 nAscent = nCJKAscent;
429 if (nHeight < nCTLHeight)
430 nHeight = nCTLHeight;
431 if (nAscent < nCTLAscent)
432 nAscent = nCTLAscent;
435 Size aTextSize(nTextWidth, nHeight);
462 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/dropcapspage.ui",
"DropCapPage", &
rSet)
466 , m_xDropCapsBox(m_xBuilder->weld_check_button(
"checkCB_SWITCH"))
467 , m_xWholeWordCB(m_xBuilder->weld_check_button(
"checkCB_WORD"))
468 , m_xSwitchText(m_xBuilder->weld_label(
"labelFT_DROPCAPS"))
469 , m_xDropCapsField(m_xBuilder->weld_spin_button(
"spinFLD_DROPCAPS"))
470 , m_xLinesText(m_xBuilder->weld_label(
"labelTXT_LINES"))
471 , m_xLinesField(m_xBuilder->weld_spin_button(
"spinFLD_LINES"))
472 , m_xDistanceText(m_xBuilder->weld_label(
"labelTXT_DISTANCE"))
473 , m_xDistanceField(m_xBuilder->weld_metric_spin_button(
"spinFLD_DISTANCE",
FieldUnit::
CM))
474 , m_xTextText(m_xBuilder->weld_label(
"labelTXT_TEXT"))
475 , m_xTextEdit(m_xBuilder->weld_entry(
"entryEDT_TEXT"))
476 , m_xTemplateText(m_xBuilder->weld_label(
"labelTXT_TEMPLATE"))
477 , m_xTemplateBox(m_xBuilder->weld_combo_box(
"comboBOX_TEMPLATE"))
478 , m_xPict(new
weld::CustomWeld(*m_xBuilder,
"drawingareaWN_EXAMPLE", m_aPict))
488 const int nMaxWidth(
m_xTemplateBox->get_approximate_digit_width() * 50);
519 return DeactivateRC::LeavePage;
524 return std::make_unique<SwDropCapsPage>(pPage, pController, *
rSet);
589 bool bChecked = m_xDropCapsBox->get_active();
591 m_xWholeWordCB->set_sensitive(bChecked && !m_bHtmlMode);
593 m_xSwitchText->set_sensitive(bChecked && !m_xWholeWordCB->get_active());
594 m_xDropCapsField->set_sensitive(bChecked && !m_xWholeWordCB->get_active());
595 m_xLinesText->set_sensitive( bChecked );
596 m_xLinesField->set_sensitive( bChecked );
597 m_xDistanceText->set_sensitive( bChecked );
598 m_xDistanceField->set_sensitive( bChecked );
599 m_xTemplateText->set_sensitive( bChecked );
600 m_xTemplateBox->set_sensitive( bChecked );
601 m_xTextEdit->set_sensitive( bChecked && !m_bFormat );
602 m_xTextText->set_sensitive( bChecked && !m_bFormat );
606 ValueChangedHdl(*m_xDropCapsField);
607 m_xDropCapsField->grab_focus();
617 m_xDropCapsField->set_sensitive(!m_xWholeWordCB->get_active());
618 m_xSwitchText->set_sensitive(!m_xWholeWordCB->get_active());
620 ValueChangedHdl(*m_xDropCapsField);
635 bool bSetText =
false;
647 if (!sEdit.isEmpty() && !
sPreview.startsWith(sEdit))
658 const sal_Int32 nTmp =
m_xTextEdit->get_text().getLength();
686 ModifyEntry(rEdit.get_widget());
691 m_aPict.UpdatePaintSettings();
735 sText = sText.copy(0, std::min<sal_Int32>(sText.getLength(),
m_xDropCapsField->get_value()));
constexpr OUStringLiteral sPreview
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
tools::Long GetLineHeight() const
tools::Long GetAscent() const
void SetFont(const vcl::Font &rNewFont)
void DrawRect(const tools::Rectangle &rRect)
FontMetric GetFontMetric() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
void SetTabPage(std::unique_ptr< SfxTabPage > xTabPage)
weld::Container * get_content_area()
void SetExchangeSupport()
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
virtual SfxPrinter * GetPrinter(bool bCreate=false)
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetWindowColor() const
FontFamily GetFamily() const
FontPitch GetPitch() const
rtl_TextEncoding GetCharSet() const
const OUString & GetFamilyName() const
Size GetTextSize(const OutputDevice &rOut, const OUString &rTxt, const sal_Int32 nIdx=0, const sal_Int32 nLen=SAL_MAX_INT32) const
void DrawPrev(OutputDevice *pOut, Printer *pPrinter, const Point &rPos, const OUString &rTxt, const sal_Int32 nIdx=0, const sal_Int32 nLen=SAL_MAX_INT32) const
void Push()
store a copy of the current cursor on the cursor stack
bool MovePara(SwWhichPara, SwMoveFnCollection const &)
void EndCursorMove(const bool bIdleEnd=false)
virtual std::unique_ptr< LockAllViewsGuard > LockAllViews() override
SwDropCapsDlg(weld::Window *pParent, const SfxItemSet &rSet)
std::unique_ptr< weld::CheckButton > m_xWholeWordCB
std::unique_ptr< weld::ComboBox > m_xTemplateBox
virtual ~SwDropCapsPage() override
std::unique_ptr< weld::Entry > m_xTextEdit
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
void ModifyEntry(const weld::Entry &rEdit)
std::unique_ptr< weld::Label > m_xTextText
virtual bool FillItemSet(SfxItemSet *rSet) override
static const WhichRangesContainer s_aPageRg
std::unique_ptr< weld::SpinButton > m_xLinesField
void FillSet(SfxItemSet &rSet)
std::unique_ptr< weld::SpinButton > m_xDropCapsField
SwDropCapsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< weld::CheckButton > m_xDropCapsBox
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
std::unique_ptr< weld::MetricSpinButton > m_xDistanceField
void GetFirstScriptSegment(sal_Int32 &start, sal_Int32 &end, sal_uInt16 &scriptType)
Get the details of the first script change.
virtual void Resize() override
void SetValues(const OUString &rText, sal_uInt8 nLines, sal_uInt16 nDistance)
void SetDistance(sal_uInt16 nD)
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
void SetLines(sal_uInt8 nL)
static void GetFontSettings(const SwDropCapsPage &_rPage, vcl::Font &_rFont, sal_uInt16 _nWhich)
css::uno::Reference< css::i18n::XBreakIterator > m_xBreak
std::vector< ScriptInfo > maScriptChanges
void SetDropCapsPage(SwDropCapsPage *pPage)
void UpdatePaintSettings()
virtual void Paint(vcl::RenderContext &, const tools::Rectangle &rRect) override
void SetText(const OUString &rT)
virtual ~SwDropCapsPict() override
void DrawPrev(vcl::RenderContext &rRenderContext, const Point &rPt)
VclPtr< Printer > mpPrinter
bool GetNextScriptSegment(size_t &nIdx, sal_Int32 &start, sal_Int32 &end, sal_uInt16 &scriptType)
Get the details of the first script change.
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
OUString GetDropText(const sal_Int32 nChars) const
static Color & GetFontColor()
const SfxItemPool & GetAttrPool() const
SwDocShell * GetDocShell()
SwCharFormat * GetCharStyle(const OUString &rFormatName, GetStyle eCreate=GETSTYLE_NOCREATE)
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
const SwView & GetView() const
static VclPtr< reference_type > Create(Arg &&... arg)
void SetFontSize(const Size &)
void SetPitch(FontPitch ePitch)
void SetTransparent(bool bTransparent)
void SetFillColor(const Color &)
void SetColor(const Color &)
void SetFamily(FontFamily)
void SetCharSet(rtl_TextEncoding)
const Size & GetFontSize() const
void SetFamilyName(const OUString &rFamilyName)
virtual OutputDevice & get_ref_device()=0
#define FN_FORMAT_DROPCAPS
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
bool(* SwWhichPara)(SwPaM &, SwMoveFnCollection const &)
Size SFX2_DLLPUBLIC getParagraphPreviewOptimalSize(const OutputDevice &rReference)
IMPL_LINK(SwDropCapsPage, ModifyHdl, weld::Entry &, rEdit, void)
static OUString GetDefaultString(sal_Int32 nChars)
IMPL_LINK_NOARG(SwDropCapsPage, ClickHdl, weld::Toggleable &, void)
static void calcFontHeightAnyAscent(vcl::RenderContext &rWin, vcl::Font const &_rFont, tools::Long &_nHeight, tools::Long &_nAscent)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
constexpr TypedWhichId< SwFormatDrop > RES_PARATR_DROP(70)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
#define LINK(Instance, Class, Member)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
bool GoCurrPara(SwPaM &rPam, SwMoveFnCollection const &aPosPara)
SwMoveFnCollection const & fnParaStart
OUString SwResId(TranslateId aId)
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)