26#include <osl/diagnose.h>
38#include <svx/svxids.hrc>
55using ::sd::framework::FrameworkHelper;
56using ::com::sun::star::uno::Reference;
57using ::com::sun::star::frame::XFrame;
61class OutlineToImpressFinalizer final
64 OutlineToImpressFinalizer (
68 void operator() (
bool bEventSeen);
72 std::shared_ptr<SvMemoryStream> mpStream;
80 sal_uInt16 nSlotId = rReq.
GetSlot();
90 case SID_AUTOSPELL_CHECK:
94 if( pSet && (pItem = pSet->
GetItemIfSet( SID_AUTOSPELL_CHECK,
false ) ) )
96 bool bOnlineSpelling = pItem->
GetValue();
108 case SID_ATTR_METRIC:
111 if ( pSet && (pItem = pSet->
GetItemIfSet( SID_ATTR_METRIC ) ) )
118 case FieldUnit::INCH:
119 case FieldUnit::PICA:
120 case FieldUnit::POINT:
130 pOptions->
SetMetric(
static_cast<sal_uInt16
>(eUnit) );
143 case SID_ATTR_LANGUAGE:
144 case SID_ATTR_CHAR_CJK_LANGUAGE:
145 case SID_ATTR_CHAR_CTL_LANGUAGE:
150 SfxItemState::SET == pSet->
GetItemState(SID_ATTR_LANGUAGE,
false, &pItem ) ||
151 SfxItemState::SET == pSet->
GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE,
false, &pItem ) ||
152 SfxItemState::SET == pSet->
GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE,
false, &pItem )
163 if( nSlotId == SID_ATTR_CHAR_CJK_LANGUAGE )
165 else if( nSlotId == SID_ATTR_CHAR_CTL_LANGUAGE )
190 case SID_OPENHYPERLINK:
193 bool bIntercept =
false;
220 VclMessageType::Warning, VclButtonsType::Ok,
SdResId(STR_CANT_PERFORM_IN_LIVEMODE)));
231 case SID_OUTLINE_TO_IMPRESS:
252 xDocShell = pDocSh = new ::sd::DrawDocShell(
280 if (pBase !=
nullptr)
282 std::shared_ptr<FrameworkHelper> pHelper (
283 FrameworkHelper::Instance(*pBase));
284 pHelper->RequestView(
285 FrameworkHelper::msOutlineViewURL,
286 FrameworkHelper::msCenterPaneURL);
288 pHelper->RunOnResourceActivation(
289 FrameworkHelper::CreateResourceId(
290 FrameworkHelper::msOutlineViewURL,
291 FrameworkHelper::msCenterPaneURL),
292 OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes));
303 if( SfxItemState::DEFAULT == rItemSet.
GetItemState( SID_ATTR_METRIC ) )
316 if (rItemSet.
GetItemState(SID_OPENDOC) != SfxItemState::UNKNOWN)
320 rItemSet.
Put(*pItem);
324 if (rItemSet.
GetItemState(SID_OPENHYPERLINK) != SfxItemState::UNKNOWN)
328 rItemSet.
Put(*pItem);
331 if( SfxItemState::DEFAULT == rItemSet.
GetItemState( SID_AUTOSPELL_CHECK ) )
342 if( SfxItemState::DEFAULT == rItemSet.
GetItemState( SID_ATTR_LANGUAGE ) )
349 if( SfxItemState::DEFAULT == rItemSet.
GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE ) )
356 if( SfxItemState::DEFAULT == rItemSet.
GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE ) )
382 if( !((rSimpleEvent.GetId() == VclEventId::WindowCommand) &&
static_cast<VclWindowEvent*
>(&rSimpleEvent)->
GetData()) )
387 if( rEvent.
GetCommand() != CommandEventId::Media )
394 case MediaCommand::Play:
415 const bool bReplaceable)
437 OSL_ENSURE( pViewFrame,
"SdModule::CreateFromTemplate: no view frame - was the document really loaded?" );
438 pFrame = pViewFrame ? &pViewFrame->
GetFrame() :
nullptr;
450 Reference< XFrame > xTargetFrame;
453 xTargetFrame = pFrmItem->
GetFrame();
458 bool bNewDocDirect = rReq.
GetSlot() == SID_NEWSD;
467 if( !aStandardTemplate.isEmpty() )
479 if (bStartWithTemplate)
500 pDispatcher->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, { &aDocFrame });
515 xDocShell = pNewDocSh = new ::sd::DrawDocShell(SfxObjectCreateMode::STANDARD,
false,
DocumentType::Impress);
527 OSL_ENSURE( pViewFrame,
"SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" );
528 pFrame = pViewFrame ? &pViewFrame->
GetFrame() :
nullptr;
537OutlineToImpressFinalizer::OutlineToImpressFinalizer (
542 mrDocument(rDocument)
548 if (pStream ==
nullptr)
553 mpStream = std::make_shared<SvMemoryStream>();
554 static const std::size_t nBufferSize = 4096;
555 ::std::unique_ptr<sal_Int8[]> pBuffer (
new sal_Int8[nBufferSize]);
557 sal_uInt64 nReadPosition(0);
562 std::size_t nReadByteCount (0);
572 if (nErrorCode == ERRCODE_NONE)
574 if (nReadByteCount == 0)
577 else if (nErrorCode == ERRCODE_IO_PENDING)
586 if (nReadByteCount > 0)
588 mpStream->WriteBytes(pBuffer.get(), nReadByteCount);
589 nReadPosition += nReadByteCount;
595 mpStream->Seek(STREAM_SEEK_TO_BEGIN);
598void OutlineToImpressFinalizer::operator() (
bool)
602 =
dynamic_cast<sd::OutlineViewShell*
>(FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
604 if (pOutlineShell !=
nullptr && mpStream !=
nullptr)
609 pOutlineShell->
ReadRtf(*mpStream);
SfxApplication * SfxGetpApp()
static void AddEventListener(const Link< VclSimpleEvent &, void > &rEventListener)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
sal_uInt16 GetValue() const
CommandEventId GetCommand() const
CommandMediaData * GetMediaData() const
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
void CreateFirstPages(SdDrawDocument const *pRefDocument=nullptr)
if the document does not contain at least one handout, one slide and one notes page with at least one...
SAL_DLLPRIVATE void StopOnlineSpelling()
SAL_DLLPRIVATE void SetOnlineSpell(bool bIn)
SAL_DLLPRIVATE bool GetOnlineSpell() const
void StopWorkStartupDelay()
SAL_DLLPRIVATE void SetLanguage(const LanguageType eLang, const sal_uInt16 nId)
SAL_DLLPRIVATE void StartOnlineSpelling(bool bForceSpelling=true)
SAL_DLLPRIVATE LanguageType GetLanguage(const sal_uInt16 nId) const
SAL_DLLPRIVATE DocumentType GetDocumentType() const
void GetState(SfxItemSet &)
SfxFrame * ExecuteNewDocument(SfxRequest const &rReq)
SdOptions * GetSdOptions(DocumentType eDocType)
Return options.
static bool OutlineToImpress(SfxRequest const &rRequest)
Take an outline from a text document and create a new impress document according to the structure of ...
void Execute(SfxRequest &rReq)
bool mbEventListenerAdded
static SfxFrame * CreateEmptyDocument(const css::uno::Reference< css::frame::XFrame > &i_rFrame)
static SfxFrame * CreateFromTemplate(const OUString &rTemplatePath, const css::uno::Reference< css::frame::XFrame > &i_rFrame, const bool bReplaceable)
void SetMetric(sal_uInt16 nInMetric)
sal_uInt16 GetMetric() const
bool IsStartWithTemplate() const
void SetStartWithTemplate(bool bOn)
static bool IsHeadlessOrUITest()
ErrCode LoadTemplate(SfxObjectShellLock &xDoc, const OUString &rFileName, std::unique_ptr< SfxItemSet > pArgs)
static bool IsTipOfTheDayDue()
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const Link< SfxPoolItem const *, void > & GetValue() const
SfxItemSet & GetItemSet() const
static OUString GetStandardTemplate(std::u16string_view rServiceName)
SfxMedium * GetMedium() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void SetReturnValue(const SfxPoolItem &)
void Done(bool bRemove=false)
void PutItem(const SfxPoolItem &rItem)
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
SfxItemPool & GetPool() const
virtual SfxInterface * GetInterface() const
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
SfxViewShell * GetViewShell() const
SfxDispatcher * GetDispatcher() const
OUString const & getTemplatePath() const
virtual short run() override
bool IsStartWithTemplate() const
const css::uno::Reference< css::frame::XFrame > & GetFrame() const
static SfxViewFrame * LoadDocumentIntoFrame(SfxObjectShell const &i_rDoc, const SfxFrameItem *i_pFrameItem, SfxInterfaceId i_nViewId)
SfxDispatcher * GetDispatcher()
SfxFrame & GetFrame() const
virtual ErrCode ReadAt(sal_uInt64 nPos, void *pBuffer, std::size_t nCount, std::size_t *pRead) const
const SvStream * GetStream() const
sd::ViewShell * GetViewShell()
DocumentType GetDocumentType() const
SdDrawDocument * GetDoc()
Show a textual overview of the text contents of all slides.
ErrCode ReadRtf(SvStream &rInput)
Fill Outliner from Stream.
virtual void UpdatePreview(SdPage *pPage) override
Update the preview to show the specified page.
Derivative of sd::View for the outline mode |* .
void SetActualPage(SdPage const *pActual)
selects the paragraph for the given page at the outliner view
static bool IsRunning(ViewShellBase const &rBase)
returns true if there is a running presentation for the given ViewShellBase
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
Base class of the stacked shell hierarchy.
::sd::View * GetView() const
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CTL(EE_CHAR_START+16)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CJK(EE_CHAR_START+15)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
#define LINK(Instance, Class, Member)
constexpr auto OUTLINE_FACTORY_ID
IMPL_STATIC_LINK(SdModule, EventListenerHdl, VclSimpleEvent &, rSimpleEvent, void)
OUString SdResId(TranslateId aId)