20#include <com/sun/star/frame/XFrame.hpp>
21#include <com/sun/star/beans/PropertyValue.hpp>
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/drawing/DrawViewMode.hpp>
38#include <bitmaps.hlst>
57 LayoutToolbarMenu(SlideLayoutController* pController,
weld::Widget* pParent,
const bool bInsertPage,
const OUString& rCommand);
60 mxLayoutSet1->GrabFocus();
69 bool const mbInsertPage;
70 std::unique_ptr<weld::Frame> mxFrame1;
71 std::unique_ptr<ValueSet> mxLayoutSet1;
72 std::unique_ptr<weld::CustomWeld> mxLayoutSetWin1;
73 std::unique_ptr<weld::Frame> mxFrame2;
74 std::unique_ptr<ValueSet> mxLayoutSet2;
75 std::unique_ptr<weld::CustomWeld> mxLayoutSetWin2;
76 std::unique_ptr<weld::Button> mxMoreButton;
79struct snew_slide_value_info_layout
88constexpr OUStringLiteral
EMPTY =
u"";
90const snew_slide_value_info_layout
notes[] =
96const snew_slide_value_info_layout
handout[] =
136 Size aLayoutItemSize;
137 for( ; pInfo->mpStrResId; pInfo++ )
139 OUString aText(
SdResId(pInfo->mpStrResId));
140 Image aImg(StockImage::Yes, pInfo->msBmpResId);
141 pValue->
InsertItem(
static_cast<sal_uInt16
>(pInfo->maAutoLayout)+1, aImg, aText);
149 const sal_Int32 LAYOUT_BORDER_PIX = 7;
154 pValue->GetDrawingArea()->set_size_request(aSize.
Width(), aSize.
Height());
155 pValue->SetOutputSizePixel(aSize);
158LayoutToolbarMenu::LayoutToolbarMenu(SlideLayoutController* pControl,
weld::Widget* pParent,
const bool bInsertPage,
const OUString& rCommand)
159 :
WeldToolbarPopup(pControl->getFrameInterface(), pParent,
"modules/simpress/ui/layoutwindow.ui",
"LayoutWindow")
160 , mxControl(pControl)
161 , mbInsertPage(bInsertPage)
162 , mxFrame1(m_xBuilder->weld_frame(
"horiframe"))
163 , mxLayoutSet1(new
ValueSet(nullptr))
164 , mxLayoutSetWin1(new
weld::CustomWeld(*m_xBuilder,
"valueset1", *mxLayoutSet1))
165 , mxFrame2(m_xBuilder->weld_frame(
"vertframe"))
166 , mxLayoutSet2(new
ValueSet(nullptr))
167 , mxLayoutSetWin2(new
weld::CustomWeld(*m_xBuilder,
"valueset2", *mxLayoutSet2))
168 , mxMoreButton(m_xBuilder->weld_button(
"more"))
170 mxLayoutSet1->SetStyle(WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT);
171 mxLayoutSet2->SetStyle(WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT);
173 DrawViewMode
eMode = DrawViewMode_DRAW;
178 Reference< XPropertySet > xControllerSet(
m_xFrame->getController(), UNO_QUERY_THROW );
179 xControllerSet->getPropertyValue(
"DrawViewMode" ) >>=
eMode;
188 mxLayoutSet1->SetSelectHdl(
LINK(
this, LayoutToolbarMenu, SelectValueSetHdl ) );
190 const snew_slide_value_info_layout* pInfo =
nullptr;
191 sal_Int16 nColCount = 4;
194 case DrawViewMode_DRAW: pInfo = &
standard[0];
break;
195 case DrawViewMode_HANDOUT: pInfo = &
handout[0]; nColCount = 2;
break;
196 case DrawViewMode_NOTES: pInfo = &
notes[0]; nColCount = 1;
break;
197 default: assert(
false);
200 mxLayoutSet1->SetColCount( nColCount );
204 bool bUseUILabel = (bVerticalEnabled &&
eMode == DrawViewMode_DRAW);
211 if (bVerticalEnabled && eMode == DrawViewMode_DRAW)
213 mxLayoutSet2->SetSelectHdl(
LINK(
this, LayoutToolbarMenu, SelectValueSetHdl ) );
214 mxLayoutSet2->SetColCount( 4 );
215 mxLayoutSet2->EnableFullItemMode(
false );
222 if( eMode != DrawViewMode_DRAW )
231 sSlotStr =
".uno:DuplicatePage";
233 sSlotStr =
".uno:Undo";
244 sSlotTitle =
SdResId( STR_RESET_LAYOUT );
246 mxMoreButton->set_label(sSlotTitle);
247 mxMoreButton->set_image(xSlotImage);
248 mxMoreButton->connect_clicked(
LINK(
this, LayoutToolbarMenu, SelectToolbarMenuHdl));
249 mxMoreButton->show();
254 SelectHdl(
static_cast<AutoLayout>(pLayoutSet->GetSelectedItemId()-1));
262void LayoutToolbarMenu::SelectHdl(
AutoLayout eLayout)
264 Sequence< PropertyValue > aArgs;
266 OUString sCommandURL( mxControl->getCommandURL() );
268 if( eLayout != AUTOLAYOUT_END )
272 else if( mbInsertPage )
274 sCommandURL =
".uno:DuplicatePage";
277 mxControl->dispatchCommand( sCommandURL, aArgs );
279 mxControl->EndPopupMode();
286 return "com.sun.star.comp.sd.SlideLayoutController";
292 Sequence<OUString> aSNS {
"com.sun.star.frame.ToolbarController" };
299 return "com.sun.star.comp.sd.InsertSlideController";
305 Sequence<OUString> aSNS {
"com.sun.star.frame.ToolbarController" };
309SlideLayoutController::SlideLayoutController(
const Reference< uno::XComponentContext >& rxContext,
bool bInsertPage)
310 :
svt::PopupWindowController(rxContext, nullptr, OUString())
311 , mbInsertPage(bInsertPage)
317 svt::PopupWindowController::initialize(
aArguments );
321 if ( getToolboxId(
nId, &pToolBox ) )
332 return std::make_unique<sd::LayoutToolbarMenu>(
this, m_pToolbar,
mbInsertPage, m_aCommandURL);
365extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
367 css::uno::Sequence<css::uno::Any>
const &)
372extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
374 css::uno::Sequence<css::uno::Any>
const &)
PropertiesInfo aProperties
css::uno::Reference< css::lang::XComponent > m_xFrame
AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT
AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT
AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT
AUTOLAYOUT_VTITLE_VCONTENT
AUTOLAYOUT_TITLE_2CONTENT
AUTOLAYOUT_TITLE_6CONTENT
AUTOLAYOUT_TITLE_2CONTENT_CONTENT
AUTOLAYOUT_TITLE_CONTENT_2CONTENT
AUTOLAYOUT_TITLE_VCONTENT
AUTOLAYOUT_TITLE_4CONTENT
Size GetSizePixel() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
void InsertItem(sal_uInt16 nItemId, const Image &rImage)
Size CalcWindowSizePixel(const Size &rItemSize, sal_uInt16 nCalcCols=0, sal_uInt16 nCalcLines=0) const
Size CalcItemSizePixel(const Size &rSize) const
sal_uInt16 GetColCount() const
sal_uInt16 GetLineCount() const
static VclPtr< reference_type > Create(Arg &&... arg)
virtual OUString SAL_CALL getImplementationName() override
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow() override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual VclPtr< vcl::Window > createVclPopupWindow(vcl::Window *pParent) override
weld::Window * GetFrameWeld() const
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
Sequence< PropertyValue > aArguments
#define LINK(Instance, Class, Member)
bool IsVerticalTextEnabled()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
IMPL_LINK(LayoutToolbarMenu, SelectValueSetHdl, ValueSet *, pLayoutSet, void)
IMPL_LINK_NOARG(LayoutToolbarMenu, SelectToolbarMenuHdl, weld::Button &, void)
const snew_slide_value_info_layout v_standard[]
static OUString SlideLayoutController_getImplementationName()
static Sequence< OUString > SlideLayoutController_getSupportedServiceNames()
const snew_slide_value_info_layout standard[]
static Sequence< OUString > InsertSlideController_getSupportedServiceNames()
const snew_slide_value_info_layout handout[]
const snew_slide_value_info_layout notes[]
constexpr OUStringLiteral EMPTY
static OUString InsertSlideController_getImplementationName()
static void fillLayoutValueSet(ValueSet *pValue, const snew_slide_value_info *pInfo)
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
Reference< graphic::XGraphic > GetXGraphicForCommand(const OUString &rsCommandName, const Reference< frame::XFrame > &rxFrame, vcl::ImageType eImageType)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
OUString SdResId(TranslateId aId)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_sd_SlideLayoutController_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_sd_InsertSlideController_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)