47 #include <com/sun/star/awt/FontDescriptor.hpp>
48 #include <com/sun/star/table/BorderLine2.hpp>
49 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
50 #include <com/sun/star/lang/XServiceInfo.hpp>
51 #include <com/sun/star/beans/XPropertySet.hpp>
52 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
53 #include <com/sun/star/frame/XDispatchProvider.hpp>
54 #include <com/sun/star/frame/XFrame.hpp>
55 #include <svx/strings.hrc>
56 #include <svx/svxids.hrc>
60 #include <editeng/editids.hrc>
86 #include <editeng/editrids.hrc>
94 #include <officecfg/Office/Common.hxx>
97 #include <bitmaps.hlst>
104 #define MAX_MRU_FONTNAME_ENTRIES 5
106 #define COMBO_WIDTH_IN_CHARS 18
118 class SvxStyleBox_Base
121 SvxStyleBox_Base(std::unique_ptr<weld::ComboBox> xWidget,
const OUString& rCommand,
SfxStyleFamily eFamily,
122 const Reference<XDispatchProvider>& rDispatchProvider,
126 virtual ~SvxStyleBox_Base()
132 void SetDefaultStyle(
const OUString& rDefault ) { sDefaultStyle = rDefault; }
134 int get_count()
const {
return m_xWidget->get_count(); }
135 OUString get_text(
int nIndex)
const {
return m_xWidget->get_text(nIndex); }
136 OUString get_active_text()
const {
return m_xWidget->get_active_text(); }
138 void append_text(
const OUString& rStr)
144 void insert_separator(
int pos,
const OUString& rId)
149 void set_active_or_entry_text(
const OUString& rText)
151 const int nFound =
m_xWidget->find_text(rText);
158 void set_active(
int nActive)
176 m_nMaxUserDrawFontWidth = 0;
184 virtual bool DoKeyInput(
const KeyEvent& rKEvt);
198 void Select(
bool bNonTravelSelect);
203 std::unique_ptr<weld::Builder> m_xMenuBuilder;
204 std::unique_ptr<weld::Menu> m_xMenu;
205 std::unique_ptr<weld::ComboBox>
m_xWidget;
208 int m_nMaxUserDrawFontWidth;
209 int m_nLastItemWithMenu;
211 Reference< XDispatchProvider > m_xDispatchProvider;
214 OUString aClearFormatKey;
216 OUString sDefaultStyle;
220 static Color TestColorsVisible(
const Color &FontCol,
const Color &BackCol);
224 DECL_LINK(MenuSelectHdl,
const OString&,
void);
229 ,
public SvxStyleBox_Base
232 SvxStyleBox_Impl(
vcl::Window* pParent,
const OUString& rCommand,
SfxStyleFamily eFamily,
const Reference< XDispatchProvider >& rDispatchProvider,
235 virtual ~SvxStyleBox_Impl()
override
240 virtual void dispose()
override
244 m_xMenuBuilder.reset();
248 virtual bool DoKeyInput(
const KeyEvent& rKEvt)
override;
253 void SetOptimalSize();
256 class SvxFontNameBox_Impl;
257 class SvxFontNameBox_Base;
259 class SvxFontNameToolBoxControl final :
public cppu::ImplInheritanceHelper<svt::ToolboxController,
260 css::lang::XServiceInfo>
263 SvxFontNameToolBoxControl();
266 virtual void SAL_CALL statusChanged(
const css::frame::FeatureStateEvent& rEvent )
override;
269 virtual css::uno::Reference<css::awt::XWindow> SAL_CALL createItemWindow(
const css::uno::Reference<css::awt::XWindow>& rParent)
override;
272 virtual void SAL_CALL
dispose()
override;
281 std::unique_ptr<SvxFontNameBox_Base> m_xWeldBox;
282 SvxFontNameBox_Base* m_pBox;
288 SvxFontNameBox_Base& m_rBox;
290 virtual void setProperty(
const css::uno::Any &rProperty)
override;
299 class SvxFontNameBox_Base
303 FontOptionsListener m_aWYSIWYG;
304 FontOptionsListener m_aHistory;
307 SvxFontNameToolBoxControl& m_rCtrl;
311 ::std::unique_ptr<FontList> m_aOwnFontList;
315 Reference< XDispatchProvider > m_xDispatchProvider;
317 bool mbCheckingUnknownFont;
319 void ReleaseFocus_Impl();
321 void Select(
bool bNonTravelSelect);
325 Sequence< PropertyValue > aArgs;
327 ".uno:CharEndPreviewFontName",
330 void CheckAndMarkUnknownFont();
333 SvxFontNameBox_Base(std::unique_ptr<weld::ComboBox> xWidget,
const Reference<XDispatchProvider>& rDispatchProvider,
335 virtual ~SvxFontNameBox_Base()
337 m_xListener->dispose();
341 void Update(
const css::awt::FontDescriptor* pFontDesc );
342 sal_uInt16 GetListCount()
const {
return nFtCount; }
343 void Clear() { m_xWidget->clear(); nFtCount = 0; }
346 m_xWidget->Fill(pList);
350 void SetOwnFontList(::std::unique_ptr<FontList> && _aOwnFontList) { m_aOwnFontList = std::move(_aOwnFontList); }
352 virtual void set_sensitive(
bool bSensitive)
354 m_xWidget->set_sensitive(bSensitive);
357 void set_active_or_entry_text(
const OUString& rText);
359 void statusChanged_Impl(
const css::frame::FeatureStateEvent& rEvent);
361 virtual bool DoKeyInput(
const KeyEvent& rKEvt);
363 void EnableControls();
373 void FontOptionsListener::setProperty(
const css::uno::Any &rProperty)
376 m_rBox.EnableControls();
380 ,
public SvxFontNameBox_Base
391 void SetOptimalSize();
393 virtual bool DoKeyInput(
const KeyEvent& rKEvt)
override;
396 SvxFontNameBox_Impl(
vcl::Window* pParent,
const Reference<XDispatchProvider>& rDispatchProvider,
399 virtual void dispose()
override
405 virtual ~SvxFontNameBox_Impl()
override
410 virtual Reference< css::accessibility::XAccessible >
CreateAccessible()
override;
412 virtual void set_sensitive(
bool bSensitive)
override
424 class SvxFrmValueSet_Impl final :
public ValueSet
427 sal_uInt16 nModifier;
436 SvxFrmValueSet_Impl()
441 sal_uInt16 GetModifier()
const {
return nModifier;}
448 class SvxFrameToolBoxControl;
454 std::unique_ptr<SvxFrmValueSet_Impl> mxFrameSet;
455 std::unique_ptr<weld::CustomWeld> mxFrameSetWin;
456 std::vector<BitmapEx> aImgVec;
459 void InitImageList();
460 void CalcSizeValueSet();
464 SvxFrameWindow_Impl(SvxFrameToolBoxControl* pControl,
weld::Widget* pParent);
467 mxFrameSet->GrabFocus();
470 virtual void statusChanged(
const css::frame::FeatureStateEvent& rEvent )
override;
476 explicit SvxFrameToolBoxControl(
const css::uno::Reference< css::uno::XComponentContext >& rContext );
479 virtual void SAL_CALL initialize(
const css::uno::Sequence< css::uno::Any >& rArguments )
override;
485 virtual void SAL_CALL execute(sal_Int16 nKeyModifier)
override;
491 class LineListBox final :
public ValueSet
504 return UpdateEntries( nOldWidth );
507 void SetNone(
const OUString& sNone )
515 ColorFunc pColor1Fn = &sameColor,
516 ColorFunc pColor2Fn = &sameColor,
517 ColorDistFunc pColorDistFn = &sameDistColor);
523 void SetSourceUnit(
FieldUnit eNewUnit ) { eSourceUnit = eNewUnit; }
525 const Color& GetColor()
const {
return aColor; }
531 Color nColor1, Color nColor2, Color nColorDist,
534 void UpdatePaintLineColor();
537 sal_Int32 GetStylePos( sal_Int32 nListPos,
tools::Long nWidth );
539 const Color& GetPaintColor()
const
544 Color GetColorLine1( sal_Int32 nPos );
545 Color GetColorLine2( sal_Int32 nPos );
546 Color GetColorDist( sal_Int32 nPos );
548 LineListBox(
const LineListBox& ) =
delete;
549 LineListBox&
operator =(
const LineListBox& ) =
delete;
551 std::vector<std::unique_ptr<ImpLineListData>> m_vLineList;
564 size_t nPos = GetSelectItemPos();
565 if (nPos != VALUESET_ITEM_NOTFOUND)
567 if (!m_sNone.isEmpty())
569 nStyle = GetEntryStyle( nPos );
579 auto nMinWidth = GetDrawingArea()->get_ref_device().approximate_digit_width() *
COMBO_WIDTH_IN_CHARS;
580 Size aSize(nMinWidth, aTxtSize.Height());
582 aSize.AdjustWidth( -6 );
585 if ( eSourceUnit == FieldUnit::POINT )
593 aSize = aVirDev->PixelToLogic( aSize );
595 sal_uInt32
n1 = nLine1;
596 sal_uInt32
n2 = nLine2;
608 if ( nVirHeight > aSize.Height() )
609 aSize.setHeight( nVirHeight );
611 if ( aSize.Width() <= 0 )
614 Size aVirSize = aVirDev->LogicToPixel( aSize );
615 if ( aVirDev->GetOutputSizePixel() != aVirSize )
616 aVirDev->SetOutputSizePixel( aVirSize );
617 aVirDev->SetFillColor( aColorDist );
620 aVirDev->SetFillColor( aColor1 );
622 double y1 = double( n1 ) / 2;
627 double y2 = n1 + nDist + double( n2 ) / 2;
628 aVirDev->SetFillColor( aColor2 );
631 rBmp = aVirDev->GetBitmapEx(
Point(),
Size( aSize.Width(), n1+nDist+n2 ) );
634 LineListBox::LineListBox()
643 aVirDev->SetLineColor();
644 aVirDev->SetMapMode(
MapMode( MapUnit::MapTwip ) );
656 UpdatePaintLineColor();
659 sal_Int32 LineListBox::GetStylePos( sal_Int32 nListPos,
tools::Long nWidth )
662 if (!m_sNone.isEmpty())
667 size_t nCount = m_vLineList.size();
668 while ( nPos == -1 && i < nCount )
670 auto&
pData = m_vLineList[ i ];
671 if (
pData->GetMinWidth() <= nWidth )
674 nPos =
static_cast<sal_Int32
>(i);
683 void LineListBox::InsertEntry(
685 ColorFunc pColor1Fn, ColorFunc pColor2Fn, ColorDistFunc pColorDistFn )
688 rWidthImpl, nStyle, nMinWidth, pColor1Fn, pColor2Fn, pColorDistFn));
694 return pData ? pData->
GetStyle() : SvxBorderLineStyle::NONE;
697 void LineListBox::UpdatePaintLineColor()
702 bool bRet = aNewCol != maPaintCol;
705 maPaintCol = aNewCol;
712 UpdatePaintLineColor( );
714 sal_Int32 nSelEntry = GetSelectItemPos();
715 sal_Int32 nTypePos = GetStylePos( nSelEntry, nOldWidth );
723 if (!m_sNone.isEmpty())
724 InsertItem(nId++,
Image(), m_sNone);
727 sal_uInt16 nCount = m_vLineList.size( );
730 auto& pData = m_vLineList[ n ];
737 GetColorLine1( GetItemCount( ) ),
738 GetColorLine2( GetItemCount( ) ),
739 GetColorDist( GetItemCount( ) ),
741 InsertItem(nId,
Image(aBmp));
750 else if ( n == nTypePos )
761 Color LineListBox::GetColorLine1( sal_Int32 nPos )
763 sal_Int32 nStyle = GetStylePos( nPos, m_nWidth );
765 return GetPaintColor( );
766 auto& pData = m_vLineList[ nStyle ];
770 Color LineListBox::GetColorLine2( sal_Int32 nPos )
772 sal_Int32 nStyle = GetStylePos( nPos, m_nWidth );
774 return GetPaintColor( );
775 auto& pData = m_vLineList[ nStyle ];
779 Color LineListBox::GetColorDist( sal_Int32 nPos )
783 sal_Int32 nStyle = GetStylePos( nPos, m_nWidth );
786 auto& pData = m_vLineList[ nStyle ];
797 std::unique_ptr<LineListBox> m_xLineStyleLb;
798 std::unique_ptr<weld::CustomWeld> m_xLineStyleLbWin;
804 SvxLineWindow_Impl(SvxFrameToolBoxControl* pControl,
weld::Widget* pParent);
807 m_xLineStyleLb->GrabFocus();
820 const OUString& rCommand,
830 #define BUTTON_PADDING 10
831 #define ITEM_HEIGHT 30
833 SvxStyleBox_Base::SvxStyleBox_Base(std::unique_ptr<weld::ComboBox> xWidget,
834 const OUString& rCommand,
836 const Reference< XDispatchProvider >& rDispatchProvider,
838 const OUString& rClearFormatKey,
839 const OUString& rMoreKey,
842 , m_xMenuBuilder(
Application::CreateBuilder(nullptr,
"svx/ui/stylemenu.ui"))
843 , m_xMenu(m_xMenuBuilder->weld_menu(
"menu"))
845 , eStyleFamily( eFamily )
846 , m_nMaxUserDrawFontWidth(0)
847 , m_nLastItemWithMenu(-1)
849 , m_xDispatchProvider( rDispatchProvider )
851 , m_aCommand( rCommand )
852 , aClearFormatKey( rClearFormatKey )
853 , aMoreKey( rMoreKey )
854 , bInSpecialMode( bInSpec )
856 m_xWidget->connect_changed(
LINK(
this, SvxStyleBox_Base, SelectHdl));
857 m_xWidget->connect_key_press(
LINK(
this, SvxStyleBox_Base, KeyInputHdl));
858 m_xWidget->connect_entry_activate(
LINK(
this, SvxStyleBox_Base, ActivateHdl));
859 m_xWidget->connect_focus_out(
LINK(
this, SvxStyleBox_Base, FocusOutHdl));
860 m_xWidget->connect_get_property_tree(
LINK(
this, SvxStyleBox_Base, DumpAsPropertyTreeHdl));
863 m_xMenu->connect_activate(
LINK(
this, SvxStyleBox_Base, MenuSelectHdl));
865 m_xWidget->connect_custom_get_size(
LINK(
this, SvxStyleBox_Base, CustomGetSizeHdl));
866 m_xWidget->connect_custom_render(
LINK(
this, SvxStyleBox_Base, CustomRenderHdl));
874 CalcOptimalExtraUserWidth(rArg);
878 SvxStyleBox_Impl::SvxStyleBox_Impl(
vcl::Window* pParent,
879 const OUString& rCommand,
881 const Reference< XDispatchProvider >& rDispatchProvider,
883 const OUString& rClearFormatKey,
884 const OUString& rMoreKey,
887 , SvxStyleBox_Base(m_xBuilder->weld_combo_box(
"applystyle"), rCommand, eFamily,
888 rDispatchProvider, _xFrame, rClearFormatKey, rMoreKey, bInSpec, rCtrl)
892 set_id(
"applystyle");
896 void SvxStyleBox_Base::ReleaseFocus()
904 m_xFrame->getContainerWindow()->setFocus();
907 IMPL_LINK(SvxStyleBox_Base, MenuSelectHdl,
const OString&, rMenuIdent,
void)
909 if (m_nLastItemWithMenu < 0 || m_nLastItemWithMenu >=
m_xWidget->get_count())
912 OUString sEntry =
m_xWidget->get_text(m_nLastItemWithMenu);
915 Sequence<PropertyValue> aArgs(2);
916 aArgs[0].Name =
"Param";
917 aArgs[0].Value <<= sEntry;
918 aArgs[1].Name =
"Family";
919 aArgs[1].Value <<= sal_Int16( eStyleFamily );
921 if (rMenuIdent ==
"update")
924 ".uno:StyleUpdateByExample", aArgs );
926 else if (rMenuIdent ==
"edit")
929 ".uno:EditStyle", aArgs );
936 DBG_ASSERT( pViewFrm,
"SvxStyleBox_Base::Select(): no viewframe" );
945 Select(rCombo.changed_by_direct_pick());
954 void SvxStyleBox_Base::Select(
bool bNonTravelSelect)
956 if (!bNonTravelSelect)
959 OUString aSearchEntry(
m_xWidget->get_active_text());
960 bool bDoIt =
true, bClear =
false;
963 if( aSearchEntry == aClearFormatKey &&
m_xWidget->get_active() == 0 )
965 aSearchEntry = sDefaultStyle;
968 Sequence< PropertyValue > aEmptyVals;
972 else if (aSearchEntry == aMoreKey &&
m_xWidget->get_active() == (
m_xWidget->get_count() - 1))
976 set_active_or_entry_text(
m_xWidget->get_saved_value());
986 bool bCreateNew =
false;
990 pStyle = pPool->
First(eStyleFamily);
991 while ( pStyle && pStyle->
GetName() != aSearchEntry )
992 pStyle = pPool->
Next();
1011 set_active_or_entry_text(aSearchEntry);
1014 Sequence< PropertyValue > aArgs( 2 );
1015 aArgs[0].Value <<= aSearchEntry;
1016 aArgs[1].Name =
"Family";
1017 aArgs[1].Value <<= sal_Int16( eStyleFamily );
1020 aArgs[0].Name =
"Param";
1025 aArgs[0].Name =
"Template";
1032 eStyleFamily = eNewFamily;
1038 set_active_or_entry_text(
m_xWidget->get_saved_value());
1043 return DoKeyInput(rKEvt);
1046 bool SvxStyleBox_Base::DoKeyInput(
const KeyEvent& rKEvt)
1048 bool bHandled =
false;
1059 set_active_or_entry_text(
m_xWidget->get_saved_value());
1060 if (!m_rCtrl.IsInSidebar())
1071 bool SvxStyleBox_Impl::DoKeyInput(
const KeyEvent& rKEvt)
1073 return SvxStyleBox_Base::DoKeyInput(rKEvt) || ChildKeyInput(rKEvt);
1078 if ( (rDCEvt.
GetType() == DataChangedEventType::SETTINGS) &&
1079 (rDCEvt.
GetFlags() & AllSettingsFlags::STYLE) )
1089 if (rTextRect.
Bottom() > nHeight)
1092 double ratio =
static_cast< double >( nHeight ) / rTextRect.
Bottom();
1094 Size aPixelSize(aFont.GetFontSize());
1095 aPixelSize.
setWidth( aPixelSize.Width() * ratio );
1096 aPixelSize.setHeight( aPixelSize.Height() * ratio );
1097 aFont.SetFontSize(aPixelSize);
1104 void SvxStyleBox_Impl::SetOptimalSize()
1112 SetSizePixel(get_preferred_size());
1120 const int nLeftDistance = 8;
1126 aPos.AdjustX(nLeftDistance );
1128 if (!AdjustFontForItemHeight(rRenderContext, aTextRect, rRect.
GetHeight()))
1131 rRenderContext.
DrawText(aPos, rStyleName);
1134 void SvxStyleBox_Base::SetupEntry(
vcl::RenderContext& rRenderContext, sal_Int32 nItem,
const tools::Rectangle& rRect, std::u16string_view rStyleName,
bool bIsNotSelected)
1137 if (!bIsNotSelected)
1143 if (!bIsNotSelected)
1145 if (nItem == 0 || nItem ==
m_xWidget->get_count() - 1)
1146 m_xWidget->set_item_menu(OString::number(nItem),
nullptr);
1149 m_nLastItemWithMenu = nItem;
1150 m_xWidget->set_item_menu(OString::number(nItem), m_xMenu.get());
1154 if (nItem <= 0 || nItem >=
m_xWidget->get_count() - 1)
1163 pStyle = pPool->
First(eStyleFamily);
1164 while (pStyle && pStyle->
GetName() != rStyleName)
1165 pStyle = pPool->
Next();
1172 if (!pItemSet)
return;
1175 pItemSet->GetItem<
SvxFontItem>(SID_ATTR_CHAR_FONT);
1179 if ( !(pFontItem && pFontHeightItem) )
1182 Size aFontSize( 0, pFontHeightItem->GetHeight() );
1189 aFont.SetFontSize(aPixelSize);
1191 const SfxPoolItem *pItem = pItemSet->GetItem( SID_ATTR_CHAR_WEIGHT );
1193 aFont.SetWeight( static_cast< const SvxWeightItem* >( pItem )->GetWeight() );
1195 pItem = pItemSet->GetItem( SID_ATTR_CHAR_POSTURE );
1197 aFont.SetItalic( static_cast< const SvxPostureItem* >( pItem )->GetPosture() );
1199 pItem = pItemSet->GetItem( SID_ATTR_CHAR_CONTOUR );
1201 aFont.SetOutline( static_cast< const SvxContourItem* >( pItem )->
GetValue() );
1203 pItem = pItemSet->GetItem( SID_ATTR_CHAR_SHADOWED );
1205 aFont.SetShadow( static_cast< const SvxShadowedItem* >( pItem )->
GetValue() );
1207 pItem = pItemSet->GetItem( SID_ATTR_CHAR_RELIEF );
1209 aFont.SetRelief( static_cast< const SvxCharReliefItem* >( pItem )->
GetValue() );
1211 pItem = pItemSet->GetItem( SID_ATTR_CHAR_UNDERLINE );
1213 aFont.SetUnderline( static_cast< const SvxUnderlineItem* >( pItem )->GetLineStyle() );
1215 pItem = pItemSet->GetItem( SID_ATTR_CHAR_OVERLINE );
1217 aFont.SetOverline( static_cast< const SvxOverlineItem* >( pItem )->
GetValue() );
1219 pItem = pItemSet->GetItem( SID_ATTR_CHAR_STRIKEOUT );
1221 aFont.SetStrikeout( static_cast< const SvxCrossedOutItem* >( pItem )->GetStrikeout() );
1223 pItem = pItemSet->GetItem( SID_ATTR_CHAR_CASEMAP );
1225 aFont.SetCaseMap(static_cast<const SvxCaseMapItem*>(pItem)->
GetCaseMap());
1227 pItem = pItemSet->GetItem( SID_ATTR_CHAR_EMPHASISMARK );
1229 aFont.SetEmphasisMark( static_cast< const SvxEmphasisMarkItem* >( pItem )->GetEmphasisMark() );
1234 rRenderContext.
SetFont(aFont);
1236 pItem = pItemSet->GetItem( SID_ATTR_CHAR_COLOR );
1238 if ( (
nullptr != pItem) && bIsNotSelected)
1241 drawing::FillStyle
style = drawing::FillStyle_NONE;
1245 if ( (
nullptr != pItem) && bIsNotSelected)
1250 case drawing::FillStyle_SOLID:
1254 if (
nullptr != pItem )
1255 aBackCol =
static_cast< const XFillColorItem*
>( pItem )->GetColorValue();
1257 if ( aBackCol != COL_AUTO )
1270 if( (aFontCol != COL_AUTO) || (aBackCol != COL_AUTO) )
1271 aFontCol = TestColorsVisible(aFontCol, (aBackCol != COL_AUTO) ? aBackCol : rRenderContext.
GetBackground().
GetColor());
1274 if ( aFontCol != COL_AUTO )
1281 const ::tools::Rectangle& rRect = std::get<1>(aPayload);
1282 bool bSelected = std::get<2>(aPayload);
1283 const OUString& rId = std::get<3>(aPayload);
1285 sal_uInt32
nIndex = rId.toUInt32();
1287 OUString aStyleName(
m_xWidget->get_text(nIndex));
1289 rRenderContext.
Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
1291 SetupEntry(rRenderContext, nIndex, rRect, aStyleName, !bSelected);
1293 UserDrawEntry(rRenderContext, rRect, aStyleName);
1295 rRenderContext.
Pop();
1300 if (m_nMaxUserDrawFontWidth)
1304 sal_Int32 nEntryCount =
m_xWidget->get_count();
1305 for (sal_Int32 i = 0; i < nEntryCount; ++i)
1307 OUString sStyleName(get_text(i));
1313 nMaxNormalFontWidth = std::max(nWidth, nMaxNormalFontWidth);
1316 m_nMaxUserDrawFontWidth = nMaxNormalFontWidth;
1317 for (sal_Int32 i = 1; i < nEntryCount-1; ++i)
1319 OUString sStyleName(get_text(i));
1321 rRenderContext.
Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
1325 if (AdjustFontForItemHeight(rRenderContext, aTextRectForActualFont,
ITEM_HEIGHT))
1330 rRenderContext.
Pop();
1334 m_nMaxUserDrawFontWidth = std::max(nWidth, m_nMaxUserDrawFontWidth);
1343 Color SvxStyleBox_Base::TestColorsVisible(
const Color &FontCol,
const Color &BackCol)
1347 Color retCol = FontCol;
1352 if((lumi > 120) && (lumi < 140))
1364 auto entriesNode = rJsonWriter.startNode(
"entries");
1365 for (
int i = 0, nEntryCount =
m_xWidget->get_count(); i < nEntryCount; ++i)
1367 auto entryNode = rJsonWriter.startNode(
"");
1368 rJsonWriter.put(
"",
m_xWidget->get_text(i));
1373 rJsonWriter.put(
"selectedCount", static_cast<sal_Int32>(nActive == -1 ? 0 : 1));
1376 auto selectedNode = rJsonWriter.startNode(
"selectedEntries");
1379 auto node = rJsonWriter.startNode(
"");
1380 rJsonWriter.put(
"", static_cast<sal_Int32>(nActive));
1384 rJsonWriter.put(
"command",
".uno:StyleApply");
1389 bool bChanged =
false;
1399 *ppFontList = aFontList.get();
1400 pBox->SetOwnFontList(std::move(aFontList));
1404 if ( pFontListItem )
1407 DBG_ASSERT( pNewFontList,
"Doc-FontList not available!" );
1410 if ( !*ppFontList && pNewFontList )
1413 *ppFontList = pNewFontList;
1423 ( ( *ppFontList != pNewFontList ) ||
1428 *ppFontList = pNewFontList;
1432 pBox->set_sensitive(
true);
1434 else if ( pBox && ( pDocSh || !ppFontList ))
1443 pBox->set_sensitive(
false);
1447 if ( pBox && bChanged )
1450 pBox->Fill( *ppFontList );
1457 SvxFontNameBox_Base::SvxFontNameBox_Base(std::unique_ptr<weld::ComboBox> xWidget,
1458 const Reference<XDispatchProvider>& rDispatchProvider,
1460 SvxFontNameToolBoxControl& rCtrl)
1462 , m_aWYSIWYG(
m_xListener,
"ShowFontBoxWYSIWYG", *this)
1466 , pFontList(nullptr)
1469 , m_xDispatchProvider(rDispatchProvider)
1471 , mbCheckingUnknownFont(false)
1475 m_xWidget->connect_changed(
LINK(
this, SvxFontNameBox_Base, SelectHdl));
1476 m_xWidget->connect_key_press(
LINK(
this, SvxFontNameBox_Base, KeyInputHdl));
1477 m_xWidget->connect_entry_activate(
LINK(
this, SvxFontNameBox_Base, ActivateHdl));
1478 m_xWidget->connect_focus_in(
LINK(
this, SvxFontNameBox_Base, FocusInHdl));
1479 m_xWidget->connect_focus_out(
LINK(
this, SvxFontNameBox_Base, FocusOutHdl));
1480 m_xWidget->connect_get_property_tree(
LINK(
this, SvxFontNameBox_Base, DumpAsPropertyTreeHdl));
1485 SvxFontNameBox_Impl::SvxFontNameBox_Impl(
vcl::Window* pParent,
const Reference<XDispatchProvider>& rDispatchProvider,
1488 , SvxFontNameBox_Base(m_xBuilder->weld_combo_box(
"fontnamecombobox"), rDispatchProvider, rFrame, rCtrl)
1490 set_id(
"fontnamecombobox");
1494 void SvxFontNameBox_Base::FillList()
1499 int nStartPos, nEndPos;
1500 m_xWidget->get_entry_selection_bounds(nStartPos, nEndPos);
1505 m_xWidget->select_entry_region(nStartPos, nEndPos);
1508 void SvxFontNameBox_Base::CheckAndMarkUnknownFont()
1510 if (mbCheckingUnknownFont)
1512 mbCheckingUnknownFont =
true;
1513 OUString fontname =
m_xWidget->get_active_text();
1517 if( pFontList !=
nullptr && pFontList->IsAvailable( fontname ))
1535 mbCheckingUnknownFont =
false;
1538 void SvxFontNameBox_Base::Update(
const css::awt::FontDescriptor* pFontDesc )
1542 aCurFont.SetFamilyName ( pFontDesc->Name );
1543 aCurFont.SetFamily (
FontFamily( pFontDesc->Family ) );
1544 aCurFont.SetStyleName ( pFontDesc->StyleName );
1545 aCurFont.SetPitch (
FontPitch( pFontDesc->Pitch ) );
1546 aCurFont.SetCharSet ( rtl_TextEncoding( pFontDesc->CharSet ) );
1548 OUString aCurName = aCurFont.GetFamilyName();
1549 OUString aText =
m_xWidget->get_active_text();
1550 if (aText != aCurName)
1551 set_active_or_entry_text(aCurName);
1554 void SvxFontNameBox_Base::set_active_or_entry_text(
const OUString& rText)
1556 m_xWidget->set_active_or_entry_text(rText);
1557 CheckAndMarkUnknownFont();
1567 return DoKeyInput(rKEvt);
1570 bool SvxFontNameBox_Base::DoKeyInput(
const KeyEvent& rKEvt)
1572 bool bHandled =
false;
1584 set_active_or_entry_text(
m_xWidget->get_saved_value());
1585 if (!m_rCtrl.IsInSidebar())
1587 ReleaseFocus_Impl();
1597 bool SvxFontNameBox_Impl::DoKeyInput(
const KeyEvent& rKEvt)
1599 return SvxFontNameBox_Base::DoKeyInput(rKEvt) || ChildKeyInput(rKEvt);
1606 set_active_or_entry_text(
m_xWidget->get_saved_value());
1612 void SvxFontNameBox_Impl::SetOptimalSize()
1620 SetSizePixel(get_preferred_size());
1625 if ( (rDCEvt.
GetType() == DataChangedEventType::SETTINGS) &&
1626 (rDCEvt.
GetFlags() & AllSettingsFlags::STYLE) )
1630 else if ( ( rDCEvt.
GetType() == DataChangedEventType::FONTS ) ||
1631 ( rDCEvt.
GetType() == DataChangedEventType::DISPLAY ) )
1639 void SvxFontNameBox_Base::ReleaseFocus_Impl()
1647 m_xFrame->getContainerWindow()->setFocus();
1650 void SvxFontNameBox_Base::EnableControls()
1652 bool bEnableMRU = m_aHistory.get();
1655 bool bNewWYSIWYG = m_aWYSIWYG.get();
1656 bool bOldWYSIWYG =
m_xWidget->IsWYSIWYGEnabled();
1658 if (
m_xWidget->get_max_mru_count() != nEntries || bNewWYSIWYG != bOldWYSIWYG)
1661 pFontList =
nullptr;
1666 if (bNewWYSIWYG != bOldWYSIWYG)
1672 Select(rCombo.changed_by_direct_pick());
1681 void SvxFontNameBox_Base::Select(
bool bNonTravelSelect)
1683 Sequence< PropertyValue > aArgs( 1 );
1684 std::unique_ptr<SvxFontItem> pFontItem;
1688 aCurFont.GetWeight(),
1689 aCurFont.GetItalic() ) );
1690 aCurFont = aFontMetric;
1692 pFontItem.reset(
new SvxFontItem( aFontMetric.GetFamilyType(),
1693 aFontMetric.GetFamilyName(),
1694 aFontMetric.GetStyleName(),
1695 aFontMetric.GetPitch(),
1696 aFontMetric.GetCharSet(),
1697 SID_ATTR_CHAR_FONT ) );
1700 pFontItem->QueryValue( a );
1704 if (bNonTravelSelect)
1706 CheckAndMarkUnknownFont();
1710 ReleaseFocus_Impl();
1714 aArgs[0].Name =
"CharFontName";
1716 ".uno:CharFontName",
1724 aArgs[0].Name =
"CharPreviewFontName";
1726 ".uno:CharPreviewFontName",
1735 auto entriesNode = rJsonWriter.startNode(
"entries");
1736 for (
int i = 0, nEntryCount =
m_xWidget->get_count(); i < nEntryCount; ++i)
1738 auto entryNode = rJsonWriter.startNode(
"");
1739 rJsonWriter.put(
"",
m_xWidget->get_text(i));
1743 int nSelectedEntry =
m_xWidget->get_active();
1744 rJsonWriter.put(
"selectedCount", static_cast<sal_Int32>(nSelectedEntry == -1 ? 0 : 1));
1747 auto selectedNode = rJsonWriter.startNode(
"selectedEntries");
1748 if (nSelectedEntry != -1)
1750 auto entryNode = rJsonWriter.startNode(
"");
1751 rJsonWriter.put(
"",
m_xWidget->get_text(nSelectedEntry));
1755 rJsonWriter.put(
"command",
".uno:CharFontName");
1759 std::shared_ptr<PaletteManager>
const & rPaletteManager,
1766 :
WeldToolbarPopup(rFrame, rMenuButton.get_widget(),
"svx/ui/colorwindow.ui",
"palette_popup_window")
1767 , theSlotId(nSlotId)
1768 , maCommand(rCommand)
1769 , mpParentWindow(pParentWindow)
1770 , maMenuButton(rMenuButton)
1771 , mxPaletteManager(rPaletteManager)
1772 , mrColorStatus(rColorStatus)
1773 , maColorSelectFunction(aFunction)
1774 , mxColorSet(new
SvxColorValueSet(m_xBuilder->weld_scrolled_window(
"colorsetwin", true)))
1776 , mxPaletteListBox(m_xBuilder->weld_combo_box(
"palette_listbox"))
1777 , mxButtonAutoColor(m_xBuilder->weld_button(
"auto_color_button"))
1778 , mxButtonNoneColor(m_xBuilder->weld_button(
"none_color_button"))
1779 , mxButtonPicker(m_xBuilder->weld_button(
"color_picker_button"))
1780 , mxAutomaticSeparator(m_xBuilder->weld_widget(
"separator4"))
1781 , mxColorSetWin(new
weld::CustomWeld(*m_xBuilder,
"colorset", *mxColorSet))
1782 , mxRecentColorSetWin(new
weld::CustomWeld(*m_xBuilder,
"recent_colorset", *mxRecentColorSet))
1783 , mpDefaultButton(nullptr)
1790 case SID_ATTR_CHAR_COLOR_BACKGROUND:
1791 case SID_BACKGROUND_COLOR:
1792 case SID_ATTR_CHAR_BACK_COLOR:
1793 case SID_TABLE_CELL_BACKGROUND_COLOR:
1798 case SID_AUTHOR_COLOR:
1803 case SID_BMPMASK_COLOR:
1808 case SID_ATTR_CHAR_COLOR:
1809 case SID_ATTR_CHAR_COLOR2:
1810 case SID_EXTRUSION_3D_COLOR:
1815 case SID_FM_CTL_PROPERTIES:
1831 for (
const auto& rPalette : aPaletteList)
1834 OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() );
1837 if (nSelectedEntry != -1)
1860 if (
maCommand ==
".uno:FrameLineColor" )
1888 return std::make_pair(aColor, sColorName);
1896 OUString sColorName;
1899 case SID_ATTR_CHAR_COLOR_BACKGROUND:
1900 case SID_BACKGROUND_COLOR:
1901 case SID_ATTR_CHAR_BACK_COLOR:
1902 case SID_TABLE_CELL_BACKGROUND_COLOR:
1904 sColorName =
SvxResId(RID_SVXSTR_NOFILL);
1906 case SID_AUTHOR_COLOR:
1908 sColorName =
SvxResId(RID_SVXSTR_BY_AUTHOR);
1910 case SID_BMPMASK_COLOR:
1912 sColorName =
SvxResId(RID_SVXSTR_TRANSPARENT);
1914 case SID_FM_CTL_PROPERTIES:
1916 sColorName =
SvxResId(RID_SVXSTR_DEFAULT);
1918 case SID_ATTR_CHAR_COLOR:
1919 case SID_ATTR_CHAR_COLOR2:
1920 case SID_EXTRUSION_3D_COLOR:
1923 sColorName =
EditResId(RID_SVXSTR_AUTOMATIC);
1927 return std::make_pair(aColor, sColorName);
1944 return GetNoneColor();
1950 NamedColor aNamedColor = GetSelectEntryColor(pColorSet);
1952 if (pColorSet != mxRecentColorSet.get())
1954 mxPaletteManager->AddRecentColor(aNamedColor.first, aNamedColor.second);
1955 if (!maMenuButton.get_active())
1956 mxPaletteManager->ReloadRecentColorSet(*mxRecentColorSet);
1959 maSelectedLink.Call(aNamedColor);
1964 OUString sCommand(maCommand);
1966 maMenuButton.set_inactive();
1968 aColorSelectFunction(sCommand, aNamedColor);
1973 int nPos = mxPaletteListBox->get_active();
1974 mxPaletteManager->SetPalette( nPos );
1975 mxPaletteManager->ReloadColorSet(*mxColorSet);
1976 mxColorSet->layoutToGivenHeight(mxColorSet->GetOutputSizePixel().Height(), mxPaletteManager->GetColorCount());
1986 NamedColor aNamedColor = &rButton == mxButtonAutoColor.get() ? GetAutoColor() : GetNoneColor();
1988 mxColorSet->SetNoSelection();
1989 mxRecentColorSet->SetNoSelection();
1990 mpDefaultButton = &rButton;
1992 maSelectedLink.Call(aNamedColor);
1997 OUString sCommand(maCommand);
1999 maMenuButton.set_inactive();
2001 aColorSelectFunction(sCommand, aNamedColor);
2007 auto nColor = GetSelectEntryColor().first;
2008 auto pParentWindow = mpParentWindow;
2009 OUString sCommand = maCommand;
2010 std::shared_ptr<PaletteManager> xPaletteManager(mxPaletteManager);
2012 maMenuButton.set_inactive();
2014 xPaletteManager->PopupColorPicker(pParentWindow, sCommand, nColor);
2035 if (rEvent.FeatureURL.Complete ==
".uno:ColorTableState")
2052 for (
size_t i = 1; i <= pColorSet->
GetItemCount(); ++i)
2067 const Color &rColor = rNamedColor.first;
2091 const OUString& rColorName = rNamedColor.second;
2100 OUString sColorName =
"#" + rColor.
AsRGBHexString().toAsciiUpperCase();
2118 css::table::BorderLine2 aTable;
2120 if ( rEvent.State >>= aTable )
2122 SvxBorderLine aLine;
2124 if ( !aLine.isEmpty() )
2125 aColor = aLine.GetColor();
2128 rEvent.State >>= aColor;
2130 if ( rEvent.FeatureURL.Path ==
"BorderTLBR" )
2132 else if ( rEvent.FeatureURL.Path ==
"BorderBLTR" )
2160 SvxFrameWindow_Impl::SvxFrameWindow_Impl(SvxFrameToolBoxControl* pControl,
weld::Widget* pParent)
2161 :
WeldToolbarPopup(pControl->getFrameInterface(), pParent,
"svx/ui/floatingframeborder.ui",
"FloatingFrameBorder")
2162 , mxControl(pControl)
2163 , mxFrameSet(new SvxFrmValueSet_Impl)
2164 , mxFrameSetWin(new
weld::CustomWeld(*m_xBuilder,
"valueset", *mxFrameSet))
2165 , bParagraphMode(false)
2167 mxFrameSet->SetStyle(WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT);
2168 AddStatusListener(
".uno:BorderReducedMode");
2182 for ( i=1; i<9; i++ )
2183 mxFrameSet->InsertItem(i,
Image(aImgVec[i-1]));
2186 if ( !bParagraphMode )
2187 for ( i = 9; i < 13; i++ )
2188 mxFrameSet->InsertItem(i,
Image(aImgVec[i-1]));
2190 mxFrameSet->SetColCount( 4 );
2191 mxFrameSet->SetSelectHdl(
LINK(
this, SvxFrameWindow_Impl, SelectHdl ) );
2195 mxFrameSet->SetAccessibleName(
SvxResId(RID_SVXSTR_FRAME) );
2222 SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER );
2224 SvxBorderLine theDefLine;
2225 SvxBorderLine *pLeft =
nullptr,
2229 sal_uInt16 nSel = mxFrameSet->GetSelectedItemId();
2230 sal_uInt16 nModifier = mxFrameSet->GetModifier();
2233 theDefLine.GuessLinesWidths(theDefLine.GetBorderLineStyle(),
2237 case 1: nValidFlags |= FrmValidFlags::AllMask;
2239 case 2: pLeft = &theDefLine;
2240 nValidFlags |= FrmValidFlags::Left;
2242 case 3: pRight = &theDefLine;
2243 nValidFlags |= FrmValidFlags::Right;
2245 case 4: pLeft = pRight = &theDefLine;
2246 nValidFlags |= FrmValidFlags::Right|FrmValidFlags::Left;
2248 case 5: pTop = &theDefLine;
2249 nValidFlags |= FrmValidFlags::Top;
2251 case 6: pBottom = &theDefLine;
2252 nValidFlags |= FrmValidFlags::Bottom;
2254 case 7: pTop = pBottom = &theDefLine;
2255 nValidFlags |= FrmValidFlags::Bottom|FrmValidFlags::Top;
2257 case 8: pLeft = pRight = pTop = pBottom = &theDefLine;
2258 nValidFlags |= FrmValidFlags::Left | FrmValidFlags::Right | FrmValidFlags::Top | FrmValidFlags::Bottom;
2263 pTop = pBottom = &theDefLine;
2264 aBorderInner.
SetLine( &theDefLine, SvxBoxInfoItemLine::HORI );
2265 aBorderInner.
SetLine(
nullptr, SvxBoxInfoItemLine::VERT );
2266 nValidFlags |= FrmValidFlags::HInner|FrmValidFlags::Top|FrmValidFlags::Bottom;
2270 pLeft = pRight = pTop = pBottom = &theDefLine;
2271 aBorderInner.
SetLine( &theDefLine, SvxBoxInfoItemLine::HORI );
2272 aBorderInner.
SetLine(
nullptr, SvxBoxInfoItemLine::VERT );
2273 nValidFlags |= FrmValidFlags::Right|FrmValidFlags::Left|FrmValidFlags::HInner|FrmValidFlags::Top|FrmValidFlags::Bottom;
2277 pLeft = pRight = pTop = pBottom = &theDefLine;
2278 aBorderInner.
SetLine(
nullptr, SvxBoxInfoItemLine::HORI );
2279 aBorderInner.
SetLine( &theDefLine, SvxBoxInfoItemLine::VERT );
2280 nValidFlags |= FrmValidFlags::Right|FrmValidFlags::Left|FrmValidFlags::VInner|FrmValidFlags::Top|FrmValidFlags::Bottom;
2284 pLeft = pRight = pTop = pBottom = &theDefLine;
2285 aBorderInner.
SetLine( &theDefLine, SvxBoxInfoItemLine::HORI );
2286 aBorderInner.
SetLine( &theDefLine, SvxBoxInfoItemLine::VERT );
2287 nValidFlags |= FrmValidFlags::AllMask;
2293 aBorderOuter.
SetLine( pLeft, SvxBoxItemLine::LEFT );
2294 aBorderOuter.
SetLine( pRight, SvxBoxItemLine::RIGHT );
2295 aBorderOuter.
SetLine( pTop, SvxBoxItemLine::TOP );
2296 aBorderOuter.
SetLine( pBottom, SvxBoxItemLine::BOTTOM );
2299 nValidFlags |= FrmValidFlags::AllMask;
2300 aBorderInner.
SetValid( SvxBoxInfoItemValidFlags::TOP,
bool(nValidFlags&FrmValidFlags::Top ));
2301 aBorderInner.
SetValid( SvxBoxInfoItemValidFlags::BOTTOM,
bool(nValidFlags&FrmValidFlags::Bottom ));
2302 aBorderInner.
SetValid( SvxBoxInfoItemValidFlags::LEFT,
bool(nValidFlags&FrmValidFlags::Left));
2303 aBorderInner.
SetValid( SvxBoxInfoItemValidFlags::RIGHT,
bool(nValidFlags&FrmValidFlags::Right ));
2304 aBorderInner.
SetValid( SvxBoxInfoItemValidFlags::HORI,
bool(nValidFlags&FrmValidFlags::HInner ));
2305 aBorderInner.
SetValid( SvxBoxInfoItemValidFlags::VERT,
bool(nValidFlags&FrmValidFlags::VInner));
2306 aBorderInner.
SetValid( SvxBoxInfoItemValidFlags::DISTANCE );
2307 aBorderInner.
SetValid( SvxBoxInfoItemValidFlags::DISABLE,
false );
2310 Sequence< PropertyValue > aArgs( 2 );
2311 aArgs[0].Name =
"OuterBorder";
2314 aArgs[1].Name =
"InnerBorder";
2323 mxFrameSet->SetNoSelection();
2326 mxControl->dispatchCommand(
".uno:SetBorderStyle", aArgs );
2328 mxControl->EndPopupMode();
2331 void SvxFrameWindow_Impl::statusChanged(
const css::frame::FeatureStateEvent& rEvent )
2333 if ( rEvent.FeatureURL.Complete !=
".uno:BorderReducedMode" )
2337 if ( !(rEvent.State >>= bValue) )
2340 bParagraphMode = bValue;
2342 if(!mxFrameSet->GetItemCount())
2345 bool bTableMode = ( mxFrameSet->GetItemCount() == 12 );
2346 bool bResize =
false;
2348 if ( bTableMode && bParagraphMode )
2350 for ( sal_uInt16 i = 9; i < 13; i++ )
2351 mxFrameSet->RemoveItem(i);
2354 else if ( !bTableMode && !bParagraphMode )
2356 for ( sal_uInt16 i = 9; i < 13; i++ )
2357 mxFrameSet->InsertItem(i,
Image(aImgVec[i-1]));
2367 void SvxFrameWindow_Impl::CalcSizeValueSet()
2372 Size aSize = mxFrameSet->CalcWindowSizePixel( aItemSize );
2374 mxFrameSet->SetOutputSizePixel(aSize);
2377 void SvxFrameWindow_Impl::InitImageList()
2380 aImgVec.emplace_back(RID_SVXBMP_FRAME1);
2381 aImgVec.emplace_back(RID_SVXBMP_FRAME2);
2382 aImgVec.emplace_back(RID_SVXBMP_FRAME3);
2383 aImgVec.emplace_back(RID_SVXBMP_FRAME4);
2384 aImgVec.emplace_back(RID_SVXBMP_FRAME5);
2385 aImgVec.emplace_back(RID_SVXBMP_FRAME6);
2386 aImgVec.emplace_back(RID_SVXBMP_FRAME7);
2387 aImgVec.emplace_back(RID_SVXBMP_FRAME8);
2388 aImgVec.emplace_back(RID_SVXBMP_FRAME9);
2389 aImgVec.emplace_back(RID_SVXBMP_FRAME10);
2390 aImgVec.emplace_back(RID_SVXBMP_FRAME11);
2391 aImgVec.emplace_back(RID_SVXBMP_FRAME12);
2396 return SvxBorderLine::threeDMediumColor( aMain );
2399 SvxLineWindow_Impl::SvxLineWindow_Impl(SvxFrameToolBoxControl* pControl,
weld::Widget* pParent)
2400 :
WeldToolbarPopup(pControl->getFrameInterface(), pParent,
"svx/ui/floatingframeborder.ui",
"FloatingFrameBorder")
2402 , m_xLineStyleLb(new LineListBox)
2403 , m_xLineStyleLbWin(new
weld::CustomWeld(*m_xBuilder,
"valueset", *m_xLineStyleLb))
2404 , m_bIsWriter(false)
2408 Reference< lang::XServiceInfo > xServices(
m_xFrame->getController()->getModel(), UNO_QUERY_THROW);
2409 m_bIsWriter = xServices->supportsService(
"com.sun.star.text.TextDocument");
2411 catch(
const uno::Exception& )
2415 m_xLineStyleLb->SetStyle(
WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_TABSTOP) );
2417 m_xLineStyleLb->SetSourceUnit( FieldUnit::TWIP );
2421 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::SOLID ), SvxBorderLineStyle::SOLID );
2422 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::DOTTED ), SvxBorderLineStyle::DOTTED );
2423 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::DASHED ), SvxBorderLineStyle::DASHED );
2426 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::DOUBLE ), SvxBorderLineStyle::DOUBLE );
2427 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::THINTHICK_SMALLGAP ), SvxBorderLineStyle::THINTHICK_SMALLGAP, 20 );
2428 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::THINTHICK_MEDIUMGAP ), SvxBorderLineStyle::THINTHICK_MEDIUMGAP );
2429 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::THINTHICK_LARGEGAP ), SvxBorderLineStyle::THINTHICK_LARGEGAP );
2430 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::THICKTHIN_SMALLGAP ), SvxBorderLineStyle::THICKTHIN_SMALLGAP, 20 );
2431 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::THICKTHIN_MEDIUMGAP ), SvxBorderLineStyle::THICKTHIN_MEDIUMGAP );
2432 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::THICKTHIN_LARGEGAP ), SvxBorderLineStyle::THICKTHIN_LARGEGAP );
2435 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::EMBOSSED ), SvxBorderLineStyle::EMBOSSED, 15,
2436 &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor,
2438 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::ENGRAVED ), SvxBorderLineStyle::ENGRAVED, 15,
2439 &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor,
2443 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::OUTSET ), SvxBorderLineStyle::OUTSET, 10,
2444 &SvxBorderLine::lightColor, &SvxBorderLine::darkColor );
2445 m_xLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SvxBorderLineStyle::INSET ), SvxBorderLineStyle::INSET, 10,
2446 &SvxBorderLine::darkColor, &SvxBorderLine::lightColor );
2447 Size aSize = m_xLineStyleLb->SetWidth( 20 );
2449 m_xLineStyleLb->SetSelectHdl(
LINK(
this, SvxLineWindow_Impl, SelectHdl ) );
2455 aSize = m_xLineStyleLb->CalcWindowSizePixel(aSize);
2456 m_xLineStyleLb->GetDrawingArea()->set_size_request(aSize.
Width(), aSize.
Height());
2457 m_xLineStyleLb->SetOutputSizePixel(aSize);
2465 if ( m_xLineStyleLb->GetSelectItemPos( ) > 0 )
2468 aTmp.SetBorderLineStyle( nStyle );
2469 aTmp.SetWidth( 20 );
2476 Sequence< PropertyValue > aArgs( 1 );
2477 aArgs[0].Name =
"LineStyle";
2481 m_xControl->dispatchCommand(
".uno:LineStyle", aArgs );
2487 const Reference< XDispatchProvider >& rDispatchProvider,
2489 const OUString& rCommand,
2491 : SfxStatusListener( rDispatchProvider, nSlotId, rCommand ),
2501 case SID_STYLE_FAMILY1:
2502 case SID_STYLE_FAMILY2:
2503 case SID_STYLE_FAMILY3:
2504 case SID_STYLE_FAMILY4:
2505 case SID_STYLE_FAMILY5:
2507 const sal_uInt16 nIdx = GetId() - SID_STYLE_FAMILY_START;
2509 if ( SfxItemState::DEFAULT == eState )
2513 DBG_ASSERT( pStateItem !=
nullptr,
"SfxTemplateItem expected" );
2536 :aClearForm (
SvxResId( RID_SVXSTR_CLEARFORM ) )
2537 ,aMore (
SvxResId( RID_SVXSTR_MORE_STYLES ) )
2538 ,bSpecModeWriter ( false )
2539 ,bSpecModeCalc ( false )
2547 aDefaultStyles.clear();
2552 Reference< style::XStyleFamiliesSupplier > xStylesSupplier( xModel, UNO_QUERY_THROW );
2553 Reference< lang::XServiceInfo > xServices( xModel, UNO_QUERY_THROW );
2554 bSpecModeWriter = xServices->supportsService(
"com.sun.star.text.TextDocument");
2558 xStylesSupplier->getStyleFamilies()->getByName(
"ParagraphStyles") >>=
2560 static const std::vector<OUString> aWriterStyles =
2573 for(
const OUString& aStyle: aWriterStyles )
2578 xParaStyles->getByName( aStyle ) >>= xStyle;
2580 xStyle->getPropertyValue(
"DisplayName") >>=
sName;
2581 if( !sName.isEmpty() )
2582 aDefaultStyles.push_back(
2583 std::pair<OUString, OUString>(aStyle, sName) );
2585 catch(
const uno::Exception& )
2591 bSpecModeCalc = xServices->supportsService(
2592 "com.sun.star.sheet.SpreadsheetDocument")))
2594 static const char* aCalcStyles[] =
2602 xStylesSupplier->getStyleFamilies()->getByName(
"CellStyles") >>= xCellStyles;
2603 for(
const char* pCalcStyle : aCalcStyles)
2607 const OUString sStyleName( OUString::createFromAscii( pCalcStyle ) );
2608 if( xCellStyles->hasByName( sStyleName ) )
2612 xStyle->getPropertyValue(
"DisplayName") >>=
sName;
2613 if( !sName.isEmpty() )
2614 aDefaultStyles.push_back(
2615 std::pair<OUString, OUString>(sStyleName, sName) );
2618 catch(
const uno::Exception& )
2623 catch(
const uno::Exception& )
2625 OSL_FAIL(
"error while initializing style names");
2639 ".uno:TemplateFamily5"
2644 , pStyleSheetPool(nullptr)
2645 , nActFamily(0xffff)
2667 pImpl->InitializeStyles(
m_xFrame->getController()->getModel());
2668 Reference< XDispatchProvider > xDispatchProvider(
m_xFrame->getController(), UNO_QUERY );
2672 SID_STYLE_FAMILY_START + i,
2673 OUString::createFromAscii( StyleSlotToStyleCommand[i] ),
2685 pImpl->m_xVclBox.disposeAndClear();
2686 pImpl->m_xWeldBox.reset();
2687 pImpl->m_pBox =
nullptr;
2693 pBoundItem->UnBind();
2699 if ( m_xBoundItems[i].is() )
2703 m_xBoundItems[i]->dispose();
2709 m_xBoundItems[i].clear();
2719 return "com.sun.star.comp.svx.StyleToolBoxControl";
2729 return {
"com.sun.star.frame.ToolbarController" };
2732 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
2734 css::uno::XComponentContext*,
2735 css::uno::Sequence<css::uno::Any>
const & )
2743 pBoundItem->ReBind();
2749 switch (
nActFamily-1 + SID_STYLE_FAMILY_START )
2751 case SID_STYLE_FAMILY1:
return SfxStyleFamily::Char;
2752 case SID_STYLE_FAMILY2:
return SfxStyleFamily::Para;
2753 case SID_STYLE_FAMILY3:
return SfxStyleFamily::Frame;
2754 case SID_STYLE_FAMILY4:
return SfxStyleFamily::Page;
2755 case SID_STYLE_FAMILY5:
return SfxStyleFamily::Pseudo;
2757 OSL_FAIL(
"unknown style family" );
2760 return SfxStyleFamily::Para;
2765 SvxStyleBox_Base* pBox =
pImpl->m_pBox;
2775 bool bDoFill =
false;
2778 sal_uInt16 nCount = xIter->Count();
2781 pStyle = xIter->First();
2784 if ( nCount != pBox->get_count() )
2791 while ( pStyle && !bDoFill )
2793 bDoFill = ( pBox->get_text(i) != pStyle->
GetName() );
2794 pStyle = xIter->Next();
2802 OUString aStrSel(pBox->get_active_text());
2806 std::vector<OUString> aStyles;
2809 pStyle = xIter->Next();
2811 if(
pImpl->bSpecModeWriter ||
pImpl->bSpecModeCalc )
2816 bool bInsert =
true;
2818 for(
auto const & _i:
pImpl->aDefaultStyles )
2820 if( _i.first ==
aName || _i.second ==
aName )
2828 aStyles.push_back(
aName);
2829 pStyle = xIter->Next();
2836 aStyles.push_back(pStyle->
GetName());
2837 pStyle = xIter->Next();
2842 if (
pImpl->bSpecModeWriter ||
pImpl->bSpecModeCalc)
2844 pBox->append_text(
pImpl->aClearForm);
2845 pBox->insert_separator(1,
"separator");
2848 for (
const auto &rStyle :
pImpl->aDefaultStyles)
2849 pBox->append_text(rStyle.second);
2852 std::sort(aStyles.begin(), aStyles.end());
2854 for (
const auto& rStyle : aStyles)
2855 pBox->append_text(rStyle);
2858 pBox->append_text(
pImpl->aMore);
2861 pBox->set_active_or_entry_text(aStrSel);
2862 pBox->SetFamily( eFamily );
2867 SvxStyleBox_Base* pBox =
pImpl->m_pBox;
2873 OUString aStrSel(pBox->get_active_text());
2875 if ( !rStyleName.isEmpty() )
2877 OUString aNewStyle = rStyleName;
2879 auto aFound = std::find_if(
pImpl->aDefaultStyles.begin(),
pImpl->aDefaultStyles.end(),
2880 [rStyleName] (
auto it) {
return it.first == rStyleName || it.second == rStyleName; }
2883 if (aFound !=
pImpl->aDefaultStyles.end())
2884 aNewStyle = aFound->second;
2886 if ( aNewStyle != aStrSel )
2887 pBox->set_active_or_entry_text( aNewStyle );
2890 pBox->set_active(-1);
2907 if ( i==MAX_FAMILIES || !pPool )
2950 m_pToolbar->set_item_sensitive(m_aCommandURL.toUtf8(), rEvent.IsEnabled);
2955 if (!getToolboxId( nId, &pToolBox ) )
2957 pToolBox->
EnableItem( nId, rEvent.IsEnabled );
2960 if (rEvent.IsEnabled)
2966 uno::Reference< awt::XWindow > xItemWindow;
2972 std::unique_ptr<weld::ComboBox> xWidget(m_pBuilder->weld_combo_box(
"applystyle"));
2976 pImpl->m_xWeldBox.reset(
new SvxStyleBox_Base(std::move(xWidget),
2978 SfxStyleFamily::Para,
2979 Reference< XDispatchProvider >(
m_xFrame->getController(), UNO_QUERY ),
2983 pImpl->bSpecModeWriter ||
pImpl->bSpecModeCalc, *
this));
2995 SfxStyleFamily::Para,
2996 Reference< XDispatchProvider >(
m_xFrame->getController(), UNO_QUERY ),
3000 pImpl->bSpecModeWriter ||
pImpl->bSpecModeCalc, *
this);
3006 if (
pImpl->m_pBox && !
pImpl->aDefaultStyles.empty())
3007 pImpl->m_pBox->SetDefaultStyle(
pImpl->aDefaultStyles[0].second);
3012 SvxFontNameToolBoxControl::SvxFontNameToolBoxControl()
3017 void SvxFontNameBox_Base::statusChanged_Impl(
const css::frame::FeatureStateEvent& rEvent )
3019 if ( !rEvent.IsEnabled )
3021 set_sensitive(
false);
3026 set_sensitive(
true);
3028 css::awt::FontDescriptor aFontDesc;
3029 if ( rEvent.State >>= aFontDesc )
3032 set_active_or_entry_text(
"");
3037 void SvxFontNameToolBoxControl::statusChanged(
const css::frame::FeatureStateEvent& rEvent )
3040 m_pBox->statusChanged_Impl(rEvent);
3043 m_pToolbar->set_item_sensitive(m_aCommandURL.toUtf8(), rEvent.IsEnabled);
3048 if (!getToolboxId( nId, &pToolBox ) )
3050 pToolBox->
EnableItem( nId, rEvent.IsEnabled );
3054 css::uno::Reference<css::awt::XWindow> SvxFontNameToolBoxControl::createItemWindow(
const css::uno::Reference<css::awt::XWindow>& rParent)
3056 uno::Reference< awt::XWindow > xItemWindow;
3062 std::unique_ptr<weld::ComboBox> xWidget(m_pBuilder->weld_combo_box(
"fontnamecombobox"));
3066 m_xWeldBox.reset(
new SvxFontNameBox_Base(std::move(xWidget),
3067 Reference<XDispatchProvider>(
m_xFrame->getController(), UNO_QUERY),
3069 m_pBox = m_xWeldBox.get();
3078 Reference<XDispatchProvider>(
m_xFrame->getController(), UNO_QUERY),
3080 m_pBox = m_xVclBox.get();
3088 void SvxFontNameToolBoxControl::dispose()
3090 ToolboxController::dispose();
3093 m_xVclBox.disposeAndClear();
3098 OUString SvxFontNameToolBoxControl::getImplementationName()
3100 return "com.sun.star.comp.svx.FontNameToolBoxControl";
3103 sal_Bool SvxFontNameToolBoxControl::supportsService(
const OUString& rServiceName )
3108 css::uno::Sequence< OUString > SvxFontNameToolBoxControl::getSupportedServiceNames()
3110 return {
"com.sun.star.frame.ToolbarController" };
3113 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
3115 css::uno::XComponentContext*,
3116 css::uno::Sequence<css::uno::Any>
const & )
3118 return cppu::acquire(
new SvxFontNameToolBoxControl() );
3122 ImplInheritanceHelper( rContext, nullptr, OUString() ),
3123 m_bSplitButton(true),
3131 sal_uInt16 MapCommandToSlotId(
const OUString& rCommand)
3133 if (rCommand ==
".uno:Color")
3134 return SID_ATTR_CHAR_COLOR;
3135 else if (rCommand ==
".uno:FontColor")
3136 return SID_ATTR_CHAR_COLOR2;
3137 else if (rCommand ==
".uno:BackColor")
3138 return SID_ATTR_CHAR_COLOR_BACKGROUND;
3139 else if (rCommand ==
".uno:CharBackColor")
3140 return SID_ATTR_CHAR_BACK_COLOR;
3141 else if (rCommand ==
".uno:BackgroundColor")
3142 return SID_BACKGROUND_COLOR;
3143 else if (rCommand ==
".uno:TableCellBackgroundColor")
3144 return SID_TABLE_CELL_BACKGROUND_COLOR;
3145 else if (rCommand ==
".uno:Extrusion3DColor")
3146 return SID_EXTRUSION_3D_COLOR;
3147 else if (rCommand ==
".uno:XLineColor")
3148 return SID_ATTR_LINE_COLOR;
3149 else if (rCommand ==
".uno:FillColor")
3150 return SID_ATTR_FILL_COLOR;
3151 else if (rCommand ==
".uno:FrameLineColor")
3152 return SID_FRAME_LINECOLOR;
3154 SAL_WARN(
"svx.tbxcrtls",
"Unknown color command: " << rCommand);
3162 PopupWindowController::initialize( rArguments );
3164 m_nSlotId = MapCommandToSlotId( m_aCommandURL );
3176 OString
aId(m_aCommandURL.toUtf8());
3181 m_pToolbar->set_item_popover(
aId, mxPopoverContainer->getTopLevel());
3188 if (getToolboxId(nId, &pToolBox))
3197 PopupWindowController::update();
3201 case SID_ATTR_CHAR_COLOR2:
3202 addStatusListener(
".uno:CharColorExt");
3205 case SID_ATTR_CHAR_COLOR_BACKGROUND:
3206 addStatusListener(
".uno:CharBackgroundExt");
3209 case SID_FRAME_LINECOLOR:
3210 addStatusListener(
".uno:BorderTLBR");
3211 addStatusListener(
".uno:BorderBLTR");
3242 const css::uno::Reference<css::awt::XWindow> xParent =
m_xFrame->getContainerWindow();
3245 const OString
aId(m_aCommandURL.toUtf8());
3247 auto xPopover = std::make_unique<ColorWindow>(
3267 if (!getToolboxId(nId, &pToolBox))
3270 const css::uno::Reference<css::awt::XWindow> xParent =
m_xFrame->getContainerWindow();
3275 auto xPopover = std::make_unique<ColorWindow>(
3289 std::move(xPopover),
true);
3293 mxInterimPopover->SetText(aWindowTitle);
3295 mxInterimPopover->Show();
3297 return mxInterimPopover;
3302 m_xBtnUpdater->Update(rColor);
3309 if (!getToolboxId(nId, &pToolBox) && !m_pToolbar)
3312 if ( rEvent.FeatureURL.Complete == m_aCommandURL )
3315 m_pToolbar->set_item_sensitive(m_aCommandURL.toUtf8(), rEvent.IsEnabled);
3317 pToolBox->
EnableItem( nId, rEvent.IsEnabled );
3326 else if ( rEvent.State >>= bValue )
3329 m_pToolbar->set_item_active(m_aCommandURL.toUtf8(), bValue);
3342 const OString
aId(m_aCommandURL.toUtf8());
3343 m_pToolbar->set_menu_item_active(
aId, !m_pToolbar->get_menu_item_active(
aId));
3348 createPopupWindow();
3358 case SID_ATTR_CHAR_COLOR2 :
3359 aCommand =
".uno:CharColorExt";
3362 case SID_ATTR_CHAR_COLOR_BACKGROUND :
3363 aCommand =
".uno:CharBackgroundExt";
3368 { m_aCommandURL.copy(5), css::uno::makeAny(aColor) }
3401 return "com.sun.star.comp.svx.ColorToolBoxControl";
3406 return {
"com.sun.star.frame.ToolbarController" };
3409 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
3411 css::uno::XComponentContext* rContext,
3412 css::uno::Sequence<css::uno::Any>
const & )
3417 SvxFrameToolBoxControl::SvxFrameToolBoxControl(
const css::uno::Reference< css::uno::XComponentContext >& rContext )
3418 :
svt::PopupWindowController( rContext, nullptr, OUString() )
3422 void SAL_CALL SvxFrameToolBoxControl::execute(sal_Int16 )
3427 const OString
aId(m_aCommandURL.toUtf8());
3428 m_pToolbar->set_menu_item_active(aId, !m_pToolbar->get_menu_item_active(aId));
3433 createPopupWindow();
3437 void SvxFrameToolBoxControl::initialize(
const css::uno::Sequence< css::uno::Any >& rArguments )
3439 svt::PopupWindowController::initialize( rArguments );
3444 m_pToolbar->set_item_popover(m_aCommandURL.toUtf8(), mxPopoverContainer->getTopLevel());
3449 if (getToolboxId(nId, &pToolBox))
3453 std::unique_ptr<WeldToolbarPopup> SvxFrameToolBoxControl::weldPopupWindow()
3455 if ( m_aCommandURL ==
".uno:LineStyle" )
3456 return std::make_unique<SvxLineWindow_Impl>(
this, m_pToolbar);
3457 return std::make_unique<SvxFrameWindow_Impl>(
this, m_pToolbar);
3462 if ( m_aCommandURL ==
".uno:LineStyle" )
3465 std::make_unique<SvxLineWindow_Impl>(
this, pParent->
GetFrameWeld()));
3467 mxInterimPopover->Show();
3469 mxInterimPopover->SetText(
SvxResId(RID_SVXSTR_FRAME_STYLE));
3471 return mxInterimPopover;
3475 std::make_unique<SvxFrameWindow_Impl>(
this, pParent->
GetFrameWeld()));
3477 mxInterimPopover->Show();
3479 mxInterimPopover->SetText(
SvxResId(RID_SVXSTR_FRAME));
3481 return mxInterimPopover;
3484 OUString SvxFrameToolBoxControl::getImplementationName()
3486 return "com.sun.star.comp.svx.FrameToolBoxControl";
3489 css::uno::Sequence< OUString > SvxFrameToolBoxControl::getSupportedServiceNames()
3491 return {
"com.sun.star.frame.ToolbarController" };
3494 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
3496 css::uno::XComponentContext* rContext,
3497 css::uno::Sequence<css::uno::Any>
const & )
3499 return cppu::acquire(
new SvxFrameToolBoxControl( rContext ) );
3502 SvxCurrencyToolBoxControl::SvxCurrencyToolBoxControl(
const css::uno::Reference<css::uno::XComponentContext>& rContext ) :
3503 PopupWindowController( rContext, nullptr, OUString() ),
3504 m_eLanguage(
Application::GetSettings().GetLanguageTag().getLanguageType() ),
3509 SvxCurrencyToolBoxControl::~SvxCurrencyToolBoxControl() {}
3517 std::unique_ptr<weld::Label>
m_xLabel;
3518 std::unique_ptr<weld::TreeView> m_xCurrencyLb;
3519 std::unique_ptr<weld::Button> m_xOkBtn;
3520 OUString& m_rSelectedFormat;
3523 std::vector<OUString> m_aFormatEntries;
3531 SvxCurrencyList_Impl(SvxCurrencyToolBoxControl* pControl,
weld::Widget* pParent, OUString& rSelectedFormat,
LanguageType& eSelectedLanguage)
3532 :
WeldToolbarPopup(pControl->getFrameInterface(), pParent,
"svx/ui/currencywindow.ui",
"CurrencyWindow")
3533 , m_xControl(pControl)
3534 , m_xLabel(m_xBuilder->weld_label(
"label"))
3535 , m_xCurrencyLb(m_xBuilder->weld_tree_view(
"currency"))
3536 , m_xOkBtn(m_xBuilder->weld_button(
"ok"))
3537 , m_rSelectedFormat(rSelectedFormat)
3538 , m_eSelectedLanguage(eSelectedLanguage)
3540 std::vector< OUString > aList;
3541 std::vector< sal_uInt16 > aCurrencyList;
3543 sal_uInt16 nLen = rCurrencyTable.
size();
3546 m_eFormatLanguage = aFormatter.GetLanguage();
3548 SvxCurrencyToolBoxControl::GetCurrencySymbols( aList,
true, aCurrencyList );
3550 sal_uInt16 nPos = 0, nCount = 0;
3551 sal_Int32 nSelectedPos = -1;
3555 OUString sLongestString;
3557 m_xCurrencyLb->freeze();
3558 for(
const auto& rItem : aList )
3560 sal_uInt16& rCurrencyIndex = aCurrencyList[ nCount ];
3561 if ( rCurrencyIndex < nLen )
3563 m_xCurrencyLb->append_text(rItem);
3565 if (rItem.getLength() > sLongestString.getLength())
3566 sLongestString = rItem;
3568 const NfCurrencyEntry& aCurrencyEntry = rCurrencyTable[ rCurrencyIndex ];
3570 bIsSymbol = nPos >= nLen;
3572 sal_uInt16 nDefaultFormat = aFormatter.GetCurrencyFormatStrings( aStringsDtor, aCurrencyEntry, bIsSymbol );
3573 const OUString& rFormatStr = aStringsDtor[ nDefaultFormat ];
3574 m_aFormatEntries.push_back( rFormatStr );
3575 if( rFormatStr == m_rSelectedFormat )
3576 nSelectedPos = nPos;
3581 m_xCurrencyLb->thaw();
3583 m_xCurrencyLb->set_selection_mode(SelectionMode::Multiple);
3584 m_xCurrencyLb->connect_row_activated(
LINK(
this, SvxCurrencyList_Impl, RowActivatedHdl ) );
3585 m_xLabel->set_label(
SvxResId(RID_SVXSTR_TBLAFMT_CURRENCY));
3586 m_xCurrencyLb->select( nSelectedPos );
3587 m_xOkBtn->connect_clicked(
LINK(
this, SvxCurrencyList_Impl, OKHdl));
3591 m_xCurrencyLb->insert_text(0, sLongestString);
3592 m_xCurrencyLb->set_size_request(m_xCurrencyLb->get_preferred_size().Width(), m_xCurrencyLb->get_height_rows(12));
3593 m_xCurrencyLb->remove(0);
3597 void SvxCurrencyList_Impl::GrabFocus()
3599 m_xCurrencyLb->grab_focus();
3604 RowActivatedHdl(*m_xCurrencyLb);
3609 if (!m_xControl.is())
3614 int nSelected = m_xCurrencyLb->get_selected_index();
3615 if (nSelected == -1)
3618 m_xCurrencyLb->set_selection_mode(SelectionMode::Single);
3620 m_rSelectedFormat = m_aFormatEntries[nSelected];
3621 m_eSelectedLanguage = m_eFormatLanguage;
3623 m_xControl->execute(nSelected + 1);
3625 m_xControl->EndPopupMode();
3631 void SvxCurrencyToolBoxControl::initialize(
const css::uno::Sequence< css::uno::Any >& rArguments )
3633 PopupWindowController::initialize(rArguments);
3638 m_pToolbar->set_item_popover(m_aCommandURL.toUtf8(), mxPopoverContainer->getTopLevel());
3644 if (getToolboxId(nId, &pToolBox) && pToolBox->
GetItemCommand(nId) == m_aCommandURL)
3648 std::unique_ptr<WeldToolbarPopup> SvxCurrencyToolBoxControl::weldPopupWindow()
3650 return std::make_unique<SvxCurrencyList_Impl>(
this, m_pToolbar, m_aFormatString, m_eLanguage);
3656 std::make_unique<SvxCurrencyList_Impl>(
this, pParent->
GetFrameWeld(), m_aFormatString, m_eLanguage));
3658 mxInterimPopover->Show();
3660 return mxInterimPopover;
3663 void SvxCurrencyToolBoxControl::execute( sal_Int16 nSelectModifier )
3665 sal_uInt32 nFormatKey;
3666 if (m_aFormatString.isEmpty())
3667 nFormatKey = NUMBERFORMAT_ENTRY_NOT_FOUND;
3670 if ( nSelectModifier > 0 )
3674 uno::Reference< util::XNumberFormatsSupplier > xRef(
m_xFrame->getController()->getModel(), uno::UNO_QUERY );
3675 uno::Reference< util::XNumberFormats > rxNumberFormats( xRef->getNumberFormats(), uno::UNO_SET_THROW );
3677 nFormatKey = rxNumberFormats->queryKey( m_aFormatString, aLocale,
false );
3678 if ( nFormatKey == NUMBERFORMAT_ENTRY_NOT_FOUND )
3679 nFormatKey = rxNumberFormats->addNew( m_aFormatString, aLocale );
3681 catch(
const uno::Exception& )
3690 if( nFormatKey != NUMBERFORMAT_ENTRY_NOT_FOUND )
3692 Sequence< PropertyValue > aArgs( 1 );
3693 aArgs[0].Name =
"NumberFormatCurrency";
3694 aArgs[0].Value <<= nFormatKey;
3699 PopupWindowController::execute( nSelectModifier );
3702 OUString SvxCurrencyToolBoxControl::getImplementationName()
3704 return "com.sun.star.comp.svx.CurrencyToolBoxControl";
3707 css::uno::Sequence<OUString> SvxCurrencyToolBoxControl::getSupportedServiceNames()
3709 return {
"com.sun.star.frame.ToolbarController" };
3712 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
3714 css::uno::XComponentContext* rContext,
3715 css::uno::Sequence<css::uno::Any>
const & )
3717 return cppu::acquire(
new SvxCurrencyToolBoxControl( rContext ) );
3720 Reference< css::accessibility::XAccessible > SvxFontNameBox_Impl::CreateAccessible()
3727 void SvxCurrencyToolBoxControl::GetCurrencySymbols( std::vector<OUString>& rList,
bool bFlag,
3728 std::vector<sal_uInt16>& rCurrencyList )
3730 rCurrencyList.clear();
3733 sal_uInt16 nCount = rCurrencyTable.
size();
3735 sal_uInt16 nStart = 1;
3741 rList.push_back( aString );
3742 rCurrencyList.push_back( sal_uInt16(-1) );
3746 rList.push_back( aString );
3747 rCurrencyList.push_back( 0 );
3754 const OUString aTwoSpace(
" ");
3756 for( sal_uInt16 i = 1; i < nCount; ++i )
3765 std::vector<OUString>::size_type j = nStart;
3766 for( ; j < rList.size(); ++j )
3767 if ( aCollator.compareString( aStr, rList[j] ) < 0 )
3770 rList.insert( rList.begin() + j,
aStr );
3771 rCurrencyList.insert( rCurrencyList.begin() + j, i );
3777 std::vector<OUString>::size_type nCont = rList.size();
3779 for ( sal_uInt16 i = 1; i < nCount; ++i )
3781 bool bInsert =
true;
3784 std::vector<OUString>::size_type j = nCont;
3785 for ( ; j < rList.size() && bInsert; ++j )
3787 if( rList[j] == aStr )
3789 else if ( aCollator.compareString( aStr, rList[j] ) < 0 )
3794 rList.insert( rList.begin() + j,
aStr );
3795 rCurrencyList.insert( rCurrencyList.begin() + j, i );
3801 : mpControl(pControl)
3806 [[maybe_unused]]
const OUString& ,
const NamedColor& rColor)
3832 : m_xButton(
std::move(pControl))
3833 , m_pTopLevel(pTopLevel)
3834 , m_aColorWrapper(this)
3835 , m_aAutoDisplayColor(
Application::GetSettings().GetStyleSettings().GetDialogColor())
3837 , m_bShowNoneButton(false)
3847 if (rButton.get_active())
3848 getColorWindow()->GrabFocus();
3866 css::uno::Reference<css::frame::XFrame>
xFrame(pFrame ? pFrame->
GetFrameInterface() : uno::Reference<css::frame::XFrame>());
3889 if (rColor.second.trim().isEmpty())
3924 for (
tools::Long i = 0; i != xColorTable->Count(); ++i)
3928 if (nColorTextWidth > nMaxStandardColorTextWidth)
3930 nMaxStandardColorTextWidth = nColorTextWidth;
3931 aLongestColor.second = rEntry.
GetName();
3944 xDevice->SetOutputSize(aImageSize);
3949 const Color aG(0xef, 0xef, 0xef);
3950 xDevice->DrawCheckered(aRect.
TopLeft(), aRect.
GetSize(), 8, aW, aG);
3951 xDevice->SetFillColor();
3958 xDevice->SetFillColor(rColor.first);
3962 xDevice->DrawRect(aRect);
3969 : m_pMenuButton(pMenuButton)
3970 , m_pToolbar(nullptr)
3971 , m_pControl(nullptr)
3977 : m_pMenuButton(nullptr)
3978 , m_pToolbar(pToolbar)
3980 , m_pControl(nullptr)
3986 : m_pMenuButton(nullptr)
3987 , m_pToolbar(nullptr)
3988 , m_pControl(pControl)
3989 , m_xToolBox(pToolbar)
OUString AsRGBHexString() const
#define LINK(Instance, Class, Member)
virtual std::unique_ptr< SfxStyleSheetIterator > CreateIterator(SfxStyleFamily, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, MetricVector *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
static NamedColor GetSelectEntryColor(ValueSet const *pColorSet)
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
std::pair< Color, OUString > NamedColor
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
const Wallpaper & GetBackground() const
std::tuple< vcl::RenderContext &, const tools::Rectangle &, bool, const OUString & > render_args
#define COMBO_WIDTH_IN_CHARS
void setWidth(tools::Long nWidth)
tools::Long GetDistForWidth(tools::Long nWidth)
const Color & GetHighlightTextColor() const
std::unique_ptr< ContentProperties > pData
static XColorListRef CreateStdColorList()
#define DECL_LINK(Member, ArgType, RetType)
tools::Long getWidth() const
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
ValueSet(std::unique_ptr< weld::ScrolledWindow > pScrolledWindow)
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
Reference< XFrame > xFrame
void SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton=false)
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
sal_uInt8 GetLuminance() const
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
Color GetColorLine1(const Color &rMain)
Color GetColorLine2(const Color &rMain)
css::uno::Reference< css::lang::XComponent > m_xFrame
Color GetColorDist(const Color &rMain, const Color &rDefault)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
sal_uInt16 GetCode() const
DataChangedEventType GetType() const
const Color & GetLabelTextColor() const
sal_uInt16 GetSelectedItemId() const
static SfxObjectShell * Current()
void SetLine(const editeng::SvxBorderLine *pNew)
const Size & GetListBoxPreviewDefaultPixelSize() const
std::unique_ptr< weld::Label > m_xLabel
virtual void GrabFocus() override
virtual SfxStyleSheetBasePool * GetStyleSheetPool()
static OutputDevice * GetDefaultDevice()
static bool SelectValueSetEntry(SvxColorValueSet *pColorSet, const Color &rColor)
weld::Window * GetFrameWeld() const
static sal_uInt32 getColumnCount()
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()
Reference< XNameAccess > m_xContainer
IMPL_LINK(SvxStyleBox_Base, CustomGetSizeHdl, OutputDevice &, rArg, Size)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
void Enable(bool bEnable=true, bool bChild=true)
ColorWindow(const OUString &rCommand, std::shared_ptr< PaletteManager > const &rPaletteManager, ColorStatus &rColorStatus, sal_uInt16 nSlotId, const css::uno::Reference< css::frame::XFrame > &rFrame, weld::Window *pParentWindow, const MenuOrToolMenuButton &rMenuButton, ColorSelectFunction const &rColorSelectFunction)
const OUString & GetName() const
PropertiesInfo aProperties
OUString SvxResId(const char *pId)
void DecreaseContrast(sal_uInt8 cContDec)
const vcl::Font & GetFont() const
ColorStatus & mrColorStatus
tools::Long GetLine2ForWidth(tools::Long nWidth)
bool dispatchCommand(const OUString &rCommand, const uno::Reference< css::frame::XFrame > &rFrame, const css::uno::Sequence< css::beans::PropertyValue > &rArguments, const uno::Reference< css::frame::XDispatchResultListener > &rListener)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_CurrencyToolBoxControl_get_implementation(css::uno::XComponentContext *rContext, css::uno::Sequence< css::uno::Any > const &)
SfxFrame & GetFrame() const
void Selected(const NamedColor &rNamedColor)
virtual void GetFocus() override
AllSettingsFlags GetFlags() const
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
static bool lcl_GetDocFontList(const FontList **ppFontList, SvxFontNameBox_Base *pBox)
tools::Long GetLine1ForWidth(tools::Long nWidth)
virtual OutputDevice & get_ref_device()=0
IMPL_LINK_NOARG(SvxStyleBox_Base, ActivateHdl, weld::ComboBox &, bool)
void operator()(const OUString &rCommand, const NamedColor &rColor)
std::unique_ptr< weld::ComboBox > mxPaletteListBox
virtual void StateChanged(SfxItemState eState, const SfxPoolItem *pState) override
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
bool IsNoSelection() const
void DrawRect(const tools::Rectangle &rRect)
const OUString & GetStyleName() const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
const OUString & GetName() const
tools::Long getHeight() const
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
void SelectEntry(const NamedColor &rColor)
const Color & GetDisableColor() const
std::unique_ptr< weld::Button > mxButtonPicker
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_StyleToolBoxControl_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
#define DBG_ASSERT(sCon, aError)
void DecreaseLuminance(sal_uInt8 cLumDec)
std::unique_ptr< weld::Button > mxButtonNoneColor
std::unique_ptr< SvxColorValueSet > mxRecentColorSet
float approximate_digit_width() const
LanguageType GetLanguage(SwWrtShell &rSh, sal_uInt16 nLangWhichId)
#define HID_POPUP_COLOR_CTRL
const Color & GetColor() const
weld::Button * mpDefaultButton
void Create(SvxOrientationItem &rItem, SvStream &rStrm, sal_uInt16)
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
std::unique_ptr< weld::Widget > mxAutomaticSeparator
tools::Long Width() const
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
const Color & GetFieldColor() const
OUString ApplyLreOrRleEmbedding(const OUString &rText)
void SetTextColor(const Color &rColor)
std::shared_ptr< PaletteManager > mxPaletteManager
OUString GetItemText(sal_uInt16 nItemId) const
sal_uInt16 GetModifier() const
const OUString & GetStyleName() const
std::unique_ptr< weld::Button > mxButtonAutoColor
SvxBorderLineStyle GetStyle() const
exports com.sun.star. style
ColorStatus m_aColorStatus
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
void Disable(bool bChild=true)
static const char * StyleSlotToStyleCommand[MAX_FAMILIES]
const sal_uInt16 theSlotId
float GetDPIScaleFactor() const
virtual ~ColorWindow() override
size_t GetFontNameCount() const
NamedColor m_aSelectedColor
void SelectItem(sal_uInt16 nItemId)
Point LogicToPixel(const Point &rLogicPt) const
SfxStyleControllerItem_Impl(const Reference< XDispatchProvider > &rDispatchProvider, sal_uInt16 nSlotId, const OUString &rCommand, SvxStyleToolBoxControl &rTbxCtl)
const LanguageTag & getLocale()
ValueSet & operator=(const ValueSet &)=delete
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
const OUString & GetFamilyName() const
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
const vcl::KeyCode & GetKeyCode() const
tools::Long GetMinWidth() const
static Color lcl_mediumColor(Color aMain, Color)
void EnsurePaletteManager()
static SfxViewFrame * Current()
#define WB_NO_DIRECTSELECT
ListBoxColorWrapper(ColorListBox *pControl)
size_t GetItemCount() const
std::unique_ptr< ColorWindow > m_xColorWindow
OUString EditResId(const char *pId)
constexpr sal_uInt16 KEY_ESCAPE
void SetFont(const vcl::Font &rNewFont)
SfxStyleSheetBase * Next()
virtual void dispose() override
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
MapUnit GetMapUnit() const
tools::Long GetTextHeight() const
Color m_aAutoDisplayColor
ColorWindow * getColorWindow() const
tools::Long AdjustWidth(tools::Long n)
#define HID_STYLE_LISTBOX
static VclPtr< reference_type > Create(Arg &&...arg)
std::shared_ptr< PaletteManager > m_xPaletteManager
ColorListBox(std::unique_ptr< weld::MenuButton > pControl, weld::Window *pTopLevelWindow)
void SelectEntry(const NamedColor &rColor)
Link< ColorListBox &, void > m_aSelectedLink
tools::Long Height() const
Reference< XComponentContext > getProcessComponentContext()
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
virtual void setProperty(const css::uno::Any &aProperty) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual void statusChanged(const css::frame::FeatureStateEvent &rEvent) override
const Color & GetWindowColor() const
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_FrameToolBoxControl_get_implementation(css::uno::XComponentContext *rContext, css::uno::Sequence< css::uno::Any > const &)
tools::Long AdjustHeight(tools::Long n)
void ShowChildWindow(sal_uInt16, bool bVisible=true)
static OUString GetLanguageString(const LanguageType eType)
bool GetTextBoundRect(tools::Rectangle &rRect, const OUString &rStr, sal_Int32 nBase=0, sal_Int32 nIndex=0, sal_Int32 nLen=-1, sal_uLong nLayoutWidth=0, const tools::Long *pDXArray=nullptr, const SalLayoutGlyphs *pGlyphs=nullptr) const
void SetItalic(FontItalic)
void setHeight(tools::Long nHeight)
std::function< void(const OUString &, const NamedColor &)> ColorSelectFunction
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
ListBoxColorWrapper m_aColorWrapper
#define SAL_WARN(area, stream)
std::vector< OUString > NfWSStringsDtor
virtual std::unique_ptr< SfxItemSet > GetItemSetForPreview()
IMPL_STATIC_LINK_NOARG(SvxStyleBox_Base, ShowMoreHdl, void *, void)
if(!pCandidateA->getEnd().equal(pCandidateB->getStart()))
static sal_uInt32 getMaxRowCount()
std::unique_ptr< SvxColorValueSet > mxColorSet
#define DECL_STATIC_LINK(Class, Member, ArgType, RetType)
const FontList * GetFontList() const
#define MAX_MRU_FONTNAME_ENTRIES
constexpr sal_uInt16 KEY_SHIFT
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
const Size & GetSizePixel() const
const Color & GetDialogTextColor() const
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_ColorToolBoxControl_get_implementation(css::uno::XComponentContext *rContext, css::uno::Sequence< css::uno::Any > const &)
void Push(PushFlags nFlags=PushFlags::ALL)
NamedColor GetSelectEntryColor() const
void statusChanged(const css::frame::FeatureStateEvent &rEvent)
weld::Window * m_pTopLevel
std::unique_ptr< weld::MenuButton > m_xButton
NamedColor GetAutoColor() const
sal_Int16 GetCaseMap(sal_Int32 nToken)
Color GetItemColor(sal_uInt16 nItemId) const
static bool LineToSvxLine(const css::table::BorderLine &rLine, editeng::SvxBorderLine &rSvxLine, bool bConvert)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_FontNameToolBoxControl_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
SvxStyleToolBoxControl & rControl
constexpr sal_uInt16 KEY_TAB
void ShowPreview(const NamedColor &rColor)
virtual void DataChanged(const DataChangedEvent &rDCEvt)
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)