30#include <osl/diagnose.h>
44#include <bitmaps.hlst>
63 OUStringBuffer aEntry(rEntry);
64 for (sal_Int32
i = 0;
i < rEntry.getLength(); ++
i)
65 if(aEntry[
i] == 10 || aEntry[
i] == 9)
68 return aEntry.makeStringAndClear();
87 if(nMove > 1 && nLastOutlinePos < nTarget)
91 nMove -= nLastOutlinePos - nSource;
93 if( nMove < 1 || nLastOutlinePos < nTarget )
113 int nEntryIdx = rBox.get_active();
116 while (nEntryIdx-- && pView)
123 m_xContentTree->ShowHiddenShell():
124 m_xContentTree->ShowActualView();
145 m_xContentTree->SelectContentType(rComboBox.get_active_text());
185 const sal_uInt16 nPageCnt = pSh->
GetPageCnt();
186 sal_uInt16 nPhyPage, nVirPage;
198 SwView *pView = GetCreateView();
205 bool bFocusToDoc =
false;
206 if (rCommand ==
".uno:ScrollToPrevious" || rCommand ==
".uno:ScrollToNext")
208 bool *pbNext =
new bool(
true);
209 if (rCommand ==
".uno:ScrollToPrevious")
211 pView->MoveNavigationHdl(pbNext);
213 else if (rCommand ==
"root")
215 m_xContentTree->ToggleToRoot();
217 else if (rCommand ==
"listbox")
233 else if (rCommand ==
"footer")
246 else if (rCommand ==
"header")
259 else if (rCommand ==
"anchor")
283 else if (rCommand ==
"reminder")
287 else if (rCommand ==
"chapterdown" ||
288 rCommand ==
"movedown" ||
289 rCommand ==
"chapterup" ||
290 rCommand ==
"moveup" ||
291 rCommand ==
"promote" ||
292 rCommand ==
"demote" ||
296 m_xGlobalTree->ExecCommand(rCommand);
301 bool bOutlineWithChildren = (
KEY_MOD1 != m_xContent6ToolBox->get_modifier_state());
302 m_xContentTree->ExecCommand(rCommand, bOutlineWithChildren);
305 else if (rCommand ==
"contenttoggle" || rCommand ==
"globaltoggle")
308 bool bGlobalMode = IsGlobalMode();
309 m_pConfig->SetGlobalActive(bGlobalMode);
310 m_xGlobalToolBox->set_item_active(
"globaltoggle", bGlobalMode);
311 m_xContent1ToolBox->set_item_active(
"contenttoggle", bGlobalMode);
313 else if (rCommand ==
"save")
317 m_xGlobalToolBox->set_item_active(rCommand, !bSave);
319 else if (rCommand ==
"dragmode")
320 m_xContent6ToolBox->set_menu_item_active(
"dragmode", !m_xContent6ToolBox->get_menu_item_active(
"dragmode"));
321 else if (rCommand ==
"headings")
322 m_xContent5ToolBox->set_menu_item_active(
"headings", !m_xContent5ToolBox->get_menu_item_active(
"headings"));
323 else if (rCommand ==
"update")
324 m_xGlobalToolBox->set_menu_item_active(
"update", !m_xGlobalToolBox->get_menu_item_active(
"update"));
325 else if (rCommand ==
"insert")
326 m_xGlobalToolBox->set_menu_item_active(
"insert", !m_xGlobalToolBox->get_menu_item_active(
"insert"));
337 if (!m_xGlobalToolBox->get_menu_item_active(rCommand))
340 if (rCommand ==
"update")
341 m_xGlobalTree->TbxMenuHdl(rCommand, *m_xUpdateMenu);
342 else if (rCommand ==
"insert")
343 m_xGlobalTree->TbxMenuHdl(rCommand, *m_xInsertMenu);
348 if (!m_xContent6ToolBox->get_menu_item_active(rCommand))
351 if (rCommand !=
"dragmode")
354 switch (m_nRegionMode)
356 case RegionMode::NONE:
357 m_xDragModeMenu->set_active(
"hyperlink",
true);
359 case RegionMode::LINK:
360 m_xDragModeMenu->set_active(
"link",
true);
362 case RegionMode::EMBEDDED:
363 m_xDragModeMenu->set_active(
"copy",
true);
370 if (rIdent ==
"hyperlink")
371 SetRegionDropMode(RegionMode::NONE);
372 else if (rIdent ==
"link")
373 SetRegionDropMode(RegionMode::LINK);
374 else if (rIdent ==
"copy")
375 SetRegionDropMode(RegionMode::EMBEDDED);
380 m_xGlobalTree->ExecuteContextMenuAction(rIdent);
385 if (!m_xContent5ToolBox->get_menu_item_active(rCommand))
388 if (rCommand ==
"headings")
389 m_xHeadingsMenu->set_active(OUString::number(m_xContentTree->GetOutlineLevel()),
true);
407 if (
m_xEdit->get_text().isEmpty())
409 sal_Int64 nNewPage =
m_xEdit->get_text().toInt32();
414 else if (nNewPage >
max)
446 pNav->InvalidateChildSizeCache();
447 Size aOptimalSize(pNav->GetOptimalSize());
448 Size aNewSize(pNav->GetOutputSizePixel());
451 pNav->SetOutputSizePixel(aNewSize);
475 pNav->InvalidateChildSizeCache();
476 Size aOptimalSize(pNav->GetOptimalSize());
477 Size aNewSize(pNav->GetOutputSizePixel());
480 pNav->SetOutputSizePixel(aNewSize);
500 const css::uno::Reference<css::frame::XFrame>& rxFrame,
503 if( pParent ==
nullptr )
504 throw css::lang::IllegalArgumentException(
"no parent window given to SwNavigationPI::Create",
nullptr, 0);
506 throw css::lang::IllegalArgumentException(
"no XFrame given to SwNavigationPI::Create",
nullptr, 0);
507 if( pBindings ==
nullptr )
508 throw css::lang::IllegalArgumentException(
"no SfxBindings given to SwNavigationPI::Create",
nullptr, 0);
509 return std::make_unique<SwNavigationPI>(pParent, rxFrame, pBindings,
nullptr);
514 SwView* pView = GetCreateView();
517 if (m_xEdit->get_text().isEmpty())
519 sal_Int64 page_value = m_xEdit->get_text().toInt32();
520 SwWrtShell& rSh = m_pCreateView->GetWrtShell();
523 m_xEdit->set_value(1);
524 else if (page_value >
max)
525 m_xEdit->set_value(
max);
527 m_xEdit->set_value(page_value);
528 m_xEdit->set_position(-1);
532 const css::uno::Reference<css::frame::XFrame>& rxFrame,
534 :
PanelLayout(pParent,
"NavigatorPanel",
"modules/swriter/ui/navigatorpanel.ui")
535 , m_aDocFullName(SID_DOCFULLNAME, *_pBindings, *this)
537 , m_xContent1ToolBox(m_xBuilder->weld_toolbar(
"content1"))
538 , m_xContent2ToolBox(m_xBuilder->weld_toolbar(
"content2"))
539 , m_xContent3ToolBox(m_xBuilder->weld_toolbar(
"content3"))
540 , m_xContent4ToolBox(m_xBuilder->weld_toolbar(
"content4"))
541 , m_xContent5ToolBox(m_xBuilder->weld_toolbar(
"content5"))
542 , m_xContent6ToolBox(m_xBuilder->weld_toolbar(
"content6"))
545 , m_xHeadingsMenu(m_xBuilder->weld_menu(
"headingsmenu"))
546 , m_xDragModeMenu(m_xBuilder->weld_menu(
"dragmodemenu"))
547 , m_xUpdateMenu(m_xBuilder->weld_menu(
"updatemenu"))
548 , m_xInsertMenu(m_xBuilder->weld_menu(
"insertmenu"))
549 , m_xGlobalToolBox(m_xBuilder->weld_toolbar(
"global"))
550 , m_xEdit(m_xBuilder->weld_spin_button(
"spinbutton"))
551 , m_xContentBox(m_xBuilder->weld_widget(
"contentbox"))
552 , m_xContentTree(new
SwContentTree(m_xBuilder->weld_tree_view(
"contenttree"), this))
553 , m_xGlobalBox(m_xBuilder->weld_widget(
"globalbox"))
554 , m_xGlobalTree(new
SwGlobalTree(m_xBuilder->weld_tree_view(
"globaltree"), this))
555 , m_xDocListBox(m_xBuilder->weld_combo_box(
"documents"))
556 , m_aPageChgIdle(
"SwNavigationPI m_aPageChgIdle")
557 , m_xNavigatorDlg(pNavigatorDlg)
558 , m_pContentView(nullptr)
559 , m_pContentWrtShell(nullptr)
560 , m_pActContView(nullptr)
561 , m_pCreateView(nullptr)
562 , m_pConfig(
SW_MOD()->GetNavigationConfig())
563 , m_rBindings(*_pBindings)
565 , m_bIsZoomedIn(false)
566 , m_bGlobalMode(false)
574 assert(pToolBoxControl);
622 m_xEdit->set_help_id(
"modules/swriter/ui/navigatorpanel/numericfield");
644 static_assert(
SAL_N_ELEMENTS(REGIONNAME_ARY) ==
static_cast<sal_uInt16
>(RegionMode::EMBEDDED) + 1,
"### unexpected size!");
646 for (sal_uInt16
i = 0; i <= static_cast<sal_uInt16>(RegionMode::EMBEDDED); ++
i)
702 if (bFloatingNavigator)
705 else if (bFloatingNavigator)
719 m_xBuilder->weld_container(
"gridcontent16")->hide();
749 (*m_oObjectShell)->DoClose();
782 if (nSID == SID_DOCFULLNAME)
847 if (rHint.
GetId() == SfxHintId::Dying)
859 if (eEventId == SfxEventHintId::OpenDoc)
881 if (!rMenuId.isEmpty())
882 m_xContentTree->SetOutlineLevel(rMenuId.toUInt32());
893 bool bDisable = pActView ==
nullptr;
897 sal_Int32 nConstPos = 0;
908 OUString sEntry = pDoc->
GetTitle() +
" (";
909 if (pView == pActView)
919 if (pConstView && pView == pConstView)
932 GetDocShell()->GetTitle() +
966 m_xContentTree->clear();
968 OSL_ENSURE(m_pContentView,
"no SwView");
970 m_pContentWrtShell = m_pContentView->GetWrtShellPtr();
972 m_pContentWrtShell =
nullptr;
982 if( rData.
HasFormat( nFormat = SotClipboardFormatId::FILE_LIST ))
986 sFileName = aFileList.
GetFile( 0 );
988 else if( rData.
HasFormat( nFormat = SotClipboardFormatId::STRING ) ||
989 rData.
HasFormat( nFormat = SotClipboardFormatId::SIMPLE_FILE ) ||
990 rData.
HasFormat( nFormat = SotClipboardFormatId::FILENAME ))
992 (void)rData.
GetString(nFormat, sFileName);
994 else if( rData.
HasFormat( nFormat = SotClipboardFormatId::SOLK ) ||
995 rData.
HasFormat( nFormat = SotClipboardFormatId::NETSCAPE_BOOKMARK )||
996 rData.
HasFormat( nFormat = SotClipboardFormatId::FILECONTENT ) ||
997 rData.
HasFormat( nFormat = SotClipboardFormatId::FILEGRPDESCRIPTOR ) ||
998 rData.
HasFormat( nFormat = SotClipboardFormatId::UNIFORMRESOURCELOCATOR ))
1002 sFileName = aBkmk.
GetURL();
1004 if( !sFileName.isEmpty() )
1014 (
m_xContentTree->IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE ) ||
1015 m_xContentTree->IsDropFormatSupported( SotClipboardFormatId::STRING ) ||
1016 m_xContentTree->IsDropFormatSupported( SotClipboardFormatId::SOLK ) ||
1017 m_xContentTree->IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK )||
1018 m_xContentTree->IsDropFormatSupported( SotClipboardFormatId::FILECONTENT ) ||
1019 m_xContentTree->IsDropFormatSupported( SotClipboardFormatId::FILEGRPDESCRIPTOR ) ||
1020 m_xContentTree->IsDropFormatSupported( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) ||
1021 m_xContentTree->IsDropFormatSupported( SotClipboardFormatId::FILENAME )))
1034 if (sFileName.isEmpty())
1042 if (-1 != sFileName.indexOf(
'#'))
1053 (*m_oObjectShell)->DoClose();
1061 pView->GetViewFrame().GetDispatcher()->ExecuteList(
1062 SID_OPENDOC, SfxCallMode::ASYNCHRON,
1063 { &aFileItem, &aOptionsItem, &aLink });
1076 case RegionMode::NONE:
1077 sImageId = RID_BMP_DROP_REGION;
1079 case RegionMode::LINK:
1080 sImageId = RID_BMP_DROP_LINK;
1082 case RegionMode::EMBEDDED:
1083 sImageId = RID_BMP_DROP_COPY;
1174 m_pCreateView->GetEditWin().GrabFocus();
1180 if (m_aPageChgIdle.IsActive())
1181 m_aPageChgIdle.Stop();
1182 m_aPageChgIdle.Start();
1240 if (nStateChange == StateChangedType::InitShow)
SfxApplication * SfxGetpApp()
SFX2_DLLPUBLIC bool ParentIsFloatingWindow(const vcl::Window *pParent)
OUString GetFile(size_t nIndex) const
bool Detect(bool bExtendedInfo=false)
const OUString & GetURL() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
virtual weld::Window * GetFrameWeld() const
std::unique_ptr< weld::Builder > m_xBuilder
std::unique_ptr< weld::Container > m_xContainer
void Invalidate(sal_uInt16 nId)
void SetWindow(const VclPtr< vcl::Window > &p)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
virtual void StateChanged(StateChangedType nStateChange) override
virtual void dispose() override
void SetMinOutputSizePixel(const Size &rSize)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
void SetReadOnlyUI(bool bReadOnly=true)
OUString GetTitle(sal_uInt16 nMaxLen=0) const
bool IsHelpDocument() const
SfxViewFrame * GetFrame() const
SfxViewShell * GetViewShell() const
SfxViewFrame * GetFrame() const
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
virtual SfxObjectShell * GetObjectShell() override
SfxViewFrame & GetViewFrame() const
constexpr tools::Long Height() const
void setHeight(tools::Long nHeight)
TreeListBox for content indicator.
bool GotoNextFootnoteAnchor()
bool GotoHeaderText()
jump from the content to the header
void MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, bool bWithChildren, bool bKillPams=true)
void GetPageNum(sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, bool bAtCursorPos=true, const bool bCalcFrame=true)
bool GotoFootnoteText()
jump from content to footnote
bool GotoPrevFootnoteAnchor()
SwOutlineNodes::size_type GetOutlinePos(sal_uInt8 nLevel=UCHAR_MAX, SwPaM *pPaM=nullptr)
search "outline position" before previous outline node at given level
bool IsCursorPtAtEnd() const
bool GotoFooterText()
jump from the content to the footer
bool IsAllProtect() const
void SetGlblDocSaveLinks(bool bFlag)
bool IsGlblDocSaveLinks() const
bool IsOutlineMovable(SwOutlineNodes::size_type nIdx) const
May an outline be moved or copied? Check whether it's in text body, not in table, and not read-only (...
bool MoveOutlinePara(SwOutlineNodes::difference_type nOffset)
bool IsGlobalDoc() const
Interfaces for GlobalDocument.
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
bool IsFrameSelected() const
static SwView * GetNextView(SwView const *)
static SwView * GetFirstView()
sal_Int32 GetOutlineLevel() const
sal_Int32 GetOutlineTracking() const
bool IsGlobalActive() const
RegionMode GetRegionMode() const
bool IsContentTypeTrack(ContentTypeId eCntTypeId)
void SetRegionMode(RegionMode nSet)
ContentTypeId GetRootType() const
SfxBindings & m_rBindings
SwNavigationPI(weld::Widget *pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > &rxFrame, SfxBindings *_pBindings, SfxNavigator *pNavigatorDlg)
std::unique_ptr< weld::Widget > m_xGlobalBox
virtual void NotifyItemUpdate(const sal_uInt16 nSId, const SfxItemState eState, const SfxPoolItem *pState) override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
void SetGlobalMode(bool bSet)
weld::ComboBox * m_pNavigateByComboBox
std::unique_ptr< weld::Toolbar > m_xContent4ToolBox
SwView * GetCreateView() const
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
bool IsGlobalMode() const
std::optional< SfxObjectShellLock > m_oObjectShell
static OUString CreateDropFileName(const TransferableDataHelper &rData)
static std::unique_ptr< PanelLayout > Create(weld::Widget *pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > &rxFrame, SfxBindings *pBindings)
virtual ~SwNavigationPI() override
std::unique_ptr< weld::Toolbar > m_xContent1ToolBox
std::unique_ptr< weld::Toolbar > m_xGlobalToolBox
std::unique_ptr< weld::Toolbar > m_xContent2ToolBox
std::unique_ptr< ToolbarUnoDispatcher > m_xContent3Dispatch
std::unique_ptr< weld::SpinButton > m_xEdit
std::unique_ptr< SwContentTree > m_xContentTree
void MoveOutline(SwOutlineNodes::size_type nSource, SwOutlineNodes::size_type nTarget)
std::unique_ptr< weld::Menu > m_xDragModeMenu
std::unique_ptr< weld::Menu > m_xUpdateMenu
std::unique_ptr< weld::Toolbar > m_xContent3ToolBox
SwNavigationConfig * m_pConfig
virtual weld::Window * GetFrameWeld() const override
std::unique_ptr< weld::Toolbar > m_xContent5ToolBox
::sfx2::sidebar::ControllerItem m_aDocFullName
VclPtr< SfxNavigator > m_xNavigatorDlg
static OUString CleanEntry(const OUString &rEntry)
void SelectNavigateByContentType(const OUString &rContentTypeName)
void SetRegionDropMode(RegionMode nNewMode)
SwWrtShell * m_pContentWrtShell
std::unique_ptr< weld::Menu > m_xInsertMenu
std::unique_ptr< weld::Menu > m_xHeadingsMenu
std::unique_ptr< SwGlobalTree > m_xGlobalTree
OUString m_sContentFileName
std::unique_ptr< ToolbarUnoDispatcher > m_xContent2Dispatch
std::unique_ptr< weld::Widget > m_xContentBox
::sfx2::sidebar::ControllerItem m_aPageStats
std::unique_ptr< weld::ComboBox > m_xDocListBox
std::unique_ptr< weld::Toolbar > m_xContent6ToolBox
virtual void dispose() override
SwNavigatorWin(SfxBindings *_pBindings, SfxChildWindow *_pMgr, vcl::Window *pParent, SfxChildWinInfo *pInfo)
virtual ~SwNavigatorWin() override
virtual void StateChanged(StateChangedType nStateChange) override
std::unique_ptr< SwNavigationPI > m_xNavi
SwNavigatorWrapper(vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo)
static constexpr auto npos
SwWrtShell & GetWrtShell() const
SwWrtShell * GetWrtShellPtr() const
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
bool EndPg(bool bSelect=false)
bool GotoPage(sal_uInt16 nPage, bool bRecord)
bool SttPg(bool bSelect=false)
void GotoFootnoteAnchor(const SwTextFootnote &rTextFootnote)
void GotoOutline(SwOutlineNodes::size_type nIdx)
void MoveCursor(bool bWithSelect=false)
const SwView & GetView() const
void SetPriority(TaskPriority ePriority)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
bool GetString(SotClipboardFormatId nFormat, OUString &rStr) const
bool GetFileList(SotClipboardFormatId nFormat, FileList &rFileList) const
bool HasFormat(SotClipboardFormatId nFormat) const
bool GetINetBookmark(SotClipboardFormatId nFormat, INetBookmark &rBmk) const
reference_type * get() const
std::vector< Value >::difference_type difference_type
std::vector< Value >::size_type size_type
virtual int find_text(const OUString &rStr) const=0
virtual OUString get_active_id() const=0
virtual void set_active(int pos)=0
void connect_changed(const Link< ComboBox &, void > &rLink)
#define FN_FOOTNOTE_TO_ANCHOR
FrameTypeFlags
values can be combined via logical or
constexpr OUStringLiteral HID_NAVIGATOR_TOOLBOX
constexpr OUStringLiteral HID_NAVIGATOR_GLOBAL_TOOLBOX
constexpr OUStringLiteral HID_NAVIGATOR_LISTBOX
constexpr sal_uInt16 KEY_MOD1
#define LINK(Instance, Class, Member)
#define SAL_N_ELEMENTS(arr)
constexpr OUStringLiteral aData
OString stripEnd(const OString &rIn, char c)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
IMPL_LINK(SwNavigationPI, DocListBoxSelectHdl, weld::ComboBox &, rBox, void)
static void lcl_UnSelectFrame(SwWrtShell *pSh)
SFX_IMPL_DOCKINGWINDOW(SwNavigatorWrapper, SID_NAVIGATOR)
IMPL_LINK_NOARG(SwNavigationPI, PageModifiedHdl, weld::Entry &, void)
Reference< XNameAccess > m_xContainer
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
Reference< XController > xController
OUString SwResId(TranslateId aId)
constexpr sal_uInt8 MAXLEVEL