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;
217 rWrtShell.
MovePara(pSwuifnParaCurr,pSwuifnParaStart);
236 OSL_ENSURE(pFormat,
"character style doesn't exist!");
294 OSL_ENSURE(
mnLineH > 0,
"We cannot make it that small");
334 SvxFont& rFnt = (nScript == css::i18n::ScriptType::ASIAN)
336 : ((nScript == css::i18n::ScriptType::COMPLEX)
363 Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
364 m_xBreak = css::i18n::BreakIterator::create(xContext);
368 if( css::i18n::ScriptType::WEAK == nScript )
371 if( nChg <
maText.getLength() )
374 nScript = css::i18n::ScriptType::LATIN;
381 if( nChg >=
maText.getLength() || nChg < 0 )
405 SvxFont& rFnt = (nScript == css::i18n::ScriptType::ASIAN)
407 : ((nScript == css::i18n::ScriptType::COMPLEX)
415 nTextWidth += nWidth;
418 case css::i18n::ScriptType::ASIAN:
421 case css::i18n::ScriptType::COMPLEX:
434 nCJKHeight -= nCJKAscent;
435 nCTLHeight -= nCTLAscent;
436 if (nHeight < nCJKHeight)
437 nHeight = nCJKHeight;
438 if (nAscent < nCJKAscent)
439 nAscent = nCJKAscent;
440 if (nHeight < nCTLHeight)
441 nHeight = nCTLHeight;
442 if (nAscent < nCTLAscent)
443 nAscent = nCTLAscent;
446 Size aTextSize(nTextWidth, nHeight);
473 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/dropcapspage.ui",
"DropCapPage", &
rSet)
476 , m_xDropCapsBox(m_xBuilder->weld_check_button(
"checkCB_SWITCH"))
477 , m_xWholeWordCB(m_xBuilder->weld_check_button(
"checkCB_WORD"))
478 , m_xSwitchText(m_xBuilder->weld_label(
"labelFT_DROPCAPS"))
479 , m_xDropCapsField(m_xBuilder->weld_spin_button(
"spinFLD_DROPCAPS"))
480 , m_xLinesText(m_xBuilder->weld_label(
"labelTXT_LINES"))
481 , m_xLinesField(m_xBuilder->weld_spin_button(
"spinFLD_LINES"))
482 , m_xDistanceText(m_xBuilder->weld_label(
"labelTXT_DISTANCE"))
483 , m_xDistanceField(m_xBuilder->weld_metric_spin_button(
"spinFLD_DISTANCE",
FieldUnit::
CM))
484 , m_xTextText(m_xBuilder->weld_label(
"labelTXT_TEXT"))
485 , m_xTextEdit(m_xBuilder->weld_entry(
"entryEDT_TEXT"))
486 , m_xTemplateText(m_xBuilder->weld_label(
"labelTXT_TEMPLATE"))
487 , m_xTemplateBox(m_xBuilder->weld_combo_box(
"comboBOX_TEMPLATE"))
488 , m_xPict(new
weld::CustomWeld(*m_xBuilder,
"drawingareaWN_EXAMPLE", m_aPict))
498 const int nMaxWidth(
m_xTemplateBox->get_approximate_digit_width() * 50);
529 return DeactivateRC::LeavePage;
534 return std::make_unique<SwDropCapsPage>(pPage, pController, *
rSet);
602 bool bChecked = m_xDropCapsBox->get_active();
604 m_xWholeWordCB->set_sensitive(bChecked && !m_bHtmlMode);
606 m_xSwitchText->set_sensitive(bChecked && !m_xWholeWordCB->get_active());
607 m_xDropCapsField->set_sensitive(bChecked && !m_xWholeWordCB->get_active());
608 m_xLinesText->set_sensitive( bChecked );
609 m_xLinesField->set_sensitive( bChecked );
610 m_xDistanceText->set_sensitive( bChecked );
611 m_xDistanceField->set_sensitive( bChecked );
612 m_xTemplateText->set_sensitive( bChecked );
613 m_xTemplateBox->set_sensitive( bChecked );
614 m_xTextEdit->set_sensitive( bChecked && !m_bFormat );
615 m_xTextText->set_sensitive( bChecked && !m_bFormat );
619 ValueChangedHdl(*m_xDropCapsField);
620 m_xDropCapsField->grab_focus();
630 m_xDropCapsField->set_sensitive(!m_xWholeWordCB->get_active());
631 m_xSwitchText->set_sensitive(!m_xWholeWordCB->get_active());
633 ValueChangedHdl(*m_xDropCapsField);
648 bool bSetText =
false;
652 if (
m_bFormat || pView->GetWrtShell().GetDropText(1).isEmpty())
657 sPreview = pView->GetWrtShell().GetDropText(nVal);
663 if (!sEdit.isEmpty() && !
sPreview.startsWith(sEdit))
674 const sal_Int32 nTmp =
m_xTextEdit->get_text().getLength();
702 ModifyEntry(rEdit.get_widget());
707 m_aPict.UpdatePaintSettings();
752 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)
tools::Long AdjustX(tools::Long nHorzMove)
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)
static void GetFontSettings(vcl::Font &_rFont, sal_uInt16 _nWhich)
void SetDistance(sal_uInt16 nD)
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
void SetLines(sal_uInt8 nL)
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
const Color & GetFontColor() const
const SwViewOption * GetViewOptions() const
const SfxItemPool & GetAttrPool() const
SwWrtShell & GetWrtShell() const
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
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)