17#include <bitmaps.hlst>
37 explicit DisplayModeController(
const css::uno::Reference< css::uno::XComponentContext >& rxContext );
39 virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow()
override;
43 virtual void SAL_CALL initialize(
const css::uno::Sequence< css::uno::Any >& aArguments )
override;
49 void setToolboxItemImage(
const OUString& rImage);
55 DisplayModeToolbarMenu(DisplayModeController* pControl,
weld::Widget* pParent);
58 mxDisplayModeSet1->GrabFocus();
63 std::unique_ptr<weld::Frame> mxFrame1;
64 std::unique_ptr<ValueSet> mxDisplayModeSet1;
65 std::unique_ptr<weld::CustomWeld> mxDisplayModeSetWin1;
66 std::unique_ptr<weld::Frame> mxFrame2;
67 std::unique_ptr<ValueSet> mxDisplayModeSet2;
68 std::unique_ptr<weld::CustomWeld> mxDisplayModeSetWin2;
73struct snew_slide_value_info
78 const char* msUnoCommand;
86 BMP_DISPLAYMODE_SLIDE,
88 ".uno:NormalMultiPaneGUI" },
90 BMP_DISPLAYMODE_OUTLINE,
94 BMP_DISPLAYMODE_NOTES,
98 BMP_DISPLAYMODE_SLIDE_SORTER,
99 STR_SLIDE_SORTER_MODE,
107 BMP_DISPLAYMODE_SLIDE_MASTER,
108 STR_SLIDE_MASTER_MODE,
109 ".uno:SlideMasterPage" },
111 BMP_DISPLAYMODE_NOTES_MASTER,
112 STR_NOTES_MASTER_MODE,
113 ".uno:NotesMasterPage" },
115 BMP_DISPLAYMODE_HANDOUT_MASTER,
116 STR_HANDOUT_MASTER_MODE,
117 ".uno:HandoutMode" },
124 Size aLayoutItemSize;
125 for( ; pInfo->mnId; pInfo++ )
127 OUString aText(
SdResId(pInfo->mpStrResId));
139 const sal_Int32 LAYOUT_BORDER_PIX = 7;
143 pValue->GetDrawingArea()->set_size_request(aSize.
Width(), aSize.
Height());
144 pValue->SetOutputSizePixel(aSize);
147DisplayModeToolbarMenu::DisplayModeToolbarMenu(DisplayModeController* pControl,
weld::Widget* pParent)
148 :
WeldToolbarPopup(pControl->getFrameInterface(), pParent,
"modules/simpress/ui/displaywindow.ui",
"DisplayWindow")
149 , mxControl(pControl)
150 , mxFrame1(m_xBuilder->weld_frame(
"editframe"))
151 , mxDisplayModeSet1(new
ValueSet(nullptr))
152 , mxDisplayModeSetWin1(new
weld::CustomWeld(*m_xBuilder,
"valueset1", *mxDisplayModeSet1))
153 , mxFrame2(m_xBuilder->weld_frame(
"masterframe"))
154 , mxDisplayModeSet2(new
ValueSet(nullptr))
155 , mxDisplayModeSetWin2(new
weld::CustomWeld(*m_xBuilder,
"valueset2", *mxDisplayModeSet2))
157 mxDisplayModeSet1->SetStyle(WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT);
158 mxDisplayModeSet1->SetStyle(WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT);
160 mxDisplayModeSet1->SetSelectHdl(
LINK(
this, DisplayModeToolbarMenu, SelectValueSetHdl ) );
161 mxDisplayModeSet2->SetSelectHdl(
LINK(
this, DisplayModeToolbarMenu, SelectValueSetHdl ) );
163 sal_Int16 nColCount = 2;
165 mxDisplayModeSet1->SetColCount( nColCount );
168 mxDisplayModeSet2->SetColCount( nColCount );
174 OUString sCommandURL;
177 if( pControl == mxDisplayModeSet1.get() ) {
178 sCommandURL = OUString::createFromAscii(
editmodes[mxDisplayModeSet1->GetSelectedItemId() - 1 ].msUnoCommand);
179 sImage =
editmodes[mxDisplayModeSet1->GetSelectedItemId() - 1 ].msBmpResId;
181 else if( pControl == mxDisplayModeSet2.get() ) {
182 sCommandURL = OUString::createFromAscii(
mastermodes[mxDisplayModeSet2->GetSelectedItemId() - 5 ].msUnoCommand);
183 sImage =
mastermodes[mxDisplayModeSet2->GetSelectedItemId() - 5 ].msBmpResId;
186 if (!sCommandURL.isEmpty())
187 mxControl->dispatchCommand( sCommandURL, Sequence< PropertyValue >() );
189 mxControl->setToolboxItemImage(sImage);
190 mxControl->EndPopupMode();
193DisplayModeController::DisplayModeController(
const css::uno::Reference< css::uno::XComponentContext >& rxContext )
194:
svt::PopupWindowController( rxContext,
Reference< frame::XFrame >(), OUString() )
198void SAL_CALL DisplayModeController::initialize(
const css::uno::Sequence< css::uno::Any >& aArguments )
200 svt::PopupWindowController::initialize( aArguments );
203 if ( getToolboxId( nId, &pToolBox ) )
205 setToolboxItemImage(BMP_DISPLAYMODE_SLIDE);
208std::unique_ptr<WeldToolbarPopup> DisplayModeController::weldPopupWindow()
210 return std::make_unique<sd::DisplayModeToolbarMenu>(
this, m_pToolbar);
216 std::make_unique<sd::DisplayModeToolbarMenu>(
this, pParent->
GetFrameWeld()));
218 mxInterimPopover->Show();
220 return mxInterimPopover;
223void DisplayModeController::setToolboxItemImage(
const OUString& rImage)
227 if (!getToolboxId( nId, &pToolBox ))
234 if (
size.Width() > targetSize)
235 scale =
static_cast<double>(targetSize) /
static_cast<double>(
size.Width());
236 if (
size.Height() > targetSize)
237 scale = ::std::min( scale,
static_cast<double>(targetSize) /
static_cast<double>(
size.Height()) );
238 aBmp.Scale( scale, scale );
244OUString SAL_CALL DisplayModeController::getImplementationName()
246 return "com.sun.star.comp.sd.DisplayModeController";
249Sequence< OUString > SAL_CALL DisplayModeController::getSupportedServiceNames( )
251 css::uno::Sequence<OUString> aRet {
"com.sun.star.frame.ToolbarController" };
257extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface*
259 css::uno::Sequence<css::uno::Any>
const &)
261 return cppu::acquire(
new sd::DisplayModeController(context));
const 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)
weld::Window * GetFrameWeld() const
SAL_DLLPUBLIC_EXPORT::com::sun::star::uno::XInterface * com_sun_star_comp_sd_DisplayModeController_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
#define LINK(Instance, Class, Member)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
const snew_slide_value_info editmodes[]
IMPL_LINK(DisplayModeToolbarMenu, SelectValueSetHdl, ValueSet *, pControl, void)
const snew_slide_value_info mastermodes[]
static void fillLayoutValueSet(ValueSet *pValue, const snew_slide_value_info *pInfo)
OUString SdResId(TranslateId aId)